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: allow to manually run external contributors workflows #599

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eliecharra
Copy link
Member

@eliecharra eliecharra commented Jan 23, 2025

Description of the change

This changed the way we run the test workflow that requires secrets.

Actually we should close contributors PRs and reopen ourselves to be able to run tests. That is a massive PITA.

Dependabot PRs are also broken.

This changes how we run this test workflow by using pull_request_target and then manually checking for permissions. We also always allow dependabot to run.

So for an external contributor, our workflow would be:

  • external contributor fork the project and create a new PR targetting main
  • the test workflow run and fails
  • one internal maintainer review the PR
  • internal maintainers can retry the failed run if the PR looks safe
  • all green, we can merge

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (non-breaking change that adds documentation)

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development
  • Examples for new resources and data sources have been added
  • Default values have been documented in the description (e.g., "Dummy: (Boolean) Blah blah. Defaults to false.)
  • If the action fails that checks the documentation: Run go generate to make sure the docs are up to date

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • Pull Request is no longer marked as "draft"
  • Reviewers have been assigned
  • Changes have been reviewed by at least one other engineer

This changed the way we run the test workflow that requires secrets.

Actually we should close contributors PRs and reopen ourselves to be
able to run tests. That is a massive PITA.

Dependabot PRs are also broken.

This changes how we run this test workflow by using pull_request_target
and then manually checking for permissions. We also always allow
dependabot to run.

So for an external contributor, our workflow would be:

- external contributor fork the project and create a new PR targetting
main
- the test workflow run and fails
- one internal maintainer review the PR
- internal maintainers can retry the failed run if the PR looks safe
- all green, we can merge
@eliecharra eliecharra requested review from a team January 23, 2025 10:54
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check permission
if: steps.checkAccess.outputs.require-result == 'false' && github.actor != 'dependabot[bot]'
Copy link
Member Author

Choose a reason for hiding this comment

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

Allows dependabot to pass anyway. For anyone else, check if we have write access from the previous step, otherwise make the workflow fail with a few debug info about why.

@eliecharra eliecharra requested a review from a team January 23, 2025 11:04
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.

2 participants