@@ -115,6 +115,37 @@ jobs:
115115 exit 1
116116 fi
117117
118+ - name : Authenticate via API
119+ id : auth
120+ run : |
121+ # Login via backend API and capture session cookie
122+ curl -s -c /tmp/cookies.txt \
123+ -X POST http://localhost:3080/api/auth/login \
124+ -H 'Content-Type: application/json' \
125+ -d '{"email":"${{ env.AUTH_INITIAL_ADMIN_USERNAME }}","password":"${{ env.AUTH_INITIAL_ADMIN_PASSWORD }}"}'
126+
127+ # Convert Netscape cookie jar to Playwright auth_context JSON
128+ # HttpOnly cookies are prefixed with #HttpOnly_ in curl's cookie jar
129+ AUTH_CONTEXT=$(awk '
130+ /^#HttpOnly_/ {
131+ sub(/^#HttpOnly_/, "", $1)
132+ printf "{\"name\":\"%s\",\"value\":\"%s\",\"domain\":\"%s\",\"path\":\"%s\",\"secure\":%s,\"httpOnly\":true}\n",
133+ $6, $7, $1, $3, ($4=="TRUE"?"true":"false")
134+ next
135+ }
136+ !/^#/ && NF {
137+ printf "{\"name\":\"%s\",\"value\":\"%s\",\"domain\":\"%s\",\"path\":\"%s\",\"secure\":%s,\"httpOnly\":false}\n",
138+ $6, $7, $1, $3, ($4=="TRUE"?"true":"false")
139+ }
140+ ' /tmp/cookies.txt | jq -sc '{
141+ username: "${{ env.AUTH_INITIAL_ADMIN_USERNAME }}",
142+ password: "${{ env.AUTH_INITIAL_ADMIN_PASSWORD }}",
143+ cookies: .,
144+ localStorage: {}
145+ }')
146+
147+ echo "auth_context=$AUTH_CONTEXT" >> "$GITHUB_OUTPUT"
148+
118149 - uses : github/accessibility-scanner@v2
119150 with :
120151 urls : |
@@ -129,13 +160,13 @@ jobs:
129160 repository : ${{ github.repository }}
130161 token : ${{ secrets.GH_TOKEN_A11Y }}
131162 cache_key : cached_results-c4-local.json
132- login_url : http://localhost:3080/login # Optional: URL of the login page if authentication is required
133- username : ${{ env.AUTH_INITIAL_ADMIN_USERNAME }} # Optional: Username for authentication
134- password : ${{ env.AUTH_INITIAL_ADMIN_PASSWORD }} # Optional: Password for authentication (use secrets!)
135- open_grouped_issues : true # Optional: Set to true to open an issue grouping individual issues per violation
136- skip_copilot_assignment : true # Optional: Set to true to skip assigning issues to GitHub Copilot (or if you don't have GitHub Copilot)
137- include_screenshots : true # Optional: Set to true to capture screenshots and include links to them in filed issues
138- # auth_context: # Optional: Stringified JSON object for complex authentication
163+ auth_context : ${{ steps.auth.outputs.auth_context }}
164+ open_grouped_issues : true
165+ skip_copilot_assignment : true
166+ include_screenshots : true
167+ # login_url: # Optional: URL of the login page if authentication is required
168+ # username: # Optional: Username for authentication
169+ # password: ${{ secrets.PASSWORD }} # Optional: Password for authentication (use secrets!)
139170 # reduced_motion: no-preference # Optional: Playwright reduced motion configuration option
140171 # color_scheme: light # Optional: Playwright color scheme configuration option
141172 # scans: '["axe","reflow-scan"]' # Optional: An array of scans (or plugins) to be performed. If not provided, only Axe will be performed.
0 commit comments