Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add Npm Audit workflow #196

Merged
merged 2 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/cli-core-audit.yml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -66,8 +66,7 @@ jobs:
run: make test
update-api-specs:
runs-on: ubuntu-latest
needs: [ token-validation ]
# needs: [test]
needs: [ test ]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shamantraghav -Addressed merge issue, could you please help here if this should be the expected behaviour?

Kept just test as dependency, since test already depends upon token-validation.

Copy link
Contributor

@sr010 sr010 Feb 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be fine now as tests are enabled

outputs:
change-log: ${{ steps.update-specs.outputs.change-log }}
version-type: ${{ steps.update-specs.outputs.version-type }}
Expand Down Expand Up @@ -157,4 +156,4 @@ jobs:
SLACK_ICON_EMOJI: ":ship:"
SLACK_TITLE: "Twilio Cli-core"
SLACK_MESSAGE: 'Release workflow Failed'
MSG_MINIMAL: actions url
MSG_MINIMAL: actions url