-
-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add SAST onboarding automation #72
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: main
Are you sure you want to change the base?
Changes from 1 commit
ec21c3e
89f2c4e
ad24efa
e283983
acbbe22
10735dd
8f971de
27e6a83
ecc9d0a
ae1d8e4
da090b6
6d3ad6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,14 +4,9 @@ on: | |
| workflow_dispatch: | ||
| inputs: | ||
| repository: | ||
| description: 'Repository to onboard (format: owner/repo)' | ||
| description: 'Repository to onboard (format: owner/repo, e.g., MetaMask/snaps)' | ||
| required: true | ||
| type: string | ||
| base_branch: | ||
| description: 'Base branch to create PR against' | ||
| required: false | ||
| default: 'main' | ||
| type: string | ||
| repository_dispatch: | ||
| types: [new_repository_created] | ||
|
|
||
|
|
@@ -31,13 +26,24 @@ jobs: | |
| id: target | ||
| run: | | ||
| if [ "${{ github.event_name }}" = "repository_dispatch" ]; then | ||
| echo "repository=${{ github.event.client_payload.repository }}" >> $GITHUB_OUTPUT | ||
| echo "base_branch=${{ github.event.client_payload.base_branch || 'main' }}" >> $GITHUB_OUTPUT | ||
| REPO="${{ github.event.client_payload.repository }}" | ||
| BASE_BRANCH="${{ github.event.client_payload.base_branch }}" | ||
| else | ||
| echo "repository=${{ inputs.repository }}" >> $GITHUB_OUTPUT | ||
| echo "base_branch=${{ inputs.base_branch }}" >> $GITHUB_OUTPUT | ||
| REPO="${{ inputs.repository }}" | ||
| BASE_BRANCH="" | ||
| fi | ||
|
|
||
| # If base_branch is not set, detect it from the repository | ||
| if [ -z "$BASE_BRANCH" ]; then | ||
| echo "Detecting default branch for $REPO..." | ||
| BASE_BRANCH=$(gh api repos/$REPO --jq '.default_branch') | ||
| fi | ||
|
|
||
| echo "repository=$REPO" >> $GITHUB_OUTPUT | ||
| echo "base_branch=$BASE_BRANCH" >> $GITHUB_OUTPUT | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Checkout target repository | ||
| uses: actions/checkout@v4 | ||
|
|
@@ -65,16 +71,16 @@ jobs: | |
| git add .github/workflows/security-code-scanner.yml | ||
| git commit -m "chore: add MetaMask Security Code Scanner workflow | ||
|
|
||
| This PR adds the MetaMask Security Code Scanner workflow to enable | ||
| automated security scanning of the codebase. | ||
| This PR adds the MetaMask Security Code Scanner workflow to enable | ||
| automated security scanning of the codebase. | ||
|
|
||
| The scanner will run on: | ||
| - Push to main branch | ||
| - Pull requests to main branch | ||
| - Manual workflow dispatch | ||
| The scanner will run on: | ||
| - Push to main branch | ||
| - Pull requests to main branch | ||
cursor[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Manual workflow dispatch | ||
|
|
||
| To configure the scanner for your repository's specific needs, | ||
| please review the workflow file and adjust as necessary." | ||
| To configure the scanner for your repository's specific needs, | ||
| please review the workflow file and adjust as necessary." | ||
|
|
||
| git push origin "$BRANCH_NAME" | ||
|
||
| shell: bash | ||
|
|
||
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.
Bug: Opt-out file documented but never checked in workflow
The PR body template instructs teams to add a
.github/no-security-scannerfile to "prevent future onboarding attempts", but the workflow never actually checks for this file before proceeding with onboarding. This means the documented opt-out mechanism doesn't work - repositories that have added the file will still receive onboarding PRs.Additional Locations (1)
.github/workflows/onboard-new-repo.yml#L55-L75