Bump devops-actions/action-get-tag from 3a492bc59fd26f3c3b63273bee4e01ea6fbd764c to a31b3a26c4409e47d057bd3aa778adb764ba3065 in /.github/workflows #483
Workflow file for this run
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: Testing the action | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
# Declare default GITHUB_TOKEN permissions as read only. | |
permissions: read-all | |
jobs: | |
run-pester-tests: | |
runs-on: ubuntu-latest | |
name: Run Pester tests | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Execute tests | |
shell: pwsh | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# execute Pester tests | |
# install powershell-yaml as it is not on the runners by default | |
$moduleName = "powershell-yaml" | |
Install-Module -Name $moduleName -Force -Scope CurrentUser -AllowClobber | |
# execute tests | |
$testResults = Invoke-Pester | |
if ($testResults.FailedCount -gt 0) { | |
throw "Tests failed" | |
} | |
else { | |
Write-Host "Tests passed" | |
} | |
load-all-used-actions: | |
runs-on: ubuntu-latest | |
name: Test on current organization | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: ./ | |
name: Load used actions | |
with: | |
PAT: ${{ secrets.GITHUB_TOKEN }} | |
id: load-actions | |
- shell: pwsh | |
name: Check the output file location to contain the expected content | |
run: | | |
# check the output file location to contain the expected content | |
Write-Host "Got actions file location here [${{ steps.load-actions.outputs.actions-file }}]" | |
$content = Get-Content -Path "${{ steps.load-actions.outputs.actions-file }}" | |
$actions = $content | ConvertFrom-Json | |
if ($actions.Length -le 0) { | |
Set-Content -Value "No actions found" -Path $env:GITHUB_STEP_SUMMARY | |
throw "No actions found" | |
} | |
else { | |
Write-Host "Found [$($actions.Length)] actions" | |
Set-Content -Value "Found [$($actions.Length)] actions" -Path $env:GITHUB_STEP_SUMMARY | |
} | |
- name: Upload result file as artefact | |
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 | |
with: | |
name: actions-${{ env.GITHUB_REPOSITORY_OWNER }} | |
path: | | |
actions.json | |
used-actions.json | |
load-all-used-actions-other-org: | |
runs-on: ubuntu-latest | |
name: Test on different organization | |
env: | |
organization: rajbos-actions-demo | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: ./ | |
name: Load used actions | |
with: | |
PAT: ${{ secrets.GITHUB_TOKEN }} | |
organization: ${{ env.organization }} | |
id: load-actions | |
- shell: pwsh | |
name: Check the output file location to contain the expected content | |
run: | | |
# check the output file location to contain the expected content | |
Write-Host "Got actions file location here [${{ steps.load-actions.outputs.actions-file }}]" | |
$content = Get-Content -Path "${{ steps.load-actions.outputs.actions-file }}" | |
$actions = $content | ConvertFrom-Json | |
if ($actions.Length -le 0) { | |
Set-Content -Value "No actions found" -Path $env:GITHUB_STEP_SUMMARY | |
throw "No actions found" | |
} | |
else { | |
Write-Host "Found [$($actions.Length)] actions" | |
Set-Content -Value "Found [$($actions.Length)] actions" -Path $env:GITHUB_STEP_SUMMARY | |
} | |
- name: Upload result file as artefact | |
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 | |
with: | |
name: actions-${{ env.organization }} | |
path: | | |
actions.json | |
used-actions.json |