mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
chore: Refactor the script for posting PRs for review on Slack (#43022)
This pull request refactors the GitHub Actions workflow for notifying about stale Dashboard PRs by replacing custom JavaScript scripts and the `actions/github-script` action with new TypeScript scripts that communicate via standard input/output. This simplifies the workflow, improves maintainability, and adds better error handling, especially for API rate limits. The Slack notification script is also rewritten in TypeScript and now reads PR data from stdin, making the workflow steps more composable.
This commit is contained in:
1 parent
41a7b34985
commit
03660838ef
4 files changed
+340
-273
No files matched your search
@@ -18,29 +18,26 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||
|
||||
- name: Find Dashboard PRs older than 24 hours
|
||||
id: find-prs
|
||||
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
|
||||
with:
|
||||
script: |
|
||||
const findStalePRs = require('./scripts/actions/find-stale-dashboard-prs.js');
|
||||
return await findStalePRs({ github, context, core });
|
||||
sparse-checkout: |
|
||||
scripts
|
||||
|
||||
- name: Send Slack notification
|
||||
if: fromJSON(steps.find-prs.outputs.count) > 0
|
||||
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
|
||||
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
|
||||
name: Install pnpm
|
||||
with:
|
||||
run_install: false
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install deps
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Find stale Dashboard PRs and notify Slack
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DASHBOARD_WEBHOOK_URL }}
|
||||
STALE_PRS_JSON: ${{ steps.find-prs.outputs.stale_prs }}
|
||||
with:
|
||||
script: |
|
||||
const sendSlackNotification = require('./scripts/actions/send-slack-pr-notification.js');
|
||||
const stalePRs = JSON.parse(process.env.STALE_PRS_JSON);
|
||||
const webhookUrl = process.env.SLACK_WEBHOOK_URL;
|
||||
await sendSlackNotification(stalePRs, webhookUrl);
|
||||
|
||||
- name: No stale PRs found
|
||||
if: fromJSON(steps.find-prs.outputs.count) == 0
|
||||
run: |
|
||||
echo "✓ No Dashboard PRs older than 24 hours found"
|
||||
run: pnpm tsx scripts/actions/find-stale-dashboard-prs.ts | pnpm tsx scripts/actions/send-slack-pr-notification.ts
|
||||
Reference in new issue
Block a user