|
| 1 | +# This workflow integrates ShiftLeft Inspect with GitHub |
| 2 | +# Visit https://docs.shiftleft.io for help |
| 3 | +name: ShiftLeft NG SAST |
| 4 | + |
| 5 | +on: |
| 6 | + pull_request: |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + NextGen-Static-Analysis: |
| 11 | + runs-on: ubuntu-20.04 |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v2 |
| 14 | + - name: Download ShiftLeft CLI |
| 15 | + run: | |
| 16 | + curl https://cdn.shiftleft.io/download/sl > ${GITHUB_WORKSPACE}/sl && chmod a+rx ${GITHUB_WORKSPACE}/sl |
| 17 | + - uses: actions/setup-python@v2 |
| 18 | + with: |
| 19 | + python-version: '3.8.5' |
| 20 | + - name: Extract branch name |
| 21 | + shell: bash |
| 22 | + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" |
| 23 | + id: extract_branch |
| 24 | + - name: Analyze codebase |
| 25 | + run: | |
| 26 | + python3 -m venv .venv |
| 27 | + . .venv/bin/activate |
| 28 | + pip install --upgrade setuptools wheel |
| 29 | + pip install -r requirements.txt |
| 30 | + ${GITHUB_WORKSPACE}/sl analyze --app flask-webgoat --tag branch=${{ github.head_ref || steps.extract_branch.outputs.branch }} --python --cpg --godmodeon . |
| 31 | + env: |
| 32 | + SHIFTLEFT_ACCESS_TOKEN: ${{ secrets.SHIFTLEFT_ACCESS_TOKEN }} |
| 33 | + |
| 34 | + Build-Rules: |
| 35 | + runs-on: ubuntu-20.04 |
| 36 | + needs: NextGen-Static-Analysis |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v2 |
| 39 | + - name: Download ShiftLeft CLI |
| 40 | + run: | |
| 41 | + curl https://cdn.shiftleft.io/download/sl > ${GITHUB_WORKSPACE}/sl && chmod a+rx ${GITHUB_WORKSPACE}/sl |
| 42 | + - name: Extract branch name |
| 43 | + shell: bash |
| 44 | + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" |
| 45 | + id: extract_branch |
| 46 | + - name: Validate Build Rules |
| 47 | + run: ${GITHUB_WORKSPACE}/sl check-analysis --app flask-webgoat --branch "${{ github.head_ref || steps.extract_branch.outputs.branch }}" --report --github-pr-number=${{github.event.number}} --github-pr-user=${{ github.repository_owner }} --github-pr-repo=${{ github.event.repository.name }} --github-token=${{ secrets.GITHUB_TOKEN }} |
| 48 | + env: |
| 49 | + SHIFTLEFT_ACCESS_TOKEN: ${{ secrets.SHIFTLEFT_ACCESS_TOKEN }} |
0 commit comments