name: Conditional Variables description: | 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 rule evaluation. Example: 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_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 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 rules id: evaluate shell: bash env: CONTEXT: ${{ inputs.context }} RULES: ${{ inputs.rules }} FAIL_ON_NO_MATCH: ${{ inputs.fail-on-no-match }} run: | "${{ github.action_path }}/evaluate.sh"