The Wayback Machine - https://web.archive.org/web/20201023025946/https://github.com/CodelyTV/pr-size-labeler/issues/9
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ignoring files, such as package-lock.json #9

Open
kevindice opened this issue Apr 9, 2020 · 2 comments
Open

Add support for ignoring files, such as package-lock.json #9

kevindice opened this issue Apr 9, 2020 · 2 comments
Assignees

Comments

@kevindice
Copy link

@kevindice kevindice commented Apr 9, 2020

No description provided.

@dowrow
Copy link

@dowrow dowrow commented Jun 9, 2020

I'm really interested in this. What would be the best way to implement it?
I've been checking the github::calculate_total_modifications() method and the Github API docs and the only approach I found would be:

  • Allow a 8th argument to be passed to the action (ignore_files), which would be a string with the comma-separated files to ignore.
  • Inside calculate_total_modifications() define a variable totalLines = deteledLines + addedLines (current returned value)
  • Loop over every file in the PR (using this endpoint GET /repos/:owner/:repo/pulls/:pull_number/files) and check if the filename matches one of the ignored_files. If it does, substract its (deletedLines + addedLines) from the totalLines.

Does this make sense? Am I missing anything?

@JavierCane
Copy link
Member

@JavierCane JavierCane commented Aug 19, 2020

It would be awesome to support this 🙌

@dowrow, your approach seems to completely make sense 🙂

The only thing I would suggest would be using a YAML sequence instead of a comma separated string for specifying the different files to ignore. That is, being able to specify it as files_to_ignore: ['package-lock.json', 'composer.lock'] instead of files_to_ignore: 'package-lock.json, composer.lock'.

Example of how the README.md complete example would look like:

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_max_size: '10'
          s_max_size: '100'
          m_max_size: '500'
          l_max_size: '1000'
          fail_if_xl: 'false'
          message_if_xl: 'This PR is so big! Please, split it 😊'
          files_to_ignore: ['package-lock.json', 'composer.lock']

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.