-
Notifications
You must be signed in to change notification settings - Fork 3
55 lines (48 loc) · 1.67 KB
/
jcapi-powershell-ci.yml
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
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