name: PR Workflow Approval Reminder on: # schedule: # - cron: "0 */6 * * *" # every 6 hours workflow_dispatch: jobs: check-prs: runs-on: ubuntu-latest steps: - name: Check PRs blocked by workflow approval id: filter uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const { data: pulls } = await github.rest.pulls.list({ owner: context.repo.owner, repo: context.repo.repo, state: 'open' }); let result = ''; for (const pr of pulls) { const { data: runs } = await github.rest.actions.listWorkflowRunsForRepo({ owner: context.repo.owner, repo: context.repo.repo, event: 'pull_request', head_sha: pr.head.sha }); const waitingRuns = runs.workflow_runs.filter(r => r.status === 'waiting'); if (waitingRuns.length > 0) { const runNames = waitingRuns.map(r => r.name).join(', '); result += `• **PR #${pr.number}**: [${pr.title}](${pr.html_url}) \n ⏸️ Workflows: ${runNames}\n\n`; } } let message; if (result === '') { message = '✅ No PRs are blocked by workflow approval right now.'; } else { message = `🚦 **PRs waiting for maintainer approval to run workflows:**\n\n${result}`; } core.setOutput('message', message); - name: Send message to Discord via webhook run: | payload=$(jq -n --arg content "${{ steps.filter.outputs.message }}" '{content: $content}') curl -X POST -H "Content-Type: application/json" \ -d "$payload" \ ${{ secrets.PR_REMINDER_DISCORD_WEBHOOK }}