From 4aeb5cfb11a59849ac590b15a8635e5f84937611 Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Fri, 22 Dec 2023 14:25:39 +0000 Subject: [PATCH] Validate links in changed markdown files New workflow gets the list of markdown files modified and runs `mlc` Markup Line Checker tool on those file. Signed-off-by: Sudan Landge --- .github/workflows/markdown_link_checker.yml | 28 +++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/markdown_link_checker.yml diff --git a/.github/workflows/markdown_link_checker.yml b/.github/workflows/markdown_link_checker.yml new file mode 100644 index 000000000000..c0f795b78b3b --- /dev/null +++ b/.github/workflows/markdown_link_checker.yml @@ -0,0 +1,28 @@ +name: Check links in markdown documentation + +on: pull_request + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: "Checkout repository" + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: "Validate links in updated markdown files" + run: | + git fetch origin + changedFiles=$(git diff origin/$GITHUB_BASE_REF.. --name-only) + mlc_installed=0 + for file in $changedFiles; do + if [[ ".md" == ".${file##*.}" ]]; then + if [[ $mlc_installed == 0 ]]; then + cargo install mlc + mlc_installed=1 + fi + echo ${file}; + mlc $file + fi + done