-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
45 lines (41 loc) · 1.31 KB
/
action.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
35
36
37
38
39
40
41
42
43
44
45
name: 'env'
description: 'Share variables between spaceporn dependencies workflows'
inputs:
repository:
description: 'The repository name'
required: false
default: "${{ github.action_repository }}"
path:
description: 'The env.yml path'
required: false
runs:
using: "composite"
steps:
- name: Install yq on Windows
if: runner.os == 'Windows'
id: install
shell: bash
run: |
if choco install yq || scoop install main/yq || winget install --id MikeFarah.yq
then
printf 'succeed=true\n' >> "${GITHUB_OUTPUT}"
else
printf 'succeed=false\n' >> "${GITHUB_OUTPUT}"
fi
- if: runner.os == 'Windows' && steps.install.outputs.succeed != 'true'
uses: actions/setup-go@v5
- name: Install yq with GO on Windows
if: runner.os == 'Windows' && steps.install.outputs.succeed != 'true'
shell: bash
run: |
go install github.com/mikefarah/yq/v4@latest
- uses: actions/checkout@v4
with:
repository: "${{ inputs.repository }}"
- name: Load environment
env:
FILTER: '. | to_entries | map([.key, .value] | join ("=")) | .[]'
ENV_PATH: "${{ inputs.path }}"
shell: bash
run: |
yq "${FILTER}" "${ENV_PATH:-"${GITHUB_ACTION_PATH}"}/env.yml" >> "${GITHUB_ENV}"