Skip to content

Commit 99eace6

Browse files
authored
fix link check (#2333)
1 parent aa315a5 commit 99eace6

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

.mise/tasks/lint/links-in-modified-files.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@
33

44
set -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=""
1212
fi
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

1820
if [ -n "$config_modified" ] ; then
1921
echo "config changes, checking all files."
@@ -24,7 +26,9 @@ elif [ "$usage_event" != "pull_request" ] ; then
2426
else
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

.mise/tasks/lint/local-links.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
#MISE description="Lint links in all files"
2+
#MISE description="Lint links in local files"
33

44
set -e
55

0 commit comments

Comments
 (0)