Skip to content

Commit 260584a

Browse files
updating sync md
1 parent 89cebb5 commit 260584a

1 file changed

Lines changed: 18 additions & 14 deletions

File tree

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
1-
name: Sync README to index.md
1+
name: Sync README to Index
22

33
on:
44
push:
55
branches: [main]
6-
paths:
7-
- 'README.md'
6+
paths: ['readme.md']
87

98
jobs:
109
sync:
1110
runs-on: ubuntu-latest
12-
1311
steps:
14-
- name: Checkout
12+
- name: Checkout code
1513
uses: actions/checkout@v4
16-
# persist-credentials: true is default and lets us push later
14+
with:
15+
fetch-depth: 0
1716

18-
- name: Copy README → index.md
19-
run: |
20-
cp README.md index.md
17+
- name: Copy file
18+
run: cp readme.md index.md
2119

22-
- name: Commit & push if changed
23-
id: sync
20+
- name: Commit changes
21+
id: commit
2422
run: |
2523
git config user.name "github-actions[bot]"
2624
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
2725
git add index.md
2826
if git diff-index --quiet HEAD; then
29-
echo "No changes in index.md; skipping commit."
27+
echo "changes_made=false" >> $GITHUB_OUTPUT
3028
else
31-
git commit -m "chore: auto-sync index.md from README.md"
32-
git push
29+
git commit -m "chore: Auto-update index.md from readme.md"
30+
echo "changes_made=true" >> $GITHUB_OUTPUT
3331
fi
32+
33+
- name: Push changes
34+
if: steps.commit.outputs.changes_made == 'true'
35+
uses: ad-m/github-push-action@v0.6.0
36+
with:
37+
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)