File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -160,23 +160,25 @@ jobs:
160160 }
161161 }
162162
163- # Remove "First-time Contributor" label from other open PRs if PR is merged:
164- - name : ' Remove "First-time Contributor" label from other open PRs if PR is merged'
163+ # Remove "First-time Contributor" label from other open PRs of same author if PR is merged:
164+ - name : ' Remove "First-time Contributor" label from other open PRs of same author if PR is merged'
165165 if : ${{ github.event.action == 'closed' && github.event.pull_request.merged == true }}
166166 # Pin action to full length commit SHA
167167 uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
168168 with :
169169 github-token : ${{ secrets.CHATBOT_GITHUB_TOKEN }}
170170 script : |
171171 const prAuthor = context.payload.pull_request.user.login;
172+ const { owner, repo } = context.repo;
172173
173- const { data: pullRequests } = await github.rest.pulls.list({
174- 'owner': context.repo.owner,
175- 'repo': context.repo.repo,
176- 'state': 'open'
174+ // Search for all open PRs from the PR author:
175+ const query = `repo:${owner}/${repo} type:pr state:open author:${prAuthor}`;
176+ const response = await github.rest.search.issuesAndPullRequests({
177+ 'q': query,
178+ 'per_page': 100
177179 });
178180
179- // Remove "First-time Contributor" label from any other open PRs by the same author:
181+ const pullRequests = response.data.items;
180182 for ( const pull of pullRequests ) {
181183 if ( pull.user.login === prAuthor ) {
182184 try {
You can’t perform that action at this time.
0 commit comments