-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (49 loc) · 1.71 KB
/
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
# This workflow assigns the "Tech Team" GitHub's project to all the issues (re)opened in this
# repository. Initially taken from:
# https://docs.github.com/en/issues/trying-out-the-new-projects-experience/automating-projects
name: Project assignment
on:
issues:
types:
- opened
- reopened
jobs:
project:
name: Project assignment
runs-on: ubuntu-latest
steps:
- name: Get Tech Team project
env:
GITHUB_TOKEN: ${{ secrets.DOKTEUR_ACCESS_TOKEN }}
ORGANIZATION: arkhn
PROJECT_NUMBER: 18
run: |
gh api graphql -f query='
query($org: String!, $number: Int!) {
organization(login: $org){
projectNext(number: $number) {
id
fields(first:20) {
nodes {
id
name
settings
}
}
}
}
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > tech_team_project.json
echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' tech_team_project.json) >> $GITHUB_ENV
- name: Add to project
env:
GITHUB_TOKEN: ${{ secrets.DOKTEUR_ACCESS_TOKEN }}
CONTENT_ID: ${{ github.event.issue.node_id }}
run: |
item_id="$( gh api graphql -f query='
mutation($project:ID!, $content:ID!) {
addProjectNextItem(input: {projectId: $project, contentId: $content}) {
projectNextItem {
id
}
}
}' -f project=$PROJECT_ID -f content=$CONTENT_ID --jq '.data.addProjectNextItem.projectNextItem.id')"