mirror of
https://code.forgejo.org/actions/cascading-pr
synced 2025-03-15 14:54:40 +01:00
create the pull request
This commit is contained in:
parent
2892041d6c
commit
2de0a1208c
1 changed files with 24 additions and 0 deletions
24
tests/run.sh
24
tests/run.sh
|
@ -50,6 +50,28 @@ function user_create() {
|
||||||
user_login $username
|
user_login $username
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function create_pull_request() {
|
||||||
|
forgejo-curl.sh api_json ${options[url]}/api/v1/repos/user1/originrepo/pulls | jq --raw-output '.[] | .number' | while read pr ; do
|
||||||
|
forgejo-curl.sh api_json -X DELETE ${options[url]}/api/v1/repos/user1/originrepo/issues/$pr
|
||||||
|
done
|
||||||
|
forgejo-curl.sh api_json -X DELETE ${options[url]}/api/v1/repos/user1/originrepo/branches/branch1 >& /dev/null || true
|
||||||
|
forgejo-curl.sh api_json --data-raw '{"new_branch_name":"branch1"}' ${options[url]}/api/v1/repos/user1/originrepo/branches
|
||||||
|
(
|
||||||
|
cd $TMPDIR
|
||||||
|
rm -fr originrepo
|
||||||
|
git clone -b branch1 http://user1:admin1234@${options[host_port]}/user1/originrepo
|
||||||
|
cd originrepo
|
||||||
|
echo CONTENT > README
|
||||||
|
git config user.email root@example.com
|
||||||
|
git config user.name username
|
||||||
|
git add .
|
||||||
|
git commit -m 'update'
|
||||||
|
git push origin branch1
|
||||||
|
)
|
||||||
|
|
||||||
|
forgejo-curl.sh api_json --data-raw '{"title":"PR","base":"main","head":"branch1"}' ${options[url]}/api/v1/repos/user1/originrepo/pulls
|
||||||
|
}
|
||||||
|
|
||||||
function run() {
|
function run() {
|
||||||
user_create user2 user2@example.com
|
user_create user2 user2@example.com
|
||||||
forgejo-test-helper.sh push tests/destinationrepo http://user2:admin1234@${options[host_port]} user2 destinationrepo
|
forgejo-test-helper.sh push tests/destinationrepo http://user2:admin1234@${options[host_port]} user2 destinationrepo
|
||||||
|
@ -59,6 +81,8 @@ function run() {
|
||||||
user_secret user1 ORIGIN_TOKEN $(user_token user1 ORIGIN_TOKEN)
|
user_secret user1 ORIGIN_TOKEN $(user_token user1 ORIGIN_TOKEN)
|
||||||
user_secret user1 DESTINATION_TOKEN $(user_token user2 DESTINATION_TOKEN)
|
user_secret user1 DESTINATION_TOKEN $(user_token user2 DESTINATION_TOKEN)
|
||||||
|
|
||||||
|
create_pull_request
|
||||||
|
|
||||||
push_self ${options[host_port]}
|
push_self ${options[host_port]}
|
||||||
|
|
||||||
echo do something
|
echo do something
|
||||||
|
|
Loading…
Add table
Reference in a new issue