forked from elizaOS/eliza
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,281 changed files
with
78,375 additions
and
8,593 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Block Minified JavaScript/TypeScript | ||
|
||
on: | ||
pull_request: | ||
branches: ["main", "develop", "*"] | ||
push: | ||
branches: ["main", "develop", "*"] | ||
|
||
jobs: | ||
block-minified-code: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Detect potential minified code | ||
shell: bash | ||
run: | | ||
echo "Scanning for potential minified JS/TS code..." | ||
# We'll look in .ts, .tsx, .js, .jsx files, skipping common build dirs. | ||
FILES=$(find . \ | ||
\( -name 'node_modules' -prune \) -o \ | ||
\( -name 'dist' -prune \) -o \ | ||
\( -name 'build' -prune \) -o \ | ||
-type f \( -name '*.ts' -o -name '*.tsx' -o -name '*.js' -o -name '*.jsx' \) \ | ||
-print) | ||
if [ -z "$FILES" ]; then | ||
echo "No relevant JS/TS files found." | ||
exit 0 | ||
fi | ||
THRESHOLD=1000 | ||
VIOLATIONS=0 | ||
for file in $FILES; do | ||
# Use grep -En to capture line number and text | ||
# If any line is ≥ THRESHOLD chars, we store those lines in RESULTS | ||
RESULTS=$(grep -En ".{${THRESHOLD},}" "$file" || true) | ||
if [ -n "$RESULTS" ]; then | ||
# We have potential minified lines | ||
while IFS= read -r match; do | ||
# 'match' will be something like "1234:the entire matched line" | ||
LINENUM=$(echo "$match" | cut -d: -f1) | ||
# If you want the text, you can do: | ||
# MATCHED_LINE=$(echo "$match" | cut -d: -f2-) | ||
echo "::error file=$file,line=$LINENUM::Detected potential minified code (≥ $THRESHOLD chars)." | ||
done <<< "$RESULTS" | ||
VIOLATIONS=1 | ||
fi | ||
done | ||
if [ "$VIOLATIONS" -eq 1 ]; then | ||
echo "ERROR: Minified code detected. Please remove or exclude it." | ||
exit 1 | ||
else | ||
echo "No minified code detected." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.