Skip to content

Custom action output #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/actions/my-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: my action
description: Set some variable as output
inputs:
my_input:
description: 'Some input'
required: true
outputs:
my_output:
description: 'The output'
value: ${{ steps.my-step.outputs.my_output }}
runs:
using: composite
steps:
- id: my-step
name: Step to write output
run: |
echo ${{ inputs.my_input }}
echo "my_output='output from my action.'" >> $GITHUB_OUTPUT
shell: bash
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test

on: [push,pull_request]

jobs:
job1:
runs-on: ubuntu-latest
outputs:
my_output_from_job: ${{ steps.my-action.outputs.my_output }}
steps:
- uses: actions/checkout@v4
- id: my-action
uses: ./.github/actions/my-action
with:
my_input: 'Input from job1'
- name: use output from the custom action
run: echo ${{ steps.my-action.outputs.my_output }}

job2:
runs-on: ubuntu-latest
needs: job1
steps:
- run: |
echo ${{ needs.job1.outputs.my_output_from_job }}