Skip to content

Commit 7365223

Browse files
authored
dont need pr read and no fork pr (#48004)
1 parent 22e4689 commit 7365223

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

.github/workflows/typespec-python-regenerate.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ on:
2020
permissions:
2121
contents: write
2222
issues: write
23-
pull-requests: write
23+
pull-requests: read
2424

2525
# Note: with cancel-in-progress, a newer run can cancel an older one after it
2626
# has force-pushed the branch but before it finishes updating the tracking
@@ -71,6 +71,11 @@ jobs:
7171
HEAD_SHA=$(echo "$PR_JSON" | jq -r '.headRefOid')
7272
HEAD_OWNER=$(echo "$PR_JSON" | jq -r '.headRepositoryOwner.login')
7373
HEAD_REPO_NAME=$(echo "$PR_JSON" | jq -r '.headRepository.name')
74+
# Reject fork PRs: head branch must be in microsoft/typespec itself
75+
if [ "$HEAD_OWNER/$HEAD_REPO_NAME" != "microsoft/typespec" ]; then
76+
echo "::error::Only PRs with head branches in microsoft/typespec are accepted. Fork PRs are not supported (got ${HEAD_OWNER}/${HEAD_REPO_NAME})."
77+
exit 1
78+
fi
7479
REPO="${HEAD_OWNER}/${HEAD_REPO_NAME}"
7580
REF="${HEAD_SHA}"
7681
DISPLAY_REF="PR #${PR_NUMBER} @ ${HEAD_SHA:0:7}"

0 commit comments

Comments
 (0)