33
44set -e
55
6- # USAGE flag "--base <base>" help="base branch to compare against" default="origin/main"
7- # USAGE flag "--head <head>" help="head branch to compare against" default=""
8- # USAGE flag "--event <event>" help="PR name" default="pull_request"
6+ # USAGE flag "--base <base>" help="base branch to compare against (default: origin/main) " default="origin/main"
7+ # USAGE flag "--head <head>" help="head branch to compare against (empty for local changes) (default: empty) " default=""
8+ # USAGE flag "--event <event>" help="event name (default: pull_request) " default="pull_request"
99
10- if [ " $usage_head " == " ''" ]; then
10+ if [ " $usage_head " = " ''" ]; then
1111 usage_head=" "
1212fi
1313
1414# Check if lychee config was modified
15- config_modified=$( git diff --name-only --merge-base " $usage_base " " $usage_head " \
16- | grep -E ' ^(\.github/config/lychee\.toml|.mise/tasks/lint|mise\.toml)$' || true)
15+ # shellcheck disable=SC2086
16+ # - because usage_head may be empty
17+ config_modified=$( git diff --name-only --merge-base " $usage_base " $usage_head \
18+ | grep -E ' ^(\.github/config/lychee\.toml|\.mise/tasks/lint/.*|mise\.toml)$' || true)
1719
1820if [ -n " $config_modified " ] ; then
1921 echo " config changes, checking all files."
@@ -24,7 +26,9 @@ elif [ "$usage_event" != "pull_request" ] ; then
2426else
2527 # Using lychee's default extension filter here to match when it runs against all files
2628 # Note: --diff-filter=d filters out deleted files
27- modified_files=$( git diff --name-only --diff-filter=d " $usage_base " " $usage_head " \
29+ # shellcheck disable=SC2086
30+ # - because usage_head may be empty
31+ modified_files=$( git diff --name-only --diff-filter=d " $usage_base " $usage_head \
2832 | grep -E ' \.(md|mkd|mdx|mdown|mdwn|mkdn|mkdown|markdown|html|htm|txt)$' \
2933 | tr ' \n' ' ' || true)
3034
0 commit comments