Trigger release workflow from merged pull requests#5
Conversation
Co-authored-by: nilsandrey <3579285+nilsandrey@users.noreply.github.com>
|
@copilot edit this PR description to contain the necessary metadata the pipeline workflow is expecting. Description, changes, etc, wrapped in the expected markup. |
Updated the PR description with the expected changelog description markers and version-bump markup so the release workflow can read it directly. Current head: |
There was a problem hiding this comment.
Pull request overview
This PR adjusts the release automation to run off merged pull requests (instead of push on main) and to use PR metadata directly to decide the version bump and changelog entry, failing fast when required metadata is missing.
Changes:
- Trigger the release workflow on
pull_request.closedtomainand gate execution to merged PRs only. - Derive version bump type directly from the merged PR body and hard-fail if no bump checkbox is selected.
- Checkout the PR base branch ref for building, changelog/version updates, and release creation.
| pull_request: | ||
| types: | ||
| - closed | ||
| branches: | ||
| - main |
There was a problem hiding this comment.
Using on: pull_request can cause this workflow to run with a read-only GITHUB_TOKEN and without secrets when the PR originates from a fork. Since later steps git push and gh release create, releases may fail for fork-based contributions. Consider switching the trigger to pull_request_target (still gated on merged == true) while continuing to checkout the base branch, or keep the push-to-main trigger for the release job to ensure consistent write permissions.
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: ${{ github.event.pull_request.base.ref }} |
There was a problem hiding this comment.
Checking out ref: ${{ github.event.pull_request.base.ref }} means the workflow builds/releases whatever main points to at checkout time, which can include additional merges if multiple PRs land close together. That can produce a release/changelog entry tied to PR #${PR_NUMBER} but containing code from later commits. Prefer pinning the checkout to the merged commit for this PR (e.g. the PR’s merge commit SHA) and then updating/pushing the base branch from that known commit.
| ref: ${{ github.event.pull_request.base.ref }} | |
| ref: ${{ github.event.pull_request.merge_commit_sha }} |
Run the release workflow from merged pull requests instead of
pushonmain, read PR metadata directly from the merged pull request event, and fail when expected release metadata is missing instead of silently skipping release creation.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.