Skip to content

Commit 4a7a56e

Browse files
committed
feat: sync workflow now copies versions.json, compile-all.sh, workflows too
1 parent fc261df commit 4a7a56e

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

.github/workflows/sync-readmes.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Sync READMEs across branches
1+
name: Sync shared files across branches
22

33
on:
44
push:
@@ -10,6 +10,9 @@ on:
1010
paths:
1111
- README.md
1212
- README_FR.md
13+
- versions.json
14+
- compile-all.sh
15+
- .github/workflows/*.yml
1316

1417
jobs:
1518
sync:
@@ -26,12 +29,13 @@ jobs:
2629
git config user.name "github-actions[bot]"
2730
git config user.email "github-actions[bot]@users.noreply.github.com"
2831
29-
- name: Sync READMEs to all branches
32+
- name: Sync files to all branches
3033
env:
3134
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3235
run: |
3336
SOURCE_BRANCH="${GITHUB_REF#refs/heads/}"
3437
TARGETS=("dev" "1.20.x" "1.21.x" "26.1.x")
38+
FILES=(README.md README_FR.md versions.json compile-all.sh .github/workflows/)
3539
3640
for target in "${TARGETS[@]}"; do
3741
if [ "$target" = "$SOURCE_BRANCH" ]; then
@@ -40,9 +44,13 @@ jobs:
4044
4145
if git show-ref --verify --quiet refs/remotes/origin/"$target"; then
4246
git checkout "$target"
43-
git checkout "$SOURCE_BRANCH" -- README.md README_FR.md
47+
48+
for file in "${FILES[@]}"; do
49+
git checkout "$SOURCE_BRANCH" -- "$file" 2>/dev/null || true
50+
done
51+
4452
if ! git diff --cached --quiet; then
45-
git commit -m "docs: sync READMEs from $SOURCE_BRANCH [skip sync]"
53+
git commit -m "chore: sync shared files from $SOURCE_BRANCH [skip sync]"
4654
git push origin "$target"
4755
fi
4856
fi

0 commit comments

Comments
 (0)