ci: Detect breaking PRs with semver-checks#692
Merged
Conversation
ABorgna
added a commit
that referenced
this pull request
Dec 8, 2024
…ow (#694) The `semver-checks` workflow from #692 uses `pull_request_target` as a workflow trigger. When using `_target` instead of `pull_request` events, `actions/checkout` fetches the _base_ branch of the PR by default. See in this workflow, both the base and "head" checkouts use the same sha. https://github.com/petgraph/petgraph/actions/runs/12163228521/job/33921923785?pr=675#step:2:72 This fix sets an explicit parameter when fetching the head. drive-by: Check if the PR has build errors and skip posting comments if so.
ABorgna
added a commit
that referenced
this pull request
Mar 19, 2025
This is part of the CI improvements listed in #725. Adds a check when a PR is opened or modified to ensure it's title contains a [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) tag, e.g. ```yml # Some new features and bug fixes feat: Add this algorithm fix(component): Don't panic # A PR that introduces a semver breaking change fix!: Refactor all the traits ``` When a PR introduces breaking changes (that will require a breaking semver bump) we also require a `BREAKING CHANGE: ...` line in the PR body describing what the changes required in user code. When the check fails, the bot posts a help message indicating what needs to be fixed. The list of valid tags are: `feat, fix, docs, style, refactor, perf, test, ci, chore, revert`. `rfc` is an invalid tag with a custom error message, useful when opening draft PRs. I added a pull request template with these instructions. The main goal of this requirement is to automate changelog generation with [release-plz](https://release-plz.dev/). The tags get grouped into categories in the changelog, and breaking changes are automatically picked when deciding the version bump. This also integrates with the semver checks added in #692. The check fails on PRs with breaking changes unless they are marked as breaking in title. --- The code here is based on the reusable workflow I implemented in [CQCL/hugrverse-actions](https://github.com/CQCL/hugrverse-actions?tab=readme-ov-file#pr-title).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Runs
cargo-semver-checkson each PR comparing it against the its base, and posting a comment when breaking API changes are detected.The action fails on detected changes unless we flag the PR as breaking following the conventional commits format. In that case we still post a comment with the results.
Note that there exists a
cargo-semver-checks-actionsby obi1kenobi already but it's targeted towards comparing against the latest published crate instead of checking individual PRs, so we cannot use it here.drive-by: Add a
workflow_dispatchtrigger to the ci checks action too.