Skip to content

Commit 7620005

Browse files
authored
Merge pull request #17 from diogotcorreia/stash-rebase
Add ability to stash and rebase in addition to merge
2 parents 6dab34d + dc35c91 commit 7620005

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,19 @@ packages/documentation/copy/es/**/*.ts @KingDarBoja [translate] [es]
7474

7575
## Config
7676

77-
There is only one option available ATM, `cwd` which can be used to determine the root folder to look for CODEOWNER files in:
77+
There are only two options available at the moment:
78+
79+
- `cwd`, which can be used to determine the root folder to look for CODEOWNER files in.
80+
- `merge_method`, which can be `merge` (default), `squash` or `rebase`, depending on what you want the action to do.
7881

7982
```yml
8083
- name: Run Codeowners merge check
8184
uses: OSS-Docs-Tools/code-owner-self-merge@v1
8285
env:
8386
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84-
with:
87+
with:
8588
cwd: './docs'
89+
merge_method: 'squash'
8690
```
8791

8892
### Dev

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ inputs:
1010
cwd:
1111
description: 'The path to the root folder where it should look for code owners'
1212
default: ''
13+
merge_method:
14+
description: "The merge strategy to use: 'merge', 'squash' or 'rebase'"
15+
default: 'merge'
1316

1417
runs:
1518
using: 'node12'

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ async function mergeIfLGTMAndHasAccess() {
139139

140140
core.info(`Creating comments and merging`)
141141
try {
142-
await octokit.pulls.merge({ ...thisRepo, pull_number: issue.number });
142+
// @ts-ignore
143+
await octokit.pulls.merge({ ...thisRepo, pull_number: issue.number, merge_method: core.getInput('merge_method') || 'merge' });
143144
await octokit.issues.createComment({ ...thisRepo, issue_number: issue.number, body: `Merging because @${sender} is a code-owner of all the changes - thanks!` });
144145
} catch (error) {
145146
await octokit.issues.createComment({ ...thisRepo, issue_number: issue.number, body: `There was an issue merging, maybe try again ${sender}.` });

0 commit comments

Comments
 (0)