From 848b9875272f4dbdadc11a152b3c89eeaf4b6176 Mon Sep 17 00:00:00 2001 From: abadhwar Date: Mon, 7 Feb 2022 01:47:59 +0530 Subject: [PATCH 1/2] Add Npm Audit --- .github/workflows/cli-core-audit.yml | 47 ++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/cli-core-audit.yml diff --git a/.github/workflows/cli-core-audit.yml b/.github/workflows/cli-core-audit.yml new file mode 100644 index 00000000..fb3b8690 --- /dev/null +++ b/.github/workflows/cli-core-audit.yml @@ -0,0 +1,47 @@ +name: NPM Audit Check +on: + push: + branches: [ main ] + pull_request: + +jobs: + audit: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: [16.x, 14.x] + steps: + - name: Checkout cli repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - run: make install + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - name: Run audit check + run: npm audit --audit-level=moderate --production + # minimum vulnerability level that will cause the command to fail + # audit reports with low severity would pass the test + notify-complete-fail: + if: ${{ failure() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }} + needs: [ audit ] + name: Notify Npm Audit Failed + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Slack Notification + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_WEBHOOK: ${{ secrets.ALERT_SLACK_WEB_HOOK }} + SLACK_COLOR: 'danger' + SLACK_USERNAME: CLI Github Actions + SLACK_MSG_AUTHOR: twilio-dx + SLACK_ICON_EMOJI: ':github:' + SLACK_TITLE: "Twilio Cli" + SLACK_MESSAGE: 'Cli audit test failed' + MSG_MINIMAL: actions url + SLACK_FOOTER: Posted automatically using GitHub Actions From 2287ae37cd459444c7484b78dd0606ac6dcfc4b1 Mon Sep 17 00:00:00 2001 From: abadhwar Date: Tue, 8 Feb 2022 11:55:02 +0530 Subject: [PATCH 2/2] Resolve conflicts --- .github/workflows/release.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0c153e2a..51fa4f3e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: token-validation: runs-on: ubuntu-latest steps: - - name: Validate REPO_ACCESS_TOKEN + - name: Validate REPO_ACCESS_TOKEN uses: actions/checkout@v2 with: repository: 'twilio/twilio-oai' @@ -66,8 +66,7 @@ jobs: run: make test update-api-specs: runs-on: ubuntu-latest - needs: [ token-validation ] -# needs: [test] + needs: [ test ] outputs: change-log: ${{ steps.update-specs.outputs.change-log }} version-type: ${{ steps.update-specs.outputs.version-type }} @@ -157,4 +156,4 @@ jobs: SLACK_ICON_EMOJI: ":ship:" SLACK_TITLE: "Twilio Cli-core" SLACK_MESSAGE: 'Release workflow Failed' - MSG_MINIMAL: actions url \ No newline at end of file + MSG_MINIMAL: actions url