actions: update the documentation with context examples
This commit is contained in:
parent
79cc059d98
commit
921ed6f481
5 changed files with 57 additions and 9 deletions
|
@ -133,10 +133,10 @@ jobs:
|
|||
|
||||
- name: save event
|
||||
run: |
|
||||
d=/srv/example/pull-request/${{ github.event.pull_request.head.repo.owner.username }}/$GITHUB_EVENT_NAME/${{ github.event.action }}
|
||||
d=/srv/example/pull-request/contexts/${{ github.event.pull_request.head.repo.owner.username }}/$GITHUB_EVENT_NAME
|
||||
mkdir -p $d
|
||||
cat > $d/event <<'EOF'
|
||||
${{ toJSON(github.event) }}
|
||||
cat > $d/github <<'EOF'
|
||||
${{ toJSON(github) }}
|
||||
EOF
|
||||
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
|
||||
set -ex
|
||||
|
||||
test -d $d/fork-org/pull_request/opened
|
||||
test -d $d/fork-org/pull_request_target/opened
|
||||
test -d $d/root/pull_request/opened
|
||||
test -d $d/root/pull_request_target/opened
|
||||
c=$d/contexts
|
||||
|
||||
test opened = "$(jq -r .event.action < $c/fork-org/pull_request/github)"
|
||||
test opened = "$(jq -r .event.action < $c/fork-org/pull_request_target/github)"
|
||||
|
||||
test opened = "$(jq -r .event.action < $c/root/pull_request/github)"
|
||||
test opened = "$(jq -r .event.action < $c/root/pull_request_target/github)"
|
||||
|
|
|
@ -48,7 +48,7 @@ function setup() {
|
|||
for assert in $EXAMPLE_DIR/assert-*.sh ; do
|
||||
if ! forgejo.sh retry $assert ; then
|
||||
find $d
|
||||
cat $FORGEJO_RUNNER_LOGS
|
||||
sed -e 's/^/[RUNNER LOGS]/' < $FORGEJO_RUNNER_LOGS
|
||||
false
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
|
@ -41,6 +42,15 @@ function examples_v1_22() {
|
|||
examples_v1_21
|
||||
}
|
||||
|
||||
function save_contexts() {
|
||||
local example="$1"
|
||||
|
||||
if test -d /srv/example/$example/contexts; then
|
||||
mkdir -p /srv/contexts
|
||||
rsync -av /srv/example/$example/contexts/ /srv/contexts/$example/
|
||||
fi
|
||||
}
|
||||
|
||||
function cleanup_example_volume() {
|
||||
if ! test -d /srv/example ; then
|
||||
mkdir -p /srv/example
|
||||
|
@ -109,6 +119,7 @@ function main() {
|
|||
false
|
||||
fi
|
||||
echo "======================== END example-$example ==================="
|
||||
save_contexts $example
|
||||
cleanup_example_volume
|
||||
done
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue