-
-
Notifications
You must be signed in to change notification settings - Fork 16
ci: automate openapi artifact regeneration on release PRs #967
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -49,6 +49,8 @@ jobs: | |||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||
| - uses: actions/checkout@v6 | ||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||
| token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
| token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }} | |
| token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }} | |
| ref: ${{ github.head_ref || github.ref_name }} | |
| fetch-depth: 0 |
Copilot
AI
May 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regeneration path is gated only by the branch name prefix. A forked PR could use the same release-please--* branch name; in that case the workflow would attempt to commit/push back to a repository it doesn't have access to, causing CI failures. Mirror the safety guard used in .github/workflows/release_artifacts.yml by additionally checking the PR head repo matches github.repository (and/or event type is pull_request).
| if: steps.verify.outcome == 'failure' && startsWith(github.head_ref, 'release-please--') | |
| if: steps.verify.outcome == 'failure' && github.event_name == 'pull_request' && startsWith(github.head_ref, 'release-please--') && github.event.pull_request.head.repo.full_name == github.repository |
Copilot
AI
May 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This regeneration+push behavior largely overlaps with the existing .github/workflows/release_artifacts.yml automation that refreshes OpenAPI artifacts for release-please branches. Keeping both paths increases the chance of redundant commits and harder-to-debug CI behavior; consider consolidating to a single workflow/trigger (or ensuring they can't both act on the same branch).
Copilot
AI
May 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git commit will fail the step if there are no staged changes (e.g., if openapi-verify failed for a reason other than generated file drift). Add a guard (like a git diff --quiet check) before committing/pushing so the workflow doesn't error out unnecessarily.
| git commit -m "chore: regenerate openapi spec and client for version bump" | |
| git push | |
| echo "## OpenAPI artifacts regenerated" >> "$GITHUB_STEP_SUMMARY" | |
| echo "Version bump detected; OpenAPI spec and frontend client have been regenerated and committed." >> "$GITHUB_STEP_SUMMARY" | |
| if ! git diff --cached --quiet; then | |
| git commit -m "chore: regenerate openapi spec and client for version bump" | |
| git push | |
| echo "## OpenAPI artifacts regenerated" >> "$GITHUB_STEP_SUMMARY" | |
| echo "Version bump detected; OpenAPI spec and frontend client have been regenerated and committed." >> "$GITHUB_STEP_SUMMARY" | |
| else | |
| echo "## OpenAPI artifacts unchanged" >> "$GITHUB_STEP_SUMMARY" | |
| echo "OpenAPI verification failed, but regenerating the tracked OpenAPI spec and frontend client produced no staged changes." >> "$GITHUB_STEP_SUMMARY" | |
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra-filesis intended for release-please to update version strings, but the listed generated TS files currently don't contain the app version (e.g.,1.0.0does not appear inclient.gen.ts). This makes these entries ineffective at best and can be confusing to maintain; consider removing the TS files here (or adding a version marker/updater that actually matches something in those files).