Giter VIP home page Giter VIP logo

pr-size-labeler's Introduction

Codely logo

๐Ÿท Pull Request Size Labeler

codely.tv CodelyTV Courses GitHub Action version

Visualize and optionally limit the size of your Pull Requests

๐Ÿš€ Usage

Create a file named labeler.yml inside the .github/workflows directory and paste the following configuration.

Note

Take into account that PR Size Labeler considers any line addition, deletion, or modification as a change by default, but you can configure it with optional arguments such as files_to_ignore, ignore_file_deletions, or even ignore_line_deletions.

name: labeler

on: [pull_request]

jobs:
  labeler:
    runs-on: ubuntu-latest
    name: Label the PR size
    steps:
      - uses: codelytv/pr-size-labeler@v1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          xs_label: 'size/xs'
          xs_max_size: '10'
          s_label: 'size/s'
          s_max_size: '100'
          m_label: 'size/m'
          m_max_size: '500'
          l_label: 'size/l'
          l_max_size: '1000'
          xl_label: 'size/xl'
          fail_if_xl: 'false'
          message_if_xl: >
            This PR exceeds the recommended size of 1000 lines.
            Please make sure you are NOT addressing multiple issues with one PR.
            Note this PR might be rejected due to its size.
          github_api_url: 'https://api.github.com'
          files_to_ignore: ''

๐ŸŽ›๏ธ Arguments

Name Required Default Value Description
GITHUB_TOKEN Yes Automatically supplied GitHub token needed to interact with the repository.
xs_label No 'size/xs' Label for very small-sized PRs.
xs_max_size No '10' Maximum number of changes allowed for XS-sized PRs.
s_label No 'size/s' Label for small-sized PRs.
s_max_size No '100' Maximum number of changes allowed for S-sized PRs.
m_label No 'size/m' Label for medium-sized PRs.
m_max_size No '500' Maximum number of changes allowed for M-sized PRs.
l_label No 'size/l' Label for large-sized PRs.
l_max_size No '1000' Maximum number of changes allowed for L-sized PRs.
xl_label No 'size/xl' Label for extra-large-sized PRs. A PR will be labeled as 'xl' if it exceeds the amount of changes defined in l_max_size
fail_if_xl No 'false' Whether to fail the GitHub workflow if the PR size is 'XL' (blocks the merge).
message_if_xl No Custom message Message to display when a PR exceeds the 'XL' size limit.
github_api_url No 'https://api.github.com' URL for the GitHub API, can be changed for GitHub Enterprise Servers.
files_to_ignore No '' Files to ignore during PR size calculation. Supports newline or whitespace delimited list.
ignore_line_deletions No 'false' Whether to ignore lines which are deleted when calculating the PR size. If set to 'true', deleted lines will be ignored.
ignore_file_deletions No 'false' Whether to ignore completely deleted files when calculating the PR size. If set to 'true', deleted files will be ignored. Distinct from ignore_line_deletions in that it only ignores files which are deleted completely. If ignore_line_deletions is used then using ignore_file_deletions is redundant.

Example for files_to_ignore:

files_to_ignore: 'package-lock.json *.lock'
# OR
files_to_ignore: |
  "package-lock.json"
  "*.lock"
  "docs/*"

Contributing

If you would like to help improve the project, please read the contribution guidelines.

โš–๏ธ License

MIT

pr-size-labeler's People

Contributors

rgomezcasas avatar johnlk avatar javiercane avatar bhean avatar bflad avatar wu-cl avatar mambax avatar khru avatar lionseal avatar fty4 avatar mikybars avatar rjlopezdev avatar kooku0 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.