Equicord/.github/workflows/reportBrokenPlugins.yml
2026-07-15 22:31:22 -04:00

100 lines
3.3 KiB
YAML

name: Test Patches
on:
workflow_dispatch:
inputs:
discord_branch:
type: choice
description: "Discord Branch to test patches on"
options:
- both
- stable
- canary
default: both
webhook_url:
type: string
description:
"Webhook URL that the report will be posted to. This will be
visible for everyone, so DO NOT pass sensitive webhooks like
discord webhook. This is meant to be used by Equibot."
required: false
pr_repo:
type: string
description: "Fork repo to checkout when testing a PR"
required: false
pr_branch:
type: string
description: "Branch to checkout when testing a PR"
required: false
schedule:
# # Every day at midnight
- cron: 0 0 * * *
env:
FORCE_COLOR: true
jobs:
TestPlugins:
name: Test Patches
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
repository: ${{ inputs.pr_repo || github.repository }}
ref: ${{ inputs.pr_branch || (github.event_name == 'schedule' && 'dev' || github.ref) }}
- uses: pnpm/action-setup@v6
- name: Use Node.js 24
uses: actions/setup-node@v6
with:
node-version: 24
cache: "pnpm"
- name: Install dependencies
run: |
pnpm install --frozen-lockfile --prefer-offline
- name: Build Equicord Reporter Version
run: pnpm buildReporter
- name: Run Reporter
timeout-minutes: 10
run: |
export PATH="$PWD/node_modules/.bin:$PATH"
export CHROMIUM_BIN=/usr/bin/google-chrome
esbuild scripts/generateReport.ts > dist/report.mjs
stable_output_file=$(mktemp)
canary_output_file=$(mktemp)
pids=""
branch="${{ inputs.discord_branch }}"
if [[ "${{ github.event_name }}" = "schedule" ]]; then
branch="both"
fi
if [[ "$branch" = "both" || "$branch" = "stable" ]]; then
node dist/report.mjs > "$stable_output_file" &
pids+=" $!"
fi
if [[ "$branch" = "both" || "$branch" = "canary" ]]; then
USE_CANARY=true node dist/report.mjs > "$canary_output_file" &
pids+=" $!"
fi
exit_code=0
for pid in $pids; do
if ! wait "$pid"; then
exit_code=1
fi
done
cat "$stable_output_file" "$canary_output_file" >> $GITHUB_STEP_SUMMARY
exit $exit_code
env:
WEBHOOK_URL: ${{ inputs.webhook_url || secrets.WEBHOOK_URL }}
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }}