runner icon indicating copy to clipboard operation
runner copied to clipboard

continue-on-error on composite actions does not work with inputs variables.

Open rcmdnk opened this issue 2 years ago • 2 comments

Describe the bug When continue-on-error flag is used on composite actions, it seems the variables are passed to the composite actions and evaluated in there.

As a result, if the workflow uses the inputs variables for the continue-on-error, the variable is not recognized in the comoposite action.

To Reproduce Steps to reproduce the behavior:

  1. Make a compoosite action which fails: https://github.com/rcmdnk/fail-action/blob/81594b3cffd3dd376eb64c70d3a3b25c094cf64a/action.yml
  2. Make workflow like:
name: test

on:
  workflow_dispatch:
    inputs:
      continue:
        type: boolean
        required: false
        default: false
        
jobs:      
  test:
    runs-on: ubuntu-latest
    steps: 
      - name: check continue-on-error test 1
        continue-on-error: true
        run: exit 1
      - name: check continue-on-error with variable
        continue-on-error: ${{ github.event_name == 'workflow_dispatch' && inputs.continue }}
        run: exit 1
      - uses: rcmdnk/fail-action@main
        continue-on-error: true
      - uses: rcmdnk/fail-action@main
        continue-on-error: ${{ github.event_name == 'workflow_dispatch' && inputs.continue }}
      - name: last check
        run: ok
  1. Run the workflow manually by checking continue.

Expected behavior If inputs.continue is true, all steps must be executed.

Runner Version and Platform

ubuntu-latest, macos-12

What's not working?

The workflow stops before last check.

Job Log Output

The step continue-on-error flag with inputs.continue on uses: rcmdnk/fail-action@main shows error like:

##[debug]Expanded: (('workflow_dispatch' == 'workflow_dispatch') && null)
##[debug]Result: null
Error: .github/workflows/test.yml (Line: 24, Col: 28): Unexpected value ''
Error: The step failed and an error occurred when attempting to determine whether to continue on error.
Error: The template is not valid. .github/workflows/test.yml (Line: 24, Col: 28): Unexpected value ''
##[debug]GitHub.DistributedTask.ObjectTemplating.TemplateValidationException: The template is not valid. .github/workflows/test.yml (Line: 24, Col: 28): Unexpected value ''

and it stops there and last check is not executed.

Example run: https://github.com/rcmdnk/composite-continue-on-error-test/actions/runs/4095530933

rcmdnk avatar Feb 05 '23 07:02 rcmdnk

I wonder if its using the composite action's set of inputs instead? 🤔

As a potential workaround, you could try using github.event.inputs.continue here instead since you're trying to get a workflow-level input.

JamesMGreene avatar Apr 20 '23 16:04 JamesMGreene

Is this really solved? I can't get this to work in my pipeline yet

EDIT: This solution https://github.com/actions/runner/issues/1492 works 👍

vineethvijay7 avatar Apr 18 '24 11:04 vineethvijay7