Skip to content

Commit

Permalink
CI: Fix check for not allowing manual build trigger for main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
DriesSchaumont committed Apr 24, 2024
1 parent eac1c5a commit 55af850
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/main-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 55af850

Please sign in to comment.