Skip to content

Commit 5537a3e

Browse files
committed
wip
1 parent f588f0c commit 5537a3e

File tree

3 files changed

+10
-28
lines changed

3 files changed

+10
-28
lines changed

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ import {generateScreenshots} from './generateScreenshots.js'
66
import {loadPlugins, invokePlugin} from './pluginManager.js'
77
import {getScansContext} from './scansContextProvider.js'
88
import * as core from '@actions/core'
9-
import {FindingWithContext} from './types.d.js'
109

1110
export async function findForUrl(
1211
url: string,
1312
authContext?: AuthContext,
14-
includeScreenshotsInput: boolean = false,
13+
includeScreenshots: boolean = false,
1514
reducedMotion?: ReducedMotionPreference,
1615
colorScheme?: ColorSchemePreference,
1716
): Promise<Finding[]> {
@@ -29,12 +28,9 @@ export async function findForUrl(
2928
await page.goto(url)
3029

3130
const findings: Finding[] = []
32-
const addFinding = async (
33-
findingData: FindingWithContext,
34-
{includeScreenshots = false}: {includeScreenshots?: boolean} = {},
35-
) => {
31+
const addFinding = async (findingData: Finding) => {
3632
let screenshotId
37-
if (includeScreenshotsInput || includeScreenshots) {
33+
if (includeScreenshots) {
3834
screenshotId = await generateScreenshots(page)
3935
}
4036
findings.push({...findingData, screenshotId})
@@ -53,7 +49,7 @@ export async function findForUrl(
5349
page,
5450
addFinding,
5551
// - this will be coming soon
56-
// runAxeScan: () => runAxeScan({page, includeScreenshots: includeScreenshotsInput, findings}),
52+
// runAxeScan: () => runAxeScan({page, includeScreenshots, findings}),
5753
})
5854
} else {
5955
core.info(`Skipping plugin ${plugin.name} because it is not included in the 'scans' input`)
@@ -77,7 +73,7 @@ async function runAxeScan({
7773
addFinding,
7874
}: {
7975
page: playwright.Page
80-
addFinding: (findingData: FindingWithContext, options?: {includeScreenshots?: boolean}) => Promise<void>
76+
addFinding: (findingData: Finding, options?: {includeScreenshots?: boolean}) => Promise<void>
8177
}) {
8278
const url = page.url()
8379
core.info(`Scanning ${url}`)

.github/actions/find/src/types.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ export type Finding = {
88
screenshotId?: string
99
}
1010

11-
export type FindingWithContext = Finding & {
12-
scannerType: string
13-
ruleId?: string
14-
}
11+
// export type FindingWithContext = Finding & {
12+
// scannerType: string
13+
// ruleId?: string
14+
// }
1515

1616
export type Cookie = {
1717
name: string

PLUGINS.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,9 @@ 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 either the scanner action input OR in the arguments to this function (see below). It has the following arguments:
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:
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).
24-
- An [optional] 'options' object that has the following fields:
25-
- [optional] `includeScreenshots` <bool>: Will automatically generate a screenshot and add the screenshotId to the `Finding` data if it's set to true.
26-
27-
Example usage:
28-
29-
```
30-
addFinding({ ...findingTypeData })
31-
addFinding({
32-
...findingTypeData
33-
}, {
34-
includeScreenshots: true
35-
})
36-
37-
```
3824

3925
## How to create plugins
4026

0 commit comments

Comments
 (0)