Skip to content

Commit

Permalink
main action: remove process.env usages
Browse files Browse the repository at this point in the history
  • Loading branch information
thypon committed Jun 7, 2024
1 parent e9e31cf commit 3f92a94
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions actions/main/action.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ module.exports = async ({ github, context, inputs, actionPath, core, debug = fal

debugLog('Security Action enabled')
// reviewdog-enabled-pr steps
const reviewdogEnabledPr = options.baseline_scan_only && process.env.GITHUB_EVENT_NAME === 'pull_request' && context.actor !== 'dependabot[bot]'
debugLog(`Security Action enabled for PR: ${reviewdogEnabledPr}, baseline_scan_only: ${options.baseline_scan_only}, GITHUB_EVENT_NAME: ${process.env.GITHUB_EVENT_NAME}, context.actor: ${context.actor}`)
const reviewdogEnabledPr = options.baseline_scan_only && context.eventName === 'pull_request' && context.actor !== 'dependabot[bot]'
debugLog(`Security Action enabled for PR: ${reviewdogEnabledPr}, baseline_scan_only: ${options.baseline_scan_only}, GITHUB_EVENT_NAME: ${context.eventName}, context.actor: ${context.actor}`)
// reviewdog-enabled-full steps
const reviewdogEnabledFull = !reviewdogEnabledPr && (!options.baseline_scan_only || process.env.GITHUB_EVENT_NAME === 'workflow_dispatch')
debugLog(`Security Action enabled for full: ${reviewdogEnabledFull}, baseline_scan_only: ${options.baseline_scan_only}, GITHUB_EVENT_NAME: ${process.env.GITHUB_EVENT_NAME}`)
const reviewdogEnabledFull = !reviewdogEnabledPr && (!options.baseline_scan_only || context.eventName === 'workflow_dispatch')
debugLog(`Security Action enabled for full: ${reviewdogEnabledFull}, baseline_scan_only: ${options.baseline_scan_only}, GITHUB_EVENT_NAME: ${context.eventName}`)
// reviewdog-enabled steps
if (!reviewdogEnabledPr && !reviewdogEnabledFull) { return }
debugLog('Security Action enabled for reviewdog')
Expand Down Expand Up @@ -203,7 +203,9 @@ module.exports = async ({ github, context, inputs, actionPath, core, debug = fal

const { default: sendSlackMessage } = await import(`${actionPath}/src/sendSlackMessage.js`)

const message = `Repository: [${process.env.GITHUB_REPOSITORY}](https://github.com/${process.env.GITHUB_REPOSITORY})\npull-request: ${context.payload.pull_request.html_url}\nFindings: ${commentsAfter}`
const repoName = `${context.repo.owner}/${context.repo.repo}`

const message = `Repository: [${repoName}](https://github.com/${repoName})\npull-request: ${context.payload.pull_request.html_url}\nFindings: ${commentsAfter}`

let githubToSlack = {}
try {
Expand Down

0 comments on commit 3f92a94

Please sign in to comment.