Skip to content

Commit

Permalink
action.*: configurable assignees and hotwords, + hotwords_enabled key…
Browse files Browse the repository at this point in the history
…word
  • Loading branch information
thypon committed May 31, 2024
1 parent c69be2e commit 56140b5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 24 deletions.
29 changes: 27 additions & 2 deletions action.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ const CONSOLE_BLUE = '\x1B[0;34m'
const CONSOLE_RED = '\x1b[0;31m'
const RESET_CONSOLE_COLOR = '\x1b[0m'

const ASSIGNEES = `thypon
bcaller`
const HOTWORDS = `password
cryptography
login
policy
authentication
authorization
authn
authz
oauth
secure
insecure
safebrowsing
safe browsing
csp
url parse
urlparse
:disableDigestUpdates
pinDigest`

function runCommand () {
const args = Array.prototype.slice.call(arguments)
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -40,10 +61,14 @@ module.exports = async ({ github, context, inputs, actionPath, core, debug = fal

const options = Object.assign({
enabled: 'true',
baseline_scan_only: 'true'
baseline_scan_only: 'true',
assignees: ASSIGNEES,
hotwords: HOTWORDS,
hotwords_enabled: 'true'
}, config, properties, inputs)

options.enabled = options.enabled === 'true'
options.hotwords_enabled = options.hotwords_enabled === 'true'
options.baseline_scan_only = options.baseline_scan_only === 'true'
options.debug = options.debug ? (options.debug === 'true') : debug

Expand Down Expand Up @@ -150,7 +175,7 @@ module.exports = async ({ github, context, inputs, actionPath, core, debug = fal

// add description-contains-hotwords step
const { default: hotwords } = await import(`${actionPath}/src/steps/hotwords.js`)
const descriptionContainsHotwords = (context.actor !== 'renovate[bot]') ? await hotwords({ context, github, hotwords: options.hotwords }) : false
const descriptionContainsHotwords = (context.actor !== 'renovate[bot]' && options.hotwords_enabled) ? await hotwords({ context, github, hotwords: options.hotwords }) : false
debugLog('Description contains hotwords:', descriptionContainsHotwords)

// add should-trigger label step
Expand Down
27 changes: 5 additions & 22 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,13 @@ inputs:
required: false
assignees:
description: assign PR to the people linked
default: |
thypon
bcaller
required: false
hotwords:
description: body hotwords which should trigger the action
default: |
password
cryptography
login
policy
authentication
authorization
authn
authz
oauth
secure
insecure
safebrowsing
safe browsing
csp
url parse
urlparse
:disableDigestUpdates
pinDigest
required: false
hotwords_enabled:
description: control if the hotwords should trigger the action
required: false
debug:
description: enables debug output for this action
required: false
Expand Down

0 comments on commit 56140b5

Please sign in to comment.