Skip to content

Trigger release workflow from merged pull requests#5

Merged
nilsandrey merged 2 commits into
mainfrom
copilot/update-trigger-to-merged-prs
Mar 8, 2026
Merged

Trigger release workflow from merged pull requests#5
nilsandrey merged 2 commits into
mainfrom
copilot/update-trigger-to-merged-prs

Conversation

Copilot AI commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

Run the release workflow from merged pull requests instead of push on main, read PR metadata directly from the merged pull request event, and fail when expected release metadata is missing instead of silently skipping release creation.

  • Major – Breaking change (requires a new major version bump)
  • Minor – New feature, backward-compatible (requires a new minor version bump)
  • Patch – Bug fix or internal improvement, backward-compatible (requires a new patch version bump)

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: nilsandrey <3579285+nilsandrey@users.noreply.github.com>
Copilot AI changed the title [WIP] Update trigger to use merged pull requests Trigger release workflow from merged pull requests Mar 8, 2026
@nilsandrey

Copy link
Copy Markdown
Owner

@copilot edit this PR description to contain the necessary metadata the pipeline workflow is expecting. Description, changes, etc, wrapped in the expected markup.

Copilot AI commented Mar 8, 2026

Copy link
Copy Markdown
Contributor Author

@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: 9ecc8f5.

@nilsandrey
nilsandrey marked this pull request as ready for review March 8, 2026 18:35
Copilot AI review requested due to automatic review settings March 8, 2026 18:35
@nilsandrey
nilsandrey merged commit c5729c2 into main Mar 8, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.closed to main and 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.

Comment on lines +4 to 8
pull_request:
types:
- closed
branches:
- main

Copilot AI Mar 8, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.base.ref }}

Copilot AI Mar 8, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
ref: ${{ github.event.pull_request.base.ref }}
ref: ${{ github.event.pull_request.merge_commit_sha }}

Copilot uses AI. Check for mistakes.
@nilsandrey
nilsandrey deleted the copilot/update-trigger-to-merged-prs branch March 8, 2026 23:12
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.

3 participants