A GitHub Actions workflow that sends pull request data to a webhook for automated review and analysis.
This workflow:
- Runs your standard CI pipeline (tests, linting, etc.)
- Collects detailed information about the pull request
- Sends this data to a configured webhook
- Works with any programming language or tech stack
Copy the example workflow file to your repository:
.github/workflows/ci-pipeline.yml
You'll need to add the following to your repository:
WEBHOOK_USERNAME
: The username for webhook authenticationWEBHOOK_AUTH_TOKEN
: The authentication token for your webhook
WEBHOOK_URL
: The URL endpoint where PR data will be sent
To add these, go to:
- Your repository → Settings → Secrets and variables → Actions
- Add each secret and variable
You can modify the example workflow to:
- Change the trigger branches
- Add additional CI steps specific to your project
- Adjust the Node.js versions used
- Automated code review using AI
- Integration with custom review systems
- Collecting PR metrics for dashboards
- Triggering additional quality checks
This repository includes an example n8n workflow that can receive and process the PR data. The workflow:
- Receives PR data via a webhook endpoint
- Processes the PR data to create a structured prompt
- Uses Claude AI to perform an automated code review
- Can approve PRs, request changes, or add comments based on AI review
To use the n8n workflow:
- Import the
n8n-workflow.json
file into your n8n instance - Configure the required credentials:
- HTTP Basic Auth: For webhook authentication (matching WEBHOOK_USERNAME/WEBHOOK_AUTH_TOKEN)
- GitHub API: For interacting with GitHub repositories
- Anthropic API: For Claude AI code reviews
- Activate the webhook endpoint
- Set your
WEBHOOK_URL
in GitHub to the generated n8n webhook URL
The n8n workflow requires the following credentials to be configured:
-
HTTP Basic Auth (for the Webhook node)
- Username: Should match WEBHOOK_USERNAME in GitHub
- Password: Should match WEBHOOK_AUTH_TOKEN in GitHub
-
GitHub API (for GitHub Tool nodes)
- Access Token: A GitHub Personal Access Token with repo permissions
-
Anthropic API (for Anthropic Chat Model node)
- API Key: Your Anthropic API key for accessing Claude
The complete integration between GitHub Actions and n8n works as follows:
- A new pull request is created or updated in your GitHub repository
- The GitHub Actions workflow is triggered
- The workflow runs your CI pipeline (tests, linting, etc.)
- The workflow collects PR data and sends it to your n8n webhook
- n8n processes the PR data and generates a review prompt
- Claude AI reviews the code and provides feedback
- n8n sends the feedback back to GitHub as comments or review decisions
This creates a fully automated code review system that can be customized to your specific needs.
The GitHub Actions workflow sends a JSON payload to n8n with the following structure:
{
"id": "PR ID",
"number": "PR Number",
"title": "PR Title",
"body": "PR Description",
"state": "open/closed",
"created_at": "Creation timestamp",
"updated_at": "Last update timestamp",
"repository": {
"name": "repo-name",
"owner": "owner-name"
},
"head": {
"ref": "source branch",
"sha": "head commit SHA"
},
"base": {
"ref": "target branch",
"sha": "base commit SHA"
},
"user": {
"login": "username",
"id": "user ID"
},
"changed_files": [
{
"filename": "path/to/file",
"status": "added/modified/removed",
"additions": 10,
"deletions": 5,
"changes": 15,
"patch": "diff content"
}
],
"comments": [
{
"id": "comment ID",
"body": "comment text",
"user": "username",
"created_at": "timestamp"
}
],
"review_comments": [
{
"id": "comment ID",
"body": "comment text",
"user": "username",
"path": "file path",
"position": "line position",
"created_at": "timestamp"
}
]
}
Contributions are welcome! Please feel free to submit a Pull Request.