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
|
@ -1,3 +1,15 @@
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# https://code.forgejo.org/forgejo/end-to-end/settings/actions
|
||||||
|
#
|
||||||
|
# secrets.CASCADE_DOCS_ORIGIN_TOKEN
|
||||||
|
# https://code.forgejo.org/forgejo-ci scope write:issue, read:repository, read:user
|
||||||
|
# vars.CASCADE_DOCS_DESTINATION_DOER
|
||||||
|
# forgejo-cascading-pr (https://codeberg.org/forgejo-cascading-pr)
|
||||||
|
# secrets.CASCADE_DOCS_DESTINATION_TOKEN
|
||||||
|
# https://codeberg.org/forgejo-cascading-pr scope write:issue, write:repository, read:user
|
||||||
|
#
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
|
@ -11,6 +23,7 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
info:
|
info:
|
||||||
- version: v1.22
|
- version: v1.22
|
||||||
|
branch: next
|
||||||
forgejo: https://codeberg.org
|
forgejo: https://codeberg.org
|
||||||
repo: forgejo-experimental/forgejo
|
repo: forgejo-experimental/forgejo
|
||||||
tests: ${{ vars.V1_22_TESTS }}
|
tests: ${{ vars.V1_22_TESTS }}
|
||||||
|
@ -29,7 +42,9 @@ jobs:
|
||||||
with:
|
with:
|
||||||
install-only: true
|
install-only: true
|
||||||
|
|
||||||
- if: matrix.info.tests != 'none'
|
- name: run
|
||||||
|
id: run
|
||||||
|
if: matrix.info.tests != 'none'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -x
|
set -x
|
||||||
|
@ -41,3 +56,22 @@ jobs:
|
||||||
chown forgejo $DIR /srv
|
chown forgejo $DIR /srv
|
||||||
|
|
||||||
su -c "actions/run.sh $binary $full_version ${{ matrix.info.version }} ${{ matrix.info.tests }}" forgejo
|
su -c "actions/run.sh $binary $full_version ${{ matrix.info.version }} ${{ matrix.info.tests }}" forgejo
|
||||||
|
|
||||||
|
echo full_version="$full_version" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: update documentation
|
||||||
|
if: matrix.info.version == 'v1.21' && matrix.info.tests != 'none' && github.ref == 'refs/heads/main'
|
||||||
|
uses: https://code.forgejo.org/actions/cascading-pr@v1
|
||||||
|
with:
|
||||||
|
origin-url: ${{ env.GITHUB_SERVER_URL }}
|
||||||
|
origin-repo: ${{ github.repository }}
|
||||||
|
origin-token: ${{ secrets.CASCADE_DOCS_ORIGIN_TOKEN }}
|
||||||
|
origin-ref: refs/heads/main
|
||||||
|
destination-url: https://codeberg.org
|
||||||
|
destination-fork-repo: ${{ vars.CASCADE_DOCS_DESTINATION_DOER }}/docs
|
||||||
|
destination-repo: forgejo/docs
|
||||||
|
destination-branch: ${{ matrix.info.branch || matrix.info.version }}
|
||||||
|
destination-token: ${{ secrets.CASCADE_DOCS_DESTINATION_TOKEN }}
|
||||||
|
update: .forgejo/cascading-docs
|
||||||
|
env:
|
||||||
|
VERSION: "${{ steps.run.outputs.full_version }}"
|
||||||
|
|
|
@ -133,10 +133,10 @@ jobs:
|
||||||
|
|
||||||
- name: save event
|
- name: save event
|
||||||
run: |
|
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
|
mkdir -p $d
|
||||||
cat > $d/event <<'EOF'
|
cat > $d/github <<'EOF'
|
||||||
${{ toJSON(github.event) }}
|
${{ toJSON(github) }}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
test -d $d/fork-org/pull_request/opened
|
c=$d/contexts
|
||||||
test -d $d/fork-org/pull_request_target/opened
|
|
||||||
test -d $d/root/pull_request/opened
|
test opened = "$(jq -r .event.action < $c/fork-org/pull_request/github)"
|
||||||
test -d $d/root/pull_request_target/opened
|
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
|
for assert in $EXAMPLE_DIR/assert-*.sh ; do
|
||||||
if ! forgejo.sh retry $assert ; then
|
if ! forgejo.sh retry $assert ; then
|
||||||
find $d
|
find $d
|
||||||
cat $FORGEJO_RUNNER_LOGS
|
sed -e 's/^/[RUNNER LOGS]/' < $FORGEJO_RUNNER_LOGS
|
||||||
false
|
false
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
@ -41,6 +42,15 @@ function examples_v1_22() {
|
||||||
examples_v1_21
|
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() {
|
function cleanup_example_volume() {
|
||||||
if ! test -d /srv/example ; then
|
if ! test -d /srv/example ; then
|
||||||
mkdir -p /srv/example
|
mkdir -p /srv/example
|
||||||
|
@ -109,6 +119,7 @@ function main() {
|
||||||
false
|
false
|
||||||
fi
|
fi
|
||||||
echo "======================== END example-$example ==================="
|
echo "======================== END example-$example ==================="
|
||||||
|
save_contexts $example
|
||||||
cleanup_example_volume
|
cleanup_example_volume
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue