一键导入
pr-automation-approve-workflows
// Approve pending GitHub Actions workflows and add /ok-to-test comments to PRs that need testing
// Approve pending GitHub Actions workflows and add /ok-to-test comments to PRs that need testing
Query and manage macOS Calendar events. Use when the user asks about calendar events, appointments, schedules, or wants to create/modify calendar entries.
Run a check script to verify skill path resolution works correctly
Search and query Goodreads library from CSV export. Use when the user asks about books, TBR (to-be-read), reading lists, book searches, or mentions Goodreads. Also use for queries about book ratings, authors, reading status, or library statistics.
Search and query Calibre library databases. Use when the user asks about books, TBR (to-be-read), reading lists, Calibre library queries, book searches, or mentions Calibre. Also use for queries about book ratings, authors, reading status, or library statistics.
| name | PR Automation - Approve Workflows |
| description | Approve pending GitHub Actions workflows and add /ok-to-test comments to PRs that need testing |
This skill automates the approval of pending GitHub Actions workflows and adds /ok-to-test comments to pull requests that require external contributor verification.
Use this skill when you need to:
/ok-to-test comments to PRs labeled with "needs-ok-to-test"GitHub CLI (gh) installed
which ghGitHub authentication
gh auth loginRepository context
owner/repo formatIf a repository argument is provided, use it. Otherwise, detect from the current directory:
# If no repo provided, detect from git remote
if [ -z "$repo" ]; then
repo=$(git remote get-url origin | sed -E 's/.*github\.com[:/]([^/]+\/[^.]+)(\.git)?/\1/')
fi
Query all open PRs with the "needs-ok-to-test" label:
gh pr list --repo "$repo" --limit 100 --json number,title,labels --state open \
--jq '.[] | select(.labels[]? | .name == "needs-ok-to-test") | {number: .number, title: .title}'
For each PR found:
/ok-to-test:
gh pr comment $pr_number --repo "$repo" --body "/ok-to-test"
Query GitHub Actions API for workflow runs that need approval. There are two scenarios:
Scenario A: Completed runs with action_required (already timed out) These cannot be approved but should be reported:
gh api "repos/$repo/actions/runs?per_page=100" \
--jq '.workflow_runs[] | select(.conclusion == "action_required") | {id: .id, name: .name, branch: .head_branch, created: .created_at}'
Scenario B: Waiting runs (can be approved) These are the ones we can actually approve:
gh api "repos/$repo/actions/runs" \
--jq '.workflow_runs[] | select(.status == "waiting") | {id: .id, name: .name, branch: .head_branch}'
For each workflow run that needs approval (status == "waiting"):
gh api "repos/$repo/actions/runs/$run_id/approve" -X POST
Track which runs were successfully approved vs which failed.
Create a summary report with:
PRs that received /ok-to-test comments:
Workflow runs approved:
Action required runs (informational):
Handle the following error cases:
No repository found: If not provided and can't detect from git, prompt user for repository name
GitHub API errors:
No PRs or workflows found: Report that everything is up to date
Rate limiting: If GitHub API rate limit is hit, report and suggest trying again later
Provide a structured summary:
# PR Workflow Approval Summary
## PRs Marked as /ok-to-test (3)
- PR #116: CLID-473: subagent to generate weekly reports
- PR #105: Add claude interactive google service account creation
- PR #76: an olmv1 claude plugin for managing clusterextensions
## GitHub Actions Workflows Approved (2)
- Run 18977369749: Lint Plugins (branch: add_qa_assignee_query) ✓
- Run 18979766265: Lint Plugins (branch: gh2jira) ✓
## Timed Out Workflows (informational) (5)
These workflows timed out waiting for approval. New commits will trigger new runs.
- Run 18968492733: Lint Plugins (branch: raise_pr_debug_cluster)
- Run 18967558922: Lint Plugins (branch: ovn_analyzer)
...
## Status
✓ All pending approvals completed successfully
# User invokes: /pr-automation:approve-workflows openshift-eng/ai-helpers
# Step 1: Set repo variable
repo="openshift-eng/ai-helpers"
# Step 2: Find PRs needing ok-to-test
prs=$(gh pr list --repo "$repo" --limit 100 --json number,title,labels --state open \
--jq '.[] | select(.labels[]? | .name == "needs-ok-to-test")')
# Step 3: Comment on each PR
echo "$prs" | jq -r '.number' | while read pr; do
gh pr comment $pr --repo "$repo" --body "/ok-to-test"
done
# Step 4: Find and approve waiting workflows
gh api "repos/$repo/actions/runs" \
--jq '.workflow_runs[] | select(.status == "waiting") | .id' | \
while read run_id; do
gh api "repos/$repo/actions/runs/$run_id/approve" -X POST
done
# User invokes: /pr-automation:approve-workflows
# Detect repo from git remote
repo=$(git remote get-url origin | sed -E 's/.*github\.com[:/]([^/]+\/[^.]+)(\.git)?/\1/')
# Continue with same steps as Example 1...
/ok-to-test command is specific to Prow CI and triggers Prow jobs, not GitHub Actions