mirror of
https://github.com/sudoxnym/fdroiddata.git
synced 2026-07-13 17:51:43 +00:00
improve auto-merge.sh
This commit is contained in:
parent
84728f5d80
commit
f18b853466
1 changed files with 13 additions and 12 deletions
|
|
@ -6,19 +6,20 @@ cd "$(dirname "$(dirname "${BASH_SOURCE[0]}")")"
|
||||||
|
|
||||||
mr=$1
|
mr=$1
|
||||||
glab="glab --repo fdroid/fdroiddata"
|
glab="glab --repo fdroid/fdroiddata"
|
||||||
|
|
||||||
echo "Rebasing..."
|
echo "Rebasing..."
|
||||||
$glab mr rebase $mr --skip-ci
|
$glab mr rebase $mr --skip-ci
|
||||||
while [[ $($glab mr view $mr -F json | jq -r '.detailed_merge_status') != "mergeable" ]]; do
|
|
||||||
echo "Checking status..."
|
echo "Merging..."
|
||||||
|
while $glab mr merge $mr --auto-merge=false --rebase --yes; [[ $? != 0 ]]; do
|
||||||
continue
|
continue
|
||||||
done
|
done
|
||||||
echo "Merging..."
|
|
||||||
$glab mr merge $mr --auto-merge=false --rebase --yes && {
|
echo "Canceling pipelines..."
|
||||||
echo "Canceling pipelines..."
|
merged_commit=$($glab mr view $mr -F json | jq -r 'if .squash then .squash_commit_sha else .sha end')
|
||||||
merged_commit=$($glab mr view $mr -F json | jq -r 'if .squash then .squash_commit_sha else .sha end')
|
head_pipelines=$($glab ci list -F json | jq -r 'map(select(.sha == "'$merged_commit'" and (.source == "push" or .source == "merge_request_event")) | .id)[]')
|
||||||
head_pipelines=$($glab ci list -F json | jq -r 'map(select(.sha == "'$merged_commit'" and (.source == "push" or .source == "merge_request_event")) | .id)[]')
|
for pipeline in $head_pipelines; do
|
||||||
for pipeline in $head_pipelines; do
|
glab api --method POST --silent projects/:id/pipelines/$pipeline/cancel
|
||||||
glab api --method POST --silent projects/:id/pipelines/$pipeline/cancel
|
done
|
||||||
done
|
|
||||||
echo "Done!"
|
echo "Done!"
|
||||||
} || echo "Merge failed: https://gitlab.com/fdroid/fdroiddata/-/merge_requests/$mr"
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue