Skip to content

Commit

Permalink
fix: handling of boolean input
Browse files Browse the repository at this point in the history
all inputs are strings even though their yaml definition suggests that
they may of other types too. see actions/toolkit#361
  • Loading branch information
simoneb committed Mar 4, 2021
1 parent 8afc7f5 commit afbe82b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "github-action-merge-dependabot",
"version": "1.2.0",
"version": "1.2.1",
"description": "",
"main": "src/index.js",
"scripts": {
Expand Down
8 changes: 5 additions & 3 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ const { logWarning } = require('./log')
const mergeMethods = {
merge: 'merge',
squash: 'squash',
rebase: 'rebase'
rebase: 'rebase',
}

const getMergeMethod = () => {
const input = core.getInput('merge-method')

if (!input || !mergeMethods[input]) {
logWarning('merge-method input is ignored because it is malformed, defaulting to `squash`.')
logWarning(
'merge-method input is ignored because it is malformed, defaulting to `squash`.'
)
return mergeMethods.squash
}

Expand All @@ -24,5 +26,5 @@ exports.getInputs = () => ({
MERGE_METHOD: getMergeMethod(),
EXCLUDE_PKGS: core.getInput('exclude') || [],
MERGE_COMMENT: core.getInput('merge-comment') || '',
APPROVE_ONLY: core.getInput('approve-only')
APPROVE_ONLY: /true/i.test(core.getInput('approve-only')),
})

0 comments on commit afbe82b

Please sign in to comment.