mirror of
https://code.forgejo.org/actions/cascading-pr.git
synced 2025-06-28 04:43:44 +00:00
cascading-pr.sh login both repos
This commit is contained in:
parent
007e34c709
commit
71281446ea
7 changed files with 52 additions and 16 deletions
|
@ -4,12 +4,31 @@
|
|||
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
source $SELF_DIR/cascading-pr-lib.sh
|
||||
|
||||
trap "rm -fr $TMPDIR" EXIT
|
||||
|
||||
function repo_login() {
|
||||
local repo="$1"
|
||||
(
|
||||
export DOT=$TMPDIR/$repo
|
||||
forgejo-curl.sh logout
|
||||
forgejo-curl.sh --token "${options[destination_token]}" login "${options[destination_url]}"
|
||||
)
|
||||
}
|
||||
|
||||
function repo_curl() {
|
||||
local repo=$1
|
||||
shift
|
||||
DOT=$TMPDIR/$repo forgejo-curl.sh "$@"
|
||||
}
|
||||
|
||||
function run() {
|
||||
options[origin_host_port]=$(host_port ${options[origin_url]})
|
||||
options[destination_host_port]=$(host_port ${options[destination_url]})
|
||||
: ${options[prefix]:=${options[origin_repo]}}
|
||||
|
||||
# login destination
|
||||
|
||||
repo_login ${options[destination_repo]}
|
||||
repo_login ${options[origin_repo]}
|
||||
|
||||
# open a PR on destination
|
||||
# checkout the head of the PR
|
||||
# update the PR
|
||||
|
@ -31,34 +50,48 @@ function main() {
|
|||
--origin-url)
|
||||
shift
|
||||
options[origin_url]=$1
|
||||
shift
|
||||
;;
|
||||
--origin-repo)
|
||||
shift
|
||||
options[origin_repo]=$1
|
||||
shift
|
||||
;;
|
||||
--origin-token)
|
||||
shift
|
||||
options[origin_token]=$1
|
||||
shift
|
||||
;;
|
||||
--destination-url)
|
||||
shift
|
||||
options[destination_url]=$1
|
||||
shift
|
||||
;;
|
||||
--destination-repo)
|
||||
shift
|
||||
options[destination_repo]=$1
|
||||
shift
|
||||
;;
|
||||
--destination-token)
|
||||
shift
|
||||
options[destination_token]=$1
|
||||
shift
|
||||
;;
|
||||
--destination-branch)
|
||||
shift
|
||||
options[destination_branch]=$1
|
||||
shift
|
||||
;;
|
||||
--update)
|
||||
shift
|
||||
options[update]=$1
|
||||
shift
|
||||
;;
|
||||
--prefix)
|
||||
shift
|
||||
options[prefix]=$1
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
"${1:-run}"
|
||||
return 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue