From 70be1879232873117b78813d0385b5a9d588a632 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Wed, 29 Mar 2023 23:33:49 +0200 Subject: [PATCH] echo the sha in the output --- .forgejo/workflows/integration.yml | 3 ++- action.yml | 3 ++- forgejo-test-helper.sh | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/integration.yml b/.forgejo/workflows/integration.yml index 8f1f2a3..5640e91 100644 --- a/.forgejo/workflows/integration.yml +++ b/.forgejo/workflows/integration.yml @@ -10,6 +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 + ./forgejo-test-helper.sh run_workflow testdata/demo http://root:admin1234@$(cat forgejo-ip):3000 root demo setup-forgejo > /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 diff --git a/action.yml b/action.yml index 48da173..061d693 100644 --- a/action.yml +++ b/action.yml @@ -18,7 +18,8 @@ description: | `testrepo/.forgejo/workflows/*.yml` are replaced with `$forgejo/root/myaction`. * `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. + content of the `testrepo` directory. The SHA of the tip of the repository + is in the output, starting with `sha=`. The combination of `push_self_action` and `run_workflow` allows to run Forgejo Actions workflows from `testrepo` that use the action diff --git a/forgejo-test-helper.sh b/forgejo-test-helper.sh index 3a3d884..bad0b6d 100755 --- a/forgejo-test-helper.sh +++ b/forgejo-test-helper.sh @@ -63,7 +63,9 @@ function push() { git commit -m 'initial commit' git remote add origin $url/$owner/$project git push --force -u origin main - git rev-parse HEAD > SHA + sha=$(git rev-parse HEAD) + echo $sha > SHA + echo sha=$sha ) }