-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (56 loc) · 1.57 KB
/
main.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
53
54
55
56
57
58
name: Update README
on:
workflow_dispatch:
push:
schedule:
# run at 10am UTC every Sunday.
- cron: '0 10 * * 0'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install npm dependencies
run: npm install
- name: Run eslint
run: npm run lint
update:
if: ${{ github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install npm dependencies
run: npm install
- name: Update README
env:
GH_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run update-readme
- name: Setup git config
run: |
# Setup the username and email. Use 'GitHub Actions Bot' with no email
# by default
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Commit
run: |
if [[ -n $(git status -s) ]]; then
# If changes exist, stage the file, commit and push
git add README.md
git commit -m "Update README.md."
git push origin main
else
# No changes, skip commit and push.
echo "No changes to commit. Skipping commit and push."
fi