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

chore(ci): Enable PR tagged images on pull request approval #300

Closed
wants to merge 1 commit into from

Conversation

EyeCantCU
Copy link
Member

@EyeCantCU EyeCantCU commented Aug 13, 2023

Submits an image to the GitHub Container Registry on pull request approval, permitting approved pull requests to be tested before being merged.

Requires branch protection rule: 'Require approval of the most recent reviewable push'

This rule ensures that the state of a PR is reset after a new commit has been pushed to an open pull request.

@KyleGospo
Copy link
Member

Love the concept, only thing is we need to make sure that commits made after a PR is approved for runs aren't run until re-approved, otherwise you could get a PR approved and then do something malicious after the fact.

@EyeCantCU
Copy link
Member Author

Very true. I'll look into it

@EyeCantCU
Copy link
Member Author

EyeCantCU commented Aug 13, 2023

So, here's what I'm thinking. Instead of using the pull_request trigger, we could use the pull_request_review trigger on submissions. When a pull request is approved, the workflow will run. To avoid future pushes from triggering the build workflow again, we'd need to enable the branch protection rule: 'Require approval of the most recent reviewable push'. For each action in the workflow, we'd need an if statement that checks for whether something was pushed versus the state of the PR being approved. Thoughts?

@EyeCantCU EyeCantCU changed the title chore(ci): Enable PR tagged images chore(ci): Enable PR tagged images on pull request approval Aug 13, 2023
@EyeCantCU
Copy link
Member Author

Everything is in place now for this to work properly, save for the branch protection rule

@bsherman
Copy link
Contributor

The immediate issue i see here is contributors using PRs for revisions aren't immediately going to see build results until workflows are approved. Luckily I think restoring the PR trigger should resolve that

This hopefully isn't a big problem. Hmm... except maybe? Contributors should be encouraged to run their builds locally... but I guess workflow changes are something not as easily tested since i don't think they'll run in a fork.

@EyeCantCU
Copy link
Member Author

The immediate issue i see here is contributors using PRs for revisions aren't immediately going to see build results until workflows are approved. Luckily I think restoring the PR trigger should resolve that

This hopefully isn't a big problem. Hmm... except maybe? Contributors should be encouraged to run their builds locally... but I guess workflow changes are something not as easily tested since i don't think they'll run in a fork.

My latest push fixed this

Submits an image to the GitHub Container Registry on pull request approval, permitting
approved pull requests to be tested before being merged.

Requires branch protection rule: 'Require approval of the most recent reviewable push'

This rule ensures that the state of a PR is reset after a new commit has been pushed to
an open pull request.
@EyeCantCU
Copy link
Member Author

Latest push ensures that the PR number is applied to the tag and that builds triggered by pull_request_review only run on approvals

@EyeCantCU EyeCantCU closed this Sep 7, 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