documentation and sanity check for tokens

This commit is contained in:
Earl Warren 2023-03-30 16:52:28 +02:00
parent b9dd7fd700
commit 42078f52f6
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 7 additions and 5 deletions

View file

@ -8,20 +8,17 @@ Setup Forgejo and a runner.
The forgejo-test-helper.sh script is available to help test and debug actions. The forgejo-test-helper.sh script is available to help test and debug actions.
`forgejo=http://root:admin1234@${{ steps.forgejo.outputs.host-port }}` `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` * `forgejo-test-helper.sh push_self_action $forgejo root myaction vTest`
Creates the repository `$forgejo/root/myaction` and populate it with the Creates the repository `$forgejo/root/myaction` and populate it with the
content of the repository under test, except for the `.forgejo` directory content of the repository under test, except for the `.forgejo` directory
(it would otherwise create an infinite recursion loop). The tag `vTest` is (it would otherwise create an infinite recursion loop). The tag `vTest` is
set to the SHA under test. set to the SHA under test.
* `forgejo-test-helper.sh run_workflow testrepo $forgejo root testrepo myaction $token` * `forgejo-test-helper.sh run_workflow testrepo $forgejo root testrepo myaction`
Create the repository `$forgejo/root/testrepo` and populate it with the Create the repository `$forgejo/root/testrepo` and populate it with the
content of the `testrepo` directory. All occurrences of `SELF` in content of the `testrepo` directory. All occurrences of `SELF` in
`testrepo/.forgejo/workflows/*.yml` are replaced with `$forgejo/root/myaction`. `testrepo/.forgejo/workflows/*.yml` are replaced with `$forgejo/root/myaction`.
All occurrences of `FORGEJO_TOKEN` `testrepo/.forgejo/workflows/*.yml` * `forgejo-test-helper.sh push testrepo $forgejo root testrepo`
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 Create the repository `$forgejo/root/testrepo` and populate it with the
content of the `testrepo` directory. The SHA of the tip of the repository content of the `testrepo` directory. The SHA of the tip of the repository
is in the output, starting with `sha=`. is in the output, starting with `sha=`.

View file

@ -47,6 +47,11 @@ function push() {
local self_action="$5" local self_action="$5"
local token="$6" local token="$6"
if test -z "$token"; then
echo missing token argument
return 1
fi
local dir="$DIR/$project" local dir="$DIR/$project"
rsync -a $directory/ $dir/ rsync -a $directory/ $dir/