-
Notifications
You must be signed in to change notification settings - Fork 2
34 lines (32 loc) · 1.12 KB
/
VarReuseInJobs.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
name: VarReuseInJobs
on: [workflow_dispatch]
jobs:
set_resource_group:
runs-on: ubuntu-latest
outputs:
rg_name: ${{ steps.set_rg.outputs.rg_name }}
steps:
- uses: actions/checkout@v4
- uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
enable-AzPSSession: true
- name: Setup Azure PowerShell
uses: azure/powershell@v2
with:
inlineScript: |
$RG = Get-AzResourceGroup -Name GitHubAction24 -Verbose
$rgName = $RG.ResourceGroupName
$rgName
Write-Output "rg_name=$rgName" >> $Env:GITHUB_OUTPUT
echo "::set-output name=rg_name::$rgName"
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_name }}"
Write-Host "Using Resource Group Name: $rgName"
shell: pwsh