From 04ef154193f669a348e82c4ebd2c949fd15c7df1 Mon Sep 17 00:00:00 2001 From: EncodedVenom Date: Sat, 19 Oct 2024 19:47:26 -0400 Subject: [PATCH] Unit testing init PR --- .github/workflows/analysis.yaml | 1 + .github/workflows/gh-warn-luau-analyze.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 .github/workflows/gh-warn-luau-analyze.sh diff --git a/.github/workflows/analysis.yaml b/.github/workflows/analysis.yaml index f3d07be..27da361 100644 --- a/.github/workflows/analysis.yaml +++ b/.github/workflows/analysis.yaml @@ -17,3 +17,4 @@ jobs: - name: Analyze run: | output=$(luau-analyze src || true) # Suppress errors for now. + ./gh-warn-luau-analyze.sh "$output" diff --git a/.github/workflows/gh-warn-luau-analyze.sh b/.github/workflows/gh-warn-luau-analyze.sh new file mode 100644 index 0000000..9fa07e3 --- /dev/null +++ b/.github/workflows/gh-warn-luau-analyze.sh @@ -0,0 +1,19 @@ +# Parse the output and generate GitHub Actions warnings +while IFS="" read -r line || [ -n "$line" ]; do + + # Check if the line contains the error format + if [[ "$line" == *"TypeError:"* ]]; then + # Extract the file name and line number using string manipulation + file_line="${line%%:*}" # Get the part before the first colon + message="${line#*: TypeError: }" # Get the message after "TypeError: " + + # Extract the file and line number + file="${file_line%(*}" # Get the file name (everything before the '(') + location="${file_line#*()}"; # Get the part inside parentheses (line and column) + line_number="${location%%,*}"; # Extract the line number + column_number="${location#*,}"; # Extract the column number + + # Generate GitHub Actions warning + echo "::warning file=${file},line=${line_number},col=${column_number}::${message}" + fi +done