actions / labeler

An action for automatically labelling pull requests
MIT License
1.92k stars 415 forks source link

Support labeling based on size of change #486

Open dfandrich opened 1 year ago

dfandrich commented 1 year ago

I would like to add a label in certain cases based on files changed, but only if the commit changes fewer than N files in total. Anything more than N and the change is likely a global refactor and adding the specific label won't add any value.

panticmilos commented 1 year ago

hi @dfandrich, thank you for the report, we will take a look at it.

akutz commented 1 year ago

Mentioned in https://github.com/vmware-tanzu/vm-operator/pull/50#pullrequestreview-1274283991 (this was not added automatically for some reason)

jw-maynard commented 1 year ago

@panticmilos and @MaksimZhukov I'm working on a PR for this in my personal fork right now but I currently have a breaking change with the way the config is written. I basically put the existing config under a top level section name labels and added a new optional section called sizes.

Obviously there are other options for handling this:

Do you guys have a preference?

https://github.com/jw-maynard/labeler/pull/2

jw-maynard commented 1 year ago

@panticmilos and @MaksimZhukov I'm working on a PR for this in my personal fork right now but I currently have a breaking change with the way the config is written. I basically put the existing config under a top level section name labels and added a new optional section called sizes.

Obviously there are other options for handling this:

  • a separate config file in the .github dir
  • an additional optional input to the action
  • some code to check if there is a labels top level item in the config and if not, fall back to the previous parsing

Do you guys have a preference?

jw-maynard#2

So I just noticed there is a v5 WIP with breaking changes in it so maybe I'll just work off of that branch

lucacome commented 7 months ago

Any chance we can get some traction on this @MaksimZhukov ? 🙏

MattMencel commented 4 months ago

I've been using this Labeler Action alongside https://github.com/pascalgn/size-label-action with good success.

lucacome commented 4 months ago

It'd be nice to just use one Action instead of two, since there's already a PR open in this repo for the same functionality...

austinpray-mixpanel commented 4 months ago

I just tacked https://github.com/pascalgn/size-label-action as the next step in the labeler workflow. It's instant so there's basically no cost to having two steps in the labeler job.

name: Labeler
on: [pull_request]

jobs:
  label:
    timeout-minutes: 15
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
    - uses: actions/labeler@v5
      with:
        repo-token: '${{ secrets.GITHUB_TOKEN }}'
        configuration-path: .github/labeler.yaml
    - name: size-label
      uses: "pascalgn/size-label-action@v0.5.2"
      env:
        # See https://github.com/pascalgn/size-label-action
        GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
        IGNORED: |-
          package-lock.json
dfandrich commented 4 months ago

Using a separate action to set separate size labels would only work to satisfy this if #129 were also implemented.