From f65c8a162557928a3947716281ee2876a3467aef Mon Sep 17 00:00:00 2001 From: Diego Mascialino Date: Thu, 16 Jul 2020 11:53:32 -0300 Subject: [PATCH] Add action --- .github/workflows/shiftleft.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/shiftleft.yml diff --git a/.github/workflows/shiftleft.yml b/.github/workflows/shiftleft.yml new file mode 100644 index 00000000..3c6d6746 --- /dev/null +++ b/.github/workflows/shiftleft.yml @@ -0,0 +1,33 @@ +# This workflow integrates ShiftLeft NG SAST with GitHub +# Visit https://docs.shiftleft.io for help +name: ShiftLeft + +on: + pull_request: + +jobs: + NextGen-Static-Analysis: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Download ShiftLeft CLI + run: | + curl https://cdn.shiftleft.io/download/sl > ${GITHUB_WORKSPACE}/sl && chmod a+rx ${GITHUB_WORKSPACE}/sl + # ShiftLeft requires Java 1.8. Post the package step override the version + - name: Setup Java JDK + uses: actions/setup-java@v1.3.0 + with: + java-version: 1.8 + - name: NextGen Static Analysis + run: ${GITHUB_WORKSPACE}/sl analyze --app shiftleft-js-demo --tag branch=${{ github.head_ref }} --js --cpg . + env: + SHIFTLEFT_ACCESS_TOKEN: ${{ secrets.SHIFTLEFT_ACCESS_TOKEN }} + SHIFTLEFT_API_HOST: www-ext.stg.shiftleft.io + SHIFTLEFT_GRPC_API_HOST: api-ext.stg.shiftleft.io:443 + - name: Create status check + run: | + URL="https://www.stg.shiftleft.io/violationlist/shiftleft-js-demo?apps=shiftleft-js-demo&isApp=1" + GH_CHECK_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/check-runs" + curl -XPOST $GH_CHECK_URL -H "Authorization: Token ${GITHUB_TOKEN}" -H "accept: application/vnd.github.antiope-preview+json" -H "Content-Type: application/json" -d "{\"name\": \"ShiftLeft Inspect\", \"head_sha\": \"${GITHUB_REF}\", \"external_id\": \"shiftleft-js-demo\", \"details_url\": \"${URL}\", \"status\": \"completed\", \"conclusion\": \"action_required\", \"output\": {\"title\": \"ShiftLeft Inspect Findings\", \"summary\": \"Visit ${URL} for the findings\"}}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}