Skip to content

Commit

Permalink
Merge pull request #17 from diogotcorreia/stash-rebase
Browse files Browse the repository at this point in the history
Add ability to stash and rebase in addition to merge
  • Loading branch information
orta authored Apr 5, 2021
2 parents 6dab34d + dc35c91 commit 7620005
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,19 @@ packages/documentation/copy/es/**/*.ts @KingDarBoja [translate] [es]

## Config

There is only one option available ATM, `cwd` which can be used to determine the root folder to look for CODEOWNER files in:
There are only two options available at the moment:

- `cwd`, which can be used to determine the root folder to look for CODEOWNER files in.
- `merge_method`, which can be `merge` (default), `squash` or `rebase`, depending on what you want the action to do.

```yml
- name: Run Codeowners merge check
uses: OSS-Docs-Tools/code-owner-self-merge@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
with:
cwd: './docs'
merge_method: 'squash'
```

### Dev
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ inputs:
cwd:
description: 'The path to the root folder where it should look for code owners'
default: ''
merge_method:
description: "The merge strategy to use: 'merge', 'squash' or 'rebase'"
default: 'merge'

runs:
using: 'node12'
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ async function mergeIfLGTMAndHasAccess() {

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

0 comments on commit 7620005

Please sign in to comment.