Skip to content

Commit 1e0b2a9

Browse files
committed
Added "dynamic uses" action
To the repository root so it can be referenced and used in Github workflows. The action is originally from [1] and is a workaround to problem outlined in [2]. Contains failing CI. [1] https://github.com/jenseng/dynamic-uses [2] https://github.com/orgs/community/discussions/25246
1 parent e7f77c1 commit 1e0b2a9

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

action.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Dynamic Uses
2+
description: Dynamically resolve and use another GitHub action. Workaround for https://github.com/actions/runner/issues/895
3+
author: Jon Jensen
4+
inputs:
5+
uses:
6+
description: Action reference or path, e.g. `actions/setup-node@v3`
7+
required: true
8+
with:
9+
description: 'JSON-ified `inputs` for the action, e.g. `{"node-version": "18"}`'
10+
required: false
11+
default: "{}"
12+
outputs:
13+
outputs:
14+
description: 'JSON-ified `outputs` from the action, e.g. `{"node-version": "v18.12.0", "cache-hit": true}`'
15+
value: ${{ steps.run.outputs.outputs }}
16+
runs:
17+
using: composite
18+
steps:
19+
- name: Setup
20+
shell: bash
21+
run: |
22+
mkdir -p ./.tmp-dynamic-uses &&
23+
cat <<'DYNAMIC_USES_EOF' >./.tmp-dynamic-uses/action.yml
24+
outputs:
25+
outputs:
26+
value: ${{ '$' }}{{ toJSON(steps.run.outputs) }}
27+
runs:
28+
using: composite
29+
steps:
30+
- run: rm -rf ./.tmp-dynamic-uses
31+
shell: bash
32+
- name: Run
33+
id: run
34+
uses: ${{ inputs.uses }}
35+
with: ${{ inputs.with || '{}' }}
36+
DYNAMIC_USES_EOF
37+
- name: Run
38+
id: run
39+
uses: ./.tmp-dynamic-uses
40+
- name: Cleanup
41+
if: always() && steps.run.outcome != 'success'
42+
shell: bash
43+
run: rm -rf ./.tmp-dynamic-uses

0 commit comments

Comments
 (0)