VM Patch feature #17
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: README-Lint | |
on: | |
pull_request: | |
paths: | |
- '**.md' | |
branches: | |
- main | |
workflow_call: | |
jobs: | |
lint-README: | |
name: Lint README file | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Get list of changed Markdown files | |
id: get-md-files | |
run: | | |
echo "::set-output name=files::$(git diff --name-only --diff-filter=d origin/main... | grep .md)" | |
- name: Lint Markdown files | |
uses: docker://avtodev/markdown-lint:v1 # fastest way | |
id: lintFile | |
with: | |
config: '/lint/config/changelog.yml' | |
output: './.github/md_lint_output.txt' | |
args: ${{ steps.get-md-files.outputs.files }} | |
- name: Output file contents | |
id: outputCont | |
if: ${{ failure() }} | |
run: | | |
OUTPUT_STRING=$(cat $(pwd)/.github/md_lint_output.txt) | |
OUTPUT_STRING="${OUTPUT_STRING//'%'/'%25'}" | |
OUTPUT_STRING="${OUTPUT_STRING//$'\n'/'%0A'}" | |
OUTPUT_STRING="${OUTPUT_STRING//$'\r'/'%0D'}" | |
echo "::set-output name=outFile::$OUTPUT_STRING" | |
- name: Create Fail Comment | |
uses: actions/github-script@v5 | |
if: ${{ failure() }} | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `${{steps.outputCont.outputs.outFile}}` | |
}) | |
- name: Create Success Comment | |
uses: actions/github-script@v5 | |
if: ${{ success() }} | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'Markdown Valid' | |
}) |