mirror of
https://code.forgejo.org/actions/setup-forgejo.git
synced 2024-11-23 20:40:59 -05:00
do not try to replace SELF if there are not workflows
This commit is contained in:
parent
5e74823706
commit
ed3687d21a
2 changed files with 14 additions and 7 deletions
15
action.yml
15
action.yml
|
@ -5,21 +5,24 @@ description: |
|
||||||
|
|
||||||
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 }}`
|
||||||
|
|
||||||
* 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
|
* `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`.
|
||||||
|
* `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.
|
||||||
|
|
||||||
This combination allows to run Forgejo Actions workflows from
|
The combination of `push_self_action` and `run_workflow` allows to
|
||||||
`testrepo` that use the action under test (`myaction`) to verify it
|
run Forgejo Actions workflows from `testrepo` that use the action
|
||||||
works as intended.
|
under test (`myaction`) to verify it works as intended.
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
image:
|
image:
|
||||||
|
|
|
@ -48,7 +48,11 @@ function push() {
|
||||||
|
|
||||||
local dir="$DIR/$project"
|
local dir="$DIR/$project"
|
||||||
rsync -a $directory/ $dir/
|
rsync -a $directory/ $dir/
|
||||||
sed -i -e "s|SELF|$url/$owner/$self_action|" $dir/.forgejo/workflows/*.yml
|
|
||||||
|
local workflows=$dir/.forgejo/workflows/*.yml
|
||||||
|
if test "$(echo $workflows)" != "$workflows"; then
|
||||||
|
sed -i -e "s|SELF|$url/$owner/$self_action|" $dir/.forgejo/workflows/*.yml
|
||||||
|
fi
|
||||||
(
|
(
|
||||||
cd $dir
|
cd $dir
|
||||||
git init
|
git init
|
||||||
|
|
Loading…
Reference in a new issue