Skip to content

Instantly share code, notes, and snippets.

@pwo3
pwo3 / .gitlab-ci.yml
Created September 24, 2020 07:39
.gitlab-ci.yml
image: node:14-alpine
stages:
- run
auto-rebase:
stage: run
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
script:
@pwo3
pwo3 / auto-rebase.sh
Created September 24, 2020 07:37
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