[퀵찬] 해커톤 앱 제출 #532
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: On Workshop 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 8" | |
required: false | |
default: "" | |
permissions: | |
contents: read | |
id-token: write | |
issues: write | |
pull-requests: write | |
jobs: | |
verification: | |
name: "Verifying Workshop 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 }}" | |
$tz = [TimeZoneInfo]::FindSystemTimeZoneById("Asia/Seoul") | |
$today = [DateTimeOffset]::New([TimeZoneInfo]::ConvertTimeBySystemTimeZoneId((Get-Date).ToUniversalTime(), "Asia/Seoul")) | |
$workshop = [DateTimeOffset]::Parse("${{ vars.WORKSHOP_DUE_DATE }}").ToOffset($tz.GetUtcOffset($today)) | |
$result = $(./gha-scripts/Check-IssueDetails.ps1 ` | |
-IssueNumber "${{ github.event.inputs.issue-number }}" ` | |
-DueDate "${{ vars.WORKSHOP_DUE_DATE }}" ` | |
-GitHubPayload $($payload | ConvertFrom-Json)) | ConvertFrom-Json | |
$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") | |
$challengeCode = 'WORKSHOP' | |
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=$challengeCode" | 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 "githubRepository=$($result.githubRepository)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append | |
echo "isValidGitHubRepository=$($result.isValidGitHubRepository)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append | |
echo "frontendUrl=$($result.frontendUrl)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append | |
echo "isValidFrontendUrl=$($result.isValidFrontendUrl)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append | |
echo "backendUrl=$($result.backendUrl)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append | |
echo "isValidBackendUrl=$($result.isValidBackendUrl)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append | |
echo "dashboardUrl=$($result.dashboardUrl)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8 -Append | |
echo "isValidDashboardUrl=$($result.isValidDashboardUrl)" | 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 "GitHub ID: ${{ steps.issue.outputs.githubID }}" | |
# echo "GitHub profile: ${{ steps.issue.outputs.githubProfile }}" | |
# echo "Is valid GitHub profile: ${{ steps.issue.outputs.isValidGitHubProfile }}" | |
# echo "GitHub repository: ${{ steps.issue.outputs.githubRepository }}" | |
# echo "Is valid GitHub repository: ${{ steps.issue.outputs.isValidGitHubRepository }}" | |
# echo "Frontend app URL: ${{ steps.issue.outputs.frontendUrl }}" | |
# echo "Is valid frontend app URL: ${{ steps.issue.outputs.isValidFrontendUrl }}" | |
# echo "Backend app URL: ${{ steps.issue.outputs.backendUrl }}" | |
# echo "is valid backend app URL: ${{ steps.issue.outputs.isValidBackendUrl }}" | |
# echo "Dashboard app URL: ${{ steps.issue.outputs.dashboardUrl }}" | |
# echo "Is valid dashboard app URL: ${{ steps.issue.outputs.isValidDashboardUrl }}" | |
# 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 == 'WORKSHOP' && | |
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 == 'WORKSHOP' && | |
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 == 'WORKSHOP' && | |
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: Call Power Automate workflow to verify GitHub ID from the registration details | |
if: | | |
steps.issue.outputs.issueType == 'WORKSHOP' && | |
steps.issue.outputs.isOverdue == 'false' | |
id: registration-verification | |
uses: fjogeleit/http-request-action@v1 | |
with: | |
url: ${{ secrets.PAU_ON_REGISTRATION_VERIFICATION_REQUESTED_URL_HOL }} | |
method: "POST" | |
data: '{ "issueType": "${{ steps.issue.outputs.issueType }}", "githubProfile": "${{ steps.issue.outputs.githubProfile }}" }' | |
- name: Check registration details | |
if: | | |
steps.issue.outputs.issueType == 'WORKSHOP' && | |
steps.issue.outputs.isOverdue == 'false' && | |
steps.issue.outputs.isValidGitHubProfile == 'true' && | |
steps.issue.outputs.isValidGitHubRepository == 'true' && | |
steps.issue.outputs.isValidFrontendUrl == 'true' && | |
steps.issue.outputs.isValidBackendUrl == 'true' && | |
steps.issue.outputs.isValidDashboardUrl == '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 == 'WORKSHOP' && | |
steps.issue.outputs.isOverdue == 'false' && | |
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 == 'WORKSHOP' && | |
steps.issue.outputs.isOverdue == 'false' && | |
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 }}` | |
해커톤 등록 정보를 확인하신 후, **새롭게 이슈를 생성**해 주세요. | |
다시 이슈를 생성했는데도 같은 문제가 발생한다면, 디스코드 채널 `#사전워크샵`에 문의해주세요. | |
이후, 이 이슈는 자동으로 닫힐 예정입니다. | |
🔹 해커그라운드 운영진 일동 🔹 | |
- name: Close issue - Invalid registration details | |
if: | | |
steps.issue.outputs.issueType == 'WORKSHOP' && | |
steps.issue.outputs.isOverdue == 'false' && | |
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 == 'WORKSHOP' && | |
steps.issue.outputs.isOverdue == 'false' && | |
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 "workshop,verifying" \ | |
-R ${{ github.event.repository.full_name }} | |
- name: Comment to issue - Acknowledge | |
if: | | |
steps.issue.outputs.issueType == 'WORKSHOP' && | |
steps.issue.outputs.isOverdue == 'false' && | |
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 }} 님! | |
사전 워크샵 과제 완료 이슈를 생성해 주셔서 감사합니다! 🎉 | |
생성해주신 이슈는 현재 확인 중이며, 완주 여부를 확인한 후 다시 알려드리겠습니다. | |
참가자님의 해커톤 완주를 응원해요! 💪🏼 | |
🔹 해커그라운드 운영진 일동 🔹 | |
- name: Get random inspector | |
if: | | |
steps.issue.outputs.issueType == 'WORKSHOP' && | |
steps.issue.outputs.isOverdue == 'false' && | |
steps.registration-verification-result.outputs.isValidRegistration == 'true' | |
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 == 'WORKSHOP' && | |
steps.issue.outputs.isOverdue == 'false' && | |
steps.registration-verification-result.outputs.isValidRegistration == 'true' | |
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 }} |