Skip to content

Commit 6e11f7d

Browse files
jbachorikclaude
andcommitted
Fix fork PR detection in /contribute-upstream command
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 40fcd41 commit 6e11f7d

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

.claude/commands/contribute-upstream.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,17 @@ If there are zero candidates, tell the user and stop.
3434

3535
## Step 3: Filter Out Existing PRs
3636

37-
Before proposing new PRs, check what's already open from DataDog against upstream:
37+
Before proposing new PRs, check what's already open from the DataDog fork against upstream. Note: `--author DataDog` does not work because fork PRs are authored by the pushing user, not the org. Instead, query the API and filter by head repo:
3838

3939
```bash
40-
gh pr list --repo async-profiler/async-profiler --author DataDog --state open --json number,title,body,files
40+
gh api 'repos/async-profiler/async-profiler/pulls?state=open&per_page=100' \
41+
--jq '.[] | select(.head.repo.full_name == "DataDog/async-profiler") | {number, title}'
42+
```
43+
44+
Then for each matching PR, fetch the files it touches:
45+
46+
```bash
47+
gh api 'repos/async-profiler/async-profiler/pulls/<number>/files' --jq '.[].filename'
4148
```
4249

4350
For each open PR, extract the list of files it touches. Then cross-reference with the candidate files from Step 2:

0 commit comments

Comments
 (0)