-
Notifications
You must be signed in to change notification settings - Fork 3
789 lines (679 loc) · 34.7 KB
/
on-csc-completion-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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
name: On CSC Completion Submitted
on:
issues:
types:
- opened
workflow_dispatch:
inputs:
issue-number:
description: "Issue number"
required: true
error-code:
description: "Error code. It should be between 0 and 4"
required: false
default: ""
permissions:
contents: read
id-token: write
issues: write
pull-requests: write
jobs:
verification:
name: "Verifying CSC completion"
runs-on: ubuntu-latest
steps:
- name: Check event payload
shell: pwsh
run: |
$eventPayload = '${{ toJson(github) }}'
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- 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.CSC_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 "challengeCode=$($result.challengeCode)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "isValidChallengeCode=$($result.isValidChallengeCode)" | 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 "githubProfile=$($result.githubProfile)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "isValidGitHubProfile=$($result.isValidGitHubProfile)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "microsoftLearnProfile=$($result.microsoftLearnProfile)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "isValidMicrosoftLearnProfile=$($result.isValidMicrosoftLearnProfile)" | 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
# - name: Debug issue details
# shell: bash
# run: |
# echo "Issue number: ${{ steps.issue.outputs.issueNumber }}"
# echo "Issue type: ${{ steps.issue.outputs.issueType }}"
# echo "Challenge code: ${{ steps.issue.outputs.challengeCode }}"
# echo "Is valid challenge code: ${{ steps.issue.outputs.isValidChallengeCode }}"
# echo "GitHub ID: ${{ steps.issue.outputs.githubID }}"
# echo "GitHub profile: ${{ steps.issue.outputs.githubProfile }}"
# echo "Is valid GitHub profile: ${{ steps.issue.outputs.isValidGitHubProfile }}"
# echo "Microsoft Learn profile: ${{ steps.issue.outputs.microsoftLearnProfile }}"
# echo "Is valid Microsoft Learn profile: ${{ steps.issue.outputs.isValidMicrosoftLearnProfile }}"
# echo "Date submitted: ${{ steps.issue.outputs.dateSubmitted }}"
# echo "Date due: ${{ steps.issue.outputs.dateDue }}"
# echo "Is overdue: ${{ steps.issue.outputs.isOverdue }}"
- name: Add a label - Overdue
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'true'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue edit ${{ steps.issue.outputs.issueNumber }} \
--add-label "overdue" \
-R ${{ github.event.repository.full_name }}
- name: Comment to issue - Overdue
if: |
steps.issue.outputs.issueType == 'CSC' &&
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 }}**을 넘겼습니다. 😭
따라서, 이번 "기초교육 - 클라우드 스킬 챌린지" 완주에 반영할 수 없습니다.
이번 2024 해커그라운드 해커톤 본선 행사에는 참여하실 수 없지만, 다음 해커그라운드 해커톤에서는 꼭 완주하셔서 본선에서 만나요! 🚀
그동안 클라우드 스킬 챌린지 이벤트에 참여해 주셔서 감사합니다.
🔹 해커그라운드 운영진 일동 🔹
- name: Close issue - Overdue
if: |
steps.issue.outputs.issueType == 'CSC' &&
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 - Invalid challenge code
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'false'
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 - Invalid challenge code
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'false'
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.challengeCode }}`
* 예상 챌린지 코드: `AZ-900`, `AI-900`
챌린지 코드는 위에 언급한 두 가지 중 하나여야 합니다.
이 이슈는 자동으로 닫힐 예정이니, **새롭게 이슈를 생성**해 주세요.
🔹 해커그라운드 운영진 일동 🔹
- name: Close issue - Invalid challenge code
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'false'
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 - Invalid GitHub profile
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.issue.outputs.isValidGitHubProfile == 'false'
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 - Invalid GitHub profile
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.issue.outputs.isValidGitHubProfile == 'false'
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 }} 님!
안타깝게도 제출하신 **GitHub Profile 주소**를 확인할 수 없습니다. 😱
* 제출 GitHub Profile: `${{ steps.issue.outputs.githubProfile }}`
다시 한 번 GitHub Profile 주소를 확인해주세요.
이 이슈는 자동으로 닫힐 예정이니, **새롭게 이슈를 생성**해 주세요.
🔹 해커그라운드 운영진 일동 🔹
- name: Close issue - Invalid GitHub profile
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.issue.outputs.isValidGitHubProfile == 'false'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue close ${{ steps.issue.outputs.issueNumber }} \
-c "GitHub Profile 주소를 확인할 수 없습니다. 이슈를 닫습니다." \
-R ${{ github.event.repository.full_name }}
- name: Add a label - Invalid Microsoft Learn profile
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.issue.outputs.isValidMicrosoftLearnProfile == 'false'
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 - Invalid Microsoft Learn profile
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.issue.outputs.isValidMicrosoftLearnProfile == 'false'
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 }} 님!
안타깝게도 제출하신 **Microsoft Learn Profile 주소**를 확인할 수 없습니다. 😱
* 제출 Microsoft Learn Profile: `${{ steps.issue.outputs.microsoftLearnProfile }}`
다시 한 번 Microsoft Learn Profile 주소를 확인해주세요.
이 이슈는 자동으로 닫힐 예정이니, **새롭게 이슈를 생성**해 주세요.
🔹 해커그라운드 운영진 일동 🔹
- name: Close issue - Invalid Microsoft Learn profile
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.issue.outputs.isValidMicrosoftLearnProfile == 'false'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue close ${{ steps.issue.outputs.issueNumber }} \
-c "Microsoft Learn Profile 주소를 확인할 수 없습니다. 이슈를 닫습니다." \
-R ${{ github.event.repository.full_name }}
- name: Call Power Automate workflow to verify GitHub ID and MS Learn Profile ID from the registration details
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.issue.outputs.isValidGitHubProfile == 'true' &&
steps.issue.outputs.isValidMicrosoftLearnProfile == 'true'
id: registration-verification
uses: fjogeleit/http-request-action@v1
with:
url: ${{ secrets.PAU_ON_REGISTRATION_VERIFICATION_REQUESTED_URL }}
method: "POST"
data: '{ "issueType": "${{ steps.issue.outputs.issueType }}", "githubProfile": "${{ steps.issue.outputs.githubProfile }}", "microsoftLearnProfile": "${{ steps.issue.outputs.microsoftLearnProfile }}" }'
- name: Check registration details
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.issue.outputs.isValidGitHubProfile == 'true' &&
steps.issue.outputs.isValidMicrosoftLearnProfile == 'true'
id: registration-verification-result
shell: pwsh
run: |
$result = '${{ steps.registration-verification.outputs.response }}' | ConvertFrom-Json
echo "isValidRegistration=$($result.isValidRegistration)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
- name: Add a label - Invalid registration details
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'false'
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 - Invalid registration details
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'false'
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 }} 님!
안타깝게도 제출하신 정보로 신청한 참가자를 찾을 수 없습니다. 😱
* 제출 GitHub Profile: `${{ steps.issue.outputs.githubProfile }}`
* 제출 Microsoft Learn Profile: `${{ steps.issue.outputs.microsoftLearnProfile }}`
해커톤 등록 정보를 확인하신 후, **새롭게 이슈를 생성**해 주세요.
다시 이슈를 생성했는데도 같은 문제가 발생한다면, 참가 등록 절차부터 다시 시작해 주세요.
참가 등록 👉 [https://hgrd.kr/hackathon-register](https://hgrd.kr/hackathon-register)
이후, 이 이슈는 자동으로 닫힐 예정입니다.
🔹 해커그라운드 운영진 일동 🔹
- name: Close issue - Invalid registration details
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'false'
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 == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue edit ${{ steps.issue.outputs.issueNumber }} \
--add-label "csc,${{ steps.issue.outputs.challengeCode }},verifying" \
-R ${{ github.event.repository.full_name }}
- name: Comment to issue - Acknowledge
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true'
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.issue.outputs.ChallengeCode }} 챌린지 완료 이슈를 생성해 주셔서 감사합니다! 🎉
생성해주신 이슈는 현재 확인 중이며, 완주 여부를 확인한 후 다시 알려드리겠습니다.
참가자님의 해커톤 완주를 응원해요! 💪🏼
🔹 해커그라운드 운영진 일동 🔹
- name: Check trophies
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true'
id: check-trophies
shell: pwsh
run: |
$errorCode = "${{ github.event.inputs.error-code }}"
$forceError = if ($errorCode -eq '') { $false } else { $true }
pushd ./check-csc-trophies
dotnet restore && dotnet build
$playwright = Get-ChildItem -File Microsoft.Playwright.dll -Path . -Recurse
$installer = "$($playwright[0].Directory.FullName)/playwright.ps1"
& "$installer" install
if ($forceError -eq $true) {
$result = dotnet run `
--project ./src/HackersGround.Csc.Trophies.ConsoleApp `
-- `
-c ${{ steps.issue.outputs.challengeCode }} `
-u ${{ steps.issue.outputs.microsoftLearnProfile }} `
--force-error `
--error-code $errorCode | ConvertFrom-Json
} else {
$result = dotnet run `
--project ./src/HackersGround.Csc.Trophies.ConsoleApp `
-- `
-c ${{ steps.issue.outputs.challengeCode }} `
-u ${{ steps.issue.outputs.microsoftLearnProfile }} | ConvertFrom-Json
}
echo "challengeCode=$($result.challengeCode)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "challengeStatus=$($result.challengeStatus)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
echo "challengeMessage=$($result.message)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
popd
- name: Add label - FAILED
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'FAILED'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue edit ${{ steps.issue.outputs.issueNumber }} \
--add-label "failed" \
-R ${{ github.event.repository.full_name }}
- name: Comment to issue - FAILED
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'FAILED'
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 }} 님!
저희 쪽에서 확인하는 중에 문제가 발생했습니다❗
최대한 빨리 확인한 후 다시 알려드리겠습니다.
🔹 해커그라운드 운영진 일동 🔹
- name: Get random inspector
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'FAILED'
id: inspector
shell: pwsh
run: |
$inspector = ./get-randomassignee/Get-RandomAssignee.ps1 -Assignees "${{ vars.INSPECTORS }}"
echo "githubId=$inspector" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
- name: Assign an inspector
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'FAILED'
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: Add label - INVALID
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'INVALID'
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 - INVALID
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'INVALID'
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 }} 님!
입력하신 값이 올바르지 않습니다. 😭
다시 한 번 확인해 주세요❗
이 이슈는 자동으로 닫힐 예정이니, **새롭게 이슈를 생성**해 주세요.
🔹 해커그라운드 운영진 일동 🔹
- name: Remove label - INVALID
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'INVALID'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue edit ${{ steps.issue.outputs.issueNumber }} \
--remove-label "verifying" \
-R ${{ github.event.repository.full_name }}
- name: Close issue - INVALID
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'INVALID'
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 label - NOT_COMPLETED
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'NOT_COMPLETED'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue edit ${{ steps.issue.outputs.issueNumber }} \
--add-label "incomplete" \
-R ${{ github.event.repository.full_name }}
- name: Comment to issue - NOT_COMPLETED
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'NOT_COMPLETED'
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.challengeCode }}의 아직 끝내지 않은 모듈이 있습니다. 😭
${{ steps.issue.outputs.challengeCode }}의 모든 모듈을 완료 하신 후 이슈를 생성해주세요❗
이 이슈는 자동으로 닫힐 예정이니, **새롭게 이슈를 생성**해 주세요.
🔹 해커그라운드 운영진 일동 🔹
- name: Remove label - NOT_COMPLETED
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'NOT_COMPLETED'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue edit ${{ steps.issue.outputs.issueNumber }} \
--remove-label "verifying" \
-R ${{ github.event.repository.full_name }}
- name: Close issue - NOT_COMPLETED
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'NOT_COMPLETED'
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 label - COMPLETED
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'COMPLETED'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue edit ${{ steps.issue.outputs.issueNumber }} \
--add-label "verified" \
-R ${{ github.event.repository.full_name }}
- name: Comment to issue - COMPLETED
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'COMPLETED'
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.issue.outputs.challengeCode }}의 모든 모듈을 완주하셨습니다!
축하드려요. 🎉🎉🎉
- name: Remove label - COMPLETED
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'COMPLETED'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue edit ${{ steps.issue.outputs.issueNumber }} \
--remove-label "verifying" \
-R ${{ github.event.repository.full_name }}
- name: Comment and close issue - COMPLETED
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'COMPLETED'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue close ${{ steps.issue.outputs.issueNumber }} \
-c "축하드립니다, @${{ steps.issue.outputs.githubID }}님!
${{ steps.issue.outputs.challengeCode }} 과정을 완주하셨습니다!!
${{ steps.issue.outputs.challengeCode }} 과정을 마치고 느꼈던 감정이나 어려웠던 점을 디스코드 채널에 공유해주시면 더욱 좋겠어요.
앞으로도 화이팅하세요!🎉🎉🎉💪💪💪
🔹 해커그라운드 운영진 일동 🔹 " \
-R ${{ github.event.repository.full_name }}
- name: Post message to Discord
if: |
steps.issue.outputs.issueType == 'CSC' &&
steps.issue.outputs.isOverdue == 'false' &&
steps.issue.outputs.isValidChallengeCode == 'true' &&
steps.registration-verification-result.outputs.isValidRegistration == 'true' &&
steps.check-trophies.outputs.challengeStatus == 'COMPLETED'
uses: Ilshidur/action-discord@master
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
with:
args: "GitHub ID @${{ steps.issue.outputs.githubID }}님께서 ${{ steps.issue.outputs.challengeCode }} 과정을 완주하셨습니다."
- name: Set challenge status
if: |
steps.issue.outputs.issueType == 'CSC'
id: challenge-status
shell: pwsh
run: |
$result = if ("${{ steps.issue.outputs.isOverdue }}" -eq "true") {
'OVERDUE'
} elseif ("${{ steps.issue.outputs.isValidChallengeCode }}" -eq "false") {
'INVALID_CHALLENGE_CODE'
} elseif ("${{ steps.issue.outputs.isValidGitHubProfile }}" -eq "false") {
'INVALID_GITHUB_PROFILE'
} elseif ("${{ steps.issue.outputs.isValidMicrosoftLearnProfile }}" -eq "false") {
'INVALID_MICROSOFT_LEARN_PROFILE'
} elseif ("${{ steps.registration-verification-result.outputs.isValidRegistration }}" -eq "false") {
'REGISTRATION_NOT_FOUND'
} elseif ("${{ steps.check-trophies.outputs.challengeStatus }}" -eq "INVALID") {
'INVALID_INPUT'
} elseif ("${{ steps.check-trophies.outputs.challengeStatus }}" -eq "NOT_COMPLETED") {
'NOT_COMPLETED'
} elseif ("${{ steps.check-trophies.outputs.challengeStatus }}" -eq "COMPLETED") {
'COMPLETED'
} else {
'SOMETHING_WENT_WRONG'
}
echo "value=$result" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append
- name: Call Power Automate workflow
if: |
steps.issue.outputs.issueType == 'CSC'
uses: fjogeleit/http-request-action@v1
with:
url: ${{ secrets.PAU_ON_CSC_SUBMITTED_URL }}
method: "POST"
data: '{ "githubId": "${{ steps.issue.outputs.githubID }}", "challengeCode": "${{ steps.issue.outputs.challengeCode }}", "challengeStatus": "${{ steps.challenge-status.outputs.value }}", "dateDue": "${{ steps.issue.outputs.dateDue }}", "dateSubmitted": "${{ steps.issue.outputs.dateSubmitted }}", "githubProfileUrl": "${{ steps.issue.outputs.githubProfile }}", "microsoftLearnProfileUrl": "${{ steps.issue.outputs.microsoftLearnProfile }}" }'