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

does not annotate the Pull Request - only the whole repo #5

Open
securestep9 opened this issue Jun 14, 2020 · 1 comment
Open

does not annotate the Pull Request - only the whole repo #5

securestep9 opened this issue Jun 14, 2020 · 1 comment

Comments

@securestep9
Copy link

when running the GitHub action on a pull request annotations are generated for the whole repo and PR is marked as failed due to errors elsewhere. The action should add annotations on a PR only - on files modified by the PR

@rbialon
Copy link
Owner

rbialon commented Jun 18, 2020

Thanks for the suggestion!
I'm not quite sure if this is possible using the Github Action's regex parser (or problem matcher, as they call it), as we simply specify which part of flake8 output should be used for which part of the annotations. There is no configuration from which files the output should be used. It is searching through flake8's whole output and not acting on single files.

To keep this annotator universal, I'd suggest restricting flake8 to the files changed within the PR so that only the changed parts will be linted.
One way to achieve this is presented in this Medium article, the variables might have to be changed:

DIFF=$(git diff --name-only --diff-filter=b $(git merge-base HEAD $BRANCH))
flake8 $DIFF 

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

2 participants