Skip to content

An action for automatically labelling pull requests based on the changed lines count

License

Notifications You must be signed in to change notification settings

vloddi/changed-lines-count-labeler

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Changed Lines Count Labeler

build and test status

Automatically label new pull requests based on the changed lines count.

Usage

Create .github/changed-lines-count-labeler.yml

Create a .github/changed-lines-count-labeler.yml file with a list of labels and minimatch globs to match to apply the label.

The key is the name of the label in your repository that you want to add (eg: "small", "large") and the value is the minimum and maximum count of lines.

Examples

# Add 'small' to any changes below 10 lines
small:
  max: 9

# Add 'medium' to any changes between 10 and 100 lines
medium:
  min: 10
  max: 99

# Add 'large' to any changes for more than 100 lines
large:
  min: 100

Create Workflow

Create a workflow (eg: .github/workflows/changed-lines-count-labeler.yml see Creating a Workflow file) to utilize the labeler action with content:

name: "Changed Lines Count Labeler"
on: [pull_request]

jobs:
  changed-lines-count-labeler:
    runs-on: ubuntu-latest
    name: An action for automatically labelling pull requests based on the changed lines count
    steps:
    - name: Set a label
      uses: vkirilichev/[email protected]
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        configuration-path: .github/changed-lines-count-labeler.yml

Note: This grants access to the GITHUB_TOKEN so the action can make calls to GitHub's rest API

Inputs

Various inputs are defined in action.yml to let you configure the labeler:

Name Description Default
repo-token Token to use to authorize label changes. Typically the GITHUB_TOKEN secret, with contents:read and pull-requests:write access N/A
configuration-path The path to the label configuration file .github/changed-lines-count-labeler.yml

About

An action for automatically labelling pull requests based on the changed lines count

Resources

License

Stars

Watchers

Forks

Packages

No packages published