[GH-ISSUE #1035] Enhancement: Support Conditionals in Composite Actions #601

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

Originally created by @ajrice6713 on GitHub (Mar 11, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1035

Describe feature

Github added support for conditionals in composite actions in Nov 2021 but it does not seem they are supported in act.

Ex:

# ./action.yml
name: Composite Conditional Test
inputs: 
 my-input:
    description: '`a` or `b` - where to clone the api specs from'
    default: a
    required: false

runs: 
  using: composite
  steps: 
    - name: Check inputs 
      run: |
        echo '${{ inputs.file-source }}'
      shell: bash

    - name: check for a
      if: inputs.file-source == 'local'
      run: |
        echo 'you entered a'  
      shell: bash
    
    - name: check for b
      if: inputs.file-source == 'remote'
      run: |
        echo 'you entered b'
      shell: bash
# ./.github/workflows/test.yml

name: Test
on: [workflow_dispatch]
jobs:
  test:
    name: Test
    runs-on: ubuntu-latest
    steps: 
      - name: Checkout 
        uses: actions/checkout@v2 

      - name: Run Test
        uses: ./ 
        with: 
           my-input: b

Output:

b
you entered a
you entered b

It seems the conditionals are being ignored and that conditionals are not defined in the ActionRuns schema

Originally created by @ajrice6713 on GitHub (Mar 11, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1035 ## Describe feature Github added support for conditionals in composite actions in [Nov 2021](https://github.blog/changelog/2021-11-09-github-actions-conditional-execution-of-steps-in-actions/) but it does not seem they are supported in act. Ex: ```yml # ./action.yml name: Composite Conditional Test inputs: my-input: description: '`a` or `b` - where to clone the api specs from' default: a required: false runs: using: composite steps: - name: Check inputs run: | echo '${{ inputs.file-source }}' shell: bash - name: check for a if: inputs.file-source == 'local' run: | echo 'you entered a' shell: bash - name: check for b if: inputs.file-source == 'remote' run: | echo 'you entered b' shell: bash ``` ```yml # ./.github/workflows/test.yml name: Test on: [workflow_dispatch] jobs: test: name: Test runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Run Test uses: ./ with: my-input: b ``` Output: ```sh b you entered a you entered b ``` It seems the conditionals are being ignored and that conditionals are not defined in the [`ActionRuns` schema](https://github.com/nektos/act/blob/3db3c737230adc457e08a8d60b34458977d01e5c/pkg/model/action.go#L48)
kerem 2026-03-01 21:44:52 +03:00
Author
Owner

@ChristopherHX commented on GitHub (Mar 11, 2022):

This feature has been contributed by me ( https://github.com/nektos/act/pull/793 ), but still no beeing released.
Here you can find a snaphot of act with this feature: https://github.com/nektos/act/actions/runs/1924759934
I would keep this issue open until the next release.

<!-- gh-comment-id:1065635838 --> @ChristopherHX commented on GitHub (Mar 11, 2022): This feature has been contributed by me ( https://github.com/nektos/act/pull/793 ), but still no beeing released. Here you can find a snaphot of act with this feature: https://github.com/nektos/act/actions/runs/1924759934 I would keep this issue open until the next release.
Author
Owner

@ChristopherHX commented on GitHub (Mar 22, 2022):

Released in https://github.com/nektos/act/releases/tag/v0.2.26
github.action_status isn't available, just use success() and failure()

<!-- gh-comment-id:1075624696 --> @ChristopherHX commented on GitHub (Mar 22, 2022): Released in https://github.com/nektos/act/releases/tag/v0.2.26 `github.action_status` isn't available, just use `success()` and `failure()`
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#601
No description provided.