Skip to content

Commit 618aafa

Browse files
committed
Print instructions to log if ToC is outdated
Some assets contain a table of contents to facilitate the navigation of their content. The table of contents must be kept in sync with the content. The continuous integration system uses the excellent markdown-toc tool to detect outdated table of contents. In order to support checking any number of files at arbitrary paths in the repository, using a specified `--maxdepth` flag value for each, a job matrix is used in the "Check ToC" GitHub Actions workflow. The user may also run the `markdown:toc` locally to update the table of contents, but because the project-specific configuration is implemented in the workflow instead of the taskfile they must specify the file's path and `--maxdepth` flag value via task variables in the invocation. Contributors may find it challenging to update the table of contents. In order to facilitate the update following detection of an out of sync state by the continuous integration system, instructions for two resolution options are printed to the workflow run logs: - exact command to run locally - replacement with the corrected file from the workflow artifact
1 parent 56e3e2e commit 618aafa

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.github/workflows/check-toc-task.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,15 @@ jobs:
106106
if: failure() && steps.check-toc.outcome == 'failure'
107107
run: |
108108
echo "::notice file=${{ matrix.file.name }}::Corrected file was saved to the ${{ env.ARTIFACT_NAME }} workflow artifact"
109+
110+
- name: Resolution instructions
111+
if: failure() && steps.check-toc.outcome == 'failure'
112+
run: |
113+
echo "Table of contents can be updated by running the following command from the root of the repository:"
114+
echo "task markdown:toc FILE_PATH=${{ matrix.file.name }} MAX_DEPTH=${{ matrix.file.maxdepth }}"
115+
echo
116+
echo "- OR -"
117+
echo
118+
echo "Download the ${{ env.ARTIFACT_NAME }} workflow artifact and replace ${{ matrix.file.name }} with the"
119+
echo "corrected file from the artifact."
120+
echo "See: https://docs.github.com/actions/managing-workflow-runs/downloading-workflow-artifacts"

0 commit comments

Comments
 (0)