cascading-pr.sh login both repos

This commit is contained in:
Earl Warren 2023-10-12 15:12:52 +02:00
parent 007e34c709
commit 71281446ea
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
7 changed files with 52 additions and 16 deletions

View file

@ -8,11 +8,12 @@ jobs:
- uses: actions/checkout@v4
- uses: SELF@vTest
with:
origin-url: ${{ env.$GITHUB_SERVER_URL }}
origin-url: ${{ env.GITHUB_SERVER_URL }}
origin-repo: user1/originrepo
origin-token: ${{ secrets.ORIGIN_TOKEN }}
destination-url: ${{ env.$GITHUB_SERVER_URL }}
destination-url: ${{ env.GITHUB_SERVER_URL }}
destination-repo: user2/destinationrepo
destination-token: ${{ secrets.DESTINATION_TOKEN }}
destination-branch: main
update: upgraded
debug: true

View file

@ -4,13 +4,11 @@
set -e
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TMPDIR=/tmp/cascading-pr-test
source $SELF_DIR/../cascading-pr-lib.sh
TMPDIR=/tmp/cascading-pr
function push_self() {
local host_port=$1
forgejo-test-helper.sh push_self_action http://user1:admin1234@$host_port user1 cascading-pr vTest
forgejo-test-helper.sh push_self_action http://user1:admin1234@${options[host_port]} user1 cascading-pr vTest
}
function user_login() {
@ -25,16 +23,13 @@ function user_login() {
function user_curl() {
local username=$1
shift
(
export DOT=$TMPDIR/$username
forgejo-curl.sh "$@"
)
DOT=$TMPDIR/$username forgejo-curl.sh "$@"
}
function user_token() {
local username=$1 name=$2
curl -sS -f -H Content-Type:application/json --user "$username:${options[password]}" --data-raw '{"name":"'$name'","scopes":["write:repository","write:issue"]}' ${options[url]}/api/v1/users/$username/tokens | jq --raw-output .sha1
curl -sS -f -H Content-Type:application/json --user "$username:${options[password]}" --data-raw '{"name":"'$name'","scopes":["write:repository","write:issue"]}' ${options[url]}/api/v1/users/$username/tokens | jq --raw-output .sha1 | tee $TMPDIR/$username/token
}
function user_secret() {
@ -83,7 +78,7 @@ function run() {
create_pull_request
push_self ${options[host_port]}
push_self
echo do something
}