Skip to content

Commit 154490b

Browse files
ostermanclaude
andauthored
fix: Move PR size labeler to dedicated workflow (#1816)
* fix: Move PR size labeler to dedicated workflow with elevated permissions Move the pr-size-labeler job from codeql.yml to a new dedicated workflow that uses pull_request_target event. This grants write permissions needed to label PRs from forks, fixing the 403 error for non-member contributors. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * chore: Remove redundant job name from pr-size-labeler workflow 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * chore: Rename job ID for cleaner workflow display Changes job ID from "pr-size-labeler" to "label" so the GitHub Actions UI shows "PR Size Labeler / label" instead of redundant naming. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
1 parent 6e39488 commit 154490b

File tree

2 files changed

+43
-32
lines changed

2 files changed

+43
-32
lines changed

.github/workflows/codeql.yml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -205,35 +205,3 @@ jobs:
205205
> {{ provided }}
206206
> ```
207207
> You'll need to add one before this PR can be merged.
208-
209-
pr-size-labeler:
210-
name: PR Size Labeler
211-
if: github.event_name == 'pull_request'
212-
runs-on: ubuntu-latest
213-
permissions:
214-
contents: read
215-
pull-requests: write
216-
issues: write
217-
steps:
218-
- name: Checkout repository
219-
uses: actions/checkout@v4
220-
221-
- name: PR Size Labeler
222-
uses: ./.github/actions/pr-sizer
223-
with:
224-
xs_label: "size/xs"
225-
xs_max_size: "10"
226-
s_label: "size/s"
227-
s_max_size: "100"
228-
m_label: "size/m"
229-
m_max_size: "500"
230-
l_label: "size/l"
231-
l_max_size: "1000"
232-
xl_label: "size/xl"
233-
fail_if_xl: "false"
234-
files_to_ignore: |
235-
package-lock.json
236-
yarn.lock
237-
go.sum
238-
ignore_line_deletions: "false"
239-
ignore_file_deletions: "false"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "PR Size Labeler"
2+
3+
# Use pull_request_target to get write permissions for PRs from forks.
4+
# This is safe because we only use the GitHub API to read file metadata -
5+
# we never checkout or execute code from the PR.
6+
on:
7+
pull_request_target:
8+
types: [opened, synchronize, reopened]
9+
10+
jobs:
11+
label:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
issues: write
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
# Checkout the base branch (not the PR head) for security.
22+
# We only need the action definition from .github/actions/pr-sizer/
23+
ref: ${{ github.base_ref }}
24+
25+
- name: PR Size Labeler
26+
uses: ./.github/actions/pr-sizer
27+
with:
28+
xs_label: "size/xs"
29+
xs_max_size: "10"
30+
s_label: "size/s"
31+
s_max_size: "100"
32+
m_label: "size/m"
33+
m_max_size: "500"
34+
l_label: "size/l"
35+
l_max_size: "1000"
36+
xl_label: "size/xl"
37+
fail_if_xl: "false"
38+
files_to_ignore: |
39+
package-lock.json
40+
yarn.lock
41+
go.sum
42+
ignore_line_deletions: "false"
43+
ignore_file_deletions: "false"

0 commit comments

Comments
 (0)