Skip to content

Commit

Permalink
Sample reusable workflow (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
walkowif authored Jun 11, 2024
1 parent 2bbbae3 commit edc64ed
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/sample-reusable-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Sample reusable workflow ♻️

on:
workflow_call:
inputs:
name:
description: Your name
required: false
default: "<name>"
type: string

jobs:
greetings:
name: Greet the user 👋
runs-on: ubuntu-latest
if: >
inputs.name != 'Octocat'
container:
image: rocker/r-ubuntu:latest

steps:
- name: Hello world! 💬
run: cat(paste0("Hello ${{ inputs.name }}! 👋"))
shell: Rscript {0}

- name: Greet people with R in their name
if: >
contains(inputs.name, 'R') || contains(inputs.name, 'r')
run: |
cat("Your name (${{ inputs.name }}) contains the letter 'R'. How cool!")
shell: Rscript {0}

- name: Greet people without R in their name
if: >
!contains(inputs.name, 'R') && !contains(inputs.name, 'r')
run: |
cat("Your name (${{ inputs.name }}) doesn't contain the letter 'R'. That's great!")
shell: Rscript {0}

0 comments on commit edc64ed

Please sign in to comment.