Commit 0fca61d
ci: label external-contributor PRs (#9641)
## Description
Adds a new GitHub Actions workflow, `Label External Contributors`, that
runs whenever a pull request is opened and applies the existing
`external-contributor` label when:
* the PR is **not** authored by a bot (`user.type == 'Bot'` or login
ending in `[bot]`), **and**
* either of the following is true (logical OR):
* the author is **not** a member of the `warpdotdev` GitHub
organization, **or**
* the PR head repository is a fork (`pr.head.repo.full_name !=
pr.base.repo.full_name`).
The workflow triggers on `pull_request_target` so the `GITHUB_TOKEN` has
the `pull-requests: write` permission needed to label PRs that come from
forks. The top-level workflow token stays read-only and only the
labeling job widens permissions. The script never checks out the PR's
code — it only reads the event payload and calls a couple of REST
endpoints — so the `pull_request_target` trigger is safe.
Org membership is determined via the GitHub REST membership API. If that
call cannot be performed (for example, when `GITHUB_TOKEN` lacks
org-membership context for a private member), we fall back to the PR's
`author_association` field (`MEMBER` or `OWNER` is treated as internal).
The same heuristic was applied retroactively to all currently-open PRs
in the repo. The retrospective pass evaluated 148 open PRs, skipped 20
bot-authored PRs, labeled 89 external-contributor PRs (all of which were
forks from non-org members), and left 39 internal-author PRs untouched.
## Linked Issue
N/A — direct request from the team Slack channel.
- [x] Where appropriate, screenshots or a short video of the
implementation are included below (especially for user-visible or UI
changes).
## Screenshots / Videos
Not applicable: this PR only adds a CI workflow.
## Testing
* Validated the workflow YAML parses cleanly.
* Exercised the heuristic locally across all 148 currently-open PRs (89
expected to be labeled external, 20 bots skipped, 39 internal — all
matched expectations).
* Verified after retrospectively applying labels that `gh pr list
--state open --label external-contributor` now returns 89 PRs, matching
the dry-run prediction.
## Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
_Conversation:
https://staging.warp.dev/conversation/cf25ce7e-4d2d-4880-a3a3-8c4242f7c0d5_
_Run:
https://oz.staging.warp.dev/runs/019ddf8f-1365-7da4-9c47-75aee57c151c_
_This PR was generated with [Oz](https://warp.dev/oz)._
---------
Co-authored-by: Oz <oz-agent@warp.dev>1 parent 10ec3d1 commit 0fca61d
1 file changed
Lines changed: 96 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
0 commit comments