-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathaction.yml
43 lines (43 loc) · 1.29 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
name: Dynamic Uses
description: Dynamically resolve and use another GitHub action. Workaround for https://github.com/actions/runner/issues/895
author: Jon Jensen
inputs:
uses:
description: Action reference or path, e.g. `actions/setup-node@v3`
required: true
with:
description: 'JSON-ified `inputs` for the action, e.g. `{"node-version": "18"}`'
required: false
default: "{}"
outputs:
outputs:
description: 'JSON-ified `outputs` from the action, e.g. `{"node-version": "v18.12.0", "cache-hit": true}`'
value: ${{ steps.run.outputs.outputs }}
runs:
using: composite
steps:
- name: Setup
shell: bash
run: |
mkdir -p ./.tmp-dynamic-uses &&
cat <<'DYNAMIC_USES_EOF' >./.tmp-dynamic-uses/action.yml
outputs:
outputs:
value: ${{ '$' }}{{ toJSON(steps.run.outputs) }}
runs:
using: composite
steps:
- run: rm -rf ./.tmp-dynamic-uses
shell: sh
- name: Run
id: run
uses: ${{ inputs.uses }}
with: ${{ inputs.with || '{}' }}
DYNAMIC_USES_EOF
- name: Run
id: run
uses: ./.tmp-dynamic-uses
- name: Cleanup
if: always() && steps.run.outcome != 'success'
shell: bash
run: rm -rf ./.tmp-dynamic-uses