gaurav-nelson / github-action-markdown-link-check

Check all links in markdown files if they are alive or dead. 🔗✔️
MIT License
399 stars 77 forks source link

Respect folder-path when check-modified-files-only == yes #168

Closed exoego closed 1 year ago

exoego commented 1 year ago

Fixes #167

This PR leverages -- <path>... options of git diff [<options>] [<commit>] [--] [<path>…​] Refer https://git-scm.com/docs/git-diff

I've tested the results of git diff --name-only --diff-filter=AM "$MASTER_HASH" -- "${FOLDER_ARRAY[@]}" with some variants of FOLDER_PATH in bash.

$ FOLDER_PATH="."
$ FOLDER_ARRAY=(${FOLDER_PATH//,/ })
$ git diff --name-only --diff-filter=AM "$MASTER_HASH" -- "${FOLDER_ARRAY[@]}"
.github/workflows/linkcheck.yml
docs/running.md
docs/scalafix-migrations.md
modules/core/src/main/scala/org/scalasteward/core/application/Cli.scala
modules/core/src/test/scala/org/scalasteward/core/application/CliTest.scala
modules/docs/mdoc/running.md
modules/docs/mdoc/scalafix-migrations.md

$ FOLDER_PATH="docs"
$ FOLDER_ARRAY=(${FOLDER_PATH//,/ })
$ git diff --name-only --diff-filter=AM "$MASTER_HASH" -- "${FOLDER_ARRAY[@]}"
docs/running.md
docs/scalafix-migrations.md

$ FOLDER_PATH="docs,modules"
$ FOLDER_ARRAY=(${FOLDER_PATH//,/ })
$ git diff --name-only --diff-filter=AM "$MASTER_HASH" -- "${FOLDER_ARRAY[@]}"
docs/running.md
docs/scalafix-migrations.md
modules/core/src/main/scala/org/scalasteward/core/application/Cli.scala
modules/core/src/test/scala/org/scalasteward/core/application/CliTest.scala
modules/docs/mdoc/running.md
modules/docs/mdoc/scalafix-migrations.md

Reference

gaurav-nelson commented 1 year ago

@exoego Sorry for delay on this one. Can you rebase and push this commit again?

exoego commented 1 year ago

@gaurav-nelson Rebased