@@ -25,6 +25,7 @@ name: doc update check
2525# * [ ] should be able to retrieve config files and dictionary from the called ref, not master.
2626# * [ ] should be able to merge config files and dictionary with local definitions on target repo.
2727# * [ ] should be able to work on diff
28+ # * [ ] should format the output of spellcheck report
2829
2930on :
3031 workflow_call :
@@ -122,6 +123,7 @@ jobs:
122123 if : ${{ steps.markdownlint.outcome != 'success' && hashFiles(env.lintreport) != '' }}
123124 id : report-exists
124125 run : |
126+ # summarizes a bit the output from spellcheck
125127 echo 'report<<EOF' >> $GITHUB_OUTPUT
126128 cat ${{ env.lintreport }}|sed -e '$a\' >> $GITHUB_OUTPUT
127129 echo 'EOF' >> $GITHUB_OUTPUT
@@ -423,13 +425,33 @@ jobs:
423425 reactions : ${{ steps.notify_spelling_report.outputs.reactions }}
424426 runs-on : ubuntu-latest
425427 steps :
428+ - name : Pre-process spellcheck report
429+ id : preprocess
430+ env :
431+ MSG : ${{ needs.markdown-spelling.outputs.report }}
432+ SED_CMD : .github/workflows/filter.sed # a sed script to parse and reformat the spellcheck report
433+ JQ_CMD : .github/workflows/merge.jq # a jq script to dedupe spellcheck reports by file
434+ TMPFILE : /tmp/spellcheck-report.txt
435+ run : |
436+ export MSG
437+ printenv MSG > "${TMPFILE}"
438+ # produces a JSON object:
439+ # {
440+ # "file.md": [ mispelled word [, ...]]
441+ # }
442+ cat "${TMPFILE}" | sed -n -f "${SED_CMD}" | jq -s "${JQ_CMD}" > /tmp/preprocessed.txt
443+
444+ echo 'report<<EOF' >> $GITHUB_OUTPUT
445+ cat /tmp/preprocessed.txt|sed -e '$a\' >> $GITHUB_OUTPUT
446+ echo 'EOF' >> $GITHUB_OUTPUT
447+
426448 - name : Format PR comment
427449 id : comment_formatter
428450 uses : skills/action-text-variables@v3
429451 with :
430452 template-vars : >
431453 {
432- "text": ${{ toJSON(needs.markdown-spelling .outputs.report) }}
454+ "text": ${{ steps.preprocess .outputs.report) }}
433455 }
434456 template-text : |
435457 ### ${{ env.spellcheck_comment_title }}
@@ -442,6 +464,7 @@ jobs:
442464 <br>
443465
444466 ```
467+ ### TODO: range json
445468 {{ text }}
446469 ```
447470
0 commit comments