Skip to content

Use native GitHub approvals for community PRs - #905

Draft
blampe wants to merge 5 commits into
masterfrom
blampe/forks
Draft

Use native GitHub approvals for community PRs#905
blampe wants to merge 5 commits into
masterfrom
blampe/forks

Conversation

@blampe

@blampe blampe commented Apr 29, 2024

Copy link
Copy Markdown
Contributor

Edit: forked PRs still don't get secrets, and we'll likely need to work around that with pull_request_target.

Inspired by pulumi/pulumi#16083.

GitHub natively allows maintainers to manually kick off tests on PRs from community members. It's straightforward and doesn't hide test results behind a URL.

This PR removes all the logic around /run-acceptance-tests in favor of GitHub's native functionality.

Caveat: GitHub doesn't currently provide an API for configuring fork approval settings (integrations/terraform-provider-github#2108), and the default is "Require approval for first-time contributors" whereas the current workflow is equivalent to "Require approval for all outside collaborators".

I've changed the pulumi org's default permission to always require approval for outside PRs, and this seems to have had the intended effect.

uses: actions/checkout@v4
with:
lfs: true
ref: ${{ env.PR_COMMIT_SHA }}

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.

This was being appended as part of addDispatchConditional. In theory it's not needed -- GitHub will checkout a merge commit of the PR by default, which is good. We got rid of this in some other actions as part of #687 which makes me more confident it's safe to remove.

@blampe
blampe requested a review from a team April 29, 2024 20:33
@blampe
blampe requested a review from tgummerer April 29, 2024 21:28

@danielrbradley danielrbradley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a great simplification!

By changing the org-level setting does this mean we don't need to set it to always require approvals on a per-repo basis?

@blampe

blampe commented Apr 29, 2024

Copy link
Copy Markdown
Contributor Author

By changing the org-level setting does this mean we don't need to set it to always require approvals on a per-repo basis?

I think so, yes. pulumi/kubernetes was configured for "first-time contributors" before I tweaked the org-level setting, but afterwards it showed "all outside collaborators". Seems to be the case with all the other repos I spot-checked as well.

@blampe
blampe marked this pull request as draft April 30, 2024 19:54
@iwahbe

iwahbe commented Jun 20, 2024

Copy link
Copy Markdown
Member

@blampe Can we cary this forward?

@blampe

blampe commented Jun 20, 2024

Copy link
Copy Markdown
Contributor Author

@blampe Can we cary this forward?

@iwahbe unclear, probably needs more thought (especially for provider repos since we almost always require some kind of credentials during tests).

Some additional context in pulumi/pulumi#16083 and https://pulumi.slack.com/archives/C02FXTZEZ6W/p1714422853089509.

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.

5 participants