Skip to content

ci: add --update-notifier=false for npm ci #2212

ci: add --update-notifier=false for npm ci

ci: add --update-notifier=false for npm ci #2212

Workflow file for this run

name: Coverage
on:
push:
branches: [master]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node: [18.x]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js ${{matrix.node}}
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node}}
- run: npm -v
- run: npm ci --update-notifier=false
- name: Run jest coverage
run: |
set -o pipefail
npm run coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage/coverage-final.json
- name: Notify Slack channel
if: always() && job.status != 'success' && github.ref == 'refs/heads/master'
env:
GITHUB_WORKFLOW: ${{env.GITHUB_WORKFLOW}}
GITHUB_RUN_NUMBER: ${{env.GITHUB_RUN_NUMBER}}
GITHUB_SHA: ${{env.GITHUB_SHA}}
GITHUB_REPOSITORY: ${{env.GITHUB_REPOSITORY}}
GITHUB_REF: ${{env.GITHUB_REF}}
run: |
GIT_SHA_SHORT=$(git rev-parse --short ${GITHUB_SHA})
NOTIFICATION_TEXT="${GITHUB_WORKFLOW} [${{matrix.node}}] #${GITHUB_RUN_NUMBER} (${GIT_SHA_SHORT}) of ${GITHUB_REPOSITORY}@${GITHUB_REF}"
SUCCESS_NOTIFICATION="${NOTIFICATION_TEXT} successful"
SUCCESS_COLOR="good"
FAILURE_NOTIFICATION="${NOTIFICATION_TEXT} failed"
FAILURE_COLOR="danger"
CANCELLED_NOTIFICATION="${NOTIFICATION_TEXT} cancelled"
CANCELLED_COLOR="warning"
if [[ ${{job.status}} == "success" ]]; then
TEXT=$SUCCESS_NOTIFICATION
COLOR=$SUCCESS_COLOR
elif [[ ${{job.status}} == "failure" ]]; then
TEXT=$FAILURE_NOTIFICATION
COLOR=$FAILURE_COLOR
elif [[ ${{job.status}} == "cancelled" ]]; then
TEXT=$CANCELLED_NOTIFICATION
COLOR=$CANCELLED_COLOR
fi
curl -X POST \
-H "Content-Type: application/json" \
--url ${{secrets.SLACK_WEBHOOK}} \
-d @- << EOF
{
"attachments": [
{
"color": "${COLOR}",
"text": "${TEXT}"
}
]
}
EOF