-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (56 loc) · 1.81 KB
/
docs-autofix.yml
File metadata and controls
67 lines (56 loc) · 1.81 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
63
64
65
66
67
name: Docs Auto Fix
on:
push:
branches:
- master
paths:
- 'docs/**'
workflow_dispatch:
permissions:
contents: write
jobs:
normalize-images:
if: github.actor != 'github-actions[bot]' || !contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pip install pyyaml
- name: Normalize images
run: python scripts/normalize_images.py --fix --report-json artifacts/image-fix-report.json --summary-md artifacts/image-fix-summary.md
- name: Append summary
if: always()
run: |
if [ -f artifacts/image-fix-summary.md ]; then
cat artifacts/image-fix-summary.md >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload reports
if: always()
uses: actions/upload-artifact@v4
with:
name: docs-autofix-reports
path: artifacts/
- name: Check if docs changed
id: check_changes
run: |
if git diff --quiet -- docs; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.check_changes.outputs.changed == 'true'
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add docs
git commit -m "docs: normalize image paths and update references [skip ci]"
git pull --rebase origin master
git push origin master