Skip to content

Commit 1e65ae6

Browse files
Create vbscript-syntax-check.yml
Signed-off-by: LUIZ HAMILTON ROBERTO DA SILVA <[email protected]>
1 parent 05fd4ee commit 1e65ae6

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: VBScript Syntax Check with SARIF
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
paths:
7+
- '**/*.vbs'
8+
- '**/*.hta'
9+
pull_request:
10+
branches: [main, develop]
11+
paths:
12+
- '**/*.vbs'
13+
- '**/*.hta'
14+
workflow_dispatch:
15+
16+
jobs:
17+
vbscript-lint:
18+
name: VBScript Syntax Validation
19+
runs-on: ubuntu-latest
20+
21+
outputs:
22+
sarif-report-path: ${{ steps.sarif-output.outputs.sarif-path }}
23+
24+
steps:
25+
- name: 📦 Checkout Repository (short path to avoid path errors)
26+
uses: actions/checkout@v4
27+
with:
28+
path: repo
29+
30+
- name: 🔍 Locate VBS and HTA Files
31+
id: locate-files
32+
working-directory: ./repo
33+
run: |
34+
find . -type f \( -iname "*.vbs" -o -iname "*.hta" \) > vbscript-files.txt
35+
cat vbscript-files.txt || echo "No .vbs or .hta files found."
36+
37+
- name: ✅ Heuristic Content Check
38+
id: heuristic-check
39+
working-directory: ./repo
40+
run: |
41+
mkdir -p sarif-output
42+
echo '{"version":"2.1.0","runs":[{"tool":{"driver":{"name":"VBScript Syntax Check","informationUri":"https://docs.microsoft.com/en-us/previous-versions//d1wf56tt(v=vs.85)","rules":[]}},"results":[]}]}' > sarif-output/vbscript-syntax-check.sarif
43+
44+
while IFS= read -r file; do
45+
echo "🔍 Checking: $file"
46+
if file "$file" | grep -qi "text"; then
47+
head -n 5 "$file"
48+
else
49+
echo "::warning file=$file::Not a valid text-based VBS or HTA file."
50+
jq \
51+
--arg uri "$file" \
52+
'.runs[0].results += [{"ruleId": "vbscript-text-check", "message": {"text": "Not a valid text-based file"}, "locations": [{"physicalLocation": {"artifactLocation": {"uri": $uri}}]}]' \
53+
sarif-output/vbscript-syntax-check.sarif > temp.sarif && mv temp.sarif sarif-output/vbscript-syntax-check.sarif
54+
fi
55+
done < vbscript-files.txt
56+
57+
- name: 📤 Upload SARIF Output
58+
id: sarif-output
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: vbscript-syntax-check-sarif
62+
path: repo/sarif-output/vbscript-syntax-check.sarif
63+
64+
- name: 📊 Upload SARIF to GitHub Code Scanning (optional)
65+
uses: github/codeql-action/upload-sarif@v3
66+
with:
67+
sarif_file: repo/sarif-output/vbscript-syntax-check.sarif

0 commit comments

Comments
 (0)