Skip to content

Commit 4eab30a

Browse files
committed
Removes passing in url, updates cache key
1 parent 381f66f commit 4eab30a

6 files changed

Lines changed: 12 additions & 13 deletions

File tree

.github/actions/file/src/openIssue.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ export async function openIssue(octokit: Octokit, repoWithOwner: string, finding
2121
const owner = repoWithOwner.split('/')[0]
2222
const repo = repoWithOwner.split('/')[1]
2323

24+
const labels = [`${finding.scannerType}-scanning-issue`]
2425
// Only include a ruleId label when it's defined
25-
const labels = [
26-
`${finding.scannerType}-scanning-issue`,
27-
...(finding.ruleId ? [`${finding.scannerType} rule: ${finding.ruleId}`] : []),
28-
]
26+
if (finding.ruleId) {
27+
labels.push(`${finding.scannerType} rule: ${finding.ruleId}`)
28+
}
29+
2930
const title = truncateWithEllipsis(
3031
`Accessibility issue: ${finding.problemShort[0].toUpperCase() + finding.problemShort.slice(1)} on ${new URL(finding.url).pathname}`,
3132
GITHUB_ISSUE_TITLE_MAX_LENGTH,

.github/actions/file/src/updateFilingsWithNewFindings.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ function getFilingKey(filing: ResolvedFiling | RepeatedFiling): string {
55
}
66

77
function getFindingKey(finding: Finding): string {
8+
if (finding.ruleId && finding.html) {
9+
return `${finding.url};${finding.ruleId};${finding.html}`
10+
}
811
return `${finding.url};${finding.scannerType};${finding.problemUrl}`
912
}
1013

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export async function findForUrl(
4848
plugin,
4949
page,
5050
addFinding,
51-
url,
5251
})
5352
} else {
5453
core.info(`Skipping plugin ${plugin.name} because it is not included in the 'scans' input`)

.github/actions/find/src/pluginManager.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const __dirname = path.dirname(__filename)
1313
type PluginDefaultParams = {
1414
page: playwright.Page
1515
addFinding: (findingData: Finding) => Promise<void>
16-
url: string
1716
}
1817

1918
type Plugin = {
@@ -109,6 +108,6 @@ export async function loadPluginsFromPath({pluginsPath}: {pluginsPath: string})
109108
type InvokePluginParams = PluginDefaultParams & {
110109
plugin: Plugin
111110
}
112-
export function invokePlugin({plugin, page, addFinding, url}: InvokePluginParams) {
113-
return plugin.default({page, addFinding, url})
111+
export function invokePlugin({plugin, page, addFinding}: InvokePluginParams) {
112+
return plugin.default({page, addFinding})
114113
}

.github/scanner-plugins/reflow-scan/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
export default async function reflowScan({page, addFinding, url} = {}) {
1+
export default async function reflowScan({page, addFinding} = {}) {
22
const originalViewport = page.viewportSize()
3+
const url = page.url()
34
// Check for horizontal scrolling at 320x256 viewport
45
try {
56
await page.setViewportSize({width: 320, height: 256})

PLUGINS.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ A async function (you must use `await` or `.then` when invoking this function) t
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

25-
#### `url`
26-
27-
Passes in the URL of the page being scanned to be used when a finding is added.
28-
2925
## How to create plugins
3026

3127
As mentioned above, plugins need to exist under `./.github/scanner-plugins`. For a plugin to work, it needs to meet the following criteria:

0 commit comments

Comments
 (0)