{"id":13532732,"url":"https://github.com/tibdex/autosquash","last_synced_at":"2025-04-01T21:30:52.692Z","repository":{"id":49318112,"uuid":"213162462","full_name":"tibdex/autosquash","owner":"tibdex","description":":package: GitHub Action to update PRs with outdated checks and squash and merge the ones matching all branch protections","archived":true,"fork":false,"pushed_at":"2021-04-05T09:54:16.000Z","size":632,"stargazers_count":142,"open_issues_count":5,"forks_count":24,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-24T06:45:58.184Z","etag":null,"topics":["github-action","javascript-github-action","pull-requests","squash-and-merge"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tibdex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-06T12:14:20.000Z","updated_at":"2025-01-06T23:10:54.000Z","dependencies_parsed_at":"2023-01-04T13:20:52.550Z","dependency_job_id":null,"html_url":"https://github.com/tibdex/autosquash","commit_stats":{"total_commits":32,"total_committers":7,"mean_commits":4.571428571428571,"dds":0.46875,"last_synced_commit":"de9b409e1f232d63c05484929c935117909134fa"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tibdex%2Fautosquash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tibdex%2Fautosquash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tibdex%2Fautosquash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tibdex%2Fautosquash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tibdex","download_url":"https://codeload.github.com/tibdex/autosquash/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246712949,"owners_count":20821822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-action","javascript-github-action","pull-requests","squash-and-merge"],"created_at":"2024-08-01T07:01:13.335Z","updated_at":"2025-04-01T21:30:52.239Z","avatar_url":"https://github.com/tibdex.png","language":"TypeScript","funding_links":[],"categories":["Community Resources"],"sub_categories":["Pull Requests"],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"assets/autosquash.png\" height=\"250\" width=\"250\" alt=\"Autosquash logo; adapted from https://dribbble.com/shots/2767743-WALL-E\"/\u003e\n  \u003cp\u003eAutosquash\u003c/p\u003e\n\u003c/h1\u003e\n\nAutosquash automatically updates and merges your pull requests.\n\nAutosquash is a simple and opinionated [JavaScript GitHub action](https://help.github.com/en/articles/about-actions#javascript-actions) integrating especially well in repositories with [branch protections](https://help.github.com/en/articles/about-protected-branches) with [strict status checks](https://help.github.com/en/articles/types-of-required-status-checks) protecting against [semantic conflicts](https://bors.tech/essay/2017/02/02/pitch/).\n\nPull requests with the `autosquash` label will be:\n\n- [updated](https://developer.github.com/changes/2019-05-29-update-branch-api/) when new commits land on their base branch and make their status checks outdated.\n- [squashed and merged](https://help.github.com/en/articles/about-pull-request-merges#squash-and-merge-your-pull-request-commits) once all the branch protections are respected:\n  - The description of the pull request, up to its first [thematic break](https://github.github.com/gfm/#thematic-breaks), will become the message of the squashed commit.\n  - The creator of the pull request will be the main author of the squashed commit.\n    If other people authored commits in the pull request, they will be added as [co-authors](https://github.blog/changelog/2019-12-19-improved-attribution-when-squashing-commits/) of the squashed commit.\n\n# Maintenance update\n\nFocus has shifted to the development of [Auto-update](https://github.com/tibdex/auto-update), the successor of Autosquash.\n\nIndeed, GitHub now supports [pull request auto-merge](https://github.blog/changelog/2021-02-04-pull-request-auto-merge-is-now-generally-available/) out of the box.\nThe only thing not taken care of by GitHub (yet) is automatically [updating a pull request when its base branch receives new commits](https://developer.github.com/changes/2019-05-29-update-branch-api/) and that's exactly what [Auto-update](https://github.com/tibdex/auto-update) does.\n\n# Usage\n\n- Add this [.github/workflows/autosquash.yml](.github/workflows/autosquash.yml) to your repository.\n- [Add the `autosquash` label](https://help.github.com/en/articles/creating-a-label) to pull requests you want to merge.\n\n# Why squash and merge?\n\nAutosquash favors squash and merge over regular merge or rebase and merge for the following reasons:\n\n## GitHub is merge oriented rather than rebase oriented\n\nGitHub handles merge commits graciously.\nIndeed, it has a [web interface for resolving merge conflicts](https://help.github.com/en/articles/resolving-a-merge-conflict-on-github) and it helps the reviewer not wasting time reviewing conflict-free merge commits by displaying this:\n\n![](assets/clean-merge.png)\n\nOn the other hand, rebasing a pull request rewrites its Git history and GitHub doesn't like that.\nFor instance, clicking on a notification concerning changes in a pull request with rewritten history will give you this:\n\n![](assets/disappeared.png)\n\nThe same thing will happen if you click on the file link of a [line comment](https://help.github.com/en/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request) but the pull request was rebased since the comment was posted.\n\nAnother minor inconvenience with rebase and merge is that it's harder, when looking at the list of `main` commits, to know which commit comes from which pull request.\nYou have to go to the actual commit page for GitHub to show you which pull request had it.\nWith regular merge or squash and merge, GitHub adds a pull request link in the commit title so the pull request is always a single click away from the list of commits.\n\n`git rebase` and `git push --force` are useful when prototyping a feature locally.\nThey also allow to create a pull request with a clean initial Git history.\nBut once you ask for a review and start collaborating on a pull request, it's best to stop using these commands.\n\nThis eliminates the rebase and merge option and leaves us with the regular merge or squash and merge ones.\n\n## The pull request is the unit of change\n\nIt's nice to make small and atomic commits inside a big pull request but it's even nicer to make small and atomic pull requests.\n\nThe pull request is the unit of change:\n\n- It is reviewed as a whole.\n  All the commits have to be reviewed and approved since it's their aggregated changes that will be applied to `main` when merged.\n- It is tested as a whole.\n  CI providers only test the pull request's head commit.\n  It's the only one guaranteed to not break the build and the tests.\n  All the intermediate commits, as carefully crafted as they may be, might break `git bisect` if they land individually on `main`.\n\nBy the time a pull request is ready to be merged, its Git history will often contain commits addressing review comments, fixing tests, typos, or code formatting.\nThere is no point in making these commits part of `main`'s history.\nWe would rather gather all the pull request's commits into a single cohesive commit and put it on top of `main`.\nAnd that's where the Autosquash [WALL·E inspired](https://www.youtube.com/watch?v=WB8LrCWmGYw) logo and :package: emoji come from!\n\nThe regular merge option doesn't help keeping `main`'s history clean, so we're only left with the squash and merge one.\n\n## Read more\n\n- [Two years of squash merge](https://blog.dnsimple.com/2019/01/two-years-of-squash-merge/)\n- [Utter disregard for Git commit history](https://zachholman.com/posts/git-commit-history/)\n- [How to split pull requests](https://www.thedroidsonroids.com/blog/splitting-pull-request)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftibdex%2Fautosquash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftibdex%2Fautosquash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftibdex%2Fautosquash/lists"}