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

Fix re-run detection and improve messaging #1010

Merged
merged 2 commits into from
Aug 2, 2023
Merged

Conversation

mctofu
Copy link
Contributor

@mctofu mctofu commented Aug 1, 2023

The handling of the GITHUB_ACTOR has changed for re-runs which has broken our detection of improper re-runs (workflow re-run from the actions tab instead of requested via Dependabot). Now when a re-run occurs the GITHUB_ACTOR stays as dependabot[bot] and the GITHUB_TRIGGERING_ACTOR indicates the user that triggered the re-run.

GITHUB_TRIGGERING_ACTOR is available starting in GHES 3.7 so I've treated it as an optional field.

https://github.blog/changelog/2022-07-19-differentiating-triggering-actor-from-executing-actor/

The handling of the GITHUB_ACTOR has changed for re-runs which has
broken our detection of improper re-runs (workflow re-run from the
actions tab instead of requested via Dependabot). Now when a re-run
occurs the GITHUB_ACTOR stays as dependabot[bot] and the
GITHUB_TRIGGERING_ACTOR indicates the user that triggered the re-run.

GITHUB_TRIGGERING_ACTOR is available starting in GHES 3.7 so I've treated
it as an optional field.

https://github.blog/changelog/2022-07-19-differentiating-triggering-actor-from-executing-actor/
@mctofu mctofu requested a review from a team as a code owner August 1, 2023 20:56
@@ -144,6 +145,7 @@ describe('run', () => {
describe('when the action is triggered by a different actor', () => {
beforeEach(() => {
process.env.GITHUB_ACTOR = 'classic-rando'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be dependabot[bot]?

Now when a re-run occurs the GITHUB_ACTOR stays as dependabot[bot] and the GITHUB_TRIGGERING_ACTOR indicates the user that triggered the re-run.

Suggested change
process.env.GITHUB_ACTOR = 'classic-rando'
process.env.GITHUB_ACTOR = 'dependabot[bot]'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's covered in the next tests. This test would cover the case where this action has been added to a custom workflow and the GITHUB_ACTOR would be the user that initially triggers it.

@mctofu mctofu force-pushed the mctofu/fix-re-run-detection branch from ad7fd83 to 35aed31 Compare August 2, 2023 18:08
@mctofu
Copy link
Contributor Author

mctofu commented Aug 2, 2023

image

@mctofu mctofu merged commit bb75286 into main Aug 2, 2023
9 checks passed
@mctofu mctofu deleted the mctofu/fix-re-run-detection branch August 2, 2023 20:21
@honeyankit honeyankit mentioned this pull request Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants