Skip to content

Commit 63f3b05

Browse files
Update vbscript-syntax-check.yml
Signed-off-by: LUIZ HAMILTON ROBERTO DA SILVA <[email protected]>
1 parent b79a1e8 commit 63f3b05

1 file changed

Lines changed: 21 additions & 11 deletions

File tree

.github/workflows/vbscript-syntax-check.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,17 @@ jobs:
3939
working-directory: ./repo
4040
run: |
4141
echo '{"version":"2.1.0","runs":[{"tool":{"driver":{"name":"VBScript Syntax Check","informationUri":"https://learn.microsoft.com/en-us/previous-versions//d1wf56tt(v=vs.85)","rules":[]}},"results":[' > vbscript-results.sarif
42+
echo "| File | Line | Message |" > vbscript-summary.md
43+
echo "|------|------|---------|" >> vbscript-summary.md
4244
4345
exit_code=0
4446
first=true
47+
error_found=false
4548
4649
while IFS= read -r file; do
4750
echo "🔍 Checking: $file"
4851
49-
# Skip HTA files that start with HTML or lack VBScript blocks
52+
# Skip HTML-based HTA files
5053
if [[ "$file" == *.hta ]]; then
5154
if grep -iqE '^\s*<(html|!doctype)' "$file"; then
5255
echo "::notice file=$file::Skipped HTA (HTML content)"
@@ -58,24 +61,20 @@ jobs:
5861
fi
5962
fi
6063
61-
# Run VBScript under Wine
64+
# Validate syntax using Wine
6265
if ! wine cscript.exe //nologo "$file" 2> error.log; then
63-
echo "::error file=$file::Syntax error in VBScript."
6466
[[ "$first" == false ]] && echo "," >> vbscript-results.sarif
6567
first=false
68+
error_found=true
6669
67-
# Extract first useful line number using grep -n
6870
match_line=$(grep -in "Error" error.log | head -n 1)
6971
line_number=$(echo "$match_line" | cut -d: -f1)
7072
message=$(echo "$match_line" | cut -d: -f2- | sed 's/"/'\''/g')
7173
72-
# fallback if grep fails
73-
if [[ -z "$line_number" ]]; then
74-
line_number=1
75-
message="Syntax error in VBScript"
76-
fi
74+
[[ -z "$line_number" ]] && line_number=1 && message="Syntax error in VBScript"
7775
78-
echo "❌ Line $line_number: $message"
76+
echo "::error file=$file,line=$line_number::${message}"
77+
echo "| \`$file\` | $line_number | $message |" >> vbscript-summary.md
7978
8079
echo '{' >> vbscript-results.sarif
8180
echo ' "level": "error",' >> vbscript-results.sarif
@@ -93,14 +92,25 @@ jobs:
9392
done < vbscript-files.txt
9493
9594
echo ']}]}' >> vbscript-results.sarif
95+
96+
if [[ "$error_found" == false ]]; then
97+
echo "| ✅ No syntax errors found. |" >> vbscript-summary.md
98+
fi
99+
96100
exit $exit_code
97101
98102
- name: 📁 Upload SARIF Artifact
99103
uses: actions/upload-artifact@v4
100104
with:
101-
name: vbscript-lint-report
105+
name: vbscript-lint-sarif
102106
path: repo/vbscript-results.sarif
103107

108+
- name: 📝 Upload Markdown Summary
109+
uses: actions/upload-artifact@v4
110+
with:
111+
name: vbscript-lint-summary
112+
path: repo/vbscript-summary.md
113+
104114
- name: 🛰️ Upload SARIF to GitHub Code Scanning
105115
uses: github/codeql-action/upload-sarif@v3
106116
with:

0 commit comments

Comments
 (0)