-
Notifications
You must be signed in to change notification settings - Fork 5
191 lines (167 loc) · 7.81 KB
/
on-hackathon-r5-verified.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: On Hackathon Team Pitch Verified
on:
issue_comment:
types:
- created
workflow_dispatch:
inputs:
issue-number:
description: 'Issue number'
required: true
default: ''
inspected:
description: 'Value indicating whether the verification process done by human or not'
required: true
default: 'false'
verified:
description: 'Value indicating whether the verification process is successful or not'
required: true
default: 'false'
onlyissueclose:
description: 'Value indicating whether the issue should be closed or not'
required: true
default: 'true'
permissions:
contents: read
id-token: write
issues: write
pull-requests: write
jobs:
verification-start:
name: 'Completing verification'
runs-on: ubuntu-latest
steps:
- name: Check event payload
shell: pwsh
run: |
$eventPayload = '${{ toJson(github) }}'
- name: Checkout repository
uses: actions/checkout@v4
- name: Get GitHub access token
id: github-connect
shell: pwsh
run: |
$token = ./gha-scripts/Get-GitHubAccessToken.ps1 `
-AccessTokenIDs "${{ vars.ACCESS_TOKEN_IDS }}" `
-ApimBaseUrl "${{ vars.APIM_BASE_URL }}" `
-ApimApiKey "${{ secrets.APIM_SUBSCRIPTION_KEY }}"
echo "::add-mask::$token"
echo "token=$token" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8
- name: Check issue details
id: issue
shell: pwsh
env:
GH_TOKEN: ${{ steps.github-connect.outputs.token }}
run: |
$payload = '${{ toJson(github) }}'
$Issuenumber = "${{ github.event.inputs.issue-number }}"
$result = $(./gha-scripts/Check-IssueDetailsForRoundVerification.ps1 `
-IssueNumber "${{ github.event.inputs.issue-number }}" `
-GitHubPayload $($payload | ConvertFrom-Json)) | ConvertFrom-Json
if ("${{ github.event_name}}" -eq "workflow_dispatch") {
$verified = ("${{ github.event.inputs.verified }}".ToLowerInvariant() -eq "true") ? "true" : "false"
$invalid = ""
} else {
$verified = ("${{ github.event.comment.body }}".StartsWith("/ok")) ? "true" : "false"
$invalid = ("${{ github.event.comment.body }}".StartsWith("/invalid")) ? "true" : ""
$invalid = ("${{ github.event.comment.user.login }}" -eq "${{ github.event.issue.assignee.login }}") ? "" : "true"
}
echo "issueNumber=$($result.issueNumber)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "issueType=$($result.issueType)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "githubID=$($result.githubID)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "assignee=$($result.assignee)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "title=$($result.title)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "teamName=$($result.teamName)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "teamRepository=$($result.teamRepository)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "verified=$verified" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "invalid=$invalid" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
- name: Add a label - NOT Verified
if: |
steps.issue.outputs.issueType == 'PITCH' &&
(steps.issue.outputs.verified == 'false' || steps.issue.outputs.invalid == 'true' || github.event.comment.user.login != github.event.issue.assignee.login)
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue edit ${{ steps.issue.outputs.issueNumber }} \
--add-label "invalid" \
-R ${{ github.event.repository.full_name }}
- name: Comment to issue - NOT Verified
if: |
steps.issue.outputs.issueType == 'PITCH' &&
(steps.issue.outputs.verified == 'false' || steps.issue.outputs.invalid == 'true' || github.event.comment.user.login != github.event.issue.assignee.login ) &&
github.event.inputs.onlyissueclose != 'false'
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ steps.issue.outputs.issueNumber }}
emoji: 'confused,eyes'
body: |
👋🏼 @${{ steps.issue.outputs.githubID }} 님!
팀 발표자료 제출을 확인하는 과정에서 문제가 발생했습니다. 😢
곧바로 사무국을 찾아가서 문제를 해결해주세요. 🙏
- name: Close issue - NOT Verified
if: |
steps.issue.outputs.issueType == 'PITCH' &&
(steps.issue.outputs.verified == 'false' || steps.issue.outputs.invalid == 'true' || github.event.comment.user.login != github.event.issue.assignee.login )
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue close ${{ steps.issue.outputs.issueNumber }} \
-c "이슈를 확인할 수 없습니다. 이슈를 닫습니다." \
-R ${{ github.event.repository.full_name }}
- name: Add a label - Verified
if: |
steps.issue.outputs.issueType == 'PITCH' &&
steps.issue.outputs.verified == 'true' &&
github.event_name != 'workflow_dispatch' &&
github.event.comment.user.login == github.event.issue.assignee.login
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue edit ${{ steps.issue.outputs.issueNumber }} \
--add-label "verified" \
--remove-label "verifying,invalid" \
-R ${{ github.event.repository.full_name }}
- name: Comment to issue - Verified
if: |
steps.issue.outputs.issueType == 'PITCH' &&
steps.issue.outputs.verified == 'true' &&
github.event_name != 'workflow_dispatch' &&
github.event.comment.user.login == github.event.issue.assignee.login
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ steps.issue.outputs.issueNumber }}
emoji: 'hooray'
body: |
👋🏼 @${{ steps.issue.outputs.githubID }} 님!
팀 발표자료 제출 확인이 끝났습니다. 축하드립니다! 🎉
끝까지 마무리 잘 해 주세요! 💪 끝날 때 까지 끝난 게 아닙니다.
곧 최종 심사를 진행하겠습니다! 🚀
- name: Close issue - Verified
if: |
steps.issue.outputs.issueType == 'PITCH' &&
steps.issue.outputs.verified == 'true' &&
github.event_name != 'workflow_dispatch' &&
github.event.comment.user.login == github.event.issue.assignee.login
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue close ${{ steps.issue.outputs.issueNumber }} \
-c "팀 발표자료 제출을 확인했습니다. 이슈를 닫습니다." \
-R ${{ github.event.repository.full_name }}
- name: Call Power Automate workflow
if: |
steps.issue.outputs.issueType == 'PITCH'
id: request
uses: fjogeleit/http-request-action@v1
with:
url: ${{ secrets.PAU_ON_ROUND_5_VERIFIED_URL }}
method: 'POST'
data: '{ "issueNumber": ${{ steps.issue.outputs.issueNumber }}, "githubId": "${{ steps.issue.outputs.githubID }}", "teamName": "${{ steps.issue.outputs.teamName }}", "repositoryName": "${{ steps.issue.outputs.teamRepository }}", "verified": "${{ steps.issue.outputs.verified }}", "invalid": "${{ steps.issue.outputs.invalid }}", "onlyissueclose": "${{ github.event.inputs.onlyissueclose }}" }'