-
Notifications
You must be signed in to change notification settings - Fork 3.2k
68 lines (64 loc) · 2.42 KB
/
triage_add_to_project.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: 'Triage: add issue/PR to project'
on:
# makes this workflow reusable
workflow_call:
secrets:
ADD_TO_TRIAGE_BOARD_TOKEN:
required: true
TRIAGE_BOARD_TOKEN:
required: true
WORKFLOW_DEPLOY_KEY:
required: true
issues:
types:
- opened
pull_request_target:
types:
- opened
jobs:
add-to-triage-project:
name: Add to triage project
runs-on: ubuntu-latest
permissions:
issues: write
env:
PROJECT_NUMBER: 9
GITHUB_TOKEN: ${{ secrets.ADD_TO_TRIAGE_BOARD_TOKEN }}
steps:
- name: is-collaborator
run: |
gh api graphql -f query='
query($org: String!, $repo: String!, $user: String!) {
repository(owner: $org, name: $repo) {
collaborators(query: $user, first: 1) {
totalCount
}
}
} ' -f org=${{ github.repository_owner }} -f repo=${{ github.event.repository.name }} -f user=${{ github.event.pull_request.user.login || github.event.issue.user.login }} > collaborators.json
echo 'IS_COLLABORATOR='$(jq -r '.data.repository.collaborators.totalCount' collaborators.json) >> $GITHUB_ENV
- uses: actions/[email protected]
# only add issues/prs from outside contributors to the project
if: ${{ env.IS_COLLABORATOR == 0 || github.event.repository.name == 'cypress-support-internal' || github.event.pull_request.user.login == 'github-actions[bot]' || github.event.issue.user.login == 'github-actions[bot]' }}
with:
project-url: https://github.com/orgs/${{github.repository_owner}}/projects/${{env.PROJECT_NUMBER}}
github-token: ${{ secrets.ADD_TO_TRIAGE_BOARD_TOKEN }}
add-contributor-pr-comment:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: 'cypress-io/release-automations'
ref: 'master'
ssh-key: ${{ secrets.WORKFLOW_DEPLOY_KEY }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Run comment_workflow.js Script
uses: actions/github-script@v7
with:
github-token: ${{ secrets.TRIAGE_BOARD_TOKEN }}
script: |
const script = require('./scripts/triage/add_contributing_comment.js')
await script.addContributingComment(github, context);