Skip to content

Commit

Permalink
two new workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedbham committed Apr 14, 2024
1 parent cf92e11 commit bcc0862
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/reusable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Reusable workflow
on:
workflow_call:
inputs:
who-to-greet:
description: 'Person to greet'
type: string
required: true
default: 'World'
outputs:
current-time:
description: 'The time we greeted the person'
value: ${{ jobs.reusable-job.current-time }}


jobs:
reusable-job:
runs-on: ubuntu-latest
steps:
- name: Echo greeting
run: echo "Hello ${{ github.event.inputs.who-to-greet }}"
- name: Set current time
id: time
run: |
echo "::set-output name=current-time::$(date)"
outputs:
current-time: steps.time.outputs.current-time

16 changes: 16 additions & 0 deletions .github/workflows/reuse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Reuse other workflow
on:
workflow_dispatch:
jobs:
call-workflow:
runs-on: ubuntu-latest
steps:
- name: Call reusable workflow
uses: ./.github/workflows/reusable.yml
with:
who-to-greet: ${{ github.actor }}
use-output:
runs-on: ubuntu-latest
needs: call-workflow
steps:
- run: echo "The time we greeted Alice was ${{ needs.call-workflow.outputs.current-time }}"

0 comments on commit bcc0862

Please sign in to comment.