Skip to content

ci: Add release labels job to pr.yaml to sync labels/title - #5724

Merged
mafredri merged 3 commits into
mainfrom
mafredri/ci-pr-tags
Jan 16, 2023
Merged

mafredri merged 3 commits into
mainfrom
mafredri/ci-pr-tags

Conversation

@mafredri

@mafredri mafredri commented Jan 16, 2023 •

Copy link
Copy Markdown
Member

This PR adds a script using actions/github-script to pr.yaml.

This script ensures PR title and labels are in sync:

When release/breaking label is:

  • Added, rename PR title to include ! (e.g. feat!:)
  • Removed, rename PR title to strip ! (e.g. feat:)

When title is:

  • Renamed (+!), add the release/breaking label
  • Renamed (-!), remove the release/breaking label

Notes

I considered adding a new label, release/use-pr-title. which would tell the release notes generation script to use PR title instead of commit. It would've been added in certain scenarios (e.g. single commit PRs merged with different title than PR).

But considering contributors can edit the title of their PR, it's not such a good idea unless we can prevent editing (e.g. via locking the PR). Otherwise a PR title could be edited right before a release and its contents would be out of our control.

Also note: Since we're using the pull_request_target, only the pr.yaml from main will be used, thus this PR will not run the new check/functionality. I have tested the functionality in another repo.

@mafredri mafredri self-assigned this Jan 16, 2023
@mafredri
mafredri requested review from bpmct and mtojek January 16, 2023 08:53
Comment thread .github/workflows/pr.yaml Resolved
@mtojek
mtojek self-requested a review January 16, 2023 09:29
@mafredri
mafredri enabled auto-merge (squash) January 16, 2023 09:33
@mafredri
mafredri merged commit 8ae28a3 into main Jan 16, 2023
@mafredri
mafredri deleted the mafredri/ci-pr-tags branch January 16, 2023 09:40
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants