-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (37 loc) · 1.16 KB
/
readme_script.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
name: Generate Table of Contents
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "20"
- name: Install dependencies
run: npm install
working-directory: scripts
- name: Run table-of-contents.js
run: npm run generate-table-of-contents
working-directory: scripts
- name: Replace README.md in root
run: |
if cp scripts/README.md README.md; then
echo "README.md replaced successfully"
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add README.md
git commit -m "Update README with table of contents"
git push
else
echo "Failed to replace README.md"
exit 1
fi
working-directory: ${{ github.workspace }}