You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plugin system allows teams to create custom scans/tests to run on their pages. An example of this is Axe interaction tests. In some cases, it might be desirable to perform specific interactions on elements of a given page before doing an Axe scan. These interactions are usually unique to each page that is scanned, so it would require the owning team to write a custom plugin that can interact with the page and run the Axe scan when ready. See the example under [.github/scanner-plugins/test-plugin](https://github.com/github/accessibility-scanner/tree/main/.github/scanner-plugins/test-plugin) (this is not an Axe interaction test, but should give a general understanding of plugin structure).
4
+
5
+
Some plugins come built-in with the scanner and can be enabled via actions inputs.
6
+
7
+
## How Plugins Work
8
+
9
+
Plugins are dynamically loaded by the scanner when it runs. The scanner will look into the `./.github` folder in your repo (where you run the workflow from) and search for a `scanner-plugins` folder. If it finds it, it will assume each folder under that is a plugin, and attempt to load the `index.js` file inside it. Once loaded, the scanner will invoke the exported default function from the `index.js` file.
10
+
11
+
### Default function API
12
+
13
+
When the default function is invoked, the following arguments are passed to the function:
14
+
15
+
- page: this is the [playwright page](https://playwright.dev/docs/api/class-page) instance. See the linked docs for information on how to interact with the page.
16
+
- addFinding: this is a function that will add a finding to the list. Findings are used to generate issues and 'filings'. See here for the [types](https://github.com/github/accessibility-scanner/blob/main/tests/types.d.ts). This function expects a single object as an argument, and it should match the `Finding` type defined in the types linked above.
17
+
18
+
## How To Create Plugins
19
+
20
+
As mentioned above, plugins need to exist under `./.github/scanner-plugins`. For a plugin to work, it needs to meet the following criteria:
21
+
22
+
- Each seperate plugin should exist in a separate folder under `./.github/scanner-plugins`. So `./.github/scanner-plugins/plugin-1` would be 1 plugin loaded by the scanner.
23
+
- Each plugin should have one `index.js` file inside its folder.
24
+
- The `index.js` file must export a `name` field. This is the name used to pass to the `scans` input. So the following: `scans: ['my-custom-plugin']` would cause the scanner to only run that plugin.
25
+
- The `index.js` file must export a default function. This is the function that the scanner uses to run the plugin. This can be an async function.
26
+
27
+
## Things to look out for
28
+
29
+
- Plugin names should be unique. If multiple plugins have the same name, and the `scans` input array contains this name, all the plugins with that name _will_ run. However, this is not advised because if you want to turn off one plugin, you'll have to go back and change that plugin name.
Copy file name to clipboardExpand all lines: README.md
+2-28Lines changed: 2 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,7 +124,7 @@ Trigger the workflow manually or automatically based on your configuration. The
124
124
|`include_screenshots`| No | Whether to capture screenshots of scanned pages and include links to them in filed issues. Screenshots are stored on the `gh-cache` branch of the repository running the workflow. Default: `false`|`true`|
125
125
|`reduced_motion`| No | Playwright `reducedMotion` setting for scan contexts. Allowed values: `reduce`, `no-preference`|`reduce`|
126
126
|`color_scheme`| No | Playwright `colorScheme` setting for scan contexts. Allowed values: `light`, `dark`, `no-preference`|`dark`|
127
-
|`scans`| No |A list of scans (or plugins) to be performed. If not provided, only axe will be performed. |`['axe', 'reflow']`|
127
+
|`scans`| No |An array of scans (or plugins) to be performed. If not provided, only Axe will be performed. |`['axe', ...other plugins]`|
128
128
129
129
---
130
130
@@ -157,33 +157,7 @@ The a11y scanner leverages GitHub Copilot coding agent, which can be configured
157
157
158
158
## Plugins
159
159
160
-
The plugin system allows teams to create custom scans/test to run on their pages. An example of this is axe interaction tests. In some cases, it might be desirable to perform specific interactions on elements of a given page before doing an axe scan. These interactions are usually unique to each page that is scanned, so it would require the owning team to write a custom plugin that can interact with the page and run the axe scan when ready. See the example under `./.github/scanner-plugins/test-plugin` (this is not an axe interaction test, but should give a general understanding of how plugins look like).
161
-
162
-
Some plugins come built-in with the scanner and can be enabled via actions inputs.
163
-
164
-
### How Plugins Work
165
-
166
-
Plugins are dynamically loaded by the scanner when it runs. The scanner will look into the `./.github` folder in your repo (where you run the workflow from) and search for a `scanner-plugins` folder. If it finds it, it will assume each folder under that is a plugin, and attempt to load the `index.js` file inside it. Once loaded, the scanner will invoke the exported default function from the `index.js` file.
167
-
168
-
#### Default Function Api
169
-
170
-
When the default function is invoked, the following arguments are passed to the function:
171
-
172
-
- page: this is the [playwright page](https://playwright.dev/docs/api/class-page) instance. See the linked docs for information on how to interact with the page.
173
-
- addFinding: this is a function that will add a finding to the list. Findings are used to generate issues and 'filings'. See here for the [types](https://github.com/github/accessibility-scanner/blob/main/tests/types.d.ts). This function expects a single object as an argument, and it should match the `Finding` type defined in the types linked above.
174
-
175
-
### How To Create Plugins
176
-
177
-
As mentioned above, plugins need to live under `./.github/scanner-plugins`. For a plugin to work, it needs to meet the following criteria:
178
-
179
-
- Each seperate plugin should live in a separate folder under `./.github/scanner-plugins`. So `./.github/scanner-plugins/plugin-1` would be 1 plugin loaded by the scanner
180
-
- Each plugin should have one `index.js` file inside its folder
181
-
- The `index.js` file must export a `name` field. This is the name used to pass to the `scans` input. So the following: `scans: ['my-custom-plugin']` would cause the scanner to only run that plugin
182
-
- The `index.js` file must export a default function. This is the function that the scanner uses to run the plugin. This can be an async function.
183
-
184
-
### Things To Lookout For
185
-
186
-
- Plugin names should be unique. If multiple plugins have the same name, and the `scans` input passes this name, all the plugins with that name _will_ run. However, this is not advised because if you want to turn off one plugin, you'll have to go back and change that plugin name.
160
+
See the [plugin docs](https://github.com/github/accessibility-scanner/tree/main/PLUGINS.md) for more information
0 commit comments