-
-
Notifications
You must be signed in to change notification settings - Fork 142
37 lines (32 loc) · 984 Bytes
/
sync-readme-to-index.yml
File metadata and controls
37 lines (32 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Sync README to Index
on:
push:
branches: [main]
paths: ['readme.md']
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Copy file
run: cp readme.md index.md
- name: Commit changes
id: commit
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add index.md
if git diff-index --quiet HEAD; then
echo "changes_made=false" >> $GITHUB_OUTPUT
else
git commit -m "chore: Auto-update index.md from readme.md"
echo "changes_made=true" >> $GITHUB_OUTPUT
fi
- name: Push changes
if: steps.commit.outputs.changes_made == 'true'
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}