Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
name: PR Labeler

on:
# SAFETY: pull_request_target is used here because:
# - The workflow does NOT check out PR code
# - Need access to github.token with write permissions to add labels
pull_request_target:
pull_request:
types: [opened, synchronize, reopened]

permissions:
Expand All @@ -13,6 +10,13 @@ permissions:

jobs:
label:
# Skip on PRs from forks.
# In `pull_request` events, `GITHUB_TOKEN` is read-only for PRs from forks, so adding labels would fail.
# This means labeling only runs on internal PRs (i.e. from core contributors who have write access to the repo).
# The simplest way to extend it to external contributors making PRs from forks would be to switch to
# `pull_request_target` event, but we don't want to do that due to the security risks of `pull_request_target`.
# (see https://github.com/oxc-project/oxc/pull/21566)
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-slim
steps:
- uses: actions/labeler@f27b608878404679385c85cfa523b85ccb86e213 # v6
Expand Down
Loading