[GH-ISSUE #1793] local reusable workflow failure exists and ignores failure() #876

Closed
opened 2026-03-01 21:47:05 +03:00 by kerem · 2 comments
Owner

Originally created by @AmitBenAmi on GitHub (May 8, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/1793

Bug report info

act version:            0.2.45
GOOS:                   darwin
GOARCH:                 amd64
NumCPU:                 8
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
	/var/run/docker.sock
	$HOME/.docker/run/docker.sock
Config files:           
	/Users/amitbe/.actrc:
		-P ubuntu-latest=node:16-buster-slim
		-P ubuntu-22.04=node:16-bullseye-slim
		-P ubuntu-20.04=node:16-buster-slim
		-P ubuntu-18.04=node:16-buster-slim
Build info:
	Go version:            go1.20.3
	Module path:           command-line-arguments
	Main version:          
	Main path:             
	Main checksum:         
	Build settings:
		-buildmode:           exe
		-compiler:            gc
		-ldflags:             -X main.version=0.2.45
		CGO_ENABLED:          1
		CGO_CFLAGS:           
		CGO_CPPFLAGS:         
		CGO_CXXFLAGS:         
		CGO_LDFLAGS:          
		GOARCH:               amd64
		GOOS:                 darwin
		GOAMD64:              v1
Docker Engine:
	Engine version:        23.0.5
	Engine runtime:        runc
	Cgroup version:        2
	Cgroup driver:         cgroupfs
	Storage driver:        overlay2
	Registry URI:          https://index.docker.io/v1/
	OS:                    Docker Desktop
	OS type:               linux
	OS version:            
	OS arch:               x86_64
	OS kernel:             5.15.49-linuxkit
	OS CPU:                4
	OS memory:             7959 MB
	Security options:
		name=seccomp,profile=builtin
		name=cgroupns

Command used with act

act workflow_dispatch --workflows .github/workflows/workflow.yaml -P common-4gb=nektos/act-environments-ubuntu:18.04-lite

Describe issue

I have a matrix workflow that runs a local reusable workflow for each matrix value.
When running with act, it ends up with the error message of:
Error: Job 'Setup-${{ inputs.cluster }}' failed.

I have a job in the calling workflow that has the failure() flag, and it isn't being run

No response

Workflow content

# Main workflow file
name: workflow

on:
  workflow_dispatch:

jobs:
  test:
    uses: ./.github/workflows/inner-workflow.yaml
    name: test-${{ matrix.cluster }}
    strategy:
      fail-fast: false
      matrix:
        cluster:
          - cluster1
          - cluster2
          - cluster3
          - cluster4
    with:
      cluster: ${{ matrix.cluster }}
      branch: '${{ github.ref }}'
      runner: 'common-4gb'
  alert:
    runs-on: ubuntu-latest
    needs: test
    if: ${{ failure() }}
    steps:
      - name: show last jobs outputs and results
        run: |-
          echo 'needs context'
          echo '${{ toJson(needs) }}'
          echo 'jobs context'
          echo '${{ toJson(job) }}'

---
# Inner workflow file

name: inner workflow
run-name: inner workflow | ${{ inputs.cluster }}

on:
  workflow_call:
    inputs:
      cluster:
        description: Cluster
        type: string
        required: true
      branch:
        description: Branch
        type: string
        required: true
      runner:
        description: Runner
        type: string
        required: true

jobs:
  job1:
    name: Setup-${{ inputs.cluster }}
    runs-on: ['${{ inputs.runner }}']
    strategy:
      fail-fast: false
    steps:
      - name: fail for cluster1
        run: |-
          if [[ ${{ inputs.cluster }} == "cluster1" ]]; then
            exit 1
          else
            exit 0
          fi
  job2:
    name: Test-${{ inputs.cluster }}
    runs-on: ['${{ inputs.runner }}']
    needs: [job1]
    strategy:
      fail-fast: false
    steps:
      - name: fail on cluster2
        run: |-
          if [[ ${{ inputs.cluster }} == "cluster2" ]]; then
            exit 1
          else
            exit 0
          fi

Relevant log output

[test/inner workflow/Test-cluster2 ] exitcode '1': failure
[test/inner workflow/Test-cluster2 ] 🏁  Job failed
[test/inner workflow/Test-cluster2 ] [DEBUG] Loading revision from git directory
[test/inner workflow/Test-cluster2 ] [DEBUG] Found revision: eae86a83e3c62d8c0bedaa8839ae775882887651
[test/inner workflow/Test-cluster2 ] [DEBUG] HEAD points to 'eae86a83e3c62d8c0bedaa8839ae775882887651'
[test/inner workflow/Test-cluster2 ] [DEBUG] using github ref: refs/heads/adding-alerting-to-amp-patching
[test/inner workflow/Test-cluster2 ] [DEBUG] Found revision: eae86a83e3c62d8c0bedaa8839ae775882887651
[test/inner workflow/Test-cluster2 ] [DEBUG] expression '${{ matrix.cluster }}' rewritten to 'format('{0}', matrix.cluster)'
[test/inner workflow/Test-cluster2 ] [DEBUG] evaluating expression 'format('{0}', matrix.cluster)'
[test/inner workflow/Test-cluster2 ] [DEBUG] expression 'format('{0}', matrix.cluster)' evaluated to '%!t(string=cluster2)'
[test/inner workflow/Test-cluster2 ] [DEBUG] expression '${{ github.ref }}' rewritten to 'format('{0}', github.ref)'
[test/inner workflow/Test-cluster2 ] [DEBUG] evaluating expression 'format('{0}', github.ref)'
[test/inner workflow/Test-cluster2 ] [DEBUG] expression 'format('{0}', github.ref)' evaluated to '%!t(string=refs/heads/adding-alerting-to-amp-patching)'
[test/inner workflow/Test-cluster3 ] [DEBUG] Removed container: 0c64ae55cf92cd81c56bdb96d979c95046ab15f3df15efb55842111e4b982e21
[test/inner workflow/Test-cluster3 ] [DEBUG]   🐳  docker volume rm act-test-inner-workflow-Test-cluster3-29432ad076e9684af9374fe5ea0621b4947ab54a351803c4486db0322a197cbd
[test/inner workflow/Test-cluster2 ] [DEBUG] Loading revision from git directory
[test/inner workflow/Test-cluster2 ] [DEBUG] Found revision: eae86a83e3c62d8c0bedaa8839ae775882887651
[test/inner workflow/Test-cluster2 ] [DEBUG] HEAD points to 'eae86a83e3c62d8c0bedaa8839ae775882887651'
[test/inner workflow/Test-cluster3 ] [DEBUG]   🐳  docker volume rm act-test-inner-workflow-Test-cluster3-29432ad076e9684af9374fe5ea0621b4947ab54a351803c4486db0322a197cbd-env
[test/inner workflow/Test-cluster2 ] [DEBUG] using github ref: refs/heads/adding-alerting-to-amp-patching
[test/inner workflow/Test-cluster2 ] [DEBUG] Found revision: eae86a83e3c62d8c0bedaa8839ae775882887651
[test/inner workflow/Test-cluster2 ] [DEBUG] expression '${{ matrix.cluster }}' rewritten to 'format('{0}', matrix.cluster)'
[test/inner workflow/Test-cluster2 ] [DEBUG] evaluating expression 'format('{0}', matrix.cluster)'
[test/inner workflow/Test-cluster2 ] [DEBUG] expression 'format('{0}', matrix.cluster)' evaluated to '%!t(string=cluster2)'
[test/inner workflow/Test-cluster2 ] [DEBUG] expression '${{ github.ref }}' rewritten to 'format('{0}', github.ref)'
[test/inner workflow/Test-cluster2 ] [DEBUG] evaluating expression 'format('{0}', github.ref)'
[test/inner workflow/Test-cluster2 ] [DEBUG] expression 'format('{0}', github.ref)' evaluated to '%!t(string=refs/heads/adding-alerting-to-amp-patching)'
[test/inner workflow/Test-cluster3 ] 🏁  Job succeeded
[test/inner workflow/Test-cluster3 ] [DEBUG] Loading revision from git directory
[test/inner workflow/Test-cluster3 ] [DEBUG] Found revision: eae86a83e3c62d8c0bedaa8839ae775882887651
[test/inner workflow/Test-cluster3 ] [DEBUG] HEAD points to 'eae86a83e3c62d8c0bedaa8839ae775882887651'
[test/inner workflow/Test-cluster3 ] [DEBUG] using github ref: refs/heads/adding-alerting-to-amp-patching
[test/inner workflow/Test-cluster3 ] [DEBUG] Found revision: eae86a83e3c62d8c0bedaa8839ae775882887651
[test/inner workflow/Test-cluster3 ] [DEBUG] expression '${{ matrix.cluster }}' rewritten to 'format('{0}', matrix.cluster)'
[test/inner workflow/Test-cluster3 ] [DEBUG] evaluating expression 'format('{0}', matrix.cluster)'
[test/inner workflow/Test-cluster3 ] [DEBUG] expression 'format('{0}', matrix.cluster)' evaluated to '%!t(string=cluster3)'
[test/inner workflow/Test-cluster3 ] [DEBUG] expression '${{ github.ref }}' rewritten to 'format('{0}', github.ref)'
[test/inner workflow/Test-cluster3 ] [DEBUG] evaluating expression 'format('{0}', github.ref)'
[test/inner workflow/Test-cluster3 ] [DEBUG] expression 'format('{0}', github.ref)' evaluated to '%!t(string=refs/heads/adding-alerting-to-amp-patching)'
[test/inner workflow/Test-cluster3 ] [DEBUG] Loading revision from git directory
[test/inner workflow/Test-cluster3 ] [DEBUG] Found revision: eae86a83e3c62d8c0bedaa8839ae775882887651
[test/inner workflow/Test-cluster3 ] [DEBUG] HEAD points to 'eae86a83e3c62d8c0bedaa8839ae775882887651'
[test/inner workflow/Test-cluster3 ] [DEBUG] using github ref: refs/heads/adding-alerting-to-amp-patching
[test/inner workflow/Test-cluster3 ] [DEBUG] Found revision: eae86a83e3c62d8c0bedaa8839ae775882887651
[test/inner workflow/Test-cluster3 ] [DEBUG] expression '${{ matrix.cluster }}' rewritten to 'format('{0}', matrix.cluster)'
[test/inner workflow/Test-cluster3 ] [DEBUG] evaluating expression 'format('{0}', matrix.cluster)'
[test/inner workflow/Test-cluster3 ] [DEBUG] expression 'format('{0}', matrix.cluster)' evaluated to '%!t(string=cluster3)'
[test/inner workflow/Test-cluster3 ] [DEBUG] expression '${{ github.ref }}' rewritten to 'format('{0}', github.ref)'
[test/inner workflow/Test-cluster3 ] [DEBUG] evaluating expression 'format('{0}', github.ref)'
[test/inner workflow/Test-cluster3 ] [DEBUG] expression 'format('{0}', github.ref)' evaluated to '%!t(string=refs/heads/adding-alerting-to-amp-patching)'
Error: Job 'Setup-${{ inputs.cluster }}' failed

Additional information

I removed some of the output since I exceeded the 65536 characters for Github comment

Originally created by @AmitBenAmi on GitHub (May 8, 2023). Original GitHub issue: https://github.com/nektos/act/issues/1793 ### Bug report info ```plain text act version: 0.2.45 GOOS: darwin GOARCH: amd64 NumCPU: 8 Docker host: DOCKER_HOST environment variable is not set Sockets found: /var/run/docker.sock $HOME/.docker/run/docker.sock Config files: /Users/amitbe/.actrc: -P ubuntu-latest=node:16-buster-slim -P ubuntu-22.04=node:16-bullseye-slim -P ubuntu-20.04=node:16-buster-slim -P ubuntu-18.04=node:16-buster-slim Build info: Go version: go1.20.3 Module path: command-line-arguments Main version: Main path: Main checksum: Build settings: -buildmode: exe -compiler: gc -ldflags: -X main.version=0.2.45 CGO_ENABLED: 1 CGO_CFLAGS: CGO_CPPFLAGS: CGO_CXXFLAGS: CGO_LDFLAGS: GOARCH: amd64 GOOS: darwin GOAMD64: v1 Docker Engine: Engine version: 23.0.5 Engine runtime: runc Cgroup version: 2 Cgroup driver: cgroupfs Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Docker Desktop OS type: linux OS version: OS arch: x86_64 OS kernel: 5.15.49-linuxkit OS CPU: 4 OS memory: 7959 MB Security options: name=seccomp,profile=builtin name=cgroupns ``` ### Command used with act ```sh act workflow_dispatch --workflows .github/workflows/workflow.yaml -P common-4gb=nektos/act-environments-ubuntu:18.04-lite ``` ### Describe issue I have a matrix workflow that runs a local reusable workflow for each matrix value. When running with act, it ends up with the error message of: `Error: Job 'Setup-${{ inputs.cluster }}' failed`. I have a job in the calling workflow that has the `failure()` flag, and it isn't being run ### Link to GitHub repository _No response_ ### Workflow content ```yml # Main workflow file name: workflow on: workflow_dispatch: jobs: test: uses: ./.github/workflows/inner-workflow.yaml name: test-${{ matrix.cluster }} strategy: fail-fast: false matrix: cluster: - cluster1 - cluster2 - cluster3 - cluster4 with: cluster: ${{ matrix.cluster }} branch: '${{ github.ref }}' runner: 'common-4gb' alert: runs-on: ubuntu-latest needs: test if: ${{ failure() }} steps: - name: show last jobs outputs and results run: |- echo 'needs context' echo '${{ toJson(needs) }}' echo 'jobs context' echo '${{ toJson(job) }}' --- # Inner workflow file name: inner workflow run-name: inner workflow | ${{ inputs.cluster }} on: workflow_call: inputs: cluster: description: Cluster type: string required: true branch: description: Branch type: string required: true runner: description: Runner type: string required: true jobs: job1: name: Setup-${{ inputs.cluster }} runs-on: ['${{ inputs.runner }}'] strategy: fail-fast: false steps: - name: fail for cluster1 run: |- if [[ ${{ inputs.cluster }} == "cluster1" ]]; then exit 1 else exit 0 fi job2: name: Test-${{ inputs.cluster }} runs-on: ['${{ inputs.runner }}'] needs: [job1] strategy: fail-fast: false steps: - name: fail on cluster2 run: |- if [[ ${{ inputs.cluster }} == "cluster2" ]]; then exit 1 else exit 0 fi ``` ### Relevant log output ```sh [test/inner workflow/Test-cluster2 ] exitcode '1': failure [test/inner workflow/Test-cluster2 ] 🏁 Job failed [test/inner workflow/Test-cluster2 ] [DEBUG] Loading revision from git directory [test/inner workflow/Test-cluster2 ] [DEBUG] Found revision: eae86a83e3c62d8c0bedaa8839ae775882887651 [test/inner workflow/Test-cluster2 ] [DEBUG] HEAD points to 'eae86a83e3c62d8c0bedaa8839ae775882887651' [test/inner workflow/Test-cluster2 ] [DEBUG] using github ref: refs/heads/adding-alerting-to-amp-patching [test/inner workflow/Test-cluster2 ] [DEBUG] Found revision: eae86a83e3c62d8c0bedaa8839ae775882887651 [test/inner workflow/Test-cluster2 ] [DEBUG] expression '${{ matrix.cluster }}' rewritten to 'format('{0}', matrix.cluster)' [test/inner workflow/Test-cluster2 ] [DEBUG] evaluating expression 'format('{0}', matrix.cluster)' [test/inner workflow/Test-cluster2 ] [DEBUG] expression 'format('{0}', matrix.cluster)' evaluated to '%!t(string=cluster2)' [test/inner workflow/Test-cluster2 ] [DEBUG] expression '${{ github.ref }}' rewritten to 'format('{0}', github.ref)' [test/inner workflow/Test-cluster2 ] [DEBUG] evaluating expression 'format('{0}', github.ref)' [test/inner workflow/Test-cluster2 ] [DEBUG] expression 'format('{0}', github.ref)' evaluated to '%!t(string=refs/heads/adding-alerting-to-amp-patching)' [test/inner workflow/Test-cluster3 ] [DEBUG] Removed container: 0c64ae55cf92cd81c56bdb96d979c95046ab15f3df15efb55842111e4b982e21 [test/inner workflow/Test-cluster3 ] [DEBUG] 🐳 docker volume rm act-test-inner-workflow-Test-cluster3-29432ad076e9684af9374fe5ea0621b4947ab54a351803c4486db0322a197cbd [test/inner workflow/Test-cluster2 ] [DEBUG] Loading revision from git directory [test/inner workflow/Test-cluster2 ] [DEBUG] Found revision: eae86a83e3c62d8c0bedaa8839ae775882887651 [test/inner workflow/Test-cluster2 ] [DEBUG] HEAD points to 'eae86a83e3c62d8c0bedaa8839ae775882887651' [test/inner workflow/Test-cluster3 ] [DEBUG] 🐳 docker volume rm act-test-inner-workflow-Test-cluster3-29432ad076e9684af9374fe5ea0621b4947ab54a351803c4486db0322a197cbd-env [test/inner workflow/Test-cluster2 ] [DEBUG] using github ref: refs/heads/adding-alerting-to-amp-patching [test/inner workflow/Test-cluster2 ] [DEBUG] Found revision: eae86a83e3c62d8c0bedaa8839ae775882887651 [test/inner workflow/Test-cluster2 ] [DEBUG] expression '${{ matrix.cluster }}' rewritten to 'format('{0}', matrix.cluster)' [test/inner workflow/Test-cluster2 ] [DEBUG] evaluating expression 'format('{0}', matrix.cluster)' [test/inner workflow/Test-cluster2 ] [DEBUG] expression 'format('{0}', matrix.cluster)' evaluated to '%!t(string=cluster2)' [test/inner workflow/Test-cluster2 ] [DEBUG] expression '${{ github.ref }}' rewritten to 'format('{0}', github.ref)' [test/inner workflow/Test-cluster2 ] [DEBUG] evaluating expression 'format('{0}', github.ref)' [test/inner workflow/Test-cluster2 ] [DEBUG] expression 'format('{0}', github.ref)' evaluated to '%!t(string=refs/heads/adding-alerting-to-amp-patching)' [test/inner workflow/Test-cluster3 ] 🏁 Job succeeded [test/inner workflow/Test-cluster3 ] [DEBUG] Loading revision from git directory [test/inner workflow/Test-cluster3 ] [DEBUG] Found revision: eae86a83e3c62d8c0bedaa8839ae775882887651 [test/inner workflow/Test-cluster3 ] [DEBUG] HEAD points to 'eae86a83e3c62d8c0bedaa8839ae775882887651' [test/inner workflow/Test-cluster3 ] [DEBUG] using github ref: refs/heads/adding-alerting-to-amp-patching [test/inner workflow/Test-cluster3 ] [DEBUG] Found revision: eae86a83e3c62d8c0bedaa8839ae775882887651 [test/inner workflow/Test-cluster3 ] [DEBUG] expression '${{ matrix.cluster }}' rewritten to 'format('{0}', matrix.cluster)' [test/inner workflow/Test-cluster3 ] [DEBUG] evaluating expression 'format('{0}', matrix.cluster)' [test/inner workflow/Test-cluster3 ] [DEBUG] expression 'format('{0}', matrix.cluster)' evaluated to '%!t(string=cluster3)' [test/inner workflow/Test-cluster3 ] [DEBUG] expression '${{ github.ref }}' rewritten to 'format('{0}', github.ref)' [test/inner workflow/Test-cluster3 ] [DEBUG] evaluating expression 'format('{0}', github.ref)' [test/inner workflow/Test-cluster3 ] [DEBUG] expression 'format('{0}', github.ref)' evaluated to '%!t(string=refs/heads/adding-alerting-to-amp-patching)' [test/inner workflow/Test-cluster3 ] [DEBUG] Loading revision from git directory [test/inner workflow/Test-cluster3 ] [DEBUG] Found revision: eae86a83e3c62d8c0bedaa8839ae775882887651 [test/inner workflow/Test-cluster3 ] [DEBUG] HEAD points to 'eae86a83e3c62d8c0bedaa8839ae775882887651' [test/inner workflow/Test-cluster3 ] [DEBUG] using github ref: refs/heads/adding-alerting-to-amp-patching [test/inner workflow/Test-cluster3 ] [DEBUG] Found revision: eae86a83e3c62d8c0bedaa8839ae775882887651 [test/inner workflow/Test-cluster3 ] [DEBUG] expression '${{ matrix.cluster }}' rewritten to 'format('{0}', matrix.cluster)' [test/inner workflow/Test-cluster3 ] [DEBUG] evaluating expression 'format('{0}', matrix.cluster)' [test/inner workflow/Test-cluster3 ] [DEBUG] expression 'format('{0}', matrix.cluster)' evaluated to '%!t(string=cluster3)' [test/inner workflow/Test-cluster3 ] [DEBUG] expression '${{ github.ref }}' rewritten to 'format('{0}', github.ref)' [test/inner workflow/Test-cluster3 ] [DEBUG] evaluating expression 'format('{0}', github.ref)' [test/inner workflow/Test-cluster3 ] [DEBUG] expression 'format('{0}', github.ref)' evaluated to '%!t(string=refs/heads/adding-alerting-to-amp-patching)' Error: Job 'Setup-${{ inputs.cluster }}' failed ``` ### Additional information I removed some of the output since I exceeded the 65536 characters for Github comment
kerem 2026-03-01 21:47:05 +03:00
Author
Owner

@keathmilligan commented on GitHub (Sep 9, 2023):

Here is a really simple example:

workflow:

on:
  workflow_dispatch:

jobs:
  job_a:
    runs-on: ubuntu-latest
    steps:
    - run: exit 1

  job_b:
    needs: job_a
    uses: ./.github/workflows/reusable.yml

reusable workflow:

on:
  workflow_call:
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - run: echo "Hello from reusable workflow"

job_b will always run despite the needs: statement, but it does wait for job_a to finish. It behaves like if: ${{ always() }} has been specified.

<!-- gh-comment-id:1712521992 --> @keathmilligan commented on GitHub (Sep 9, 2023): Here is a really simple example: workflow: ```yaml on: workflow_dispatch: jobs: job_a: runs-on: ubuntu-latest steps: - run: exit 1 job_b: needs: job_a uses: ./.github/workflows/reusable.yml ``` reusable workflow: ```yaml on: workflow_call: jobs: build: runs-on: ubuntu-latest steps: - run: echo "Hello from reusable workflow" ``` `job_b` will always run despite the `needs:` statement, but it does wait for job_a to finish. It behaves like `if: ${{ always() }}` has been specified.
Author
Owner

@github-actions[bot] commented on GitHub (Mar 8, 2024):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:1984817701 --> @github-actions[bot] commented on GitHub (Mar 8, 2024): Issue is stale and will be closed in 14 days unless there is new activity
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
starred/act#876
No description provided.