Skip to content

Add GitHub Action to run doctools.py on pull requests and commit data changes#1070

Open
Copilot wants to merge 2 commits intomainfrom
copilot/add-github-action-doctools
Open

Add GitHub Action to run doctools.py on pull requests and commit data changes#1070
Copilot wants to merge 2 commits intomainfrom
copilot/add-github-action-doctools

Conversation

Copy link
Contributor

Copilot AI commented Feb 27, 2026

Independent contributors rely on local git hooks to run src/ssvc/doctools.py when src/ssvc/* changes. This adds a CI enforcement step so PRs always regenerate and commit updated data/ files before merging.

Changes

  • .github/workflows/run_doctools.yml — new workflow that:
    • Triggers on PRs touching src/ssvc/**
    • Installs deps via uv, clears stale data/json/decision_points/, then runs python -m ssvc.doctools --overwrite --datadir ./data
    • Auto-commits any resulting data/ changes back to the PR branch with [skip ci] to prevent recursion; no-ops if nothing changed
Original prompt

This section details on the original issue you should resolve

<issue_title>Create GitHub action to run doctools.py on pull requests</issue_title>
<issue_description>Independent contributors have local git hooks to run src/ssvc/doctools.py if code is changed in src/ssvc/*.

We want a GitHub action to run doctools.py on pull requests before merging, and then commit changes made in data/</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: sei-renae <190382933+sei-renae@users.noreply.github.com>
Copilot AI changed the title [WIP] Add GitHub action to run doctools.py on pull requests Add GitHub Action to run doctools.py on pull requests and commit data changes Feb 27, 2026
@sei-renae sei-renae marked this pull request as ready for review March 2, 2026 15:12
Copilot AI review requested due to automatic review settings March 2, 2026 15:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds CI enforcement to run ssvc.doctools on pull requests that modify src/ssvc/**, with the intent of ensuring regenerated data/ artifacts are committed before merge.

Changes:

  • Introduces a new GitHub Actions workflow to run python -m ssvc.doctools --overwrite --datadir ./data on relevant PRs.
  • Removes existing data/json/decision_points prior to regeneration to avoid stale outputs.
  • Attempts to auto-commit and push any resulting data/ changes back to the PR branch.

Comment on lines +17 to +49
- 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: Commit changes to data/
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 [skip ci]"
git push
fi
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This checkout/push approach won’t work for pull requests from forks: ref: ${{ github.head_ref }} points to a branch name in the base repo, and git push with GITHUB_TOKEN cannot push back to a fork. As written, the workflow is likely to fail (or block) on external contributor PRs. Consider checking out the PR SHA/merge ref for running doctools, and then conditionally doing the commit/push only when github.event.pull_request.head.repo.full_name == github.repository; for forks, fail with a clear message telling the contributor to run doctools locally and commit data/ changes.

Copilot uses AI. Check for mistakes.
Comment on lines +39 to +48
- name: Commit changes to data/
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 [skip ci]"
git push
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using [skip ci] on the auto-generated commit can prevent other required PR checks from re-running on the updated data/ state, leaving the PR green based on an older commit. A safer pattern is to avoid [skip ci] and instead prevent recursion by skipping this job/commit step when github.actor is github-actions[bot] (or by checking the last commit author/message), so the rest of the CI still runs on the final commit.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create GitHub action to run doctools.py on pull requests

3 participants