Skip to content

Commit

Permalink
Update GHA workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
justinyoo committed Jun 22, 2024
1 parent 8a521f2 commit 5d63353
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/on-csc-completion-submitted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ jobs:
$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)
# $result = ./gha-scripts/Check-IssueDetails.ps1 `
# -IssueNumber "${{ github.event.inputs.issue-number }}" `
# -DueDate "${{ vars.CSC_DUE_DATE }}" `
# -GitHubPayload $($payload | ConvertFrom-Json)
Write-Host "Result:"
$result
# Write-Host "Result:"
# $result
$result = $(./gha-scripts/Check-IssueDetails.ps1 `
-IssueNumber "${{ github.event.inputs.issue-number }}" `
Expand Down
29 changes: 16 additions & 13 deletions gha-scripts/Check-IssueDetails.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,25 @@ if ($eventName -eq "workflow_dispatch") {

$sections = $body.Split("###", [System.StringSplitOptions]::RemoveEmptyEntries)

Write-Host "Sections:"
$sections[1]


$segments = $sections[0].Split("`n", [System.StringSplitOptions]::RemoveEmptyEntries)

$issue = @{}
$issue.Add("title", $segments[1].Trim())

Write-Host "Issue title: $($issue.title) ||| $($issue.title -eq "클라우드 스킬 챌린지")"
$issue.title = if ($issue.title -eq "클라우드 스킬 챌린지") {
"Cloud Skills Challenge"
} elseif ($issue.title -eq "팀 주제 제출") {
"Team Topic"
} elseif ($issue.title -eq "팀 앱 제출") {
"Team App"
} elseif ($issue.title -eq "팀 발표자료 제출") {
"Team Pitch"
} else {
$issue.title
}

$sections | ForEach-Object {
$segments = $_.Split("`n", [System.StringSplitOptions]::RemoveEmptyEntries)
if ($issue.title -eq "클라우드 스킬 챌린지") {
if ($issue.title -eq "Cloud Skills Challenge") {
switch ($segments[0].Trim()) {
"챌린지 코드" {
$issue.Add("challengeCode", $segments[1].Trim())
Expand Down Expand Up @@ -129,10 +134,10 @@ Write-Host " GitHub profile: $($issue.githubProfile)"
Write-Host " Microsoft Learn profile: $($issue.microsoftLearnProfile)"

$issueType = switch ($issue.title) {
"클라우드 스킬 챌린지" { "CSC" }
"팀 주제 제출" { "TOPIC" }
"팀 앱 제출" { "APP" }
"팀 발표자료 제출" { "PITCH" }
"Cloud Skills Challenge" { "CSC" }
"Team Topic" { "TOPIC" }
"Team App" { "APP" }
"Team Pitch" { "PITCH" }
default { $null }
}

Expand Down Expand Up @@ -171,8 +176,6 @@ $result = @{
isOverdue = $isOverdue;
}

Write-Output $($($($result | ConvertTo-Json -Depth 100) -replace "\uFEFF", "") -replace "\u3164", "")

Remove-Variable result
Remove-Variable isValidMicrosoftLearnProfile
Remove-Variable isValidGitHubProfile
Expand Down

0 comments on commit 5d63353

Please sign in to comment.