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:
160
160
}
161
161
}
162
162
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'
165
165
if : ${{ github.event.action == 'closed' && github.event.pull_request.merged == true }}
166
166
# Pin action to full length commit SHA
167
167
uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
168
168
with :
169
169
github-token : ${{ secrets.CHATBOT_GITHUB_TOKEN }}
170
170
script : |
171
171
const prAuthor = context.payload.pull_request.user.login;
172
+ const { owner, repo } = context.repo;
172
173
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
177
179
});
178
180
179
- // Remove "First-time Contributor" label from any other open PRs by the same author:
181
+ const pullRequests = response.data.items;
180
182
for ( const pull of pullRequests ) {
181
183
if ( pull.user.login === prAuthor ) {
182
184
try {
You can’t perform that action at this time.
0 commit comments