I was implementing some workflows and faced an issue with reusable workflow depth limits.
Here is the requirement:
WorkFlow1
(has two jobs) will take input and executeJob1
& will pass the input value toJob2
, which actually callsWorkFlow2
WorkFlow2
(has two jobs) will take input and executeJob1
& will pass the input value toJob2
which callsWorkFlow1
The above two steps should run in a loop until we stop/disable WorkFlow1
manually.
Is there any way to achieve this?
WorkFlow1.yml
:
name: To run bat tests on mac.
on:
workflow_dispatch:
inputs:
version:
description: 'release version.'
required: true
default: '1.0.0'
type: string
workflow_call:
inputs:
version:
required: true
type: string
jobs:
run-bat-tests: **#job1**
runs-on:
- self-hosted
- label-1
outputs:
version: ${{ steps.version-no.outputs.version }}
steps:
- name: Checkout ️
uses: actions/checkout@v3
- name: Check the release version
id: version-no
run: |
echo "version=${{ inputs.version }}" >> $GITHUB_ENV
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
uninstall-test: **#job2**
if: ${{ always() }}
needs: run-bat-tests
uses: ./.github/workflows/WorkFlow2.yml
with:
version: ${{ needs.run-bat-tests.outputs.version }}
WorkFlow2.yml
:
name: To run uninstall test on mac.
on:
workflow_call:
inputs:
version:
required: true
type: string
jobs:
run-mac-uninstall-test: **#job1**
runs-on:
- self-hosted
- label-1
outputs:
version: ${{ steps.version-no.outputs.environment }}
steps:
- name: Checkout ️
uses: actions/checkout@v3
- name: Check the release version
id: version-no
run: |
echo "version=${{ inputs.version }}" >> $GITHUB_ENV
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
trigger-bat-tests: **#job2**
if: ${{ success() }}
needs: run-mac-uninstall-test
uses: ./.github/workflows/WorkFlow1.yml
with:
version: ${{ needs.run-mac-bat-tests.outputs.version }}
I tried looping the jobs, but I ended up with the issue mentioned above.