Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit 506c770

Browse files
committed
Support rebase --autosquash
1 parent 6758c2a commit 506c770

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
.idea
1+
.idea
2+
*.iml

entrypoint.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,13 @@ git fetch origin $HEAD_BRANCH
7070

7171
# do the rebase
7272
git checkout -b $HEAD_BRANCH origin/$HEAD_BRANCH
73-
git rebase origin/$BASE_BRANCH
73+
74+
# Do an exact check instead of `rebase *` so it's not possible to inject malisios commands
75+
if [[ $(jq -r ".comment.body" "$GITHUB_EVENT_PATH" | grep -Fq "/rebase --autosquash") -eq 0 ]]; then
76+
git rebase --autosquash origin/$BASE_BRANCH
77+
else
78+
git rebase origin/$BASE_BRANCH
79+
fi
7480

7581
# push back
7682
git push --force-with-lease

0 commit comments

Comments
 (0)