Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .github/workflows/regen-derived.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
name: Regenerate derived files
on: # yamllint disable-line rule:truthy
push:
branches: [main]
paths:
- "src/valuesets/schema/**/*.yaml"
- "src/valuesets/schema/*.yaml"
workflow_dispatch:
Comment on lines +3 to +9
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

The workflow lacks concurrency control, which could lead to race conditions if multiple schema changes are pushed to main in quick succession. Multiple workflow runs could attempt to create PRs simultaneously, or a second run could start while the first is still creating its PR. Add a concurrency group to ensure only one regeneration workflow runs at a time and cancel any in-progress runs when a new one starts.

Copilot uses AI. Check for mistakes.

permissions: {}

jobs:
regen:
runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

The astral-sh/setup-uv action should include the python-version parameter for consistency with other workflows in this repository. In deploy-docs.yaml:36-38, the python-version is explicitly set on the setup-uv action. While the separate setup-python step will still configure Python correctly, setting it on both actions ensures consistency and clarity.

Suggested change
cache-dependency-glob: "uv.lock"
cache-dependency-glob: "uv.lock"
python-version: "3.13"

Copilot uses AI. Check for mistakes.

- name: Set up Python
uses: actions/setup-python@v5
Comment on lines +23 to +34
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

Action versions should be pinned to specific versions for reproducibility and security. The repository uses pinned versions consistently in other workflows (e.g., actions/checkout@v4.2.2, astral-sh/setup-uv@v6.4.3, actions/setup-python@v5.6.0). Update these action references to match the versions used in main.yaml and deploy-docs.yaml.

Suggested change
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v6.4.3
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set up Python
uses: actions/setup-python@v5.6.0

Copilot uses AI. Check for mistakes.
with:
python-version: "3.13"

- name: Install just
run: uv tool install rust-just

- name: Install dependencies
run: uv sync --group dev --no-progress
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

The workflow uses 'uv sync --group dev' while other workflows in this repository use 'uv sync --dev'. Since the pyproject.toml defines dev dependencies using dependency-groups, '--group dev' is technically correct. However, for consistency with existing workflows (main.yaml:52, deploy-docs.yaml:53), consider using '--dev' instead unless there's a specific reason to use the newer '--group' syntax.

Suggested change
run: uv sync --group dev --no-progress
run: uv sync --dev --no-progress

Copilot uses AI. Check for mistakes.

- name: Regenerate derived files
run: |
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

The workflow doesn't verify that the regeneration commands succeeded before attempting to create a PR. If just gen-project or just gen-doc fails, the workflow will continue and potentially create a PR with incomplete or incorrect changes. Consider adding error handling or checks to ensure the regeneration completed successfully before proceeding to create the PR.

Suggested change
run: |
run: |
set -euo pipefail

Copilot uses AI. Check for mistakes.
just gen-project
just gen-doc

- name: Check for changes
id: changes
run: |
git add -A
if git diff --cached --quiet; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Close previous regen PRs
if: steps.changes.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr list \
--label "automated-regen" \
--state open \
--json number \
--jq '.[].number' \
| while read -r pr; do
gh pr close "$pr" --comment "Superseded by a newer regeneration run."
done

- name: Create pull request
if: steps.changes.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH="auto/regen-derived-$(date +%Y%m%d-%H%M%S)"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b "$BRANCH"
git commit -m "Regenerate derived files from schema changes"
git push -u origin "$BRANCH"

gh label create "automated-regen" \
--description "PRs created by the regen-derived workflow" \
--color "c5def5" \
--force

gh pr create \
--title "Regenerate derived files" \
--label "automated-regen" \
--body "$(cat <<'EOF'
Automated regeneration of derived files after schema changes.

Updated by running:
```
just gen-project
just gen-doc
```

Please review the diffs before merging.
EOF
)"
Comment on lines +93 to +104
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

The PR body has inconsistent indentation which may result in incorrectly formatted markdown. The heredoc content (lines 94-102) is indented with leading spaces while the opening 'EOF' delimiter (line 93) has no indentation. This could cause the PR description to have unexpected leading whitespace. Consider aligning the heredoc content to start at column 0 or adjusting the indentation to be consistent.

Copilot uses AI. Check for mistakes.