Giter Club home page Giter Club logo

auto-labeling's Introduction

Auto Labeling

CI Cron Issues codecov GitHub marketplace

A GitHub Action that automates labeling on issues and pull requests.

How it works

auto-labeling automatically detects task lists in the description of an issue or a pull request and adds labels based on their states (checked or unchecked).

<!-- pull_request_template.md -->

What kind of change does this PR introduce?

- [x] `bug-fix`
- [ ] `new-feature`
- [ ] `enhancement`

This description makes auto-labeling add bug-fix. If someone updates the description as follows:

<!-- pull_request_template.md -->

What kind of change does this PR introduce?

- [ ] `bug-fix`
- [ ] `new-feature`
- [x] `enhancement`

Then, auto-labeling removes bug-fix and adds enhancement. Note that unregistered labels are ignored.

Example workflow

name: Auto Labeling

on:
  issues:
    types:
      # Trigger the action only on relevant activity types.
      # It's actually not harmful to trigger the action on all activity types.
      - opened
      - edited

on:
  pull_request:
    types:
      - opened
      - edited

# A GitHub token created for a PR coming from a fork doesn't have
# 'admin' or 'write' permission (which is required to add labels)
# To avoid this issue, you can use the `scheduled` event and run
# this action on a certain interval.
on:
  schedule:
    - cron: '*/10 * * * *'

jobs:
  labeling:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - uses: harupy/auto-labeling@master
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          label-pattern: '- \[(.*?)\] ?`(.+?)`' # matches '- [x] `label`'

Inputs

inputs:
  github-token:
    description: 'GitHub token'
    required: true

  label-pattern:
    description: >
      Pattern (regular expression) to extract label states and names (e.g. '- \[(.*?)\] ?`(.+?)`').
    required: true

  offset:
    description: >
      Only issues and pull requests updated at or after this offset (from the current time) will be labeled.
      Required only when running this action on the schedule event.
    required: false
    default: '1m' # means one month

  quiet:
    description: >
      Suppress logging output. Must be either "true" or "false"
    required: false
    default: 'false'

auto-labeling's People

Contributors

dependabot[bot] avatar harupy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.