shiftleft.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ---
  2. # This workflow integrates ShiftLeft NG SAST with GitHub
  3. # Visit https://docs.shiftleft.io for help
  4. name: ShiftLeft
  5. on:
  6. pull_request:
  7. workflow_dispatch:
  8. jobs:
  9. NextGen-Static-Analysis:
  10. runs-on: ubuntu-latest
  11. steps:
  12. - uses: actions/checkout@v2
  13. - uses: actions/setup-go@v2
  14. with:
  15. go-version: '^1.14'
  16. - name: Build
  17. run: |
  18. go build ./...
  19. - name: Download ShiftLeft CLI
  20. run: |
  21. curl https://cdn.shiftleft.io/download/sl > ${GITHUB_WORKSPACE}/sl && chmod a+rx ${GITHUB_WORKSPACE}/sl
  22. - name: Extract branch name
  23. shell: bash
  24. run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
  25. id: extract_branch
  26. - name: NextGen Static Analysis
  27. run: |
  28. ${GITHUB_WORKSPACE}/sl --version
  29. ${GITHUB_WORKSPACE}/sl analyze --wait --app gonuma --tag branch=${{ github.head_ref || steps.extract_branch.outputs.branch }} --go --cpg $(pwd)
  30. env:
  31. SHIFTLEFT_ACCESS_TOKEN: ${{ secrets.SHIFTLEFT_ACCESS_TOKEN }}
  32. ## Uncomment the following section to enable build rule checking and enforcing.
  33. #Build-Rules:
  34. #runs-on: ubuntu-latest
  35. #needs: NextGen-Static-Analysis
  36. #steps:
  37. #- uses: actions/checkout@v2
  38. #- name: Download ShiftLeft CLI
  39. # run: |
  40. # curl https://cdn.shiftleft.io/download/sl > ${GITHUB_WORKSPACE}/sl && chmod a+rx ${GITHUB_WORKSPACE}/sl
  41. #- name: Validate Build Rules
  42. # run: ${GITHUB_WORKSPACE}/sl check-analysis --app gonuma \
  43. # --source 'tag.branch=${{ github.event.pull_request.base.ref }}' \
  44. # --target "tag.branch=${{ github.head_ref || steps.extract_branch.outputs.branch }}" \
  45. # --report \
  46. # --github-pr-number=${{github.event.number}} \
  47. # --github-pr-user=${{ github.repository_owner }} \
  48. # --github-pr-repo=${{ github.event.repository.name }} \
  49. # --github-token=${{ secrets.GITHUB_TOKEN }}
  50. # env:
  51. #SHIFTLEFT_ACCESS_TOKEN: ${{ secrets.SHIFTLEFT_ACCESS_TOKEN }}