Skip to content

fix path

fix path #171

Workflow file for this run

name: Testing the action
on:
push:
workflow_dispatch:
# Declare default GITHUB_TOKEN permissions as read only.
permissions: read-all
jobs:
load-all-used-actions:
runs-on: ubuntu-latest
name: Test on current organization
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: ./
name: Load used actions
with:
PAT: ${{ secrets.GITHUB_TOKEN }}
id: load-actions
- shell: pwsh
run: |
Write-Host "Found actions [${{ steps.load-actions.outputs.actions }}]"
$content = ${{ steps.load-actions.outputs.actions }}
New-Item -Path 'actions.json' -Value $content -Force | Out-Null
$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
}
- shell: pwsh
run: |
# check the contents of the current dir
Write-Host "Where are we? [$pwd]"
ForEach ($file in Get-ChildItem) {
Write-Host "- $($file.Name)"
}
- shell: pwsh
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@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: actions-${{ env.GITHUB_REPOSITORY_OWNER }}
path: actions.json
load-all-used-actions-other-org:
runs-on: ubuntu-latest
name: Test on different organization
env:
organization: rajbos-actions
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: ./
name: Load used actions
with:
PAT: ${{ secrets.GITHUB_TOKEN }}
organization: ${{ env.organization }}
id: load-actions
- shell: pwsh
run: |
Write-Host "Found actions [${{ steps.load-actions.outputs.actions }}]"
$content = ${{ steps.load-actions.outputs.actions }}
New-Item -Path 'actions.json' -Value $content -Force | Out-Null
$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@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: actions-${{ env.organization }}
path: actions.json