Repository navigation
Add GitHub Action to run doctools.py on pull requests and commit data changes #1070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a67f48b
Initial plan
Copilot 9155ae0
Create GitHub Action to run doctools.py on pull requests
Copilot d888203
Merge branch 'main' into copilot/add-github-action-doctools
ahouseholder 691a6b1
Fix doctools workflow: handle fork PRs and replace [skip ci] with act…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| name: "Run doctools on PR" | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'src/ssvc/**' | ||
| - .github/workflows/run_doctools.yml | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| run-doctools: | ||
| # Skip when the auto-commit from this workflow triggers a re-run | ||
| if: github.actor != 'github-actions[bot]' | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{ github.head_ref }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Python 3.12 | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip uv | ||
| uv sync --dev --frozen | ||
|
|
||
| - name: Run doctools | ||
| run: | | ||
| # Remove stale decision point files so doctools generates a clean set | ||
| rm -rf data/json/decision_points | ||
| export PYTHONPATH=$(pwd)/src | ||
| uv run python -m ssvc.doctools --overwrite --datadir ./data | ||
|
|
||
| - name: Fail if fork PR has uncommitted data/ changes | ||
| if: github.event.pull_request.head.repo.full_name != github.repository | ||
| run: | | ||
| git add data/ | ||
| if git diff --cached --quiet; then | ||
| echo "No data/ changes detected." | ||
| else | ||
| echo "::error::This PR is from a fork and data/ files need to be regenerated." | ||
| echo "::error::Please run 'make regenerate_json' locally and push the resulting data/ changes to your PR branch." | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Commit changes to data/ | ||
| if: github.event.pull_request.head.repo.full_name == github.repository | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add data/ | ||
| if git diff --cached --quiet; then | ||
| echo "No changes to commit" | ||
| else | ||
| git commit -m "chore: regenerate data files via doctools" | ||
| git push | ||
| fi | ||
|
ahouseholder marked this conversation as resolved.
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.