Skip to content

Fix re-run detection and improve messaging#1010

Merged
mctofu merged 2 commits into
mainfrom
mctofu/fix-re-run-detection
Aug 2, 2023
Merged

Fix re-run detection and improve messaging#1010
mctofu merged 2 commits into
mainfrom
mctofu/fix-re-run-detection

Conversation

@mctofu

@mctofu mctofu commented Aug 1, 2023

Copy link
Copy Markdown
Contributor

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
Comment thread __tests__/main.test.ts
@@ -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
Copy Markdown
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
Copy Markdown
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

mctofu commented Aug 2, 2023

Copy link
Copy Markdown
Contributor Author
image

@mctofu mctofu merged commit bb75286 into main Aug 2, 2023
@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

Development

Successfully merging this pull request may close these issues.

3 participants