Skip to content

Commit e29e15d

Browse files
committed
chore: finalize v1 auto-generated docs rollout
1 parent 622e564 commit e29e15d

25 files changed

Lines changed: 9440 additions & 3828 deletions

.github/scripts/check_and_update_docs.py

Lines changed: 0 additions & 723 deletions
This file was deleted.
Lines changed: 41 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,69 @@
1-
name: Check Documentation Updates
1+
name: Sync Affinity v1 Docs
22

33
on:
44
schedule:
5-
# Run daily at 00:00 UTC
6-
- cron: '0 0 * * *'
5+
- cron: "0 0 * * *"
76
workflow_dispatch:
8-
inputs:
9-
api_version:
10-
description: 'API version to check (v1, v2, or all)'
11-
required: false
12-
default: 'all'
13-
type: choice
14-
options:
15-
- all
16-
- v1
17-
- v2
18-
force_check:
19-
description: 'Force check even if recently checked'
20-
required: false
21-
default: false
22-
type: boolean
237

24-
jobs:
25-
# Run tests first to ensure code quality before attempting updates
26-
test:
27-
runs-on: ubuntu-latest
28-
steps:
29-
- name: Checkout repository
30-
uses: actions/checkout@v4
31-
32-
- name: Set up Python
33-
uses: actions/setup-python@v5
34-
with:
35-
python-version: '3.11'
36-
cache: 'pip'
8+
permissions:
9+
contents: write
10+
pull-requests: write
3711

38-
- name: Install dependencies
39-
run: |
40-
python -m pip install --upgrade pip
41-
pip install -r requirements-ci.txt
42-
43-
- name: Run tests
44-
run: |
45-
pytest tests/ -m "not integration" --tb=short
46-
47-
check-updates:
48-
needs: test # Only run if tests pass
12+
jobs:
13+
sync-docs:
4914
runs-on: ubuntu-latest
50-
permissions:
51-
contents: write
52-
pull-requests: write
53-
issues: read
54-
5515
steps:
5616
- name: Checkout repository
5717
uses: actions/checkout@v4
5818
with:
59-
fetch-depth: 0 # Full history for diff generation
19+
fetch-depth: 0
6020

6121
- name: Set up Python
6222
uses: actions/setup-python@v5
6323
with:
64-
python-version: '3.11'
65-
cache: 'pip'
24+
python-version: "3.11"
25+
cache: "pip"
6626

6727
- name: Install dependencies
6828
run: |
6929
python -m pip install --upgrade pip
7030
pip install -r requirements-ci.txt
7131
72-
- name: Install GitHub CLI
32+
- name: Sync documentation
33+
id: sync_docs
7334
run: |
74-
type -p curl >/dev/null || sudo apt-get update && sudo apt-get install -y curl
75-
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
76-
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
77-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
78-
sudo apt-get update
79-
sudo apt-get install -y gh
35+
set +e
36+
python tools/v1_sync_pipeline/sync_v1_docs.py --fail-on-diff
37+
status=$?
38+
set -e
39+
if [ "$status" -eq 0 ]; then
40+
echo "changes=false" >> "$GITHUB_OUTPUT"
41+
exit 0
42+
fi
43+
if [ "$status" -eq 1 ]; then
44+
echo "changes=true" >> "$GITHUB_OUTPUT"
45+
exit 0
46+
fi
47+
exit "$status"
8048
81-
- name: Configure GitHub CLI
82-
env:
83-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84-
run: |
85-
gh auth setup-git
86-
gh auth status
87-
88-
- name: Configure Git
89-
run: |
90-
git config --global user.name "github-actions[bot]"
91-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
49+
- name: Run link checker
50+
run: python tools/v1_sync_pipeline/qa/check_links.py docs/v1/affinity_api_docs.md
9251

93-
- name: Check and update documentation
94-
env:
95-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96-
API_VERSION: ${{ github.event.inputs.api_version || 'all' }}
97-
FORCE_CHECK: ${{ github.event.inputs.force_check || 'false' }}
98-
run: |
99-
python .github/scripts/check_and_update_docs.py --api-version "$API_VERSION" --force-check "$FORCE_CHECK"
52+
- name: Create pull request
53+
if: steps.sync_docs.outputs.changes == 'true'
54+
uses: peter-evans/create-pull-request@v6
55+
with:
56+
commit-message: "chore: sync Affinity v1 docs"
57+
title: "chore: sync Affinity v1 docs"
58+
body: |
59+
Automated sync of Affinity API v1 documentation.
60+
branch: chore/sync-v1-docs
61+
delete-branch: true
10062

10163
- name: Summary
10264
if: always()
10365
run: |
104-
echo "## Documentation Update Check Complete" >> $GITHUB_STEP_SUMMARY
105-
echo "" >> $GITHUB_STEP_SUMMARY
106-
echo "Check completed at $(date -u +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY
66+
echo "## Sync summary" >> "$GITHUB_STEP_SUMMARY"
67+
echo "" >> "$GITHUB_STEP_SUMMARY"
68+
echo "- Changes detected: ${{ steps.sync_docs.outputs.changes || 'false' }}" >> "$GITHUB_STEP_SUMMARY"
69+
echo "- Run completed at $(date -u +'%Y-%m-%d %H:%M:%S UTC')" >> "$GITHUB_STEP_SUMMARY"

.github/workflows/tests.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@ jobs:
2626
python -m pip install --upgrade pip
2727
pip install -r requirements-ci.txt
2828
29+
- name: Ensure sync script is idempotent
30+
run: |
31+
python tools/v1_sync_pipeline/sync_v1_docs.py --fail-on-diff
32+
2933
- name: Run unit tests
3034
run: |
3135
pytest tests/ -m "not integration" -v --tb=short
3236
3337
- name: Run tests with coverage
3438
run: |
35-
pytest tests/ -m "not integration" --cov=.github/scripts --cov-report=term-missing
39+
pytest tests/ -m "not integration" --cov=tools/v1_sync_pipeline --cov-report=term-missing --cov-report=xml
3640
3741
- name: Upload coverage reports
3842
if: always()

.markdownlintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docs/v1/affinity_api_docs_legacy.md

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ repos:
3939
- id: markdownlint
4040
args: [--fix, --config=.markdownlint.json]
4141
files: ^(docs/|README\.md|AGENTS\.md|.*\.md)$
42-
exclude: ^docs/v1/affinity_api_docs\.md$ # Exclude large API docs - too many false positives
42+
exclude: ^docs/v1/affinity_api_docs(_legacy)?\.md$ # Exclude large API docs - too many false positives
4343

4444
# YAML linting
4545
- repo: https://github.com/adrienverge/yamllint

0 commit comments

Comments
 (0)