act/pkg/runner/testdata/.github/workflows/local-reusable-workflow.yml
Markus Wolf a8e05cded6
feat: allow to spawn and run a local reusable workflow (#1423)
* feat: allow to spawn and run a local reusable workflow

This change contains the ability to parse/plan/run a local
reusable workflow.
There are still numerous things missing:

- inputs
- secrets
- outputs

* feat: add workflow_call inputs

* test: improve inputs test

* feat: add input defaults

* feat: allow expressions in inputs

* feat: use context specific expression evaluator

* refactor: prepare for better re-usability

* feat: add secrets for reusable workflows

* test: use secrets during test run

* feat: handle reusable workflow outputs

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-12-15 16:45:22 +00:00

77 lines
2.1 KiB
YAML

name: reusable
on:
workflow_call:
inputs:
string_required:
required: true
type: string
string_optional:
required: false
type: string
default: string
bool_required:
required: true
type: boolean
bool_optional:
required: false
type: boolean
default: true
number_required:
required: true
type: number
number_optional:
required: false
type: number
default: ${{ 1 }}
outputs:
output:
description: "A workflow output"
value: ${{ jobs.reusable_workflow_job.outputs.output }}
jobs:
reusable_workflow_job:
runs-on: ubuntu-latest
steps:
- name: test required string
run: |
echo inputs.string_required=${{ inputs.string_required }}
[[ "${{ inputs.string_required == 'string' }}" = "true" ]] || exit 1
- name: test optional string
run: |
echo inputs.string_optional=${{ inputs.string_optional }}
[[ "${{ inputs.string_optional == 'string' }}" = "true" ]] || exit 1
- name: test required bool
run: |
echo inputs.bool_required=${{ inputs.bool_required }}
[[ "${{ inputs.bool_required }}" = "true" ]] || exit 1
- name: test optional bool
run: |
echo inputs.bool_optional=${{ inputs.bool_optional }}
[[ "${{ inputs.bool_optional }}" = "true" ]] || exit 1
- name: test required number
run: |
echo inputs.number_required=${{ inputs.number_required }}
[[ "${{ inputs.number_required == 1 }}" = "true" ]] || exit 1
- name: test optional number
run: |
echo inputs.number_optional=${{ inputs.number_optional }}
[[ "${{ inputs.number_optional == 1 }}" = "true" ]] || exit 1
- name: test secret
run: |
echo secrets.secret=${{ secrets.secret }}
[[ "${{ secrets.secret == 'keep_it_private' }}" = "true" ]] || exit 1
- name: test output
id: output_test
run: |
echo "value=${{ inputs.string_required }}" >> $GITHUB_OUTPUT
outputs:
output: ${{ steps.output_test.outputs.value }}