Skip to content

Commit

Permalink
add GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Apr 6, 2024
1 parent 68c01ae commit 1875b7e
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/discord.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Discord Notification

on:
workflow_run:
workflows: ['CI', 'Docs']
types: [completed]

jobs:
notify:
# if: ${{ github.event.workflow_run.conclusion == 'failure' }}
runs-on: ubuntu-latest
steps:
- name: Push the notification using Discord webhook
env:
# 🟢 has poor compatibility: https://www.unicompat.com/1F7E2
CI_STATUS: ${{ github.event.workflow_run.conclusion == 'success' && '✅' || github.event.workflow_run.conclusion == 'failure' && '🔴' || github.event.workflow_run.conclusion }}
REPO_NAME: ${{ github.event.repository.name }}
GIT_BRANCH: ${{ github.event.workflow_run.head_branch }}
WORKFLOW_NAME: ${{ github.event.workflow_run.name }}
WORKFLOW_URL: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.html_url || '' }}
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
# Playground: https://gist.github.com/brillout/da1ab713bda6e3c0d2ad909c1a4e80f2
run: |
curl \
-i \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-X POST \
--data "{\"content\":\"$CI_STATUS $REPO_NAME $WORKFLOW_NAME $GIT_BRANCH $WORKFLOW_URL\",\"username\":\"GitHub\",\"avatar_url\":\"https://i.imgur.com/OOtUMJD.png\"}" \
$DISCORD_WEBHOOK
- name: Debug/inspect
env:
EVENT: ${{ toJSON( github.event ) }}
run: echo $EVENT
12 changes: 12 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'Check formatting'
on:
push:
jobs:
check_formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
- run: pnpm install
- run: pnpm run format:check

0 comments on commit 1875b7e

Please sign in to comment.