-
-
Notifications
You must be signed in to change notification settings - Fork 0
Add GitAntivirus workflow, SmartBrain orchestrator, and node bot automation #4
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
Open
Copilot
wants to merge
8
commits into
main
Choose a base branch
from
copilot/add-gitantivirus-workflow-again
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4813f9c
Initial plan
Copilot cba50a7
Add GitAntivirus workflow, SmartBrain orchestrator, node BOT and onboβ¦
Copilot 64bc222
Update gitantivirus.yml
SolanaRemix 59ccb33
Update gitantivirus.yml
SolanaRemix e159b35
Update package.json
SolanaRemix 67bffed
Update billing.html
SolanaRemix 76ee821
Update update-talents.sh
SolanaRemix 0d7ae2f
Address code review feedback: improve consistency and documentation
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,137 @@ | ||
| # Pull Request | ||
|
|
||
| ## π Description | ||
|
|
||
| <!-- Provide a clear and concise description of your changes --> | ||
|
|
||
| ## π― Type of Change | ||
|
|
||
| <!-- Check the relevant option(s) --> | ||
|
|
||
| - [ ] π Bug fix (non-breaking change which fixes an issue) | ||
| - [ ] β¨ New feature (non-breaking change which adds functionality) | ||
| - [ ] π₯ Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
| - [ ] π Documentation update | ||
| - [ ] π Security fix | ||
| - [ ] β‘ Performance improvement | ||
| - [ ] π¨ Code style update (formatting, naming) | ||
| - [ ] β»οΈ Code refactoring | ||
| - [ ] π§ Configuration change | ||
|
|
||
| ## π€ Bot Metadata | ||
|
|
||
| <!-- For automated PRs, fill this section --> | ||
|
|
||
| ```yaml | ||
| bot_generated: false # Set to true if automated | ||
| bot_name: GitAntivirus | ||
| scan_date: YYYY-MM-DD | ||
| dry_run: true | ||
| confidence_score: N/A | ||
| ``` | ||
|
|
||
| ## β Safety Checklist | ||
|
|
||
| <!-- Ensure all items are checked before requesting review --> | ||
|
|
||
| - [ ] I have performed a self-review of my code | ||
| - [ ] I have commented my code, particularly in hard-to-understand areas | ||
| - [ ] I have made corresponding changes to the documentation | ||
| - [ ] My changes generate no new warnings | ||
| - [ ] I have added tests that prove my fix is effective or that my feature works | ||
| - [ ] New and existing unit tests pass locally with my changes | ||
| - [ ] Any dependent changes have been merged and published | ||
| - [ ] I have checked my code for security vulnerabilities | ||
| - [ ] No sensitive information (keys, tokens, passwords) is included | ||
| - [ ] I have updated the changelog (if applicable) | ||
|
|
||
| ## π Testing | ||
|
|
||
| <!-- Describe the tests you ran and how to reproduce them --> | ||
|
|
||
| ### Test Configuration | ||
|
|
||
| - **OS:** (e.g., Ubuntu 22.04, macOS 13) | ||
| - **Node Version:** (e.g., 20.x) | ||
| - **Package Manager:** (e.g., pnpm 8.x) | ||
|
|
||
| ### Test Steps | ||
|
|
||
| 1. | ||
| 2. | ||
| 3. | ||
|
|
||
| ## π Audit Artifacts | ||
|
|
||
| <!-- Attach scan results, reports, or evidence --> | ||
|
|
||
| <details> | ||
| <summary>π Security Scan Results</summary> | ||
|
|
||
| ``` | ||
| [Paste security scan output here] | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
| <details> | ||
| <summary>π¦ Dependency Audit</summary> | ||
|
|
||
| ``` | ||
| [Paste dependency audit output here] | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
| <details> | ||
| <summary>π§ͺ Test Results</summary> | ||
|
|
||
| ``` | ||
| [Paste test results here] | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
| ## πΈ Screenshots / Recordings | ||
|
|
||
| <!-- If applicable, add screenshots or recordings to help explain your changes --> | ||
|
|
||
| ## π Related Issues | ||
|
|
||
| <!-- Link related issues using #issue_number --> | ||
|
|
||
| Closes # | ||
| Relates to # | ||
|
|
||
| ## π Additional Context | ||
|
|
||
| <!-- Add any other context about the PR here --> | ||
|
|
||
| ## π Security Notes | ||
|
|
||
| <!-- Important: Address security considerations --> | ||
|
|
||
| - **Secrets:** No secrets or credentials are included in this PR | ||
| - **Dependencies:** All new dependencies are from trusted sources | ||
| - **Permissions:** This PR requires the following permissions: | ||
| - **Impact:** Security impact assessment: [None/Low/Medium/High] | ||
|
|
||
| ## π Reviewer Notes | ||
|
|
||
| <!-- Specific instructions or areas for reviewers to focus on --> | ||
|
|
||
| --- | ||
|
|
||
| ## π Post-Merge Checklist | ||
|
|
||
| <!-- Items to complete after merge --> | ||
|
|
||
| - [ ] Update production environment | ||
| - [ ] Notify stakeholders | ||
| - [ ] Update documentation site | ||
| - [ ] Monitor for issues | ||
| - [ ] Close related issues | ||
|
|
||
| --- | ||
|
|
||
| *π€ GitAntivirus PR Template v1.0.0* |
This file contains hidden or 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,243 @@ | ||
| name: GitAntivirus - Smart Contract Security Scanner | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| push: | ||
| branches: | ||
| - main | ||
| - develop | ||
| schedule: | ||
| # Run daily at 2 AM UTC | ||
| - cron: '0 2 * * *' | ||
| workflow_dispatch: | ||
| inputs: | ||
| dry_run: | ||
| description: 'Run in dry-run mode' | ||
| required: false | ||
| default: 'true' | ||
| bot_pings: | ||
| description: 'Enable bot pings' | ||
| required: false | ||
| default: 'false' | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| issues: write | ||
|
|
||
| env: | ||
| DRY_RUN: ${{ github.event.inputs.dry_run || 'true' }} | ||
| BOT_PINGS_ENABLED: ${{ github.event.inputs.bot_pings || 'false' }} | ||
| ALLOWLIST_ORGS: '' | ||
| NODE_VERSION: '20' | ||
|
|
||
| jobs: | ||
| gitantivirus-scan: | ||
| name: π‘οΈ GitAntivirus Security Scan | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: π₯ Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: π§ Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
|
|
||
| - name: π¦ Setup pnpm | ||
| uses: pnpm/action-setup@v2 | ||
| with: | ||
| version: 8 | ||
| run_install: false | ||
|
|
||
| - name: π Get pnpm store directory | ||
| id: pnpm-cache | ||
| shell: bash | ||
| run: | | ||
| echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: πΎ Setup pnpm cache | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | ||
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pnpm-store- | ||
|
|
||
| - name: π Install dependencies | ||
| run: | | ||
| if [ -f "package.json" ]; then | ||
| pnpm install --frozen-lockfile || pnpm install || npm install | ||
| else | ||
| echo "No package.json found, skipping dependency installation" | ||
| fi | ||
|
|
||
| - name: π Make scripts executable | ||
| run: | | ||
| chmod +x scripts/*.sh || true | ||
| chmod +x node/bot/*.js || true | ||
|
|
||
| - name: π§ SMSDAO Repair (Dry-Run) | ||
| if: env.DRY_RUN == 'true' | ||
| run: | | ||
| echo "π§ͺ Running SMSDAO repair in dry-run mode..." | ||
| if [ -f "scripts/master.sh" ]; then | ||
| ./scripts/master.sh health --dry-run | ||
| fi | ||
|
|
||
| - name: π§ SmartBrain Orchestrator - Scan | ||
| run: | | ||
| echo "π Running SmartBrain scan..." | ||
| if [ -f "scripts/master.sh" ]; then | ||
| ./scripts/master.sh scan --verbose | ||
| else | ||
| echo "β οΈ SmartBrain orchestrator not found" | ||
| fi | ||
|
|
||
| - name: π SmartBrain Orchestrator - Audit | ||
| run: | | ||
| echo "π Running SmartBrain audit..." | ||
| if [ -f "scripts/master.sh" ]; then | ||
| ./scripts/master.sh audit --verbose | ||
| else | ||
| echo "β οΈ SmartBrain orchestrator not found" | ||
| fi | ||
|
|
||
| - name: π SmartBrain Orchestrator - Health Check | ||
| run: | | ||
| echo "π Running SmartBrain health check..." | ||
| if [ -f "scripts/master.sh" ]; then | ||
| ./scripts/master.sh health --verbose | ||
| else | ||
| echo "β οΈ SmartBrain orchestrator not found" | ||
| fi | ||
|
|
||
| - name: π Generate Report | ||
| run: | | ||
| echo "π Generating comprehensive report..." | ||
| mkdir -p reports | ||
| if [ -f "scripts/master.sh" ]; then | ||
| ./scripts/master.sh report --verbose > reports/analysis-report.txt | ||
| fi | ||
| echo "Report generated at: reports/analysis-report.txt" | ||
|
|
||
| - name: π€ Upload Audit Artifacts | ||
| uses: actions/upload-artifact@v3 | ||
| if: always() | ||
| with: | ||
| name: gitantivirus-reports | ||
| path: | | ||
| reports/ | ||
| /tmp/audit-report.json | ||
| retention-days: 30 | ||
|
|
||
| - name: π·οΈ Add Labels to PR | ||
| if: github.event_name == 'pull_request' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const labels = ['security-scan', 'gitantivirus']; | ||
| try { | ||
| await github.rest.issues.addLabels({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| labels: labels | ||
| }); | ||
| console.log('β Labels added successfully'); | ||
| } catch (error) { | ||
| console.log('β οΈ Could not add labels:', error.message); | ||
| } | ||
|
|
||
| - name: π¬ Sticky PR Comment | ||
| if: github.event_name == 'pull_request' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const fs = require('fs'); | ||
| const botPingsEnabled = process.env.BOT_PINGS_ENABLED === 'true'; | ||
| const repoOwner = context.repo.owner; | ||
| const dryRun = process.env.DRY_RUN === 'true'; | ||
|
|
||
| // Construct comment body | ||
| let commentBody = `## π‘οΈ GitAntivirus Security Scan Report\n\n`; | ||
| commentBody += `**Status:** ${dryRun ? 'π§ͺ Dry-Run Mode' : 'β Active'}\n`; | ||
| commentBody += `**Scan Time:** ${new Date().toISOString()}\n\n`; | ||
|
|
||
| // Add report content if available | ||
| try { | ||
| if (fs.existsSync('reports/analysis-report.txt')) { | ||
| const report = fs.readFileSync('reports/analysis-report.txt', 'utf8'); | ||
| commentBody += `### π Analysis Results\n\n\`\`\`\n${report.slice(0, 2000)}\n\`\`\`\n\n`; | ||
| } | ||
| } catch (error) { | ||
| console.log('Could not read report file:', error.message); | ||
| } | ||
|
|
||
| commentBody += `### π Security Checks\n`; | ||
| commentBody += `- β Repository scanned for vulnerabilities\n`; | ||
| commentBody += `- β Dependencies audited\n`; | ||
| commentBody += `- β Code quality checked\n`; | ||
| commentBody += `- β Health monitoring complete\n\n`; | ||
|
|
||
| // Conditionally add pings only for SolanaRemix org when enabled | ||
| if (botPingsEnabled && repoOwner === 'SolanaRemix') { | ||
| commentBody += `### π’ Notifications\n`; | ||
| commentBody += `cc: @SolanaRemix @smsdao @SmartBrain\n\n`; | ||
| } | ||
|
|
||
| commentBody += `---\n`; | ||
| commentBody += `*π€ Automated by GitAntivirus | Powered by SmartBrain*\n`; | ||
|
|
||
| // Find existing comment | ||
| const { data: comments } = await github.rest.issues.listComments({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| }); | ||
|
|
||
| const existingComment = comments.find(comment => | ||
| comment.user.type === 'Bot' && comment.body.includes('GitAntivirus Security Scan Report') | ||
| ); | ||
|
|
||
| try { | ||
| if (existingComment) { | ||
| // Update existing comment | ||
| await github.rest.issues.updateComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: existingComment.id, | ||
| body: commentBody | ||
| }); | ||
| console.log('β Updated existing comment'); | ||
| } else { | ||
| // Create new comment | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| body: commentBody | ||
| }); | ||
| console.log('β Created new comment'); | ||
| } | ||
| } catch (error) { | ||
| console.log('β οΈ Could not post comment:', error.message); | ||
| } | ||
|
|
||
| - name: π Add to Project | ||
| if: github.event_name == 'pull_request' && secrets.PROJECT_URL != '' | ||
SolanaRemix marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| uses: actions/github-script@v7 | ||
| continue-on-error: true | ||
| with: | ||
| script: | | ||
| const projectUrl = '${{ secrets.PROJECT_URL }}'; | ||
| if (!projectUrl) { | ||
| console.log('β οΈ PROJECT_URL secret not configured'); | ||
| return; | ||
| } | ||
| console.log('π Would add to project:', projectUrl); | ||
| // Project addition logic would go here if PROJECT_URL is configured | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.