Skip to content

VarReuseInJobs

VarReuseInJobs #12

name: VarReuseInJobs
on: [workflow_dispatch]
jobs:
set_resource_group:
runs-on: ubuntu-latest
outputs:
rg_name: ${{ steps.set_rg.outputs.rg }}
steps:
- uses: actions/checkout@v4
- uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
enable-AzPSSession: true
- name: Setup Azure PowerShell
id: set_rg
uses: azure/powershell@v2
with:
inlineScript: |
Write-Output "RG=$(Get-AzResourceGroup -Name GitHubAction24|ConvertTo-Json -Compress)" >> $Env:GITHUB_OUTPUT
azPSVersion: 'latest'
use_resource_group:
needs: set_resource_group
runs-on: ubuntu-latest
steps:
- name: Use RG Name
run: |
$rgName = "${{ needs.set_resource_group.outputs.rg }}"
Write-Host "Using Resource Group Name: $rgName"
shell: pwsh