Releases: srvaroa/labeler
Support matches on draft status
What's Changed
- Split conditions to their own files by @srvaroa in #57
- Add matcher on draft status by @srvaroa in #58
Full Changelog: v1.0...v1.1
v1.0: First stable version.
What's Changed
- Add undocumented condition
base-branch
by @afuh in #40 - Add label matching for authors by @Serubin in #45
- Add GOPROXY by @nlohmann in #49
- Support Append-only mode by @srvaroa in #47
- Update google/go-github/v50 by @srvaroa in #55
New Contributors
- @afuh made their first contribution in #40
- @Serubin made their first contribution in #45
- @nlohmann made their first contribution in #49
Full Changelog: v0.9...v1.0
Support matching on PR description
- Add a new matcher that allows matching on PR description.
Thanks @brunoarueira !
Support for `pull_request_target` events
v0.8 Support PullRequestTargetEvent (fixes #13) (#27)
New features
New features:
- Support for cron scheduler (thanks @garethjevans!)
- Base branch matching (thanks, @SimonRichardson!)
Fix bug in file matcher
- Fixes a bug preventing the file matcher to work correctly (thanks @posquit0!)
New feature, fixes, new config version
- New feature: allow using the same matcher type several times, which allows creating OR semantics (details in README.md).
- Bug fix: correctly AND all matchers of different types.
- New configuration format, keeping compatibility with the old one for now (details in README.md).
Bug fixes
New matchers
Support labeling based on branch and on files.
Support label assignment based on PR size
Condition based Pull Request Labeler
Implements a GitHub Action that labels Pull Requests based on configurable conditions.
It is inspired by the example Pull Request Labeller, but intends to provide a
richer set of options.
Installing
Add a .github/workflows/main.yml file to your repository with these contents:
name: Label PRs
on:
- pull_request
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: srvaroa/labeler@v0.2
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
Then, add a ./github/labeler.yml with the configuration as described below.
Configuring
Configuration can be stored at ./github/labeler.yml
as a plain list of labels and a set of conditions for each. When all conditions for a label match, then the Action will set the given label. When any condition for a label
does not match, then the Action will unset the given label.
<label>:
<condition_name>: <condition_parameters>
<condition_name>: <condition_parameters>
For example, given this ./github/labeler.yml
:
WIP:
title: "^WIP:.*"
A Pull Request with title "WIP: this is work in progress" would be labelled as WIP
. If the Pull Request title changes to "This is done", then the WIP
label would be removed.
Each label may combine multiple conditions. The label will be applied if all conditions are satisfied, removed otherwise.
For example, given this ./github/labeler.yml
:
WIP:
title: "^WIP:.*"
mergeable: false
A Pull Request with title "WIP: this is work in progress" and not in a mergeable state would be labelled as WIP
. If the Pull Request title changes to "This is done", or it becomes mergeable, then the WIP
label would be removed.
Conditions
Below are the conditions currently supported.
Regex on title
This condition is satisfied when the PR title matches on the given regex.
WIP:
title: "^WIP:.*"
Mergeable status
This condition is satisfied when the PR is in a mergeable state.
MyLabel:
mergeable: true
PR size
This condition is satisfied when the total number of changed lines in the PR is within given thresholds.
The number of changed lines is calculated as the sum of all additions + deletions
in the PR.
For example, given this ./github/labeler.yml
:
S:
size-below: 10
M:
size-above: 9
size-below: 100
L:
size-above: 100
These would be the labels assigned to some PRs, based on their size as reported by the GitHub API.
PR | additions | deletions | Resulting labels |
---|---|---|---|
First example | 1 | 1 | S |
Second example | 5 | 42 | M |
Third example | 68 | 148 | L |