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:
parent
07654423c6
commit
47f50d3257
3 changed files with 39 additions and 1 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
11
actions/example-workflow-call/.forgejo/workflows/test.yml
Normal file
11
actions/example-workflow-call/.forgejo/workflows/test.yml
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue