chore(workflow): notify authors with write access to not use forks #1242
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(not urgent, drafting this PR for consideration sometime)
This PR adds a workflow to validate PRs from forks by authors with repository write access, and block them via the workflow, compelling them to shift to contributing via the actual repository by means of an automated comment.
TL;DR see "2" in Testing to see what I mean :)
Problem Statement
Currently, this repository receives pull requests from both internal collaborators and external contributors. Some internal collaborators who have write access to the repository occasionally create PRs from forks instead of using branches in the main repository. This is not intended, and creates the following problems:
Solution
This PR introduces a new GitHub Action workflow that automatically identifies when a PR from a fork is created by a user who already has write access to the repository. The workflow then:
How the Workflow Functions
The
fork-pr-author-validation.yml
workflow:pull_request_target
events (opened, reopened, synchronize) specifically for PRs from forksTesting
These changes have been tested on a different repository https://github.com/newrelic/test-oac-repository, to allow for flexible testing (without having to use this repository). While additional workflows also run on PRs in this repository allowing for extra automation, please ignore those comments - all details of changes tested are as follows.
1. When a PR is created on the original repo (not fork)
2. When a PR is created from a fork of the repo, and the author already has write access to the repo
3. When a PR is created from a fork of the repo, and the author does not have write access to the repo