actions: show how secrets & outputs work with workflow_call (#934)
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/934 Co-authored-by: Earl Warren <contact@earl-warren.org> Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
parent
6455896fd3
commit
44f2cf9cf1
2 changed files with 21 additions and 1 deletions
|
|
@ -4,6 +4,9 @@ on:
|
||||||
parameter1:
|
parameter1:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
outputs:
|
||||||
|
output1:
|
||||||
|
value: ${{ jobs.callee.outputs.job-output }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
callee:
|
callee:
|
||||||
|
|
@ -12,11 +15,16 @@ jobs:
|
||||||
image: code.forgejo.org/oci/node:22-bookworm
|
image: code.forgejo.org/oci/node:22-bookworm
|
||||||
volumes:
|
volumes:
|
||||||
- /srv/example:/srv/example
|
- /srv/example:/srv/example
|
||||||
|
outputs:
|
||||||
|
job-output: ${{ steps.stepwithoutput.outputs.myvalue }}
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- run: |
|
- id: stepwithoutput
|
||||||
|
run: |
|
||||||
set -x
|
set -x
|
||||||
test "${{ inputs.parameter1 }}" = "value1"
|
test "${{ inputs.parameter1 }}" = "value1"
|
||||||
|
test "${{ secrets.secret }}" = "keep_it_private"
|
||||||
|
echo "myvalue=outputvalue1" >> $FORGEJO_OUTPUT
|
||||||
|
|
||||||
- name: save event
|
- name: save event
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
|
|
@ -9,3 +9,15 @@ jobs:
|
||||||
uses: ./.forgejo/workflows/reusable.yml
|
uses: ./.forgejo/workflows/reusable.yml
|
||||||
with:
|
with:
|
||||||
parameter1: value1
|
parameter1: value1
|
||||||
|
secrets:
|
||||||
|
secret: keep_it_private
|
||||||
|
|
||||||
|
verify:
|
||||||
|
needs: [caller]
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: code.forgejo.org/oci/node:22-bookworm
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
set -x
|
||||||
|
test "${{ needs.caller.outputs.output1 }}" = "outputvalue1"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue