-
I tried to define multiple workflows on one yaml file using yaml document separator Example:
Expected: two workflows are defined (called “First Workflow” and “Second Workflow”) Actually: Only first workflow is defined (called “First Workflow”), second workflow is ignored |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments
-
At the moment, that’s not supported. You’ll need a single workflow per yaml file. |
Beta Was this translation helpful? Give feedback.
-
Okay. Too bad, but thank you for your quick answer :slight_smile: |
Beta Was this translation helpful? Give feedback.
-
Hi, are there any plans to support this feature in the future ? |
Beta Was this translation helpful? Give feedback.
-
Agree that this would make for cleaner code, especially when doing things like this! |
Beta Was this translation helpful? Give feedback.
-
Any update on this feature? Just tried to do the same thing and got a parsing error. Not sure why this would be an issue when it is native yaml functionality, and certainly would lead to much cleaner code! |
Beta Was this translation helpful? Give feedback.
-
Any update on this feature? Still not working. |
Beta Was this translation helpful? Give feedback.
-
ping! this is useful/important (unless I am missing an alternative way) when defining a shared set of workflows and wanting to include them all in a bunch of repos in same org |
Beta Was this translation helpful? Give feedback.
-
One use case where this could be useful is for workflows that take user input that needs to be sanitised before being used. Content of ---
name: Sanitise User Input
on:
workflow_dispatch:
inputs:
unsafe-user-input:
required: true
type: string
jobs:
sanitise-input:
runs-on: ubuntu-latest
outputs:
safer-user-input: ${{ steps.get-safer-user-input.outputs.SAFER_USER_INPUT }}
steps:
- name: Sanitise user input
id: get-safer-user-input
env:
UNSAFE_USER_INPUT: ${{ inputs.unsafe-user-input }}
run: |
# Code to sanitise UNSAFE_USER_INPUT and store it in SAFER_USER_INPUT
...
echo "SAFER_USER_INPUT=$SAFER_USER_INPUT" >> $GITHUB_OUTPUT
run-payload:
needs: [sanitise-input]
uses: .github/workflows/multi-workflow.yml
with:
safer-user-input: ${{ needs.sanitise-input.outputs.safer-user-input }}
---
name: Run Workflow Using Sanitised User Input
on:
workflow-call:
inputs:
safer-user-input:
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: run-main-workflow
run: # Do work with safer user input |
Beta Was this translation helpful? Give feedback.
At the moment, that’s not supported. You’ll need a single workflow per yaml file.