1- import type { AuthContextInput } from './types.js'
1+ import type { AuthContextInput , ColorSchemePreference , ReducedMotionPreference } from './types.js'
22import * as core from '@actions/core'
33import { AuthContext } from './AuthContext.js'
44import { findForUrl } from './findForUrl.js'
@@ -11,11 +11,31 @@ export default async function () {
1111 const authContext = new AuthContext ( authContextInput )
1212
1313 const includeScreenshots = core . getInput ( 'include_screenshots' , { required : false } ) !== 'false'
14+ const reducedMotionInput = core . getInput ( 'reduced_motion' , { required : false } )
15+ let reducedMotion : ReducedMotionPreference | undefined
16+ if ( reducedMotionInput ) {
17+ if ( ! [ 'reduce' , 'no-preference' , null ] . includes ( reducedMotionInput ) ) {
18+ throw new Error (
19+ "Input 'reduced_motion' must be one of: 'reduce', 'no-preference', or null per Playwright documentation." ,
20+ )
21+ }
22+ reducedMotion = reducedMotionInput as ReducedMotionPreference
23+ }
24+ const colorSchemeInput = core . getInput ( 'color_scheme' , { required : false } )
25+ let colorScheme : ColorSchemePreference | undefined
26+ if ( colorSchemeInput ) {
27+ if ( ! [ 'light' , 'dark' , 'no-preference' , null ] . includes ( colorSchemeInput ) ) {
28+ throw new Error (
29+ "Input 'color_scheme' must be one of: 'light', 'dark', 'no-preference', or null per Playwright documentation." ,
30+ )
31+ }
32+ colorScheme = colorSchemeInput as ColorSchemePreference
33+ }
1434
1535 const findings = [ ]
1636 for ( const url of urls ) {
1737 core . info ( `Preparing to scan ${ url } ` )
18- const findingsForUrl = await findForUrl ( url , authContext , includeScreenshots )
38+ const findingsForUrl = await findForUrl ( url , authContext , includeScreenshots , reducedMotion , colorScheme )
1939 if ( findingsForUrl . length === 0 ) {
2040 core . info ( `No accessibility gaps were found on ${ url } ` )
2141 continue
0 commit comments