test 1
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
f60fb4b65d
commit
e37ea1f785
2 changed files with 58 additions and 0 deletions
35
.forgejo/workflows/reusable.yml
Normal file
35
.forgejo/workflows/reusable.yml
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
parameter1:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
outputs:
|
||||||
|
output1:
|
||||||
|
value: ${{ jobs.callee.outputs.job-output }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
callee:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: data.forgejo.org/oci/node:22-bookworm
|
||||||
|
volumes:
|
||||||
|
- /srv/example:/srv/example
|
||||||
|
outputs:
|
||||||
|
job-output: ${{ steps.stepwithoutput.outputs.myvalue }}
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- id: stepwithoutput
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
test "${{ inputs.parameter1 }}" = "value1"
|
||||||
|
test "${{ secrets.secret }}" = "keep_it_private"
|
||||||
|
echo "myvalue=outputvalue1" >> $FORGEJO_OUTPUT
|
||||||
|
|
||||||
|
- name: save event
|
||||||
|
run: |
|
||||||
|
d=/srv/example/push/contexts/$FORGEJO_EVENT_NAME
|
||||||
|
mkdir -p $d
|
||||||
|
cat > $d/github <<'EOF'
|
||||||
|
${{ toJSON(github) }}
|
||||||
|
EOF
|
||||||
23
.forgejo/workflows/test.yml
Normal file
23
.forgejo/workflows/test.yml
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
caller:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: data.forgejo.org/oci/node:22-bookworm
|
||||||
|
uses: ./.forgejo/workflows/reusable.yml
|
||||||
|
with:
|
||||||
|
parameter1: value1
|
||||||
|
secrets:
|
||||||
|
secret: keep_it_private
|
||||||
|
|
||||||
|
verify:
|
||||||
|
needs: [caller]
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: data.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