Skip to content

Commit cda6db3

Browse files
authored
Fix pushing
1 parent 2ffc2a9 commit cda6db3

1 file changed

Lines changed: 15 additions & 24 deletions

File tree

.github/workflows/Sync.yml

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ name: Sync from Codeberg
22

33
on:
44
workflow_dispatch:
5+
push:
56
schedule:
6-
- cron: "0 0 * * *" # runs daily at midnight (UTC)
7+
- cron: "* * * * *"
78

89
permissions:
9-
contents: write
10+
contents: write # allow pushing
1011

1112
jobs:
1213
sync:
@@ -19,37 +20,27 @@ jobs:
1920
fetch-depth: 0
2021
token: ${{ secrets.GITHUB_TOKEN }}
2122

22-
- name: Clone public Codeberg repo (read-only)
23-
run: |
24-
git clone https://codeberg.org/ampmod/ampmod.git temp-src
25-
26-
- name: Copy new or updated files (non-destructive)
23+
- name: Keep Any changes
2724
run: |
2825
rsync -av --ignore-existing temp-src/ .
2926
rsync -av --update temp-src/ .
3027
rm -rf temp-src
3128
32-
- name: Commit each changed file individually
29+
- name: Clone Codeberg repo
30+
run: |
31+
git clone --depth=1 https://codeberg.org/ampmod/aw3 temp-src
32+
cp -r temp-src/* .
33+
rm -rf temp-src
34+
35+
- name: Commit changes
3336
run: |
3437
git config user.name "github-actions[bot]"
3538
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
39+
git add -A
40+
git commit -m "Sync from Codeberg repo" || echo "No changes to commit"
3641
37-
changed_files=$(git status --porcelain | awk '{print $2}')
38-
39-
if [ -z "$changed_files" ]; then
40-
echo "No changes to commit"
41-
exit 0
42-
fi
43-
44-
for file in $changed_files; do
45-
git add "$file"
46-
git commit -m "Sync from Codeberg: update $file" || echo "No changes in $file"
47-
done
48-
49-
- name: Push changes to develop branch
42+
- name: Push changes
5043
env:
5144
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5245
run: |
53-
# Ensure we push to the current repo’s develop branch
54-
REPO_URL="https://github.com/${{ github.repository }}.git"
55-
git push "$REPO_URL" HEAD:develop
46+
git push origin HEAD:develop

0 commit comments

Comments
 (0)