PR Code Scan #51
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
| name: PR Code Scan | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| branches: | |
| - master | |
| - main | |
| - test | |
| workflow_dispatch: | |
| jobs: | |
| scan_pr_code: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Step 1: Checkout the repository code | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| # Step 2: Install Email Dependencies | |
| - name: Install Email Dependencies | |
| run: | | |
| sudo apt-get install -y msmtp mutt | |
| # Step 3: Set up Checkmarx One CLI | |
| - name: Set up Checkmarx One CLI | |
| run: | | |
| CX_VERSION="2.3.21" | |
| wget "https://github.com/Checkmarx/ast-cli/releases/download/${CX_VERSION}/ast-cli_${CX_VERSION}_linux_x64.tar.gz" | |
| tar -xvzf ast-cli_${CX_VERSION}_linux_x64.tar.gz | |
| chmod +x cx | |
| sudo mv cx /usr/local/bin/ | |
| # Step 4: Make your scan script executable | |
| - name: Make Script Executable | |
| run: chmod +x git-secret-scanner.sh | |
| # Step 5: Run the Scan Script | |
| - name: Run Scan Script | |
| run: bash ./git-secret-scanner.sh "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git" "${{ github.head_ref || github.ref_name }}" | |
| env: | |
| ACCOUNT: ${{secrets.ACCOUNT}} | |
| HOST: ${{secrets.HOST}} | |
| PORT: ${{secrets.PORT}} | |
| SENDER_EMAIL: ${{secrets.SENDER_EMAIL}} | |
| SENDER_EMAIL_USERNAME: ${{secrets.SENDER_EMAIL_USERNAME}} | |
| SENDER_EMAIL_PASSWORD: ${{secrets.SENDER_EMAIL_PASSWORD}} | |
| ACCOUNT_DEFAULT: ${{secrets.ACCOUNT_DEFAULT}} | |
| RECIPIENT_EMAIL: ${{secrets.RECIPIENT_EMAIL}} | |
| CX_API_KEY: ${{secrets.CX_ONE_API_KEY}} | |
| # Step 6: Report the results | |
| - name: Report Scan Results | |
| run: | | |
| echo "Pull Request code scan completed. Check workflow logs for details." |