Skip to content

Releases: srvaroa/labeler

Support matches on draft status

14 Feb 23:15
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.0...v1.1

v1.0: First stable version.

12 Feb 00:23
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.9...v1.0

Support matching on PR description

14 Mar 18:37
36ad6b8
Compare
Choose a tag to compare
  • Add a new matcher that allows matching on PR description.

Thanks @brunoarueira !

Support for `pull_request_target` events

24 Apr 21:18
fbec509
Compare
Choose a tag to compare
v0.8

Support PullRequestTargetEvent (fixes #13) (#27)

New features

30 Mar 14:27
2e5bbb7
Compare
Choose a tag to compare

New features:

Fix bug in file matcher

24 Oct 13:14
9d5eff2
Compare
Choose a tag to compare
  • Fixes a bug preventing the file matcher to work correctly (thanks @posquit0!)

New feature, fixes, new config version

18 Sep 16:40
a612856
Compare
Choose a tag to compare
  • 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

12 Sep 14:02
a7f2f66
Compare
Choose a tag to compare

Solve a bug for multiple conditions.

New matchers

26 Jun 14:46
052ceac
Compare
Choose a tag to compare

Support labeling based on branch and on files.

Support label assignment based on PR size

27 Aug 14:11
Compare
Choose a tag to compare

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