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

Autosquash #24

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Autosquash #24

wants to merge 5 commits into from

Conversation

fkorotkov
Copy link
Member

Fixes #20

@fkorotkov fkorotkov mentioned this pull request Nov 18, 2019
entrypoint.sh Outdated Show resolved Hide resolved
@fkorotkov fkorotkov closed this in fc8348c Dec 11, 2019
@marton78
Copy link

@fkorotkov was this closed on purpose? Didn't you mean to merge it instead?

@fkorotkov
Copy link
Member Author

It didn't work for me actually. You can try to use this branch via uses: cirrus-actions/rebase@autosquash (changed master to autosquash). Closed it until find a better way.

@ghost
Copy link

ghost commented Dec 25, 2019

rebase

@samholmes
Copy link
Contributor

Looks like the issue with this attempt was that it was missing the --interactive rebase flag. The --autosquash flag does not work outside of a interactive rebase. Luckily there is a hack around this: https://stackoverflow.com/questions/29094595/git-interactive-rebase-without-opening-the-editor In summary, the solution is to run the following to get a non-interactive autosquash rebase:

GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash origin/$BASE_BRANCH

I'll work on a PR for this, borrowing from this PR's branch.

@fkorotkov fkorotkov reopened this Jul 6, 2021
@fkorotkov
Copy link
Member Author

@samholmes thank you for the finding! I've rebased the branch. PTAL.

@samholmes
Copy link
Contributor

samholmes commented Jul 9, 2021

@fkorotkov Why not review my PRs changes? I'd appreciate the contributor recognition 😉

Looking at this PR some of my grips are with the fixup commits. There's no need to make a mistake, then fix the mistake in a separate commit unless the commit has already been merged to the base branch. The commits to this PR could use some rebasing to make a clean commit history.

Secondly, if you look closely at how I've implemented the feature, I intentionally chose to use action inputs to enable or disable autosquash; this allows for the user of this action to decide on what event will trigger the action with the autosquash input (paramater). For example, one could choose to trigger this action on the pull_request_review event to automatically rebase and auto-squash when the PR is approved.


# Do an exact check instead of `rebase *` so it's not possible to inject malicious commands
if [[ $(jq -r ".comment.body" "$GITHUB_EVENT_PATH" | grep -Fq "/rebase --autosquash") -eq 0 ]]; then
git rebase --interactive --autosquash origin/$BASE_BRANCH
Copy link

@grepsedawk grepsedawk Oct 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to use the interactive flag here, that will pop open an editor and expect "user input"
Edit: nevermind re-read

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support --autosquash
5 participants