-
Notifications
You must be signed in to change notification settings - Fork 3.5k
57 lines (53 loc) · 2.2 KB
/
platform_ingest_docs_project_board.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
name: Add Docs issue to Ingest project
on:
issues:
types:
- labeled
env:
INGEST_PROJECT_ID: 'PVT_kwDOAGc3Zs4AEzn4'
# GitHub labels for each team/area
DOCS_LABEL: 'Team:Docs'
# ID values for the Area property + its options
AREA_FIELD_ID: 'PVTSSF_lADOAGc3Zs4AEzn4zgEgZSo'
INGEST_DOCS_OPTION_ID: 'def2f8e6'
jobs:
add_to_ingest_project:
runs-on: ubuntu-latest
steps:
- uses: octokit/[email protected]
id: add_to_project
if: github.event.label.name == env.DOCS_LABEL
with:
query: |
# Variables have to be snake cased because of https://github.com/octokit/graphql-action/issues/164
mutation AddToIngestProject($project_id: ID!, $content_id: ID!) {
addProjectV2ItemById(input: { projectId: $project_id, contentId: $content_id }) {
item {
id
}
}
}
project_id: ${{ env.INGEST_PROJECT_ID }}
content_id: ${{ github.event.issue.node_id }}
env:
GITHUB_TOKEN: ${{ secrets.PROJECT_TOKEN }}
# `if` conditions can only be assigned as the "step" level, so there's no way to conditionally pass differing
# `areaId` values to our GraphQL mutation. Would be nice if there was support for dictionaries or something in
# GH actions to make this a lot more DRY
- uses: octokit/[email protected]
id: set_data_processing_area
if: github.event.label.name == env.DOCS_LABEL
with:
query: |
mutation updateIngestArea($item_id: ID!, $project_id: ID!, $area_field_id: ID!, $area_id: String) {
updateProjectV2ItemFieldValue(
input: { itemId: $item_id, projectId: $project_id, fieldId: $area_field_id, value: { singleSelectOptionId: $area_id } }) {
clientMutationId
}
}
item_id: ${{ fromJSON(steps.add_to_project.outputs.data).addProjectV2ItemById.item.id }}
project_id: ${{ env.INGEST_PROJECT_ID }}
area_field_id: ${{ env.AREA_FIELD_ID }}
area_id: ${{ env.INGEST_DOCS_OPTION_ID }}
env:
GITHUB_TOKEN: ${{ secrets.PROJECT_TOKEN }}