mirror of
https://code.forgejo.org/actions/setup-forgejo.git
synced 2024-11-23 18:21:12 -05:00
set FORGEJO_TOKEN in test workflows
This commit is contained in:
parent
870dc58266
commit
b9dd7fd700
4 changed files with 14 additions and 8 deletions
|
@ -10,7 +10,7 @@ jobs:
|
|||
./forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo:1.19
|
||||
./forgejo-runner.sh setup
|
||||
export FORGEJO_RUNNER_LOGS=forgejo-runner.log
|
||||
./forgejo-test-helper.sh run_workflow testdata/demo http://root:admin1234@$(cat forgejo-ip):3000 root demo setup-forgejo > /tmp/output
|
||||
./forgejo-test-helper.sh run_workflow testdata/demo http://root:admin1234@$(cat forgejo-ip):3000 root demo setup-forgejo $(cat forgejo-token) > /tmp/output
|
||||
grep '^sha=' /tmp/output
|
||||
./forgejo-test-helper.sh push_self_action http://root:admin1234@$(cat forgejo-ip):3000 root setup-forgejo vTest
|
||||
./forgejo-test-helper.sh run_workflow testdata/sanity-checks http://root:admin1234@$(cat forgejo-ip):3000 root sanity-check setup-forgejo
|
||||
./forgejo-test-helper.sh run_workflow testdata/sanity-checks http://root:admin1234@$(cat forgejo-ip):3000 root sanity-check setup-forgejo $(cat forgejo-token)
|
||||
|
|
|
@ -8,17 +8,20 @@ Setup Forgejo and a runner.
|
|||
The forgejo-test-helper.sh script is available to help test and debug actions.
|
||||
|
||||
`forgejo=http://root:admin1234@${{ steps.forgejo.outputs.host-port }}`
|
||||
`token=${{ steps.forgejo.outputs.token }}`
|
||||
|
||||
* `forgejo-test-helper.sh push_self_action $forgejo root myaction vTest`
|
||||
Creates the repository `$forgejo/root/myaction` and populate it with the
|
||||
content of the repository under test, except for the `.forgejo` directory
|
||||
(it would otherwise create an infinite recursion loop). The tag `vTest` is
|
||||
set to the SHA under test.
|
||||
* `forgejo-test-helper.sh run_workflow testrepo $forgejo root testrepo myaction`
|
||||
* `forgejo-test-helper.sh run_workflow testrepo $forgejo root testrepo myaction $token`
|
||||
Create the repository `$forgejo/root/testrepo` and populate it with the
|
||||
content of the `testrepo` directory. All occurrences of `SELF` in
|
||||
`testrepo/.forgejo/workflows/*.yml` are replaced with `$forgejo/root/myaction`.
|
||||
* `forgejo-test-helper.sh push testrepo $forgejo root testrepo`
|
||||
All occurrences of `FORGEJO_TOKEN` `testrepo/.forgejo/workflows/*.yml`
|
||||
are replaced with `$token`.
|
||||
* `forgejo-test-helper.sh push testrepo $forgejo root testrepo $token`
|
||||
Create the repository `$forgejo/root/testrepo` and populate it with the
|
||||
content of the `testrepo` directory. The SHA of the tip of the repository
|
||||
is in the output, starting with `sha=`.
|
||||
|
@ -67,7 +70,7 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- id: forgejo
|
||||
uses: setup-forgejo@v1
|
||||
uses: actions/setup-forgejo@v1
|
||||
with:
|
||||
image-version: 1.19
|
||||
- run: |
|
||||
|
|
|
@ -45,6 +45,7 @@ function push() {
|
|||
local owner="$3"
|
||||
local project="$4"
|
||||
local self_action="$5"
|
||||
local token="$6"
|
||||
|
||||
local dir="$DIR/$project"
|
||||
rsync -a $directory/ $dir/
|
||||
|
@ -52,8 +53,8 @@ function push() {
|
|||
local workflows=$dir/.forgejo/workflows/*.yml
|
||||
if test "$(echo $workflows)" != "$workflows"; then
|
||||
sed -i \
|
||||
-e "s|SELF|$url/$owner/$self_action|" \
|
||||
-e "s|FORGEJO_URL|$url|" \
|
||||
-e "s|SELF|$url/$owner/$self_action|g" \
|
||||
-e "s|FORGEJO_TOKEN|$token|g" \
|
||||
$dir/.forgejo/workflows/*.yml
|
||||
fi
|
||||
(
|
||||
|
@ -78,8 +79,9 @@ function run_workflow() {
|
|||
local owner="$3"
|
||||
local project="$4"
|
||||
local self_action="$5"
|
||||
local token="$6"
|
||||
|
||||
push "$directory" "$url" "$owner" "$project" "$self_action"
|
||||
push "$directory" "$url" "$owner" "$project" "$self_action" "$token"
|
||||
wait_success "$url" "$owner/$project" $(cat $DIR/$project/SHA)
|
||||
}
|
||||
|
||||
|
|
|
@ -13,5 +13,6 @@ jobs:
|
|||
- run: |
|
||||
set -ex
|
||||
test "${{ steps.forgejo.outputs.token }}"
|
||||
test "FORGEJO_TOKEN" -a "FORGEJO_TOKEN" != F'O'RGEJO_TOKEN
|
||||
curl ${{ steps.forgejo.outputs.url }}/api/forgejo/v1/version | grep 1.19
|
||||
|
||||
|
|
Loading…
Reference in a new issue