From 42078f52f652ca4c098ebba874cd4d0307c90f9e Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Thu, 30 Mar 2023 16:52:28 +0200 Subject: [PATCH] documentation and sanity check for tokens --- README.md | 7 ++----- forgejo-test-helper.sh | 5 +++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a63e1c8..6aaa822 100644 --- a/README.md +++ b/README.md @@ -8,20 +8,17 @@ 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 $token` +* `forgejo-test-helper.sh run_workflow testrepo $forgejo root testrepo myaction` 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`. - All occurrences of `FORGEJO_TOKEN` `testrepo/.forgejo/workflows/*.yml` - are replaced with `$token`. -* `forgejo-test-helper.sh push testrepo $forgejo root testrepo $token` +* `forgejo-test-helper.sh push testrepo $forgejo root testrepo` 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=`. diff --git a/forgejo-test-helper.sh b/forgejo-test-helper.sh index 64ee849..4a4b5cd 100755 --- a/forgejo-test-helper.sh +++ b/forgejo-test-helper.sh @@ -47,6 +47,11 @@ function push() { local self_action="$5" local token="$6" + if test -z "$token"; then + echo missing token argument + return 1 + fi + local dir="$DIR/$project" rsync -a $directory/ $dir/