-
Notifications
You must be signed in to change notification settings - Fork 496
Patch: CI/workflow automation fixes for Tampermonkey extension #2594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This workflow sets up CI for the repository, including build, validation, and security checks.
Patch: CI/workflow automation fixes for Tampermonkey extension
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a CI/CD pipeline for automated builds and validation. The workflow implements multi-stage testing to validate repository structure, shell scripts, and manifest files while performing basic security checks.
- Adds a GitHub Actions workflow with build, validation, and security scanning jobs
- Implements validation for JSON manifest files and shell script syntax
- Sets up basic security scanning to detect sensitive data patterns and potentially unsafe commands
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| run: | | ||
| echo "Running basic security validation..." | ||
| echo "Checking for sensitive patterns..." | ||
| ! grep -r "password\|secret\|api_key" --include="*.sh" --include="*.json" . || echo "Warning: Potential sensitive data found" |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The negation operator ! with || creates incorrect logic. If grep finds matches (exit code 0), ! inverts it to failure (exit code 1), triggering the warning. If no matches are found (exit code 1), ! inverts to success (exit code 0), and the warning isn't shown. This is backwards - the warning appears when sensitive data is found (correct) but the step fails. Remove ! and use && instead: grep -r ... || echo 'No sensitive patterns found' to log findings without failing, or keep ! without || to fail the job when patterns are detected.
| ! grep -r "password\|secret\|api_key" --include="*.sh" --include="*.json" . || echo "Warning: Potential sensitive data found" | |
| ! grep -r "password\|secret\|api_key" --include="*.sh" --include="*.json" . |
| - name: Verify no malicious patterns | ||
| run: | | ||
| echo "Checking for suspicious commands..." | ||
| ! grep -r "eval\|exec" --include="*.sh" . || echo "Warning: Found eval/exec usage - review carefully" |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same logic error as line 96. The ! with || combination causes the step to fail when eval/exec is found (which may be intentional) but the logic is confusing. Consider either: (1) grep -r ... && echo 'Warning: ...' || true to warn without failing, or (2) ! grep -r ... without the || echo to fail the job when patterns are found. The current implementation mixes both approaches inconsistently.
| ! grep -r "eval\|exec" --include="*.sh" . || echo "Warning: Found eval/exec usage - review carefully" | |
| ! grep -r "eval\|exec" --include="*.sh" . |
| cat build_sys/manifest.json.google.com | python3 -m json.tool > /dev/null && echo "manifest.json.google.com is valid JSON" | ||
| fi | ||
| if [ -f build_sys/manifest.json.legacy.com ]; then | ||
| cat build_sys/manifest.json.legacy.com | python3 -m json.tool > /dev/null && echo "manifest.json.legacy.com is valid JSON" |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless use of cat. Use input redirection instead: python3 -m json.tool < build_sys/manifest.json.google.com > /dev/null && echo ... This avoids an unnecessary process and follows shell best practices.
| cat build_sys/manifest.json.google.com | python3 -m json.tool > /dev/null && echo "manifest.json.google.com is valid JSON" | |
| fi | |
| if [ -f build_sys/manifest.json.legacy.com ]; then | |
| cat build_sys/manifest.json.legacy.com | python3 -m json.tool > /dev/null && echo "manifest.json.legacy.com is valid JSON" | |
| python3 -m json.tool < build_sys/manifest.json.google.com > /dev/null && echo "manifest.json.google.com is valid JSON" | |
| fi | |
| if [ -f build_sys/manifest.json.legacy.com ]; then | |
| python3 -m json.tool < build_sys/manifest.json.legacy.com > /dev/null && echo "manifest.json.legacy.com is valid JSON" |
| cat build_sys/manifest.json.google.com | python3 -m json.tool > /dev/null && echo "manifest.json.google.com is valid JSON" | ||
| fi | ||
| if [ -f build_sys/manifest.json.legacy.com ]; then | ||
| cat build_sys/manifest.json.legacy.com | python3 -m json.tool > /dev/null && echo "manifest.json.legacy.com is valid JSON" |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless use of cat. Use input redirection instead: python3 -m json.tool < build_sys/manifest.json.legacy.com > /dev/null && echo ... This avoids an unnecessary process and follows shell best practices.
| cat build_sys/manifest.json.legacy.com | python3 -m json.tool > /dev/null && echo "manifest.json.legacy.com is valid JSON" | |
| python3 -m json.tool < build_sys/manifest.json.legacy.com > /dev/null && echo "manifest.json.legacy.com is valid JSON" |
This PR adds a comprehensive CI/CD workflow for the Tampermonkey repository:
All workflow runs have been tested and pass successfully. This will enable automated testing and validation for future PRs and commits.