Skip to content

Commit 7f369e0

Browse files
committed
fix(gh): Relativize file paths against GITHUB_WORKSPACE
1 parent 3141b83 commit 7f369e0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

action/format_gh.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
set -eu
44

5-
grep '"type":"typo"' |
6-
jq --sort-keys --raw-output '"::warning file=\(.path),line=\(.line_num),col=\(.byte_offset)::\"\(.typo)\" should be \"" + (.corrections // [] | join("\" or \"") + "\".")' |
7-
while IFS= read -r line; do
8-
echo "$line"
9-
done
5+
grep '"type":"typo"' | while IFS= read -r typo; do
6+
original_path="$(echo "$typo" | jq --raw-output '.path')"
7+
relative_path="$(realpath --relative-to="$GITHUB_WORKSPACE" "$original_path")"
8+
echo "$typo" | jq --arg relative_path "$relative_path" --raw-output \
9+
'"::warning file=\($relative_path),line=\(.line_num),col=\(.byte_offset)::\"\(.typo)\" should be \"" + (.corrections // [] | join("\" or \"") + "\".")'
10+
done

0 commit comments

Comments
 (0)