From 2e4992c43a917e4b474b99b179a2fcb9ff21a15a Mon Sep 17 00:00:00 2001 From: ZePan110 Date: Thu, 10 Oct 2024 15:36:25 +0800 Subject: [PATCH] Fix the issue of exiting due to inability to find hyperlinks. (#199) Signed-off-by: ZePan110 --- .github/workflows/pr-path-detection.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-path-detection.yml b/.github/workflows/pr-path-detection.yml index 11157a9b..f2430bce 100644 --- a/.github/workflows/pr-path-detection.yml +++ b/.github/workflows/pr-path-detection.yml @@ -27,9 +27,9 @@ jobs: # url_lines=$(grep -Eo '\]\(http[s]?://[^)]+\)' --include='*.md' -r .|grep -Ev 'linkedin') merged_commit=$(git log -1 --format='%H') changed_files="$(git diff --name-status --diff-filter=ARM ${{ github.event.pull_request.base.sha }} ${merged_commit} | awk '/\.md$/ {print $NF}')" - if [ -n "changed_files" ]; then + if [ -n "$changed_files" ]; then for changed_file in $changed_files; do - url_lines=$(grep -H -Eo '\]\(http[s]?://[^)]+\)' "$changed_file" | grep -Ev 'linkedin') + url_lines=$(grep -H -Eo '\]\(http[s]?://[^)]+\)' "$changed_file" | grep -Ev 'linkedin') || true if [ -n "$url_lines" ]; then for url_line in $url_lines; do url=$(echo "$url_line"|cut -d '(' -f2 | cut -d ')' -f1|sed 's/\.git$//')