|
1 |
| -# 🚧 WORK IN PROGRESS. See [#1](https://github.com/gr2m/octoherd-script-use-pull-request-title-as-default-commit-message/pull/1) | [Preview](https://github.com/gr2m/octoherd-script-use-pull-request-title-as-default-commit-message/tree/initial-version) |
2 |
| - |
3 | 1 | # octoherd-script-use-pull-request-title-as-default-commit-message
|
4 | 2 |
|
5 |
| -> Enables use_squash_pr_title_as_default setting for repository |
| 3 | +> Enables `use_squash_pr_title_as_default` setting for repository |
| 4 | +
|
| 5 | +[](https://www.npmjs.com/package/octoherd-script-use-pull-request-title-as-default-commit-message) |
| 6 | +[](https://github.com/gr2m/octoherd-script-use-pull-request-title-as-default-commit-message/actions?query=workflow%3ATest+branch%3Amain) |
| 7 | + |
| 8 | +When merging a pull request using the <kbd>Squash and Merge</kbd> button, the default commit message depends on how many commits there are in the pull request. |
| 9 | + |
| 10 | +1. If there is a single commit, the commit message is used as the squash commit message. |
| 11 | +2. If there are multiple commits, the pull request titles is used as the default commit message. |
| 12 | + |
| 13 | +In May 2022, [GitHub introduced the "Default to PR title for squash merge commits" option](https://github.blog/changelog/2022-05-11-default-to-pr-titles-for-squash-merge-commit-messages/). This script enables this feature programmatically in all given repositories. |
| 14 | + |
| 15 | +## Usage |
| 16 | + |
| 17 | +Minimal usage |
| 18 | + |
| 19 | +```js |
| 20 | +npx octoherd-script-use-pull-request-title-as-default-commit-message |
| 21 | +``` |
| 22 | + |
| 23 | +Pass all options as CLI flags to avoid user prompts |
| 24 | + |
| 25 | +```js |
| 26 | +npx octoherd-script-use-pull-request-title-as-default-commit-message \ |
| 27 | + -T ghp_0123456789abcdefghjklmnopqrstuvwxyzA \ |
| 28 | + -R "gr2m/*" |
| 29 | +``` |
| 30 | + |
| 31 | +## Options |
| 32 | + |
| 33 | +| option | type | description | |
| 34 | +| ---------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 35 | +| `--octoherd-token`, `-T` | string | A personal access token ([create](https://github.com/settings/tokens/new?scopes=repo)). Script will create one if option is not set | |
| 36 | +| `--octoherd-repos`, `-R` | array of strings | One or multiple space-separated repositories in the form of `repo-owner/repo-name`. `repo-owner/*` will find all repositories for one owner. `*` will find all repositories the user has access to. Will prompt for repositories if not set | |
| 37 | +| `--octoherd-bypass-confirms` | boolean | Bypass prompts to confirm mutating requests | |
6 | 38 |
|
7 | 39 | ## Contributing
|
8 | 40 |
|
|
0 commit comments