Skip to content

Update workflow files #10

Update workflow files

Update workflow files #10

Workflow file for this run

name: CI
on:
push:
branches:
- "**"
jobs:
ci:
name: CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "10.x"
cache: "yarn"
- run: yarn install
- run: yarn run lint
- run: yarn run test
notification:
name: Slack notification
runs-on: ubuntu-latest
if: ${{ always() && github.actor != 'dependabot[bot]' }}
needs: [ci]
steps:
- name: Send notification
run: |
# Steps to setup this job:
# 1. Copy this job to your workflow file.
# 2. Add all the jobs after which the notification must be send to `needs`.
# 3. For sending notifications to #CI channel you're now done.
# Optionally: Change the message `successText`, `failureText` and `cancelledText` to your needs.
#
# To send notification to another channel:
# 1. Create a webhook url in the Slack app: https://api.slack.com/apps/A04DZLM3C78
# 2. Add the URL to the repository secrets with the name `SLACK_WEBHOOK_URL`.
# 3. Swap the `webhookUrl` variables.
#
webhookUrl="${{ secrets.SLACK_WEBHOOK_URL }}"
successText=":octocat: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Build #${{ github.run_number }}> of *${{ github.repository }}@${{ github.ref_name }}* by *${{ github.actor }}* completed successfully."
failureText=":octocat: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Build #${{ github.run_number }}> of *${{ github.repository }}@${{ github.ref_name }}* by *${{ github.actor }}* failed."
cancelledText=":octocat: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Build #${{ github.run_number }}> of *${{ github.repository }}@${{ github.ref_name }}* by *${{ github.actor }}* was cancelled.😥"
status="${{ (contains(needs.*.result, 'cancelled') && 'cancelled') || (contains(needs.*.result, 'failure') && 'failure') || 'success' }}"
if [ "$status" = 'success' ]; then
color='good'
text=$successText
elif [ "$status" = 'failure' ]; then
color='danger'
text=$failureText
elif [ "$status" = "cancelled" ]; then
color='warning'
text=$cancelledText
fi
curl "$webhookUrl" -X "POST" --header "Content-Type: application/json" \
--data "{attachments: [{text: \"$text\", color: \"$color\"}]}"