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

Option to exclude workflow initiator (GITHUB_ACTOR) as an approver #59

Merged

Conversation

timorthi
Copy link
Contributor

@timorthi timorthi commented Nov 8, 2022

Hi there, thanks for creating this GH Action - it's come in handy for some workflows over at @leaselock :)

We have a use case in which we want to allow a team of users to approve a step. However, if the user who initiates the workflow is also part of the team, we don't want to allow the initiator to self-approve.

This workflow initiator is exposed as a default environment variable GITHUB_ACTOR, so we added a small change to filter that user out.

I figured I'd share this PR as it might be useful for other users too. Perhaps we can toggle this behavior based on an input flag allow_workflow_initiator_as_approver: true|false?

Screen Shot 2022-11-08 at 3 20 35 PM

@trstringer
Copy link
Owner

Thanks for your PR! I really like this, and agree this is a great feature to add. This should definitely be behind a configuration setting, like you mention. allow_workflow_initiator_as_approver is a little verbose, but I can't think of anything more accurate and shorter right now. Could you add that into the code, and have it default to true so that we don't break current users that rely on this behavior already?

Thanks again!

@timorthi
Copy link
Contributor Author

timorthi commented Nov 9, 2022

@trstringer Updated! I've tested the input flag in a private repo and it works as expected. I went with kebab-case rather than snake_case to be consistent with the other inputs.

@timorthi timorthi changed the title Do not add workflow initiator (GITHUB_ACTOR) as an approver Option to exclude workflow initiator (GITHUB_ACTOR) as an approver Nov 9, 2022
action.yaml Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@trstringer trstringer merged commit 753e13e into trstringer:main Nov 10, 2022
@trstringer
Copy link
Owner

Thank you for your contribution!!

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.

None yet

2 participants