Skip to content

Commit 2ace90d

Browse files
authored
Fix expired content flagging by including warnings in weekly lint reports (#56303)
1 parent 19570d0 commit 2ace90d

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

.github/workflows/lint-entire-content-data-markdown.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: 'Lint entire content and data markdown files'
22

3-
# **What it does**: Lints our content markdown weekly to ensure the content matches the specified styleguide. If errors exists, it opens a PR for the Docs content team to review.
3+
# **What it does**: Lints our content markdown weekly to ensure the content matches the specified styleguide. If errors or warnings exist, it opens an issue for the Docs content team to review.
44
# **Why we have it**: Extra precaution to run linter on the entire content/data directories.
55
# **Who does it impact**: Docs content.
66

@@ -32,7 +32,7 @@ jobs:
3232
id: linting-content-data
3333
timeout-minutes: 10
3434
continue-on-error: true
35-
run: npm run lint-content -- --errors-only --paths content data --output-file /tmp/error-lints.json
35+
run: npm run lint-content -- --paths content data --output-file /tmp/lint-results.json
3636

3737
- name: Open issue in docs-content
3838
if: ${{ always() && steps.linting-content-data.outcome == 'failure' }}
@@ -41,7 +41,7 @@ jobs:
4141
REPORT_AUTHOR: docs-bot
4242
REPORT_LABEL: broken content markdown report
4343
REPORT_REPOSITORY: github/docs-content
44-
run: npm run post-lints -- --path /tmp/error-lints.json
44+
run: npm run post-lints -- --path /tmp/lint-results.json
4545

4646
- uses: ./.github/actions/slack-alert
4747
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}

src/content-linter/scripts/post-lints.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { createReportIssue, linkReports } from '#src/workflows/issue-report.js'
1212
// the entire content and data directories based on our
1313
// markdownlint.js rules.
1414
//
15-
// If errors are found, it will open up a new issue in the
15+
// If errors or warnings are found, it will open up a new issue in the
1616
// docs-content repo with the label "broken content markdown report".
1717
//
1818
// The Content FR will go through the issue and update the content and
@@ -21,18 +21,20 @@ import { createReportIssue, linkReports } from '#src/workflows/issue-report.js'
2121
// [end-readme]
2222

2323
program
24-
.description('Opens an issue for Content FR with the errors from the weekly content/data linter.')
24+
.description(
25+
'Opens an issue for Content FR with the errors and warnings from the weekly content/data linter.',
26+
)
2527
.option(
2628
'-p, --path <path>',
27-
'provide a path to the errors output json file that will be in the issue body',
29+
'provide a path to the errors and warnings output json file that will be in the issue body',
2830
)
2931
.parse(process.argv)
3032

3133
const { path } = program.opts()
3234

3335
main()
3436
async function main() {
35-
const errors = fs.readFileSync(`${path}`, 'utf8')
37+
const lintResults = fs.readFileSync(`${path}`, 'utf8')
3638
const core = coreLib
3739
const { REPORT_REPOSITORY, REPORT_AUTHOR, REPORT_LABEL } = process.env
3840

@@ -41,18 +43,18 @@ async function main() {
4143
// or open an issue report, you might get cryptic error messages from Octokit.
4244
getEnvInputs(['GITHUB_TOKEN'])
4345

44-
core.info(`Creating issue for errors...`)
46+
core.info(`Creating issue for errors and warnings...`)
4547

4648
let reportBody = 'The following files have markdown lint warnings/errors:\n\n'
47-
for (const [file, flaws] of Object.entries(JSON.parse(errors))) {
49+
for (const [file, flaws] of Object.entries(JSON.parse(lintResults))) {
4850
reportBody += `File: \`${file}\`:\n`
4951
reportBody += `\`\`\`json\n${JSON.stringify(flaws, null, 2)}\n\`\`\`\n`
5052
}
5153

5254
const reportProps = {
5355
core,
5456
octokit,
55-
reportTitle: `Error(s) in content markdown file(s)`,
57+
reportTitle: `Error(s) and warning(s) in content markdown file(s)`,
5658
reportBody,
5759
reportRepository: REPORT_REPOSITORY,
5860
reportLabel: REPORT_LABEL,

0 commit comments

Comments
 (0)