mirror of
https://code.forgejo.org/actions/cascading-pr.git
synced 2025-06-27 20:33:44 +00:00
close cascading PR if the origin PR is closed
This commit is contained in:
parent
dd3807fb41
commit
657e223acc
3 changed files with 113 additions and 27 deletions
|
@ -1,6 +1,11 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
name: test
|
||||
on: [pull_request]
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- closed
|
||||
jobs:
|
||||
test:
|
||||
runs-on: docker
|
||||
|
|
10
tests/run.sh
10
tests/run.sh
|
@ -45,6 +45,12 @@ function user_create() {
|
|||
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
|
||||
done
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -93,6 +99,10 @@ function run() {
|
|||
create_pull_request
|
||||
|
||||
wait_success ${options[url]}/api/v1/repos/user1/originrepo $(cat $TMPDIR/originrepo.sha)
|
||||
|
||||
close_pull_request
|
||||
|
||||
wait_success ${options[url]}/api/v1/repos/user1/originrepo $(cat $TMPDIR/originrepo.sha)
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue