File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -104,17 +104,22 @@ jobs:
104
104
105
105
# Only check if this is their first PR if needed
106
106
if [[ "${{ steps.event.outputs.type }}" == "opened" ]]; then
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)
107
+ # Use the GitHub Search API to find PRs by this author to this specific repo
108
+ SEARCH_QUERY="repo:${{ github.repository }} is:pr author:$PR_AUTHOR"
109
+ PR_SEARCH=$(gh api -H "Accept: application/vnd.github+json" \
110
+ "/search/issues?q=$(echo $SEARCH_QUERY | sed 's/ /%20/g')&per_page=100" || echo '{"total_count": 0}')
110
111
111
- echo "Found $PR_COUNT PRs from this contributor"
112
+ # Get the total count from the search results
113
+ PR_COUNT=$(echo $PR_SEARCH | jq '.total_count')
114
+
115
+ echo "Search query: $SEARCH_QUERY"
116
+ echo "Found $PR_COUNT PRs from this contributor to this repository"
112
117
113
118
if [ "$PR_COUNT" -eq 1 ]; then
114
- echo "First PR from this contributor"
119
+ echo "First PR from this contributor to this repository "
115
120
echo "is_first_pr=true" >> $GITHUB_OUTPUT
116
121
else
117
- echo "Not the first PR from this contributor"
122
+ echo "Not the first PR from this contributor to this repository "
118
123
echo "is_first_pr=false" >> $GITHUB_OUTPUT
119
124
fi
120
125
else
You can’t perform that action at this time.
0 commit comments