← ClaudeAtlas

gh-actions-permissionslisted

Manage GitHub Actions workflow permissions using gh CLI. Use when: (1) Checking repository Actions permissions settings, (2) Enabling GitHub Actions to create or approve pull requests, (3) Troubleshooting workflow failures with "GitHub Actions is not permitted to create or approve pull requests" errors, (4) Configuring workflow permissions for tools like release-please that need PR creation access, or (5) Managing default_workflow_permissions and can_approve_pull_request_reviews settings.
chenwei791129/agent-skills · ★ 0 · AI & Automation · score 56
Install: claude install-skill chenwei791129/agent-skills
# GitHub Actions Permissions Management Manage GitHub Actions workflow permissions via gh CLI API, specifically for enabling Actions to create and approve pull requests. ## Common Issue When GitHub Actions workflows (like release-please) fail with: ``` GitHub Actions is not permitted to create or approve pull requests ``` This occurs when the repository's workflow permissions block PR creation, even if the workflow file has correct `permissions:` declarations. ## Check Current Permissions View the current workflow permission settings: ```bash gh api repos/{owner}/{repo}/actions/permissions/workflow \ --jq '{default_workflow_permissions: .default_workflow_permissions, can_approve_pull_request_reviews: .can_approve_pull_request_reviews}' ``` **Expected output:** ```json { "default_workflow_permissions": "read", "can_approve_pull_request_reviews": false } ``` When `can_approve_pull_request_reviews` is `false`, workflows cannot create PRs regardless of workflow-level permissions. ## Enable PR Creation Permission Use PUT method (not PATCH) to update the setting: ```bash gh api --method PUT repos/{owner}/{repo}/actions/permissions/workflow \ -F default_workflow_permissions=read \ -F can_approve_pull_request_reviews=true ``` **Important:** - Must use `PUT` method, not `PATCH` (PATCH returns 404) - Must provide both parameters even if only changing one - Requires `repo` scope in gh CLI authentication Verify the change: ```bash gh api repos/{owner}/{repo}/act