-
Notifications
You must be signed in to change notification settings - Fork 26
33 lines (27 loc) · 996 Bytes
/
main32.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
name: My Workflow
on:
push:
branches:
- master
jobs:
use-hash-table:
runs-on: windows-latest
steps:
- name: Serialize hash table and set as environment variable
shell: pwsh
run: |
# Define a hash table in PowerShell
$hashTable = @{key1 = 'value1'}
# Serialize to JSON
$jsonString = $hashTable | ConvertTo-Json
# Set as environment variable for subsequent steps in this job
echo "MY_HASH_TABLE=$jsonString" | Out-File -Append $env:GITHUB_ENV
- name: Deserialize and use hash table
run: |
# Deserialize from JSON string to hash table
$hashTableFromEnv = $env:MY_HASH_TABLE | ConvertFrom-Json
# Display the entire hash table
$hashTableFromEnv
# Example of extracting a specific key's value
Write-Output "Value for key1: $($hashTableFromEnv.key1)"
shell: powershell