Skip to content
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

Sample reusable workflow #1

Merged
merged 5 commits into from
Jun 11, 2024
Merged
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
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}
Loading