Skip to content

Commit e83bfbf

Browse files
committed
add await to 'addFinding'
1 parent 877646f commit e83bfbf

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

.github/actions/find/src/findForUrl.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,18 @@ async function runAxeScan({
7979
core.info(`Scanning ${url}`)
8080
const rawFindings = await new AxeBuilder({page}).analyze()
8181

82-
rawFindings?.violations.forEach(violation =>
83-
addFinding({
84-
scannerType: 'axe',
85-
url,
86-
html: violation.nodes[0].html.replace(/'/g, '''),
87-
problemShort: violation.help.toLowerCase().replace(/'/g, '''),
88-
problemUrl: violation.helpUrl.replace(/'/g, '''),
89-
ruleId: violation.id,
90-
solutionShort: violation.description.toLowerCase().replace(/'/g, '''),
91-
solutionLong: violation.nodes[0].failureSummary?.replace(/'/g, '''),
92-
}),
93-
)
82+
if (rawFindings) {
83+
for (const violation of rawFindings.violations) {
84+
await addFinding({
85+
scannerType: 'axe',
86+
url,
87+
html: violation.nodes[0].html.replace(/'/g, '''),
88+
problemShort: violation.help.toLowerCase().replace(/'/g, '''),
89+
problemUrl: violation.helpUrl.replace(/'/g, '''),
90+
ruleId: violation.id,
91+
solutionShort: violation.description.toLowerCase().replace(/'/g, '''),
92+
solutionLong: violation.nodes[0].failureSummary?.replace(/'/g, '''),
93+
})
94+
}
95+
}
9496
}

PLUGINS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This is the [playwright page](https://playwright.dev/docs/api/class-page) instan
1818

1919
#### `addFinding`
2020

21-
A function that will add a finding to the list (findings are used to generate and file issues). It will also generate a screenshot and add the `screenshotId` to the finding data if `includeScreenshots` is true in the scanner action input. It has the following arguments:
21+
A async function (you must use `await` or `.then` when invoking this function) that will add a finding to the list (findings are used to generate and file issues). It will also generate a screenshot and add the `screenshotId` to the finding data if `includeScreenshots` is true in the scanner action input. It has the following arguments:
2222

2323
- An object that should match the [`Finding` type](https://github.com/github/accessibility-scanner/blob/main/.github/actions/find/src/types.d.ts#L1-L9).
2424

0 commit comments

Comments
 (0)