Skip to content
Open
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
26 changes: 26 additions & 0 deletions .github/workflows/reusable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Reusable workflow

on:
workflow_call:
inputs:
who-to-greet:
description: 'The person to greet'
type: string
required: true
default: World
outputs:
current-time:
description: 'The time when greeting.'
value: ${{ jobs.reusable-job.outputs.current-time }}
jobs:
reusable-job:
runs-on: ubuntu-latest
steps:
- name: Greet someone
run: echo "Hello ${{ inputs.who-to-greet }}"
- name: Set time
id: time
run: echo "time=$(date)" >> $GITHUB_OUTPUT
outputs:
current-time: ${{ steps.time.outputs.time }}

13 changes: 13 additions & 0 deletions .github/workflows/reuse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Reuse other workflow

on: [workflow_dispatch]
jobs:
call-workflow:
uses: ./.github/workflows/reusable.yml
with:
who-to-greet: '@octocat'
use-output:
runs-on: ubuntu-latest
needs: [call-workflow]
steps:
- run: echo "Time was ${{ needs.call-workflow.outputs.current-time }}"