update conditional variables
This commit is contained in:
@@ -1,45 +1,72 @@
|
||||
|
||||
name: Conditional Variables
|
||||
|
||||
description: |
|
||||
Evaluates a list of conditions and exposes variables as outputs.
|
||||
Conditions are evaluated in order. All matching conditions are applied.
|
||||
If multiple conditions set the same variable, the last matching value wins.
|
||||
Evaluates a set of rules and exposes variables as outputs.
|
||||
|
||||
Rules are evaluated in the order they are defined.
|
||||
|
||||
A rule matches when any of its conditions match the supplied context.
|
||||
|
||||
If multiple matching rules set the same variable,
|
||||
the last matching value wins.
|
||||
|
||||
inputs:
|
||||
context:
|
||||
description: |
|
||||
Context variables available during condition evaluation.
|
||||
|
||||
conditions:
|
||||
description: |
|
||||
List of conditions to evaluate.
|
||||
Context variables available during rule evaluation.
|
||||
|
||||
Example:
|
||||
|
||||
- when:
|
||||
branch:
|
||||
- 9.0-alpine-24
|
||||
- 9.0-alpine-23
|
||||
branch=9.0-alpine-24
|
||||
event=push
|
||||
install_something=1
|
||||
|
||||
required: true
|
||||
|
||||
rules:
|
||||
description: |
|
||||
Rules to evaluate.
|
||||
|
||||
Example:
|
||||
|
||||
- conditions:
|
||||
- branch == 9.0-alpine-24
|
||||
- branch == 9.0-alpine-23
|
||||
set:
|
||||
DOTNET_VERSION: 9.0
|
||||
DOTNET_VERSION=9.0
|
||||
DOTNET_RUNTIME_VERSION=9.0.18
|
||||
|
||||
- conditions:
|
||||
- install_something == 1
|
||||
set:
|
||||
INSTALL_DEPENDENCY=true
|
||||
|
||||
Conditions within a rule are evaluated as OR.
|
||||
|
||||
required: true
|
||||
|
||||
fail-on-no-match:
|
||||
description: |
|
||||
Fail the action when no condition matches.
|
||||
Fail the action if no rule matches.
|
||||
required: false
|
||||
default: "false"
|
||||
|
||||
outputs:
|
||||
matched:
|
||||
description: Indicates whether at least one rule matched.
|
||||
value: ${{ steps.evaluate.outputs.matched }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
||||
steps:
|
||||
- name: Evaluate conditions
|
||||
- name: Evaluate rules
|
||||
id: evaluate
|
||||
shell: bash
|
||||
env:
|
||||
CONTEXT: ${{ inputs.context }}
|
||||
CONDITIONS: ${{ inputs.conditions }}
|
||||
RULES: ${{ inputs.rules }}
|
||||
FAIL_ON_NO_MATCH: ${{ inputs.fail-on-no-match }}
|
||||
run: |
|
||||
"${{ github.action_path }}/evaluate.sh"
|
||||
"${{ github.action_path }}/evaluate.sh"
|
||||
|
||||
Reference in New Issue
Block a user