Skip to content

chore(deps): update codecov/codecov-action action to v5 #2727

chore(deps): update codecov/codecov-action action to v5

chore(deps): update codecov/codecov-action action to v5 #2727

Workflow file for this run

name: Coverage
on:
push:
branches: [master]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node: [22.x]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js ${{matrix.node}}
uses: actions/setup-node@v4
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@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
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