Skip to content

Commit

Permalink
Fix implementation action failing on unpkg
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoFiers committed Jun 23, 2022
1 parent 736e12b commit 16c1dc0
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 14 deletions.
15 changes: 6 additions & 9 deletions .github/scripts/implementation-update.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { readFileSync, existsSync, writeFileSync } from 'fs';
import * as YAML from 'yaml';
import fetch from 'node-fetch';
import axios from 'axios';
import { getActImplementationReport } from 'act-tools'
import moment from 'moment';

Expand All @@ -20,18 +20,15 @@ async function updateImplementation(implementation) {
const { jsonReport: jsonReportUrl, uniqueKey, name, vendor, version } = implementation;
const earlReportPath = `${assetsDir}/earl/${uniqueKey}.json`;
const actReportPath = `${dataDir}/implementations/${uniqueKey}.json`;
const response = await fetch(jsonReportUrl);
if (!response.ok) {
console.log(`Failed to load ${uniqueKey} report from ${jsonReportUrl}`);
return;
}

let reportText, earlReport;
try {
reportText = await response.text();
reportText = (await axios.get(jsonReportUrl, {
transformResponse: res => res.toString()
})).data;
earlReport = JSON.parse(reportText);
} catch {
console.log(`Unable to load ${uniqueKey} EARL report as JSON`);
} catch (e) {
console.log(`Unable to load ${uniqueKey} EARL report as JSON\n\n`, e.message);
return;
}

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/implementation-update.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Implementation update
on:
workflow_dispatch:
schedule:
# Run every 6 hours, starting UTC midnight
- cron: '0 0,6,12,18 * * *'

jobs:
test:
implementation-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion _data/wcag-act-rules/act-implementations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
standards:
- WCAG 2.1 Level A, AA, AAA
- WAI-ARIA 1.2
jsonReport: https://raw.githubusercontent.com/dequelabs/act-reports-axe/main/reports/axe-devtools-igt.json
jsonReport: https://raw.githubusercontent.com/dequelabs/act-reports-axe/main/reports/axe-devtools-combined.json
description: |
Axe DevTools Pro combines the automated results of axe-core, and results from
axe Intelligent Guided Test (IGT) tools. Tools can produced multiple issue types.
Expand Down
71 changes: 69 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"dependencies": {
"act-tools": "github:act-rules/act-tools",
"axios": "^0.27.2",
"moment": "^2.29.3",
"node-fetch": "^3.2.5",
"yaml": "^2.1.1",
"zx": "^6.2.4"
}
Expand Down

0 comments on commit 16c1dc0

Please sign in to comment.