Skip to content

Instantly share code, notes, and snippets.

@zengqingfu1442
Forked from pwo3/auto-rebase.sh
Created January 25, 2022 02:35
Show Gist options
  • Save zengqingfu1442/d2808ce39880000a7e2800a8a0a2bd05 to your computer and use it in GitHub Desktop.
Save zengqingfu1442/d2808ce39880000a7e2800a8a0a2bd05 to your computer and use it in GitHub Desktop.
auto-rebase.sh
#!/bin/bash
gitlab_base_url=https://gitlab.com/api/v4/projects
opened_merge_requests=$(curl -H "Authorization: Bearer $GITLAB_PERSONAL_TOKEN" $gitlab_base_url/"$PROJECT_ID"/merge_requests?state=opened)
for iid in $(echo "$opened_merge_requests" | jq '.[] | .iid'); do
curl -X PUT -H "Authorization: Bearer $GITLAB_PERSONAL_TOKEN" $gitlab_base_url/"$PROJECT_ID"/merge_requests/"$iid"/rebase
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment