-
Notifications
You must be signed in to change notification settings - Fork 1
151 lines (138 loc) · 5.12 KB
/
close-issue.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
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
name: 이슈 닫기 연결 자동화
on:
issues:
types:
- closed
jobs:
close-jira-issue:
permissions: write-all
name: Jira 이슈 닫기
runs-on: ubuntu-latest
steps:
- name: 원채 Jira 로그인
uses: atlassian/gajira-login@v3
if: github.actor == 'ywonchae1'
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_WONCHAE_API_TOKEN }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_WONCHAE_USER_EMAIL }}
- name: 유진 Jira 로그인
uses: atlassian/gajira-login@v3
if: github.actor == 'sseoU'
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_YOUJIN_API_TOKEN }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_YOUJIN_USER_EMAIL }}
- name: 민석 Jira 로그인
uses: atlassian/gajira-login@v3
if: github.actor == 'seok019283501'
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_MINSEOK_API_TOKEN }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_MINSEOK_USER_EMAIL }}
- name: 경재 Jira 로그인
uses: atlassian/gajira-login@v3
if: github.actor == 'bestKUFO'
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_KYONGJAE_API_TOKEN }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_KYONGJAE_USER_EMAIL }}
- name: 지인 Jira 로그인
uses: atlassian/gajira-login@v3
if: github.actor == 'OziinG'
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_JIIN_API_TOKEN }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_JIIN_USER_EMAIL }}
- name: Jira 이슈 키 찾기
id: issue-key
uses: atlassian/gajira-find-issue-key@master
with:
string: ${{ github.event.issue.title }}
- name: Jira 이슈 완료로 이동
uses: atlassian/gajira-transition@v3
with:
issue: ${{ steps.issue-key.outputs.issue }}
transitionId: 31
close-project-issue:
permissions: write-all
name: 이슈 닫기 - 프로젝트 연결 자동화
runs-on: ubuntu-latest
steps:
- name: 프로젝트에서 이슈 선택
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
ORGANIZATION: IoTeaTime
PROJECT_NUMBER: 4
run: |
gh api graphql -f query='
query($org: String!, $number: Int!) {
organization(login: $org){
projectV2(number: $number) {
id
fields(first:20) {
nodes {
... on ProjectV2Field {
id
name
}
}
}
}
}
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
echo 'PROJECT_ID='$(jq '.data.organization.projectV2.id' project_data.json) >> $GITHUB_ENV
echo 'END_DATE_FIELD_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "End date") | .id' project_data.json) >> $GITHUB_ENV
- name: 오늘 날짜 가져오기
run: echo "DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
- name: 이슈 번호로 프로젝트 아이템 가져오기
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
ORGANIZATION: IoTeaTime
REPO_NAME: meong-ha-nyang-server
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: |
gh api graphql -f query='
query(
$org: String!,
$repoName: String!,
$issueNumber: Int!
) {
organization(login: $org) {
repository(name: $repoName) {
issue(number: $issueNumber) {
id
projectItems(last: 1) {
nodes {
id
}
}
}
}
}
}' -f org=$ORGANIZATION -f repoName=$REPO_NAME -F issueNumber=$ISSUE_NUMBER > project_data.json
echo 'ITEM_ID='$(jq '.data.organization.repository.issue.projectItems.nodes[0].id' project_data.json) >> $GITHUB_ENV
- name: 단일 선택 필드 업데이트
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
run: |
gh api graphql -f query='
mutation (
$project: ID!
$item: ID!
$end_date_field: ID!
$end_date_value: Date!
) {
set_end_date: updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $end_date_field
value: {
date: $end_date_value
}
}) {
projectV2Item {
id
}
}
}' -f project=$PROJECT_ID -f item=$ITEM_ID -f end_date_field=$END_DATE_FIELD_ID -f end_date_value=$DATE --silent