-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (52 loc) · 1.87 KB
/
Copy pathupdate-readme.yml
File metadata and controls
62 lines (52 loc) · 1.87 KB
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
59
60
61
62
name: Update README and All Articles
on:
push:
branches:
- master
paths-ignore:
- 'README.md'
- 'docs/all-articles.md'
- 'docs/all-categories.md'
- 'mkdocs.yml'
workflow_dispatch:
jobs:
update-docs:
if: github.actor != 'github-actions[bot]' || !contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pip install pyyaml
- name: Check markdown docs
run: python scripts/check_docs.py --report-json artifacts/check-report.json --summary-md artifacts/check-summary.md || true
- name: Generate README, all-articles and mkdocs nav
run: python scripts/generate_readme.py --target all
- name: Append check summary
if: always()
run: |
if [ -f artifacts/check-summary.md ]; then
cat artifacts/check-summary.md >> "$GITHUB_STEP_SUMMARY"
fi
- name: Check if files changed
id: check_changes
run: |
if git diff --quiet README.md docs/all-articles.md docs/all-categories.md mkdocs.yml; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push if changed
if: steps.check_changes.outputs.changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add README.md docs/all-articles.md docs/all-categories.md mkdocs.yml
git commit -m "docs: auto-update README, all-articles, all-categories and mkdocs nav [skip ci]"
git push