From 1bcc2039361ec8a1e95ecb6418b7592060ed8e86 Mon Sep 17 00:00:00 2001 From: Frederic BIDON Date: Wed, 19 Mar 2025 11:03:52 +0100 Subject: [PATCH 1/2] md linting experiment Signed-off-by: Frederic BIDON --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3e471d8..e05a2b7 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,5 @@ Shared errors and error interface used throughout the various libraries found in ## blah blah # should raise an issue + +# should raise another issue From f9d3f30b180eacbb946ca9be53552da7eecf978c Mon Sep 17 00:00:00 2001 From: Frederic BIDON Date: Wed, 19 Mar 2025 12:07:37 +0100 Subject: [PATCH 2/2] x Signed-off-by: Frederic BIDON --- .github/workflows/markdown.yml | 44 ++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index 7183997..9f2b5fb 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -10,25 +10,59 @@ permissions: contents: read jobs: + lint-markdown: runs-on: ubuntu-latest steps: - name: Checkout Repo uses: actions/checkout@v4 + - name: Get all changed markdown files + id: changed-markdown-files + uses: tj-actions/changed-files@v45 + with: + # Avoid using single or double quotes for multiline patterns + files: | + **/*.md + + - name: "DEBUG List all changed files markdown files" + if: steps.changed-markdown-files.outputs.any_changed == 'true' + env: + ALL_CHANGED_FILES: + run: | + for file in ${ALL_CHANGED_FILES}; do + echo "$file was changed" + done + - name: Run markdown linter id: markdownlint - #continue-on-error: true uses: docker://avtodev/markdown-lint:v1 with: config: .markdownlint.yml - args: '**/*.md' - output: ./markdownlint.txt + args: '${{ steps.changed-markdown-files.outputs.all_changed_files }}' + output: ./lintreport.txt + + - name: Retrieve report as a variable + if: ${{ failure() && steps.markdownlint.outcome == 'failure' }} + id: conveyor + run: | + echo "::set-output name=text::$(cat ./lintreport.txt)" + + - name: Format PR comment + if: ${{ failure() && steps.markdownlint.outcome == 'failure' }} + id: commentformatter + uses: skills/action-text-variables@v1 + with: + template-vars: | + text=$${{ steps.conveyor.outputs.text }} + template-text: | + ## Markdown linting issues detected in modified files + + {{ text }} - name: Create PR comment if: ${{ failure() && steps.markdownlint.outcome == 'failure' }} - #if: steps.markdownlint.outputs.exit_code != 0 uses: peter-evans/create-or-update-comment@v4 with: issue-number: ${{ github.event.pull_request.number }} - body-path: ./markdownlint.txt + body: $${{ steps.commentformatter.outputs.updated-text }}