-
Notifications
You must be signed in to change notification settings - Fork 6
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
Re-enable Coverage #329
Re-enable Coverage #329
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HebaruSan yup 😑 - I honestly have no idea why, works fine on a couple of other repos with the exact same workflow! |
19ef9ec
to
5d8ed3d
Compare
This needed a lot more than permissions! I have pointed it at my own fork of the action for now, but the report will only run once the workflow is in the default branch 🙂 I'll fix the commits up before merging. Make it clearer about what was changed. |
Coverage only worked on branches within the project, due to restrictions around pull_request permissions. It is unsafe to allow pull_request_target when using checked out code, thus splitting the workflow is required. Currently pointed at my fork, which adds the necessary functionality to support workflow_run.
v1 is quite old, bumping to v5
Newer versions of setup python include caching, which improves the speed of test/build/coverage reporting
@HebaruSan - I've been using this process a bunch now. Seems to work well. I'll be keeping my fork active until the upstream decides to merge or I find an alternative 🙂 |
So it's two separate jobs now, but only one runs for pull requests, so we won't actually be able to tell whether a PR increases or decreases the number? Am I missing something? |
There's no functional difference, except the report is triggered 'workflow_run', which gets the PR context included in its event payload. It won't run until it's in the default branch of the repo (which is why it hasn't run yet), due to the security implications it is solving. If we want to enforce that it is successful, we can use branch protection rules. |
Can you summarize those security implications? It seems really weird to me to have a tool like this that doesn't run until after merging to the main branch. I thought the whole point was to make sure that proposed changes are properly tested BEFORE merging. |
I'll give you the TL;DR first, as I don't think I was clear on the point that this only applies to this specific pr. There are currently no workflows in our default branch that listen to the Further readingThe overview is covered here, and initially I had similar feelings on the matter. However when I dug further into the why, it became clearer, which is why submitted the changes upstream. The crux of the matter is allowing untrusted code (a fork) to have access to the Github Token, which is required by this action to write the PR comment. GitHub have made now two triggers for a pull request.
Building the coverage report in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll give you the TL;DR first, as I don't think I was clear on the point that this only applies to this specific pr.
Ahh, indeed that helps a lot, thanks!
Let's give it a go. 👍
Awesome! Thanks for reviewing @HebaruSan |
I have enabled coverage in a few other repos, and the
contents: read
permission, combined with thepull_request: write
appears to do the trick.Extra
actions/setup-python
to 5