Skip to content

Commit

Permalink
Add ability to change merge method
Browse files Browse the repository at this point in the history
* Add input option to action.yml, defining new possible  values and
  default value
* Read new input in JS and pass desired merge method to Oktokit
* Update documentation to highlight new input option

Re gr2m#25
  • Loading branch information
cbetta committed Oct 7, 2020
1 parent f129fbe commit 7e0d498
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -23,6 +23,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: gr2m/merge-schedule-action@v1.x
with:
# Merge method to use. Possible values are merge, squash or
# rebase. Default is merge.
merge_method: squash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
Expand Down
7 changes: 7 additions & 0 deletions action.yml
Expand Up @@ -6,3 +6,10 @@ branding:
runs:
using: "node12"
main: "dist/index.js"
inputs:
merge_method:
description: |-
Merge method to use. Possible values are `merge`, `squash` or
`rebase`. Default is `merge`.
required: false
default: merge
3 changes: 3 additions & 0 deletions lib/handle_schedule.js
Expand Up @@ -12,6 +12,8 @@ async function handleSchedule() {

const eventPayload = require(process.env.GITHUB_EVENT_PATH);

const mergeMethod = process.env.INPUT_MERGE_METHOD

core.info(`Loading open pull request`);
const pullRequests = await octokit.paginate(
"GET /repos/:owner/:repo/pulls",
Expand Down Expand Up @@ -56,6 +58,7 @@ async function handleSchedule() {
owner,
repo,
pull_number: pullRequest.number,
merge_method: mergeMethod
});

// find check runs by the Merge schedule action
Expand Down

0 comments on commit 7e0d498

Please sign in to comment.