To use GitHub's API in OpenClaw, run `clawhub install github-api`, create a GitHub personal access token at github.com/settings/tokens, and set GITHUB_TOKEN in OpenClaw config. Once configured, you can manage repositories, create and comment on issues, review pull requests, and trigger GitHub Actions workflows directly from OpenClaw chat.
Manage GitHub Repositories, Issues, and Pull Requests from OpenClaw Chat
Developer workflows involve constant context-switching: checking GitHub for new issues, reviewing pull request comments, monitoring CI/CD status, and triaging the backlog. The OpenClaw GitHub API skill reduces this friction by bringing GitHub's full API surface into your AI agent — you can manage your entire development workflow in natural language from OpenClaw chat without opening a browser.
The skill covers the full GitHub workflow surface: repositories (list, create, read file contents), issues (list, create, comment, close, label, assign), pull requests (list, read diffs, add review comments, approve or request changes), commits (history, individual commit details), branches (list, create, delete), and GitHub Actions (list workflow runs, trigger workflows, read logs). For a developer or engineering team lead, this means your AI agent can be your GitHub co-pilot — summarizing open PRs that need attention, drafting issue responses, monitoring build failures, and maintaining project hygiene without manual dashboard work.
The integration requires a GitHub personal access token, which takes about two minutes to generate from your GitHub settings. You can scope the token narrowly to only the repositories and permissions OpenClaw needs, following the principle of least privilege. Once configured, OpenClaw handles all authentication and API call routing automatically — you describe what you want to do in plain language and the skill translates it into GitHub API operations.
Integration method
The GitHub API skill connects to GitHub's REST API using a personal access token stored as GITHUB_TOKEN in OpenClaw config. Once authenticated, OpenClaw can read and write across your GitHub account: list repositories, read and create issues, review and comment on pull requests, check Actions workflow status, read file contents, and manage branches. The skill maps natural language OpenClaw prompts to the appropriate GitHub API calls automatically.
Prerequisites
- OpenClaw installed and running (see openclaw.ai for installation instructions)
- ClawHub CLI available in your terminal (bundled with OpenClaw)
- A GitHub account at github.com
- Ability to create personal access tokens in your GitHub settings (requires account in good standing)
- At least one repository you want to interact with from OpenClaw
Step-by-step guide
Install the GitHub API Skill via ClawHub
Install the GitHub API Skill via ClawHub
Open your terminal and run the ClawHub install command. The GitHub API skill downloads from the ClawHub registry and registers with your local OpenClaw instance. It requires one configuration variable: GITHUB_TOKEN. You will generate this in the next step. The skill installs successfully without the token but will return an authentication error if you attempt any operation before configuring it. The install output confirms the required variable name and suggests the appropriate GitHub token scope for common operations. If `clawhub` is not found, verify your OpenClaw PATH configuration. Reinstalling OpenClaw from openclaw.ai will restore a missing ClawHub binary.
1clawhub install github-apiPro tip: Run `clawhub info github-api` to see what GitHub API operations the skill supports and the minimum token scopes required for each operation type.
Expected result: Terminal confirms: 'github-api@X.X.X installed successfully. Required config: GITHUB_TOKEN'. The skill is registered but not yet active.
Generate a GitHub Personal Access Token
Generate a GitHub Personal Access Token
Navigate to github.com/settings/tokens (you can also find this at GitHub → Settings → Developer settings → Personal access tokens). GitHub offers two token types: Fine-grained tokens (newer, more secure, per-repo scope) and Classic tokens (broader scope but easier to set up). For most OpenClaw use cases, a Fine-grained token is recommended. Click 'Generate new token' → 'Generate new token (fine-grained)'. Give it a name like 'OpenClaw Integration'. Set expiration (90 days or 1 year is typical — set a reminder to rotate it). Under 'Repository access', choose 'All repositories' or select specific repositories you want OpenClaw to access. For permissions, expand 'Repository permissions' and enable: - **Contents**: Read and Write (to read files and create files) - **Issues**: Read and Write (to list, create, comment on issues) - **Pull requests**: Read and Write (to read diffs, post reviews) - **Actions**: Read and Write (to check and trigger workflows) - **Metadata**: Read-only (required baseline) For 'Account permissions', enable Starring: Read and Write if you want OpenClaw to be able to star repositories. Click 'Generate token'. Copy the token immediately — GitHub only shows it once.
Pro tip: Generate a fine-grained token with only the repositories and permissions OpenClaw actually needs. A narrowly scoped token limits damage if it's accidentally exposed. Label it clearly so you know which token to revoke if needed.
Expected result: You have a GitHub personal access token starting with 'github_pat_' (fine-grained) or 'ghp_' (classic) copied to your clipboard.
Configure GITHUB_TOKEN in OpenClaw
Configure GITHUB_TOKEN in OpenClaw
Add your GitHub personal access token to OpenClaw's configuration. Use the `clawhub config set` command or add it directly to your `~/.openclaw/.env` file. After setting the token, run `clawhub reload` to activate the skill. Verify the token is set correctly with `clawhub config get GITHUB_TOKEN` — the output should show a masked version of your token. After reloading, the skill is immediately ready to interact with GitHub. If you work with repositories across multiple GitHub organizations, the same token works for all organizations as long as the token's repository access is configured to include them. Fine-grained tokens may require explicit organization approval — check your GitHub organization settings if cross-org access fails.
1# Option A: Add to ~/.openclaw/.env2GITHUB_TOKEN=github_pat_your-token-here34# Option B: Set via clawhub config5clawhub config set GITHUB_TOKEN github_pat_your-token-here67# Verify the token is set8clawhub config get GITHUB_TOKEN910# Apply without restart11clawhub reloadPro tip: Never paste your GitHub token into an OpenClaw chat prompt or commit it to any repository. If you accidentally do either, revoke the token immediately at github.com/settings/tokens and generate a new one.
Expected result: `clawhub config get GITHUB_TOKEN` returns a masked token value. OpenClaw confirms the github-api skill is active after reload.
Test the Skill with a Repository Query
Test the Skill with a Repository Query
Open OpenClaw chat and test with a simple read operation — listing your repositories or checking open issues. Read operations confirm authentication is working without any side effects. The GitHub API skill understands GitHub concepts natively. You can refer to repositories as 'username/repo-name' or by name if it's unambiguous within your account. For issues and PRs, you can reference them by number or by description ('the issue about the mobile Safari button'). OpenClaw maps your natural language requests to GitHub API calls and formats the responses in a readable way. For PR lists, it shows title, author, age, review status, and CI state. For issues, it shows number, title, assignee, labels, and comment count. For commits, it shows hash, author, message, and date. If authentication fails, check that the token was set correctly and has the right scopes. A 403 on a specific operation means the token lacks that permission — return to the GitHub token settings and add the missing permission.
List all open issues in my GitHub repository 'myusername/my-repo'. Group them by label. For each issue, show the number, title, assignee, age in days, and comment count. Flag any that have been open more than 30 days without a comment.
Paste this in OpenClaw chat
Pro tip: Replace 'myusername/my-repo' with your actual GitHub username and repository name. The skill requires the full owner/repo format to uniquely identify which repository to query.
Expected result: OpenClaw returns a structured list of open issues from the specified repository, grouped by label, with the requested metadata. Issues older than 30 days without comments are flagged.
Advanced Usage: Pull Request Review and GitHub Actions Monitoring
Advanced Usage: Pull Request Review and GitHub Actions Monitoring
The GitHub API skill's most powerful use cases involve pull request workflows and CI/CD monitoring — the two GitHub surfaces where developer time is most commonly consumed. **Pull request review**: Ask OpenClaw to read a specific PR's diff, understand the changes, identify potential issues, and post review comments via the GitHub API. This is particularly effective for catching common problems — missing error handling, insecure patterns, lack of test coverage — before human reviewers spend time on them. **Actions monitoring**: Ask OpenClaw to check the status of recent GitHub Actions runs for a repository. It can identify failing workflows, read error messages from failed steps, and suggest fixes based on the error output. Combine this with OpenClaw's web search skills to look up unfamiliar error messages. **Issue automation**: Use OpenClaw to triage new issues by reading their content, applying appropriate labels, assigning to the right team member, and posting an acknowledgment comment — all in one prompt. RapidDev can help teams configure OpenClaw GitHub workflows for automated code review assistance, sprint planning support, and CI/CD monitoring that integrates with team communication tools like Slack or email.
Check the last 5 GitHub Actions workflow runs for my repo 'myusername/my-app'. For any that failed, show me the name of the failing job, the error message from the failed step, and suggest what might be causing the failure.
Paste this in OpenClaw chat
1# Optional skill config2# ~/.openclaw/skills/github-api.yaml3github-api:4 default_owner: myusername # your GitHub username or org5 default_repo: my-main-repo # default repo for unqualified queries6 pr_review_mode: comment_only # comment_only or full_review7 issue_page_size: 25 # issues returned per query8 include_closed: false # exclude closed issues/PRs by defaultPro tip: Set default_owner and default_repo in your skill config so you can ask 'list open issues' without specifying the repo every time. This is particularly helpful in a development session focused on one project.
Expected result: OpenClaw returns a summary of recent Actions workflow runs, identifies failed runs with error details, and provides diagnostic suggestions for each failure.
Common use cases
Daily Pull Request Triage
Ask OpenClaw to summarize all open pull requests across your repositories, grouped by urgency. OpenClaw reads PR titles, descriptions, review status, and CI results and surfaces the ones that need immediate attention.
List all open pull requests across my GitHub repositories. For each PR, show the title, author, age (days since opened), number of review comments, and current CI status. Group them into: needs review, changes requested, and waiting on CI.
Copy this prompt to try it in OpenClaw
Issue Creation and Triage
Create well-formatted GitHub issues from OpenClaw chat by describing the bug or feature in plain language. OpenClaw drafts the issue with appropriate structure, labels, and assignee suggestions based on the repository context.
Create a GitHub issue in my repo 'myusername/my-app'. Title: 'Button hover state missing on mobile Safari'. Description: when users hover over the primary CTA button on iOS Safari, there's no visual feedback. Steps to reproduce, expected behavior, and actual behavior sections. Label it as 'bug' and 'mobile'. Assign it to me.
Copy this prompt to try it in OpenClaw
Code Review Assistance
Ask OpenClaw to read a pull request diff and draft review comments for specific concerns — security issues, performance problems, missing tests, or style inconsistencies. OpenClaw can post the review directly via the GitHub API.
Read the diff for PR #47 in my repo 'myusername/backend-api'. Look for any missing input validation, potential SQL injection risks, or functions without error handling. Draft inline review comments for each concern you find, then post them as a review requesting changes.
Copy this prompt to try it in OpenClaw
Troubleshooting
OpenClaw returns '401 Bad credentials' or 'github-api: authentication failed' on any GitHub operation
Cause: GITHUB_TOKEN is missing from OpenClaw config, was copied incorrectly (truncated or extra whitespace), or the token has been revoked or expired.
Solution: Run `clawhub config get GITHUB_TOKEN` to verify the token is set. If empty, re-set it with `clawhub config set GITHUB_TOKEN your-token`. Verify the token is still valid at github.com/settings/tokens — expired or revoked tokens need to be regenerated.
1clawhub config get GITHUB_TOKEN2clawhub config set GITHUB_TOKEN your-token-here3clawhub reloadOpenClaw returns '403 Forbidden' on a specific operation like creating issues or posting PR reviews
Cause: The GitHub personal access token lacks the required permissions for that specific operation. Each operation type (issues, PRs, Actions) requires its own permission scope.
Solution: Go to github.com/settings/tokens, find your OpenClaw token, and add the missing permission. For fine-grained tokens, edit the token and enable the required Repository permission. Note: after changing permissions on a fine-grained token, you may need to regenerate it.
clawhub install github-api fails with a registry error
Cause: Temporary ClawHub registry availability issue.
Solution: Wait 2-3 minutes and retry. Use `--force` to clear partial installation state.
1clawhub install github-api --forceOpenClaw can access personal repos but fails on organization repos with '404 Not Found'
Cause: Fine-grained personal access tokens require explicit approval from organization admins before they can access organization repositories. The organization may not have approved your token.
Solution: Go to your GitHub organization's Settings → Personal access tokens and find your pending token request. Or ask an organization admin to approve your fine-grained token. Alternatively, use a Classic token with 'repo' scope which doesn't require organization approval for repos you have access to.
Best practices
- Use fine-grained personal access tokens scoped to specific repositories and only the permissions OpenClaw needs — this limits exposure if the token is accidentally leaked.
- Store GITHUB_TOKEN in your OpenClaw .env file, never in chat prompts, code files, or anywhere that might be shared or version-controlled.
- Set a token expiry date (90 days or 1 year) and add a calendar reminder to rotate it before it expires — expired tokens cause confusing authentication errors.
- Set default_owner and default_repo in your skill config for your primary repository to avoid specifying it in every prompt during a development session.
- For PR review assistance, explicitly describe what categories of issues to look for in your prompt — the more specific your review criteria, the more targeted and useful the review comments will be.
- Combine the GitHub API skill with the Skill Scanner skill to audit any new ClawHub skill packages before installing them — reading the skill's source code via GitHub gives you confidence in what you're installing.
- If you're using OpenClaw for team workflows, consider using a GitHub App instead of a personal access token for production use — Apps provide organization-level authentication and better auditability.
Alternatives
n8n provides visual workflow automation that can trigger on GitHub events and connect to hundreds of other tools — better for complex multi-step automated workflows than conversational GitHub management.
n8n Workflow Automation enables event-driven pipelines triggered by GitHub webhooks — better for background automation than interactive developer queries.
Skill Scanner audits OpenClaw skills for security vulnerabilities — pair it with the GitHub API skill to review skill source code hosted on GitHub before installing.
Frequently asked questions
How do I install GitHub API in OpenClaw?
Run `clawhub install github-api` in your terminal. Then go to github.com/settings/tokens, generate a new fine-grained personal access token with the repository permissions you need (Contents, Issues, Pull Requests, Actions), and set it in OpenClaw with `clawhub config set GITHUB_TOKEN your-token`. Run `clawhub reload` and test with a repository query from OpenClaw chat.
What GitHub permissions does the OpenClaw GitHub API skill need?
The minimum permissions depend on what you want to do. For read-only repository browsing: Metadata read-only. For issue management: Issues read/write. For PR reviews: Pull requests read/write. For Actions monitoring: Actions read/write. For reading file contents: Contents read. Enabling all of these covers the full range of common OpenClaw GitHub workflows.
Can the OpenClaw GitHub API skill post code reviews on pull requests?
Yes — with the Pull requests read/write permission, OpenClaw can read PR diffs and post review comments, approve PRs, or request changes. Ask OpenClaw to read a specific PR number and describe what kind of review to perform. It will analyze the diff and post the review via the GitHub API. For best results, give OpenClaw specific review criteria (e.g., 'check for missing error handling and SQL injection risks').
Does RapidDev help with GitHub automation workflows in OpenClaw?
Yes — RapidDev can help set up automated code review pipelines, issue triage workflows, and CI/CD monitoring that connects GitHub data to your team's Slack or email channels. The basic GitHub access described on this page is self-serve, but complex multi-skill automation benefits from structured configuration support.
Why is the OpenClaw GitHub API skill returning 404 for my organization repositories?
Fine-grained personal access tokens require explicit approval from your GitHub organization before they can access organization repositories. Go to your organization's Settings → Personal access tokens and look for pending token approvals, or ask an organization admin to approve your token. Alternatively, use a GitHub Classic token with 'repo' scope, which doesn't require organization pre-approval for repos you have access to.
How often do GitHub personal access tokens expire?
GitHub personal access tokens can be set to expire after 7, 30, 60, 90, or 365 days — or set to 'No expiration' (not recommended for security). When a token expires, OpenClaw will return 401 authentication errors. Generate a new token, update GITHUB_TOKEN with `clawhub config set`, and run `clawhub reload`. Set a calendar reminder before the expiry date to rotate proactively.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation