mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-24 17:10:03 +00:00
Simplify script maybe?
This commit is contained in:
parent
9878df20ba
commit
acc6e40aed
1 changed files with 11 additions and 16 deletions
|
@ -1,18 +1,13 @@
|
||||||
cat $1 | while IFS="" read -r line || [ -n "$line" ]; do
|
# Read the input file line by line
|
||||||
|
while IFS= read -r line; do
|
||||||
|
# Use regex to capture file name, line number, column number, and message
|
||||||
|
if [[ $line =~ ^(.+)\(([0-9]+),([0-9]+)\):\ (.+)$ ]]; then
|
||||||
|
file="${BASH_REMATCH[1]}"
|
||||||
|
line_number="${BASH_REMATCH[2]}"
|
||||||
|
column_number="${BASH_REMATCH[3]}"
|
||||||
|
message="${BASH_REMATCH[4]}"
|
||||||
|
|
||||||
# Check if the line contains the error format
|
# Format output for GitHub Actions
|
||||||
if [[ "$line" == *"TypeError:"* ]]; then
|
echo "::warning file=$file,line=$line_number,col=$column_number::${message}"
|
||||||
# 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
|
fi
|
||||||
done
|
done < "$1"
|
Loading…
Reference in a new issue