-
Notifications
You must be signed in to change notification settings - Fork 3
200 lines (170 loc) · 8.45 KB
/
on-hackathon-r2-submitted.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
192
193
194
195
196
197
198
199
200
name: 'On Hackathon Team Topic Submitted'
on:
issues:
types:
- opened
workflow_dispatch:
inputs:
issue-number:
description: 'Issue number'
required: true
permissions:
contents: read
id-token: write
issues: write
pull-requests: write
jobs:
verification-start:
name: 'Starting 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-IssueDetails.ps1 `
-IssueNumber "${{ github.event.inputs.issue-number }}" `
-DueDate "${{ vars.HACKATHON_R2_DUE_DATE }}" `
-GitHubPayload $($payload | ConvertFrom-Json)) | ConvertFrom-Json
$tz = [TimeZoneInfo]::FindSystemTimeZoneById("Asia/Seoul")
$dateSubmitted = [DateTimeOffset]::Parse($result.dateSubmitted).ToOffset($tz.GetUtcOffset($result.createdAt)).ToString("yyyy-MM-ddTHH:mm:ss.fffzzz")
$dateDue = [DateTimeOffset]::Parse($result.dateDue).ToOffset($tz.GetUtcOffset($result.createdAt)).ToString("yyyy-MM-ddTHH:mm:ss.fffzzz")
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 "dateSubmitted=$dateSubmitted" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "dateDue=$dateDue" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "isOverdue=$($result.isOverdue)" | 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 "isValidTeamRepository=$($result.isValidTeamRepository)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "assignee=$($result.assignee)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
- name: Debug issue details
shell: bash
run: |
echo "Issue number: ${{ steps.issue.outputs.issueNumber }}"
echo "Issue type: ${{ steps.issue.outputs.issueType }}"
echo "GitHub ID: ${{ steps.issue.outputs.githubID }}"
echo "Date submitted: ${{ steps.issue.outputs.dateSubmitted }}"
echo "Date due: ${{ steps.issue.outputs.dateDue }}"
echo "Is overdue: ${{ steps.issue.outputs.isOverdue }}"
echo "Team name: ${{ steps.issue.outputs.teamName }}"
echo "Team repository: ${{ steps.issue.outputs.teamRepository }}"
echo "Assignee: ${{ steps.issue.outputs.assignee }}"
- name: Add a label - Overdue
if: |
steps.issue.outputs.issueType == 'TOPIC' &&
steps.issue.outputs.isOverdue == 'true'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue edit ${{ steps.issue.outputs.issueNumber }} \
--add-label "round-2,hackathon,team-topic,overdue" \
-R ${{ github.event.repository.full_name }}
- name: Comment to issue - Overdue
if: |
steps.issue.outputs.issueType == 'TOPIC' &&
steps.issue.outputs.isOverdue == 'true'
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ steps.issue.outputs.issueNumber }}
body: |
👋🏼 @${{ steps.issue.outputs.githubID }} 님!
* 이슈 제출 시각: ${{ steps.issue.outputs.dateSubmitted }}
* 이슈 마감 시각: ${{ steps.issue.outputs.dateDue }}
안타깝게도 제출하신 이슈는 마감 기한인 ${{ steps.issue.outputs.dateDue }}을 넘기셨습니다. 😭 따라서, 향후 심사시 감점 요소로 작용하게 됩니다.
하지만, 그렇다고 해서 해커톤이 끝난 건 아니잖아요? 다음 라운드가 더 중요합니다! 💪
부지런히 코딩하고, 팀원들과 소통하며, 더 좋은 결과물을 만들어봅시다. 🚀 그리고 필요하면 기술 멘토님과 비기술 멘토님들께 도움을 요청하세요. 🙏
- name: Close issue - Overdue
if: |
steps.issue.outputs.issueType == 'TOPIC' &&
steps.issue.outputs.isOverdue == 'true'
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 - Acknowledge
if: |
steps.issue.outputs.issueType == 'TOPIC' &&
steps.issue.outputs.isOverdue == 'false'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue edit ${{ steps.issue.outputs.issueNumber }} \
--add-label "round-2,hackathon,team-topic,submitted,verifying" \
-R ${{ github.event.repository.full_name }}
- name: Get random inspector
if: |
steps.issue.outputs.issueType == 'TOPIC' &&
steps.issue.outputs.isOverdue == 'false'
id: inspector
shell: pwsh
run: |
$inspector = if ("${{ steps.issue.outputs.assignee }}" -eq "") {
./get-randomassignee/Get-RandomAssignee.ps1 -Assignees "${{ vars.INSPECTORS }}"
} else {
"${{ steps.issue.outputs.assignee }}"
}
echo "githubID=$inspector" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
- name: Assign an inspector
if: |
steps.issue.outputs.issueType == 'TOPIC' &&
steps.issue.outputs.isOverdue == 'false'
uses: actions-cool/issues-helper@v3
with:
actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ steps.issue.outputs.issueNumber }}
assignees: ${{ steps.inspector.outputs.githubID }}
- name: Comment to issue - Acknowledge
if: |
steps.issue.outputs.issueType == 'TOPIC' &&
steps.issue.outputs.isOverdue == 'false'
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ steps.issue.outputs.issueNumber }}
emoji: '+1,rocket'
body: |
👋🏼 @${{ steps.issue.outputs.githubID }} 님!
해커톤 주제를 제출해 주셔서 감사합니다.
@${{ steps.inspector.outputs.githubID }} 님께서 최대한 빠르게 확인해 드리겠습니다! 😊
이제 바로 애플리케이션 개발을 시작해 주세요. 더 중요한 다음 라운드가 다가오고 있습니다! 💪
부지런히 코딩하고, 팀원들과 소통하며, 더 좋은 결과물을 만들어봅시다. 🚀 그리고 필요하면 기술 멘토님과 비기술 멘토님들께 도움을 요청하세요. 🙏
- name: Call Power Automate workflow
if: |
steps.issue.outputs.issueType == 'TOPIC'
id: request
uses: fjogeleit/http-request-action@v1
with:
url: ${{ secrets.PAU_ON_ROUND_2_SUBMITTED_URL }}
method: 'POST'
data: '{ "issueNumber": ${{ steps.issue.outputs.issueNumber }}, "githubId": "${{ steps.issue.outputs.githubID }}", "teamName": "${{ steps.issue.outputs.teamName }}", "repositoryName": "${{ steps.issue.outputs.teamRepository }}", "dateSubmitted": "${{ steps.issue.outputs.dateSubmitted }}", "dateDue": "${{ steps.issue.outputs.dateDue }}", "isOverdue": ${{ steps.issue.outputs.isOverdue }} }'