Developer alerts

GitHub Actions build status on your LED matrix

Green when CI passes, red with fireworks when it breaks. Seen from across the room.

A build light is an old team favourite: you know CI broke before anyone opens a tab. This workflow runs after your CI workflow finishes and puts the result on your matrix. It is a separate file, so your existing workflow doesn't change.

What your matrix shows

api: main passed

Plain text. Illustration; the real effect is animated.

What you need

  • A GitHub repository with an Actions workflow (the example assumes it is named "CI").
  • Your Authorization value from the setup guide (about 5 minutes).

Set it up

1. Add the secret

In the repository open Settings → Secrets and variables → Actions → New repository secret. Name it PIPPLEE_AUTH and paste your Authorization value.

2. Add the workflow

Save this as .github/workflows/matrix.yml on your default branch. Change "CI" to the name of your workflow (the name: line at the top of its file).

name: Matrix build light
on:
  workflow_run:
    workflows: ["CI"]
    types: [completed]

jobs:
  matrix:
    runs-on: ubuntu-latest
    steps:
      - name: Show the result on the matrix
        env:
          PIPPLEE_AUTH: ${{ secrets.PIPPLEE_AUTH }}
          RESULT: ${{ github.event.workflow_run.conclusion }}
          LABEL: "${{ github.event.repository.name }}: ${{ github.event.workflow_run.head_branch }}"
        run: |
          LABEL=$(printf '%s' "$LABEL" | cut -c1-80)
          case "$RESULT" in
            success) BODY="{\"text\": \"$LABEL passed\", \"font_color\": \"51cf66\", \"duration\": 30}" ;;
            failure) BODY="{\"text\": \"$LABEL failed\", \"font_color\": \"ff6b6b\", \"border\": \"fireworks\", \"duration\": 300}" ;;
            *) exit 0 ;;
          esac
          curl -sS -X POST https://pipplee.com/api/v1/public/devices/text \
            -H "Authorization: $PIPPLEE_AUTH" \
            -H "Content-Type: application/json" \
            -d "$BODY"

How it works

  • workflow_run starts this workflow each time your CI workflow finishes, on any branch.
  • A pass shows the repository and branch in green for 30 seconds; a failure shows them in red with a fireworks border for 5 minutes.
  • Cancelled or skipped runs show nothing. After the time is up the matrix goes back to normal.

Variations

Only failures on main

Add a condition to the job so the matrix only lights up when main breaks.

jobs:
  matrix:
    if: github.event.workflow_run.head_branch == 'main' && github.event.workflow_run.conclusion == 'failure'
    runs-on: ubuntu-latest

Deploy finished

Point workflows at your deploy workflow instead and change the text to "Deployed". You can list several workflows: workflows: ["CI", "Deploy"].

Keep a failure up until it is fixed

Use "duration": 0 in the failure message. It stays on the matrix until the next message, which is the green one when the build passes again.

Questions

Will this run on pull requests from forks?

workflow_run runs in your repository with its secrets, but only from the workflow file on your default branch. Forks can't change it or read the secret.

Can several repositories share one matrix?

Yes. Add the same PIPPLEE_AUTH secret to each repository, or once as an organisation secret. The newest message replaces the one before it.

More ideas

All developer ideas and setup →

Get Pipplee

Set up your matrix in the app, then send it your first alert.

iPhone Android