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

Changes relative to base branch #96

Open
srolel opened this issue May 14, 2020 · 2 comments
Open

Changes relative to base branch #96

srolel opened this issue May 14, 2020 · 2 comments

Comments

@srolel
Copy link

srolel commented May 14, 2020

Is your feature request related to a problem? Please describe.
I would like to lint only changed files, but lint them from the base branch.

Describe the solution you'd like
Omit changes relative to base branch.

Describe alternatives you've considered
Squashing when the action runs.

@trilom
Copy link
Owner

trilom commented May 21, 2020

Hey @srolel -

I believe what you are talking about is covered here by providing a different pushBefore or pushAfter SHA, or a seperate prNumber.

Some ways I use this are in the lowest example on the readme where I use the head_commit.id from the commit to get the commit's PR number (merge request push) and get a list of files. You can then use that list to perform your action.

@RayBB
Copy link

RayBB commented Jan 19, 2022

The easiest way I've found to do this is in GitHub Actions use the pull_request event and prNumber: ${{ github.event.number }}

name: pre-commit
on:
  pull_request
jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2
      with:
        python-version: 3.9
    - id: file_changes
      uses: trilom/[email protected]
      with:
        prNumber: ${{ github.event.number }}
        output: ' '
    - uses: pre-commit/[email protected]
      name: mypy
      with: 
        extra_args: mypy --files ${{ steps.file_changes.outputs.files }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants