Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ demonstrate basic system features, integration APIs, and best practices.
| [Cancel GitHub Copilot access for inactive users](./github_copilot_seats/)<br/>[![Start with AutoKitteh](https://autokitteh.com/assets/autokitteh-badge.svg)](https://app.autokitteh.cloud/template?template-name=github_copilot_seats) | If Copilot was not used in a preceding period by users, unsubscribe and notify them in Slack. Users can ask for their subscription to be reinstated. | github, slack |
| [GitHub Marketplace to Slack](./github_marketplace_to_slack/)<br/>[![Start with AutoKitteh](https://autokitteh.com/assets/autokitteh-badge.svg)](https://app.autokitteh.cloud/template?template-name=github_marketplace_to_slack) | Forward GitHub Marketplace notifications to Slack | github, slack |
| [GitHub Review - PR Review Request Bot](./github_review/)<br/>[![Start with AutoKitteh](https://autokitteh.com/assets/autokitteh-badge.svg)](https://app.autokitteh.cloud/template?template-name=github_review) | Slash command bot for requesting and removing PR reviews via comments | github |
| [GitHub Wait - PR/Issue State Management Bot](./github_wait/)<br/>[![Start with AutoKitteh](https://autokitteh.com/assets/autokitteh-badge.svg)](https://app.autokitteh.cloud/template?template-name=github_wait) | Slash command bot for managing waiting states on PRs and issues with automatic label updates | github |
| [Gocat - URL Shortener & Redirector](./gocat/)<br/>[![Start with AutoKitteh](https://autokitteh.com/assets/autokitteh-badge.svg)](https://app.autokitteh.cloud/template?template-name=gocat) | Simple URL shortener using Google Sheets as a data store with webhook-based redirection | googlesheets |
| [Google Calendar To Asana](./google_cal_to_asana/)<br/>[![Start with AutoKitteh](https://autokitteh.com/assets/autokitteh-badge.svg)](https://app.autokitteh.cloud/template?template-name=google_cal_to_asana) | Creates Asana tasks based on Google Calendar events | googlecalendar, asana |
| [Create Jira ticket from Google form](./google_forms_to_jira/)<br/>[![Start with AutoKitteh](https://autokitteh.com/assets/autokitteh-badge.svg)](https://app.autokitteh.cloud/template?template-name=google_forms_to_jira) | Create and update Jira tickets automatically from Google Forms responses | googleforms, jira |
Expand Down
20 changes: 20 additions & 0 deletions github_wait/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
UVX=uvx --with autokitteh --with PyGithub

.PHONY: all
all: lint typecheck format

.PHONY: lint
lint:
$(UVX) ruff check --config ../pyproject.toml --ignore I001

.PHONY: format
format:
$(UVX) ruff format --check --config ../pyproject.toml

.PHONY: typecheck
typecheck:
$(UVX) mypy --follow-untyped-imports .

.PHONY: deploy
deploy:
akl deploy --manifest autokitteh.yaml
188 changes: 188 additions & 0 deletions github_wait/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
---
title: GitHub Wait - PR/Issue State Management Bot
description: Slash command bot for managing waiting states on PRs and issues with automatic label updates
integrations: ["github"]
categories: ["Productivity", "DevOps"]
tags: ["github", "pull_requests", "issue_management", "slash_commands", "labels"]
---

# GitHub Wait - PR/Issue State Management Bot

[![Start with AutoKitteh](https://autokitteh.com/assets/autokitteh-badge.svg)](https://app.autokitteh.cloud/template?name=github_wait)

A GitHub bot that helps reviewers track PRs that are waiting for author updates. Reviewers can mark PRs with `/wait` after completing their review, and the bot automatically removes the label when the author pushes new changes - making it easy to see at a glance which PRs are ready for re-review.

## Features

- **Quick PR Triage**: Reviewers can instantly see which PRs have been updated and need attention
- **Automatic Label Removal**: Labels disappear when authors push new code - no manual cleanup needed
- **Slash Command Interface**: Simple `/wait` or `/wait-any` commands in review comments
- **Two Wait Modes**:
- `/wait` - removed only when author pushes code (ideal for "changes requested")
- `/wait-any` - removed when author comments or pushes code (for discussions)
- **Visual Feedback**: Emoji reactions confirm command execution
- **Works Everywhere**: Use in PR reviews, review comments, or regular comments

## Why?

Active reviewers often manage dozens of PRs simultaneously. The problem: **when looking at a PR list, it's hard to tell which PRs have been updated since your last review.**

GitHub's native notifications don't give you an at-a-glance view of what needs attention. This bot solves that by:

- **After reviewing**: Mark the PR with `/wait` to indicate you're waiting for the author
- **Author updates**: When they push new code, the label automatically disappears
- **Quick scanning**: Filter your PR list by the waiting label to see what needs re-review
- **No manual cleanup**: Labels remove themselves - no stale markers cluttering your views

For reviewers handling many PRs, this creates a self-maintaining "reviewed, waiting for author" queue that updates automatically as authors respond.

### What [AutoKitteh](https://autokitteh.com) Provides

- Event-driven GitHub integration
- No server configuration needed
- Built-in GitHub API client
- Automatic event filtering
- Production ready deployment

## How It Works

### Typical Reviewer Workflow

1. **Review a PR**: Complete your code review and request changes
2. **Mark as waiting**: Add `/wait` in your review comment
3. **Bot adds label**: The `waiting` label appears on the PR
4. **Author pushes code**: When they address your feedback and push commits
5. **Label auto-removes**: The bot detects the push and removes the label
6. **You see it's ready**: The PR disappears from your "waiting" filter - time to review again!

### Wait Modes

**`/wait` (waiting for code changes)** - Best for most reviews
- Adds `waiting` label
- Label removed only when author pushes new code
- Ideal after requesting changes or when specifically waiting for code updates

**`/wait-any` (waiting for any response)** - For discussions
- Adds `waiting:any` label
- Label removed when author comments OR pushes code
- Use when you need clarification or are waiting for discussion to continue

## Usage

### After Completing a Review

When you finish reviewing a PR and are waiting for the author to make changes:

```
/wait
```

This adds the `waiting` label to the PR. When the author pushes new code, the label automatically disappears.

**Pro tip**: Filter your PR list by `label:waiting` to see all PRs you've reviewed that are still waiting for author updates. When the label disappears, you know it's time to re-review!

### For Discussion-Based Reviews

When you're waiting for the author to respond to questions or clarify something:

```
/wait-any
```

This adds the `waiting:any` label. It will be removed when the author either comments or pushes code.

### Switching Wait Modes

You can change your mind by using the other command - the bot automatically switches labels:

```
/wait # Adds "waiting" label
/wait-any # Switches to "waiting:any" label
```

## Deployment

Deploy using the AutoKitteh CLI or web interface:

[![Start with AutoKitteh](https://autokitteh.com/assets/autokitteh-badge.svg)](https://app.autokitteh.cloud/template?name=github_wait)

### Command Line Deployment

1. **Install the CLI**: https://docs.autokitteh.com/get_started/install
2. **Authenticate**: `ak auth login`
3. **Deploy**: `make deploy`
4. **Initialize connection**: Log in to https://autokitteh.cloud and initialize the GitHub connection
5. **Configure repository**: Set up the connection to watch your GitHub repository

## Connections

- **github** (required): GitHub integration for receiving events and managing labels

## Implementation Details

### Core Files

- **`handlers.py`** (`handlers.py:23`): Main event handlers
- `on_command()`: Processes `/wait` and `/wait-any` commands
- `on_pull_request_sync()`: Removes waiting labels when new code is pushed
- `on_issue_comment()`: Removes `waiting:any` label on new issue comments
- `on_pull_request_review_comment()`: Removes `waiting:any` label on new PR review comments
- `on_pull_request_review()`: Removes `waiting:any` label on new PR reviews
- `_label()`: Helper function for adding and removing labels

### How It Uses AutoKitteh

The system uses AutoKitteh's event-driven architecture:

```python
from autokitteh import Event
from autokitteh.github import github_client
```

1. **Event Triggers** (`autokitteh.yaml:10`): Multiple GitHub event types

```yaml
triggers:
- name: command
connection: github
event_type: slash_command
call: handlers.py:on_command
filter: "data.command.name in ['wait', 'wait-any'] && (data.actual_event_type in ['issue_comment', 'pull_request_review_comment', 'pull_request_review'])"
```

2. **Event Filtering**: Smart filtering based on event types and slash commands

3. **GitHub API Integration** (`handlers.py:10`): Built-in GitHub client
```python
github = github_client("github")
repo = github.get_repo(data.repository.full_name)
issue = repo.get_issue(number=data.issue.number)
issue.add_to_labels("waiting")
```

### Labels Used

The bot uses two labels:

- **`waiting`**: Indicates waiting for code changes (push events only)
- **`waiting:any`**: Indicates waiting for any activity (comments or code changes)

These labels should be created in your repository. The bot will create them automatically on first use if they don't exist.
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation states "The bot will create them automatically on first use if they don't exist." However, the code in handlers.py uses issue.add_to_labels(add) without explicit label creation logic. Verify that PyGithub's add_to_labels() method automatically creates non-existent labels, or update the documentation to clarify that labels should be pre-created in the repository.

Suggested change
These labels should be created in your repository. The bot will create them automatically on first use if they don't exist.
**Important:** These labels must be created manually in your repository before using the bot. The bot does not create labels automatically.

Copilot uses AI. Check for mistakes.

### Smart Activity Detection

The bot intelligently handles different scenarios to prevent false positives:

- **Reviewer Comments**: When reviewers add more comments (including wait commands), labels stay in place
- **Author Comments**: Comments from the author remove the `waiting:any` label (but not `waiting`)
- **Code Pushes**: New commits from the author remove both `waiting` and `waiting:any` labels
- **Reviews**: New review submissions remove the `waiting:any` label

This means reviewers can continue discussing without accidentally removing the waiting state - only author activity triggers label removal.
Comment on lines +176 to +181
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation states that "Reviewer Comments" keep labels in place and only "Author Comments" remove the waiting:any label. However, the implementation in handlers.py (lines 57-78, 81-102, 105-126) removes the waiting:any label on ANY comment (unless it contains a wait command), regardless of who posted it. The code does not differentiate between reviewer and author comments. Either the documentation should be updated to reflect the actual behavior, or the code should be modified to check the comment author and only remove labels for author comments.

Suggested change
- **Reviewer Comments**: When reviewers add more comments (including wait commands), labels stay in place
- **Author Comments**: Comments from the author remove the `waiting:any` label (but not `waiting`)
- **Code Pushes**: New commits from the author remove both `waiting` and `waiting:any` labels
- **Reviews**: New review submissions remove the `waiting:any` label
This means reviewers can continue discussing without accidentally removing the waiting state - only author activity triggers label removal.
- **Comments**: Any new comment (unless it contains a wait command) removes the `waiting:any` label, regardless of whether it is from the author or a reviewer.
- **Code Pushes**: New commits from the author remove both `waiting` and `waiting:any` labels
- **Reviews**: New review submissions remove the `waiting:any` label
This means that any activity in the form of a comment will remove the `waiting:any` label, so reviewers and authors alike can trigger label removal.

Copilot uses AI. Check for mistakes.

### Bot Responses

The bot provides feedback through:

- **Emoji reactions**: `+1` emoji on command comments to confirm execution
- **Automatic label management**: Labels appear and disappear based on activity
44 changes: 44 additions & 0 deletions github_wait/autokitteh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: v2

project:
name: github_wait

connections:
- name: github
integration: github

triggers:
- # On slash command /wait or /wait-any, add appropriate labels.
name: command
connection: github
event_type: slash_command
call: handlers.py:on_command
filter: "data.command.name in ['wait', 'wait-any'] && (data.actual_event_type in ['issue_comment', 'pull_request_review_comment', 'pull_request_review'])"

- # On a new issue comment, remove wait-any labels unless the comment is a command.
name: issue_comment
connection: github
event_type: issue_comment
call: handlers.py:on_issue_comment
filter: "data.action == 'created'"

- # On a new review comment, remove wait-any labels unless the comment is a command.
name: review_comment
connection: github
event_type: pull_request_review_comment
call: handlers.py:on_pull_request_review_comment
filter: "data.action == 'created'"

- # On a new review , remove wait-any labels unless the comment is a command.
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space before comma. Should be "review," not "review ,".

Suggested change
- # On a new review , remove wait-any labels unless the comment is a command.
- # On a new review, remove wait-any labels unless the comment is a command.

Copilot uses AI. Check for mistakes.
name: review_submitted
connection: github
event_type: pull_request_review
call: handlers.py:on_pull_request_review
filter: "data.action == 'submitted'"

- # On PR sync, remove all waiting labels.
name: pull_request
connection: github
event_type: pull_request
call: handlers.py:on_pull_request_sync
filter: "data.action == 'synchronize'"
Loading