Repository navigation
92 lines (81 loc) · 3.77 KB
/
Copy pathdocumentation.yml
File metadata and controls
92 lines (81 loc) · 3.77 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Official documentation monitor
on:
schedule:
- cron: '23 6 * * *'
workflow_dispatch:
permissions:
contents: write
concurrency:
group: official-documentation-monitor
cancel-in-progress: false
jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: python -m pip install uv
- run: uv sync --frozen
- name: Restore fallback checkpoint
uses: actions/cache/restore@v4
with:
path: .source-monitor/cache
key: documentation-metadata-v1-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: documentation-metadata-v1-
- name: Read published checkpoint
shell: bash
run: |
mkdir -p .source-monitor/cache
git ls-remote --heads origin docs-status > "$RUNNER_TEMP/docs-status-ref"
if test -s "$RUNNER_TEMP/docs-status-ref"; then
git fetch --no-tags --depth=1 origin docs-status
git show FETCH_HEAD:source-snapshot.json > .source-monitor/cache/source-snapshot.json
fi
- name: Verify official source documents
id: verify
run: uv run --frozen python scripts/check_sources.py --previous .source-monitor/cache/source-snapshot.json --output .source-monitor/current
- name: Retain checked metadata
if: always() && steps.verify.outcome != 'skipped'
shell: bash
run: |
test -f .source-monitor/current/source-snapshot.json
cp .source-monitor/current/source-snapshot.json .source-monitor/cache/source-snapshot.json
cat .source-monitor/current/README.md >> "$GITHUB_STEP_SUMMARY"
- name: Save fallback checkpoint
if: always() && steps.verify.outcome != 'skipped'
uses: actions/cache/save@v4
with:
path: .source-monitor/cache
key: documentation-metadata-v1-${{ github.run_id }}-${{ github.run_attempt }}
- name: Upload exact source metadata
if: always() && steps.verify.outcome != 'skipped'
uses: actions/upload-artifact@v4
with:
name: official-documentation-metadata
path: .source-monitor/current/
retention-days: 30
if-no-files-found: error
- name: Publish source health and checkpoint
if: always() && steps.verify.outcome != 'skipped'
shell: bash
run: |
test -f .source-monitor/current/source-report.json
git ls-remote --heads origin docs-status > "$RUNNER_TEMP/docs-status-ref"
if test -s "$RUNNER_TEMP/docs-status-ref"; then
git fetch --no-tags --depth=1 origin docs-status
git worktree add --detach "$RUNNER_TEMP/docs-status-publish" FETCH_HEAD
else
git worktree add --detach "$RUNNER_TEMP/docs-status-publish" HEAD
git -C "$RUNNER_TEMP/docs-status-publish" switch --orphan docs-status
fi
cp .source-monitor/current/source-snapshot.json "$RUNNER_TEMP/docs-status-publish/source-snapshot.json"
cp .source-monitor/current/source-report.json "$RUNNER_TEMP/docs-status-publish/source-report.json"
cp .source-monitor/current/README.md "$RUNNER_TEMP/docs-status-publish/README.md"
git -C "$RUNNER_TEMP/docs-status-publish" add source-snapshot.json source-report.json README.md
if ! git -C "$RUNNER_TEMP/docs-status-publish" diff --cached --quiet; then
git -C "$RUNNER_TEMP/docs-status-publish" -c user.name='github-actions[bot]' -c user.email='41898282+github-actions[bot]@users.noreply.github.com' commit -m 'docs: record official source verification'
git -C "$RUNNER_TEMP/docs-status-publish" push origin HEAD:refs/heads/docs-status
fi