forked from replicatedhq/troubleshoot
-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (167 loc) · 6.55 KB
/
new-issue-board-routing.yaml
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
---
on:
issues:
types: [opened]
name: Issue Comments
jobs:
ie-project:
name: Add issue to the Inbound Escalations project
runs-on: ubuntu-latest
if: "contains(join(github.event.issue.labels.*.name, ' '), 'inbound-escalation')"
steps:
- uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const PROJECT_NAME = "Inbound Escalations";
const COLUMN = "New";
const projects = await github.rest.projects.listForRepo({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
});
// there should always be exactly one
const proj = projects.data.filter(
(p) => p.name.indexOf(PROJECT_NAME) !== -1
)[0];
if (!proj) {
core.setFailed("Could not find a project called " + PROJECT_NAME);
}
core.info("found project " + PROJECT_NAME);
const columns = await github.rest.projects.listColumns({
project_id: proj.id,
});
const column = columns.data.filter(
(c) => c.name.indexOf(COLUMN) !== -1
)[0];
if (!column) {
core.setFailed("Could not find a column called " + COLUMN);
}
core.info("found column " + COLUMN);
await github.rest.projects.createCard({
column_id: column.id,
content_id: context.payload.issue.id,
content_type: "Issue",
})
npi-project:
name: Add issue to the New Production Installs project
runs-on: ubuntu-latest
if: "contains(join(github.event.issue.labels.*.name, ' '), 'kind::customer')"
steps:
- uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const PROJECT_NAME = "New Production Installs";
const COLUMN = "Not Ready";
const projects = await github.rest.projects.listForRepo({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
});
// there should always be exactly one
const proj = projects.data.filter(
(p) => p.name.indexOf(PROJECT_NAME) !== -1
)[0];
if (!proj) {
core.setFailed("Could not find a project called " + PROJECT_NAME);
}
core.info("found project " + PROJECT_NAME);
const columns = await github.rest.projects.listColumns({
project_id: proj.id,
});
const column = columns.data.filter(
(c) => c.name.indexOf(COLUMN) !== -1
)[0];
if (!column) {
core.setFailed("Could not find a column called " + COLUMN);
}
core.info("found column " + COLUMN);
await github.rest.projects.createCard({
column_id: column.id,
content_id: context.payload.issue.id,
content_type: "Issue",
})
enhancements-project:
name: Add issue to the Enhancements project
runs-on: ubuntu-latest
if: >
(
contains(join(github.event.issue.labels.*.name, ' '), 'kind::bug')
|| contains(join(github.event.issue.labels.*.name, ' '), 'kind::feature-request')
)
steps:
- uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const PROJECT_NAME = "Enhancements";
const trackedLabel = context.payload.issue.labels.filter(label => label.name === "enhancements::tracked");
const COLUMN = trackedLabel.length ? "Tracked" : "New";
const projects = await github.rest.projects.listForRepo({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
});
// there should always be exactly one
const proj = projects.data.filter(
(p) => p.name.indexOf(PROJECT_NAME) !== -1
)[0];
if (!proj) {
core.setFailed("Could not find a project called " + PROJECT_NAME);
}
core.info("found project " + PROJECT_NAME);
const columns = await github.rest.projects.listColumns({
project_id: proj.id,
});
const column = columns.data.filter(
(c) => c.name.indexOf(COLUMN) !== -1
)[0];
if (!column) {
core.setFailed("Could not find a column called " + COLUMN);
}
core.info("found column " + COLUMN);
await github.rest.projects.createCard({
column_id: column.id,
content_id: context.payload.issue.id,
content_type: "Issue",
})
packaging-project:
name: Add issue to the Packaging project
runs-on: ubuntu-latest
if: >
(
contains(join(github.event.issue.labels.*.name, ' '), 'kind::packaging-step')
)
steps:
- uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const PROJECT_NAME = "Packaging Steps";
const trackedLabel = context.payload.issue.labels.filter(label => label.name === "packaging::started");
const COLUMN = trackedLabel.length ? "In Progress" : "To Do";
const projects = await github.rest.projects.listForRepo({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
});
// there should always be exactly one
const proj = projects.data.filter(
(p) => p.name.indexOf(PROJECT_NAME) !== -1
)[0];
if (!proj) {
core.setFailed("Could not find a project called " + PROJECT_NAME);
}
core.info("found project " + PROJECT_NAME);
const columns = await github.rest.projects.listColumns({
project_id: proj.id,
});
const column = columns.data.filter(
(c) => c.name.indexOf(COLUMN) !== -1
)[0];
if (!column) {
core.setFailed("Could not find a column called " + COLUMN);
}
core.info("found column " + COLUMN);
await github.rest.projects.createCard({
column_id: column.id,
content_id: context.payload.issue.id,
content_type: "Issue",
})