Skip to content

Sa 3610 gha workflow migrations ken #56

Sa 3610 gha workflow migrations ken

Sa 3610 gha workflow migrations ken #56

name: PowerShell SDK CI
on:
pull_request:
branches:
- "master"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
Check-PR-Labels:
runs-on: ubuntu-latest
outputs:
RELEASE_TYPE: ${{ steps.validate.outputs.RELEASE_TYPE }}
steps:
- name: Validate-PR-Version-Labels
id: validate
shell: pwsh
run: |
$PR_LABEL_LIST=$(curl -s "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels" | jq -r '.[].name')
# validate type from label list:
$types = @('major', 'minor', 'patch', 'manual')
$typeCount = 0
foreach ($item in $PR_LABEL_LIST) {
if ($item -in $types) {
write-host "$item"
$typeCount += 1
$RELEASE_TYPE = $item
}
}
if ($typeCount -eq 1) {
echo "RELEASE_TYPE=$RELEASE_TYPE" >> $env:GITHUB_OUTPUT
} else {
throw "Multiple or invalid release types were found on PR"
exit 1
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Validate-SDK-Version:
needs: Check-PR-Labels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate SDK Versions
id: validate
shell: pwsh
run: |
Install-Module -Name Pester
Invoke-Pester -Path /home/runner/work/jcapi-powershell/jcapi-powershell/Tools/ModuleValidation.Tests.ps1