Skip to content

Commit fba6619

Browse files
authored
fix: first pr logic (#11)
1 parent 281d46b commit fba6619

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

.github/workflows/pr-auto-comments.yml

+5-9
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,11 @@ jobs:
104104
105105
# Only check if this is their first PR if needed
106106
if [[ "${{ steps.event.outputs.type }}" == "opened" ]]; then
107-
# Check if this is their first PR to the repo
108-
PR_COUNT=$(gh api graphql -f query='
109-
query($owner:String!, $repo:String!, $author:String!) {
110-
repository(owner:$owner, name:$repo) {
111-
pullRequests(first:100, states:[OPEN, CLOSED, MERGED], author:$author) {
112-
totalCount
113-
}
114-
}
115-
}' -f owner=${{ github.repository_owner }} -f repo=${{ github.event.repository.name }} -f author=$PR_AUTHOR | jq '.data.repository.pullRequests.totalCount')
107+
# Check if this is their first PR to the repo using REST API instead of GraphQL
108+
PR_COUNT=$(gh api -H "Accept: application/vnd.github+json" \
109+
"/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/pulls?state=all&creator=$PR_AUTHOR" | jq length)
110+
111+
echo "Found $PR_COUNT PRs from this contributor"
116112
117113
if [ "$PR_COUNT" -eq 1 ]; then
118114
echo "First PR from this contributor"

0 commit comments

Comments
 (0)