Skip to content

Instantly share code, notes, and snippets.

@pwo3
Created September 24, 2020 07:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pwo3/21d954419a7baadcb9268ba07b67d913 to your computer and use it in GitHub Desktop.
Save pwo3/21d954419a7baadcb9268ba07b67d913 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