HMS-10377: fix semantic release workflow#2121
Conversation
Reviewer's GuideReplaces the previous semantic-release workflow with two new GitHub Actions workflows: one to automatically bump the VERSION and open a release PR based on commit metadata, and another to create Git tags and GitHub releases from the VERSION file when changes land on main. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
SC Environment Impact AssessmentOverall Impact: ⚪ NONE No SC Environment-specific impacts detected in this PR. What was checkedThis PR was automatically scanned for:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2121 +/- ##
=======================================
Coverage 59.18% 59.18%
=======================================
Files 134 134
Lines 8622 8622
=======================================
Hits 5103 5103
Misses 2984 2984
Partials 535 535
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f6f063c to
2a160cc
Compare
2a160cc to
eb81366
Compare
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- The
release-create-prworkflow usesactions/checkout@v6, which doesn’t exist and is inconsistent with@v4used in the other workflow; update this to a valid, pinned version (e.g.,@v4). - In
release-create-pr.yml, the PR base is set tomasterwhile the release workflow listens to changes onmain; confirm the canonical default branch and make these workflows consistent. - The
Increment versionstep can exit 0 without settingVERSION_NEXT, but the subsequent PR creation still runs and will use an empty version; guard the PR step with a conditional (e.g.,if: steps.version.outputs.VERSION_NEXT != '') and consider usinggit log -1 --pretty=%Bwhen derivingRELEASE_TYPEto avoid including non-message lines.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `release-create-pr` workflow uses `actions/checkout@v6`, which doesn’t exist and is inconsistent with `@v4` used in the other workflow; update this to a valid, pinned version (e.g., `@v4`).
- In `release-create-pr.yml`, the PR base is set to `master` while the release workflow listens to changes on `main`; confirm the canonical default branch and make these workflows consistent.
- The `Increment version` step can exit 0 without setting `VERSION_NEXT`, but the subsequent PR creation still runs and will use an empty version; guard the PR step with a conditional (e.g., `if: steps.version.outputs.VERSION_NEXT != ''`) and consider using `git log -1 --pretty=%B` when deriving `RELEASE_TYPE` to avoid including non-message lines.
## Individual Comments
### Comment 1
<location path=".github/workflows/release-create-pr.yml" line_range="19-25" />
<code_context>
+ - name: Checkout
+ uses: actions/checkout@v6
+
+ - name: Increment version
+ id: version
+ run: |
+ DOC_FILE="docs/v3/openapi.json docs/admin/openapi.json"
+ CLOWDER_FILE=deploy/clowdapp.yaml
+ VERSION=$(cat VERSION)
+ [ "$(git log -1 --pretty=%B)" == "$VERSION" ] && exit 0
+ RELEASE_TYPE=$(git log -1 | tail -n1) # Check release type (/major, /minor, /patch (default))
+ VERSION_NEXT=$(./scripts/increment_version.sh $VERSION $RELEASE_TYPE)
</code_context>
<issue_to_address>
**issue:** Early exit leaves VERSION_NEXT unset but later step assumes it exists
Because of the early exit, `VERSION_NEXT` is never set when the latest commit message matches the current `VERSION`, but the `Create PR for new release` step still references `steps.version.outputs.VERSION_NEXT`. This can produce empty/invalid branch names, commit messages, and PR titles. Add a guard like `if: steps.version.outputs.VERSION_NEXT != ''` to that step, or ensure `VERSION_NEXT` is set to a safe sentinel value before exiting early.
</issue_to_address>
### Comment 2
<location path=".github/workflows/release-create-pr.yml" line_range="16-17" />
<code_context>
+ tag-and-release:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
</code_context>
<issue_to_address>
**issue (bug_risk):** actions/checkout@v6 does not exist and will fail the workflow
`actions/checkout` currently only goes up to `v4`. Referencing a non-existent version like `@v6` will cause the workflow to fail because the action cannot be resolved. Please use a valid version (e.g. `actions/checkout@v4`).
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
eb81366 to
4a161bd
Compare
4a161bd to
59a703b
Compare
This PR:
Example PR:
#2123