diff --git a/.github/workflows/main-build.yml b/.github/workflows/main-build.yml index c17ac83bf17..192cc95b7c2 100644 --- a/.github/workflows/main-build.yml +++ b/.github/workflows/main-build.yml @@ -62,6 +62,14 @@ on: required: false default: false description: Also build packages and docker images for viash-hub.com and push them. + is_workflow_call: + description: | + Flag to destinguish between a 'workflow_call' and 'workflow_dispatch'. + github.event_name can not be used for this because it refers to the event of + the top-level workflow. See https://github.com/actions/runner/issues/3146 + type: boolean + required: false + default: true outputs: component_matrix: description: "A JSON object that can be used to populate a github actions matrix for component jobs." @@ -97,7 +105,7 @@ jobs: steps: - name: Do not allow manual trigger if the branch is main - if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' + if: !inputs.is_workflow_call && github.ref == 'refs/heads/main' run: | echo "This workflow should not be triggered with workflow_dispatch from the main branch" exit 1