Skip to content

Commit 78e5065

Browse files
authored
[Automation] Add GH action to add issues to ingest board
Issues in this repo labeled with `Team:Fleet` will be added to the ingest board automatically w/ the `Fleet Server` area.
1 parent 34ea7dc commit 78e5065

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Add issue to Platform Ingest project
2+
3+
on:
4+
issues:
5+
types:
6+
- labeled
7+
8+
env:
9+
INGEST_PROJECT_ID: 'PVT_kwDOAGc3Zs4AEzn4'
10+
FLEET_LABEL: 'Team:Fleet'
11+
AREA_FIELD_ID: 'PVTSSF_lADOAGc3Zs4AEzn4zgEgZSo'
12+
FLEET_SERVER_OPTION_ID: 'ea828bb4'
13+
14+
jobs:
15+
add_to_ingest_project:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: octokit/graphql-action@v2.x
19+
id: add_to_project
20+
if: ${{ github.event.label.name == env.FLEET_LABEL }}
21+
with:
22+
query: |
23+
# Variables have to be snake cased because of https://github.com/octokit/graphql-action/issues/164
24+
mutation AddToIngestProject($project_id: ID!, $content_id: ID!) {
25+
addProjectV2ItemById(input: { projectId: $project_id, contentId: $content_id }) {
26+
item {
27+
id
28+
}
29+
}
30+
}
31+
project_id: ${{ env.INGEST_PROJECT_ID }}
32+
content_id: ${{ github.event.issue.node_id }}
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.FLEET_TECH_KIBANA_USER_TOKEN }}
35+
- uses: octokit/graphql-action@v2.x
36+
id: set_fleet_server_area
37+
if: github.event.label.name == env.FLEET_LABEL
38+
with:
39+
query: |
40+
mutation updateIngestArea($item_id: ID!, $project_id: ID!, $area_field_id: ID!, $area_id: String) {
41+
updateProjectV2ItemFieldValue(
42+
input: { itemId: $item_id, projectId: $project_id, fieldId: $area_field_id, value: { singleSelectOptionId: $area_id } }) {
43+
clientMutationId
44+
}
45+
}
46+
item_id: ${{ fromJSON(steps.add_to_project.outputs.data).addProjectV2ItemById.item.id }}
47+
project_id: ${{ env.INGEST_PROJECT_ID }}
48+
area_field_id: ${{ env.AREA_FIELD_ID }}
49+
area_id: ${{ env.FLEET_SERVER_OPTION_ID }}
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.PROJECT_ASSIGNER_TOKEN }}

0 commit comments

Comments
 (0)