mirror of
https://code.forgejo.org/actions/cascading-pr.git
synced 2025-06-27 20:33:44 +00:00
run.sh also runs in the CI
This commit is contained in:
parent
84c728fdc5
commit
63ccad04bc
2 changed files with 20 additions and 6 deletions
19
tests/run.sh
19
tests/run.sh
|
@ -67,6 +67,17 @@ function create_pull_request() {
|
|||
forgejo-curl.sh api_json --data-raw '{"title":"PR","base":"main","head":"branch1"}' ${options[url]}/api/v1/repos/user1/originrepo/pulls
|
||||
}
|
||||
|
||||
function finalize_options() {
|
||||
if test -f forgejo-ip; then
|
||||
: ${options[host_port]:=$(cat forgejo-ip):3000}
|
||||
fi
|
||||
options[url]=http://${options[host_port]}
|
||||
if test -f forgejo-token; then
|
||||
: ${options[token]:=$(cat forgejo-token)}
|
||||
fi
|
||||
options[password]=admin1234
|
||||
}
|
||||
|
||||
function run() {
|
||||
user_create user2 user2@example.com
|
||||
forgejo-test-helper.sh push tests/destinationrepo http://user2:admin1234@${options[host_port]} user2 destinationrepo
|
||||
|
@ -76,19 +87,16 @@ function run() {
|
|||
user_secret user1 ORIGIN_TOKEN $(user_token user1 ORIGIN_TOKEN)
|
||||
user_secret user1 DESTINATION_TOKEN $(user_token user2 DESTINATION_TOKEN)
|
||||
|
||||
push_self
|
||||
|
||||
create_pull_request
|
||||
|
||||
push_self
|
||||
|
||||
echo do something
|
||||
}
|
||||
|
||||
function main() {
|
||||
local command=run
|
||||
options[host_port]=$(cat forgejo-ip):3000
|
||||
options[url]=http://${options[host_port]}
|
||||
options[token]=$(cat forgejo-token)
|
||||
options[password]=admin1234
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
|
@ -113,6 +121,7 @@ function main() {
|
|||
options[token]=$1
|
||||
;;
|
||||
*)
|
||||
finalize_options
|
||||
"${1:-run}"
|
||||
return 0
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue