Outline
When you manage the Pull request
in GitHub
, you may use the Label
feature. Also, There are some GitHub Actions
run by the label of Pull request
like Release Drafter
.
In this blog post, I will introduce how to use PR Labels Checker
of GitHub Actions
to check the label of the Pull request
is set well.
Blog series
This blog post is a series. You can see the other posts on the link below.
- [GitHub Actions] Check title of Pull request
- [GitHub Actions] Use Release Drafter to automate Release note of GitHub
- [GitHub Actions] Check label of Pull request
- [GitHub Actions] Automate to update Changelog file
PR Labels Checker
PR Labels Checker
is a GitHub Actions
to check the Pull request
has the label.
To use PR Labels Checker
, create the .github/workflows/labels-checker.yml
file and modify it like the following.
name: Labels Checker
on:
push:
branches:
- main
pull_request:
types:
- opened
- labeled
- unlabeled
- synchronize
jobs:
check_labels:
runs-on: ubuntu-latest
steps:
- uses: danielchabr/[email protected]
with:
hasSome: breaking change,feature,bug,style,refactor,test,chore,docs,ci,dependencies
githubToken: $
If you create GitHub Actions
like this example, the error occurs when one of breaking change
, feature
, bug
, style
, refactor
, test
, chore
, docs
, ci
, dependencies
labels is not set on the Pull request
.
The label list in here is for Release Drafter
to automate Release note
.
Release Drafter
I use Release Drafter
to automate Release note
in GitHub
. If you want to know details about Release Drafter
, please see the following link.
I use the following GitHub Actions
to check the label is configured well by autolabeler
of Release Drafter
.
name: Release Drafter
on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize
permissions:
contents: read
jobs:
update_release_draft:
permissions:
contents: write
pull-requests: write
checks: write
runs-on: ubuntu-latest
steps:
- uses: release-drafter/[email protected]
env:
GITHUB_TOKEN: $
- uses: danielchabr/[email protected]
with:
hasSome: breaking change,feature,bug,style,refactor,test,chore,docs,ci,dependencies
githubToken: $
By configuring GitHub Actions
like this, when a Pull request
is created, the label is automatically set by Release Drafter
, and then PR Labels Checker
checks whether the label is applied well. The autolabeler
of Release Drafter
sets the label well, but it is configured to check it once more just in case.
Completed
Done! We’ve seen how to use PR Labels Checker
of GitHub Actions
to check Pull request
has the label well. If you use a GitHub Actions
run by the label of Pull request
, or manage the project with labels, I recommend using PR Labels Checkers
.
Was my blog helpful? Please leave a comment at the bottom. it will be a great help to me!
App promotion
Deku
.Deku
created the applications with Flutter.If you have interested, please try to download them for free.