Reusable workflow still runs even if condition fails #343

Open
opened 2023-08-21 15:54:33 +00:00 by lltr · 0 comments

When using reusable workflows, the if condition is ignored even if evaluated to false. In workflow caller:

  call-deploy-prd-workflow:
    if: github.ref_type == 'tag' # <-- this is ignored
    needs: [build-and-package]
    uses: ./.gitea/workflows/02-deploy.yaml
    with:
      ENVIRONMENT: prd
      K8S_NAMESPACE: default
      INGRESS_DOMAIN: domain.com
    secrets: inherit

However if it is a normal job and there are steps in the job, the if condition does work as expected.

Logs where workflow continues to run even if evaluation is false:

evaluating expression 'github.ref_type == 'tag''
expression 'github.ref_type == 'tag'' evaluated to 'false'
🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
...

or a simpler example is when I set the if condition to a workflow caller job's result to run if failure but the reusable workflow_call still runs even if the the job succeeded.

When using reusable workflows, the `if` condition is ignored even if evaluated to false. In workflow caller: ```yaml call-deploy-prd-workflow: if: github.ref_type == 'tag' # <-- this is ignored needs: [build-and-package] uses: ./.gitea/workflows/02-deploy.yaml with: ENVIRONMENT: prd K8S_NAMESPACE: default INGRESS_DOMAIN: domain.com secrets: inherit ``` However if it is a normal job and there are steps in the job, the `if` condition does work as expected. Logs where workflow continues to run even if evaluation is false: ``` evaluating expression 'github.ref_type == 'tag'' expression 'github.ref_type == 'tag'' evaluated to 'false' 🚀 Start image=ghcr.io/catthehacker/ubuntu:act-latest ... ``` or a simpler example is when I set the `if` condition to a workflow caller job's result to run if `failure` but the reusable workflow_call still runs even if the the job succeeded.
lltr changed title from Conditional reusable workflows ignored to Conditional ignored in reusable workflows 2023-08-21 15:54:46 +00:00
lltr changed title from Conditional ignored in reusable workflows to Reusable workflow still runs even if condition fails 2023-08-21 16:30:11 +00:00
wolfogre added the
kind
bug
label 2023-08-22 01:59:36 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/act_runner#343
No description provided.