# Github Issue Auto Fixer (`glitch/github-issue-auto-fixer`) Actor

Github Issue Auto Fixer is an AI-powered GitHub assistant that automatically scans your repo, detects issues, and fixes them. It creates a new branch, submits a pull request, comments on the issue, and emails you for review — keeping your code clean and up to date effortlessly.

- **URL**: https://apify.com/glitch/github-issue-auto-fixer.md
- **Developed by:** [Ashutosh Sahoo](https://apify.com/glitch) (community)
- **Categories:** AI, Agents, Automation
- **Stats:** 2 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## 🤖 Automated GitHub Issue Fixer

An AI-powered Apify Actor that automatically monitors GitHub repositories, analyzes issues, creates fixes, generates pull requests, and sends email notifications.

### ✨ Features

- **🔍 Continuous Monitoring**: Actively monitors your GitHub repository for new issues
- **🧠 AI-Powered Analysis**:  Analyzes issues and understand your codebase
- **🔧 Automatic Fixes**: Generates code fixes based on issue descriptions and repository context
- **🌿 Branch Management**: Creates dedicated branches for each fix
- **📝 Pull Request Creation**: Automatically creates well-documented pull requests and comments on issue then closes it.
- **📧 Email Notifications**: Sends detailed email notifications about fixes and PRs
- **🔄 Auto-Merge Option**: Optionally auto-merge PRs (use with caution!)


### 📋 Prerequisites

Before using this Actor, you'll need:

1. **GitHub Personal Access Token**
   - Go to GitHub Settings → Developer settings → Personal access tokens
   - Create a token with `repo`, `workflow`, and `user:email` permissions

2. **Google Gemini API Key(For now)**
   - Visit [Google AI Studio](https://makersuite.google.com/app/apikey)
   - Create an API key for Gemini

3. **Email Account for Notifications**
   - SMTP server details (e.g., Gmail: `smtp.gmail.com:587`)
   - Email address and password/app-specific password

### ⚙️ Configuration

#### Required Inputs

| Field | Description | Example |
|-------|-------------|---------|
| `githubRepoUrl` | Full URL of the GitHub repository to monitor | `https://github.com/username/repo` |
| `githubToken` | GitHub Personal Access Token | `ghp_xxxxxxxxxxxx` |
| `geminiApiKey` | Google Gemini API Key | `AIzaSyxxxxxxxxxx` |
| `smtpServer` | SMTP server address | `smtp.gmail.com` |
| `emailFrom` | Email address to send from | `bot@example.com` |
| `emailPassword` | Email password or app-specific password | `xxxxxxxxxxxx` |
| `notificationEmail` | Email to receive notifications | `developer@example.com` |

#### Optional Inputs

| Field | Description | Default |
|-------|-------------|---------|
| `smtpPort` | SMTP server port | `587` |
| `pollingIntervalMinutes` | How often to check for new issues (1-60 minutes) | `5` |
| `autoMerge` | Automatically merge PRs after creation | `false` |
| `maxIssuesPerRun` | Maximum issues to process per iteration | `5` |

### 📖 Usage

#### On Apify Platform

1. Go to the [Actor page](https://apify.com/your-username/github-issue-auto-fixer)
2. Click "Try for free"
3. Fill in the required configuration
4. Click "Start"
5. The Actor will run continuously, monitoring for new issues


### 🔒 Security Considerations

> [!WARNING]
> **Auto-Merge**: The auto-merge feature should be used with extreme caution. It's recommended to keep this disabled and manually review PRs before merging.

> [!IMPORTANT]
> **API Keys**: Keep your GitHub token, Gemini API key, and email credentials secure. Use Apify's secret input fields to store sensitive data.

> [!TIP]
> **Testing**: Test the Actor on a non-critical repository first to ensure it works as expected.


1. A user creates an issue: "Fix the login button not working on mobile"
2. The Actor detects the new issue within 5 minutes (default polling interval)
3. Gemini AI analyzes the issue and relevant code files
4. AI generates a fix (e.g., updating CSS for mobile responsiveness)
5. Actor creates branch `fix/issue-42`
6. Applies the fix and commits with message: "Fix issue #42: Fix login button on mobile"
7. Pushes to GitHub and creates PR
8. Sends email to developer with links to issue and PR
9. Developer reviews PR and merges if satisfied


### 🆘 Support

For issues or questions:
- Email: ashutoshsahoo556@gmail.com

# Actor input Schema

## `githubRepoUrl` (type: `string`):

Full URL of the GitHub repository to monitor (e.g., https://github.com/username/repo or https://github.com/username/repo.git)
## `githubToken` (type: `string`):

GitHub token with repo, workflow, and email permissions
## `geminiApiKey` (type: `string`):

API key for Google Gemini AI to analyze and fix issues
## `smtpServer` (type: `string`):

SMTP server address for sending emails
## `smtpPort` (type: `integer`):

SMTP server port (usually 587 for TLS)
## `emailFrom` (type: `string`):

Email address to send notifications from
## `emailPassword` (type: `string`):

Password or app-specific password for the email account
## `notificationEmail` (type: `string`):

Email address to receive notifications about issues and PRs
## `pollingIntervalMinutes` (type: `integer`):

How often to check for new issues (in minutes)
## `autoMerge` (type: `boolean`):

Automatically merge PRs after creation (use with caution!)
## `maxIssuesPerRun` (type: `integer`):

Maximum number of issues to process in one run

## Actor input object example

```json
{
  "githubRepoUrl": "https://github.com/octocat/Hello-World",
  "smtpServer": "smtp.gmail.com",
  "smtpPort": 587,
  "emailFrom": "bot@example.com",
  "notificationEmail": "developer@example.com",
  "pollingIntervalMinutes": 5,
  "autoMerge": false,
  "maxIssuesPerRun": 5
}
````

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("glitch/github-issue-auto-fixer").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("glitch/github-issue-auto-fixer").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call glitch/github-issue-auto-fixer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=glitch/github-issue-auto-fixer",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Github Issue Auto Fixer",
        "description": "Github Issue Auto Fixer is an AI-powered GitHub assistant that automatically scans your repo, detects issues, and fixes them. It creates a new branch, submits a pull request, comments on the issue, and emails you for review — keeping your code clean and up to date effortlessly.",
        "version": "1.0",
        "x-build-id": "XykzZRKHUcoA5JWmS"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/glitch~github-issue-auto-fixer/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-glitch-github-issue-auto-fixer",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/glitch~github-issue-auto-fixer/runs": {
            "post": {
                "operationId": "runs-sync-glitch-github-issue-auto-fixer",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/glitch~github-issue-auto-fixer/run-sync": {
            "post": {
                "operationId": "run-sync-glitch-github-issue-auto-fixer",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "githubRepoUrl",
                    "githubToken",
                    "geminiApiKey",
                    "smtpServer",
                    "emailFrom",
                    "emailPassword",
                    "notificationEmail"
                ],
                "properties": {
                    "githubRepoUrl": {
                        "title": "GitHub Repository URL",
                        "type": "string",
                        "description": "Full URL of the GitHub repository to monitor (e.g., https://github.com/username/repo or https://github.com/username/repo.git)"
                    },
                    "githubToken": {
                        "title": "GitHub Personal Access Token",
                        "type": "string",
                        "description": "GitHub token with repo, workflow, and email permissions"
                    },
                    "geminiApiKey": {
                        "title": "Google Gemini API Key",
                        "type": "string",
                        "description": "API key for Google Gemini AI to analyze and fix issues"
                    },
                    "smtpServer": {
                        "title": "SMTP Server",
                        "type": "string",
                        "description": "SMTP server address for sending emails",
                        "default": "smtp.gmail.com"
                    },
                    "smtpPort": {
                        "title": "SMTP Port",
                        "type": "integer",
                        "description": "SMTP server port (usually 587 for TLS)",
                        "default": 587
                    },
                    "emailFrom": {
                        "title": "From Email Address",
                        "type": "string",
                        "description": "Email address to send notifications from"
                    },
                    "emailPassword": {
                        "title": "Email Password",
                        "type": "string",
                        "description": "Password or app-specific password for the email account"
                    },
                    "notificationEmail": {
                        "title": "Notification Email",
                        "type": "string",
                        "description": "Email address to receive notifications about issues and PRs"
                    },
                    "pollingIntervalMinutes": {
                        "title": "Polling Interval (minutes)",
                        "minimum": 1,
                        "maximum": 60,
                        "type": "integer",
                        "description": "How often to check for new issues (in minutes)",
                        "default": 5
                    },
                    "autoMerge": {
                        "title": "Auto-merge PRs",
                        "type": "boolean",
                        "description": "Automatically merge PRs after creation (use with caution!)",
                        "default": false
                    },
                    "maxIssuesPerRun": {
                        "title": "Max Issues Per Run",
                        "minimum": 1,
                        "maximum": 20,
                        "type": "integer",
                        "description": "Maximum number of issues to process in one run",
                        "default": 5
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
