-
Notifications
You must be signed in to change notification settings - Fork 9.2k
73 lines (71 loc) · 2.59 KB
/
project-roadmap-label.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
68
69
70
71
72
73
name: "Project: Roadmap"
on:
issues:
types:
- labeled
- milestoned
pull_request:
types:
- labeled
env:
DESTINATION_COLUMN_ID: 'MDEzOlByb2plY3RDb2x1bW4xMTUxMzUyOQ=='
GH_TOKEN: ${{ secrets.ORGSCOPED_GITHUB_TOKEN }}
jobs:
tag-created:
if: ${{ github.event.label.name == 'roadmap' || github.event.issue.milestone.title == 'Roadmap' }}
runs-on: ubuntu-latest
steps:
- name: 'Add Roadmapped or Milestoned Issue to Working Board'
if: github.event_name == 'issues'
run: |
PROJCOLUMNS=$(gh api graphql -f query='
query {
repository(name: "${{ github.event.repository.name }}", owner: "${{ github.repository_owner }}") {
issue(number: ${{ github.event.issue.number }}) {
projectCards {
nodes {
column {
name
id
}
}
}
}
}
}')
INPROJECT=$(echo $PROJCOLUMNS | jq '.data.repository.issue.projectCards.nodes[].column | select(.id=="${{ env.DESTINATION_COLUMN_ID }}")')
if [ -z "$INPROJECT" ];
then
gh api graphql -f query='mutation {
addProjectCard(input: {projectColumnId: "${{ env.DESTINATION_COLUMN_ID }}", contentId: "${{ github.event.issue.node_id }}"}) {
clientMutationId
}
}'
fi
- name: 'Add Roadmapped Pull Requests to Working Board'
if: github.event_name == 'pull_request'
run: |
PROJCOLUMNS=$(gh api graphql -f query='
query {
repository(name: "${{ github.event.repository.name }}", owner: "${{ github.repository_owner }}") {
pullRequest(number: ${{ github.event.pull_request.number }}) {
projectCards {
nodes {
column {
name
id
}
}
}
}
}
}')
INPROJECT=$(echo $PROJCOLUMNS | jq '.data.repository.pullRequest.projectCards.nodes[].column | select(.id=="${{ env.DESTINATION_COLUMN_ID }}")')
if [ -z "$INPROJECT" ];
then
gh api graphql -f query='mutation {
addProjectCard(input: {projectColumnId: "${{ env.DESTINATION_COLUMN_ID }}", contentId: "${{ github.event.pull_request.node_id }}"}) {
clientMutationId
}
}'
fi