-
Notifications
You must be signed in to change notification settings - Fork 3
47 lines (38 loc) · 1.13 KB
/
update_readme.yaml
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
name: Update README with Markdown Links
on:
push:
branches:
- main
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '14'
- name: Install dependencies
run: npm install markdown-link-extractor
- name: Extract Markdown links
run: npx markdown-link-extractor "docs/*.md" > links.txt
- name: Update README
run: |
echo "## Notes" > temp_readme.md
cat links.txt >> temp_readme.md
awk '/## Notes/{p=1;print;system("cat links.txt")}!p' README.md > temp_readme.md
mv temp_readme.md README.md
- name: Commit changes
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add README.md
git commit -m "Update README with documentation links"
- name: Push changes
uses: ad-m/[email protected]
with:
branch: ${{ github.ref }}
force: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}