Skip to content

Commit acfe868

Browse files
authored
chore: exclude collaborator issues/PRs from triage project (#25769)
1 parent 199c4e6 commit acfe868

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

.github/workflows/triage_add_to_project.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,25 @@ jobs:
1212
add-to-triage-project:
1313
name: Add to triage project
1414
runs-on: ubuntu-latest
15+
env:
16+
PROJECT_NUMBER: 9
17+
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_TOKEN }}
1518
steps:
16-
- uses: actions/[email protected]
19+
- name: is-collaborator
20+
run: |
21+
gh api graphql -f query='
22+
query($org: String!, $repo: String!, $user: String!) {
23+
repository(owner: $org, name: $repo) {
24+
collaborators(query: $user, first: 1) {
25+
totalCount
26+
}
27+
}
28+
} ' -f org=${{ github.repository_owner }} -f repo=${{ github.event.repository.name }} -f user=${{ github.actor }} > collaborators.json
29+
30+
echo 'IS_COLLABORATOR='$(jq -r '.data.repository.collaborators.totalCount' collaborators.json) >> $GITHUB_ENV
31+
- uses: actions/[email protected]
32+
# only add issues/prs from outside contributors to the project
33+
if: ${{ env.IS_COLLABORATOR == 0 }}
1734
with:
18-
project-url: https://github.com/orgs/cypress-io/projects/9
35+
project-url: https://github.com/orgs/${{github.repository_owner}}/projects/${{env.PROJECT_NUMBER}}
1936
github-token: ${{ secrets.ADD_TO_PROJECT_TOKEN }}
20-

0 commit comments

Comments
 (0)