Skip to content

Commit

Permalink
Infrastructure: Transition revision date generation for Coverage and …
Browse files Browse the repository at this point in the history
…Quality Report to build repository workflow (pull #2976)

Makes the last updated date on the coverage and quality report the date the revised report it is merged to main in the content repository. The date is generated and added to the report during the build process that is executed in the build repo (wai-aria-practices). This is consistent with how the last update dates for examples are determined.

Note that the report is re-generated by the workflow in the content repo for all pull requests.
  • Loading branch information
howard-e committed Apr 7, 2024
1 parent 81d807d commit 003ffd2
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ on:
- "content/**/examples/**"
- "scripts/reference-tables.*"
- "scripts/coverage-report.*"
- "coverage/**"
- "content/about/coverage-and-quality/**"
pull_request:
paths:
- "package*.json"
- ".github/workflows/examples.yml"
- "content/**/examples/**"
- "scripts/reference-tables.*"
- "scripts/coverage-report.*"
- "coverage/**"
- "content/about/coverage-and-quality/**"

jobs:
examples:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<body>
<main>
<h1>Coverage and Quality Reports</h1>
<p>Page last updated: February 13, 2024</p>
<p>Page last updated:</p>
<section>
<h2>About These Reports</h2>
<p>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"npm run reference-tables",
"git add content/index/index.html",
"npm run coverage-report",
"git add coverage/"
"git add content/about/coverage-and-quality/"
]
},
"ava": {
Expand Down
14 changes: 0 additions & 14 deletions scripts/coverage-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -1138,26 +1138,12 @@ $('#example_summary_prototype').html(countPrototype);
$('#example_summary_mouse').html(countMouse);
$('#example_summary_pointer').html(countPointer);

// Create a new Date object
var currentDate = new Date();

// Format the date as a string
const formattedDate = currentDate.toLocaleDateString('en-US', {
day: 'numeric',
month: 'long',
year: 'numeric',
});

// cheerio seems to fold the doctype lines despite the template
const result = $.html()
.replace('<!DOCTYPE html>', '<!DOCTYPE html>\n')
.replace(
'<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">',
'<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">\n'
)
.replace(
'<p>Page last updated: </p>',
`<p>Page last updated: ${formattedDate}</p>`
);

fs.writeFile(coverageReportPath, result, function (err) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/coverage-report.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<body>
<main>
<h1>Coverage and Quality Reports</h1>
<p>Page last updated: </p>
<p>Page last updated:</p>
<section>
<h2>About These Reports</h2>
<p>
Expand Down

0 comments on commit 003ffd2

Please sign in to comment.