Skip to content

Commit af48154

Browse files
chore(COD-4237): removing unused option --autofix (#213)
1 parent 4dbec19 commit af48154

File tree

4 files changed

+6
-37
lines changed

4 files changed

+6
-37
lines changed

action.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ inputs:
2323
description: 'Show vulnerabilities found in transitive dependencies'
2424
required: false
2525
default: false
26-
autofix:
27-
description: 'Set to true to enable automated pull-requests for fix suggestions'
28-
required: false
29-
default: false
3026
outputs:
3127
old-completed:
3228
description: 'If running a target called old, whether the analysis for this was completed'
@@ -119,4 +115,3 @@ runs:
119115
token: '${{ inputs.token || github.token }}'
120116
footer: '${{ inputs.footer }}'
121117
eval-indirect-dependencies: '${{ inputs.eval-indirect-dependencies }}'
122-
autofix: '${{ inputs.autofix }}'

src/index.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ import {
77
uploadArtifact,
88
} from './actions'
99
import { downloadKeys, trustedKeys } from './keys'
10-
import { compareResults, createPRs, printResults } from './tool'
10+
import { compareResults, printResults } from './tool'
1111
import {
12-
autofix,
1312
callCommand,
1413
callLaceworkCli,
1514
debug,
@@ -66,18 +65,12 @@ async function runAnalysis() {
6665
if (debug()) {
6766
args.push('--debug')
6867
}
69-
if (autofix()) {
70-
args.push('--fix-suggestions')
71-
}
7268
await callLaceworkCli(...args)
7369
// make a copy of the sarif file
7470
args = [scaSarifReport, scaReport]
7571
await callCommand('cp', ...args)
7672

7773
await printResults('sca', scaReport)
78-
if (autofix()) {
79-
await createPRs(scaLWJSONReport)
80-
}
8174
toUpload.push(scaReport)
8275

8376
const uploadStart = Date.now()

src/tool.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
1-
import { info, startGroup, endGroup, error } from '@actions/core'
1+
import { endGroup, info, startGroup } from '@actions/core'
22
import { context } from '@actions/github'
33
import { existsSync, readFileSync } from 'fs'
4-
import {
5-
callCommand,
6-
callLaceworkCli,
7-
debug,
8-
getOptionalEnvVariable,
9-
getRequiredEnvVariable,
10-
telemetryCollector,
11-
} from './util'
124
import { Log } from 'sarif'
13-
import { LWJSON } from './lw-json'
14-
import { getPrApi } from './actions'
155
import { simpleGit, SimpleGitOptions } from 'simple-git'
6+
import { getPrApi } from './actions'
7+
import { LWJSON } from './lw-json'
8+
import { callLaceworkCli, debug, getOptionalEnvVariable, getRequiredEnvVariable } from './util'
169

1710
export async function printResults(tool: string, sarifFile: string) {
1811
startGroup(`Results for ${tool}`)
@@ -198,11 +191,6 @@ export async function createPRs(jsonFile: string) {
198191
await prForFixSuggestion(jsonFile, fixId, repoOwner, repoName, telem)
199192
}
200193
const after = Date.now()
201-
telemetryCollector.addField('autofix.totalPRs', telem.prsCounter.toString())
202-
telemetryCollector.addField('autofix.updatedPRs', telem.prsUpdated.toString())
203-
telemetryCollector.addField('autofix.timeAPI', telem.totalAPITime.toString())
204-
telemetryCollector.addField('autofix.APIerrors', telem.errors.map(String).join(', '))
205-
telemetryCollector.addField('autofix.totalTime', (after - before).toString())
206194
}
207195

208196
export async function compareResults(

src/util.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { getInput, isDebug } from '@actions/core'
2-
import { error, info } from '@actions/core'
1+
import { error, getInput, info, isDebug } from '@actions/core'
32
import { spawn } from 'child_process'
43
import { TelemetryCollector } from './telemetry'
54

@@ -23,12 +22,6 @@ export function getActionRef(): string {
2322
return getOptionalEnvVariable('LACEWORK_ACTION_REF', 'unknown')
2423
}
2524

26-
export function autofix() {
27-
// autofix does fix all vulnerabilities, regardless of whether they are newly introduced or no
28-
// for this reason, we skip if we are scanning the old branch
29-
return getBooleanInput('autofix') && getInput('target') != 'old'
30-
}
31-
3225
export function getRunUrl(): string {
3326
let result = getRequiredEnvVariable('GITHUB_SERVER_URL')
3427
result += '/'

0 commit comments

Comments
 (0)