-
Notifications
You must be signed in to change notification settings - Fork 2
52 lines (43 loc) · 1.3 KB
/
update-readme.yml
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Update README
on:
issues:
types: [opened, deleted]
push:
paths:
- 'docs/templates/readme.md'
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Pull latest changes
run: git pull origin main
- name: Run update script
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_GITHUB_TOKEN }}
run: node scripts/update-readme.js
- name: Check if README.md has changed
id: check_changes
run: |
if git diff --exit-code README.md; then
echo "file_changed=false" >> $GITHUB_ENV
else
echo "file_changed=true" >> $GITHUB_ENV
fi
- name: Commit changes
if: env.file_changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add README.md
git commit -m "docs: update readme"
git push origin main