Skip to content

Commit d421ce4

Browse files
committed
Test the output of a custom action
1 parent 3d16282 commit d421ce4

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: my action
2+
description: Set some variable as output
3+
inputs:
4+
my-input:
5+
description: 'Some input'
6+
required: true
7+
outputs:
8+
my-output:
9+
description: 'The output'
10+
value: ${{ steps.my-step.outputs.dependencies_hash }}
11+
runs:
12+
using: composite
13+
steps:
14+
- id: my-step
15+
name: Step to write output
16+
run: |
17+
echo ${{ inputs.my-input }}
18+
echo "my-output='output from my action.'" >> $GITHUB_OUTPUT
19+
shell: bash

.github/workflows/test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Test
2+
3+
on: [push,pull_request]
4+
5+
jobs:
6+
job1:
7+
runs-on: ubuntu-latest
8+
outputs:
9+
my-output-from-job: ${{ steps.my-action.outputs.my-output.value }}
10+
steps:
11+
- id: my-action
12+
uses: ./.github/actions/my-action
13+
with:
14+
my-input: 'Input from job1'
15+
- name: use output from the custom action
16+
run: echo ${{ steps.my-action.outputs.my-output.value }}
17+
18+
job2:
19+
runs-on: ubuntu-latest
20+
needs: job1
21+
steps:
22+
- run: |
23+
echo ${{ needs.job1.outputs.my-output-from-job }}

0 commit comments

Comments
 (0)