Skip to content

Conversation

@ABorgna
Copy link
Member

@ABorgna ABorgna commented Feb 7, 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 tag, e.g.

# 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. 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.

@ABorgna ABorgna merged commit e7f2f8f into master Mar 19, 2025
7 checks passed
@ABorgna ABorgna deleted the ab/pr-title branch March 19, 2025 22:53
github-merge-queue bot pushed a commit that referenced this pull request Mar 19, 2025
#734 added a CI check for conventional commit PR titles.

However, I wrote `main` instead of `master` as target branch for the
trigger -.-'
This fix won't be applied until after merging the PR, since the
`pull_request_target` trigger uses the workflow definition in the target
branch.
github-merge-queue bot pushed a commit that referenced this pull request Apr 5, 2025
…ion (#735)

Setups [`release-plz`](https://release-plz.dev/) to run on each push to
`master`.
This has two different flows:

### Release PR (disabled until after the `0.8.0` release)

When a PR is merged, it analyses all the commits since the last release
and creates a draft PR with the automatically generated changelog.
Commits are grouped into categories using conventional commit tags (see
#734). I ported the existing `RELEASES.rst` to markdown, so updates can
be done from there.

It also runs
[`cargo-semver-checks`](https://crates.io/crates/cargo-semver-checks) to
decide if the next release should be a semver-breaking bump, and updates
the package version.
Any merged PR marked as breaking (#734) will also cause a breaking
version bump.

### Package publication

When a change is merged that bumps the package version `release-plz`
will create a new github release with the appropriate changelog and a
list of contributors, and push the new version to crates.io.
(I haven't yet added the crates token, will do once we verify this
action is correctly configured, before the new release gets merged).


drive-by: cherry-pick new clippy lint fixes from #753

---------

Co-authored-by: starovoid <prototyperailgun@gmail.com>
github-merge-queue bot pushed a commit that referenced this pull request Apr 5, 2025
This will enable automatic release PR generation by `release-plz`.
This includes a semver-checks run to ensure that no breaking checks get
released in a minor version bump, and CHANGELOG generation based on the
commits merged since the last release, grouped by their conventional
commits tag (#734).

PRs marked as breaking (by adding a `!` after the tag) will be marked as
so in the CHANGELOG, and they will force a major version bump.

It is possible to modify the created PR before merging as needed; either
to reword parts of the changelog or to override the version bump.
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.

2 participants