actions: add test for reusable workflows (#839)

It is working although undocumented. It appears that Forgejo Actions users depend on it and breaking it would meet some non negligible push back. This test ensures that future Forgejo runner versions do not break what is working. This came to light because some fixes are necessary to the schema validation to allow for that to keep working (see https://code.forgejo.org/forgejo/act/pulls/194).

Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/839
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
Earl Warren 2025-07-26 11:23:39 +00:00 committed by earl-warren
parent 07654423c6
commit 47f50d3257
No known key found for this signature in database
GPG key ID: F128CBE6AB3A7201
3 changed files with 39 additions and 1 deletions

View file

@ -143,7 +143,7 @@ function test_actions() {
done
fi
for example in echo lxc config-options cache checkout service container expression local-action docker-action if if-fail push tag push-cancel artifacts pull-request context; do
for example in echo workflow-call lxc config-options cache checkout service container expression local-action docker-action if if-fail push tag push-cancel artifacts pull-request context; do
run actions_verify_example $example
done

View file

@ -0,0 +1,27 @@
on:
workflow_call:
inputs:
parameter1:
required: true
type: string
jobs:
callee:
runs-on: docker
container:
image: code.forgejo.org/oci/node:22-bookworm
volumes:
- /srv/example:/srv/example
steps:
- run: |
set -x
test "${{ inputs.parameter1 }}" = "value1"
- name: save event
run: |
d=/srv/example/push/contexts/$FORGEJO_EVENT_NAME
mkdir -p $d
cat > $d/github <<'EOF'
${{ toJSON(github) }}
EOF

View file

@ -0,0 +1,11 @@
on:
push:
jobs:
caller:
runs-on: docker
container:
image: code.forgejo.org/oci/node:22-bookworm
uses: ./.forgejo/workflows/reusable.yml
with:
parameter1: value1