Skip to content

Commit ad9aabe

Browse files
committed
ci(pr): restore PR labeling
1 parent 6fcce17 commit ad9aabe

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

.github/workflows/pr.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,21 @@ on:
1414

1515
jobs:
1616
pr:
17-
name: Check PR Title
17+
name: Label and Check PR Title
18+
permissions:
19+
contents: read # `actions/labeler` reads `.github/labeler.yml` via the GitHub API
20+
pull-requests: write # `actions/labeler` adds labels to the PR, requires write permission
1821
runs-on: ubuntu-slim
1922
steps:
23+
# This step can only be run on internal PRs (i.e. from core contributors who have write access to the repo).
24+
# The simplest way to extend it to external contributors making PRs from forks would be to switch to a
25+
# `pull_request_target` event, but we don't want to do that due to the security risks of `pull_request_target`
26+
# (see PR #21566).
27+
- uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1
28+
# Skip on PRs from forks.
29+
# In `pull_request` events, `GITHUB_TOKEN` is read-only for PRs from forks, so adding labels would fail.
30+
if: github.event.pull_request.head.repo.full_name == github.repository
31+
2032
- name: Validate PR title
2133
env:
2234
TITLE: ${{ github.event.pull_request.title }}

0 commit comments

Comments
 (0)