mirror of
https://code.forgejo.org/actions/cascading-pr.git
synced 2025-06-29 13:23:44 +00:00
update HACKING instructions
This commit is contained in:
parent
28c365c695
commit
d92b2a7d3e
2 changed files with 21 additions and 7 deletions
14
tests/run.sh
14
tests/run.sh
|
@ -30,31 +30,31 @@ function user_curl() {
|
|||
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","read:user"]}' ${options[url]}/api/v1/users/$username/tokens | jq --raw-output .sha1 | tee $TMPDIR/$username/repo-token
|
||||
curl -sS -f -H Content-Type:application/json --user "$username:${options[password]}" --data '{"name":"'$name'","scopes":["write:repository","write:issue","read:user"]}' ${options[url]}/api/v1/users/$username/tokens | jq --raw-output .sha1 | tee $TMPDIR/$username/repo-token
|
||||
}
|
||||
|
||||
function user_secret() {
|
||||
local username=$1 name=$2 token=$3
|
||||
|
||||
user_curl $username api_json -X PUT --data-raw '{"data":"'$token'"}' ${options[url]}/api/v1/repos/user1/originrepo/actions/secrets/$name
|
||||
user_curl $username api_json -X PUT --data '{"data":"'$token'"}' ${options[url]}/api/v1/repos/user1/originrepo/actions/secrets/$name
|
||||
}
|
||||
|
||||
function user_create() {
|
||||
local username="$1" email="$2"
|
||||
forgejo-curl.sh api_json -X DELETE ${options[url]}/api/v1/admin/users/$username?purge=true >& /dev/null || true
|
||||
forgejo-curl.sh api_json --data-raw '{"username":"'$username'","email":"'$email'","password":"'${options[password]}'","must_change_password":false}' ${options[url]}/api/v1/admin/users
|
||||
forgejo-curl.sh api_json --data '{"username":"'$username'","email":"'$email'","password":"'${options[password]}'","must_change_password":false}' ${options[url]}/api/v1/admin/users
|
||||
user_login $username
|
||||
}
|
||||
|
||||
function close_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 PATCH --data-raw '{"state":"closed"}' ${options[url]}/api/v1/repos/user1/originrepo/issues/$pr
|
||||
forgejo-curl.sh api_json -X PATCH --data '{"state":"closed"}' ${options[url]}/api/v1/repos/user1/originrepo/issues/$pr
|
||||
done
|
||||
}
|
||||
|
||||
function merge_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 --data-raw '{"Do":"merge"}' ${options[url]}/api/v1/repos/user1/originrepo/pulls/$pr/merge
|
||||
forgejo-curl.sh api_json --data '{"Do":"merge"}' ${options[url]}/api/v1/repos/user1/originrepo/pulls/$pr/merge
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ function create_pull_request() {
|
|||
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
|
||||
forgejo-curl.sh api_json --data '{"new_branch_name":"branch1"}' ${options[url]}/api/v1/repos/user1/originrepo/branches
|
||||
(
|
||||
cd $TMPDIR
|
||||
rm -fr originrepo
|
||||
|
@ -78,7 +78,7 @@ function create_pull_request() {
|
|||
git rev-parse HEAD > ../originrepo.sha
|
||||
)
|
||||
|
||||
forgejo-curl.sh api_json --data-raw '{"title":"PR","base":"main","head":"branch1"}' ${options[url]}/api/v1/repos/user1/originrepo/pulls
|
||||
forgejo-curl.sh api_json --data '{"title":"PR","base":"main","head":"branch1"}' ${options[url]}/api/v1/repos/user1/originrepo/pulls
|
||||
}
|
||||
|
||||
function finalize_options() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue