-
Notifications
You must be signed in to change notification settings - Fork 9
Feature/comment reaction action #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tulga-bytes
wants to merge
19
commits into
main
Choose a base branch
from
feature/comment-reaction-action
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
826fcce
feat: add comment-reaction action for responding to user comments
3d222a3
docs: add integration guide for comment-reaction action
20355b3
refactor: rename comment-reaction to pr-assistant
ec23cde
refactor: rename pr-assistant to assistant
9ed3faf
feat: add Augment API credentials as inputs
854736b
feat: enhance assistant to implement PR changes using Auggie SDK
0388a20
docs: update README for PR Assistant functionality
cb8d090
fix: add reaction immediately for quick user feedback
38713fd
refactor: move reaction to separate action.yml step for instant feedback
1bb3c66
fix: install Auggie CLI before running the action
d9f39d7
fix: set isAnswerOnly to false to actually implement changes
0484fd3
fix: improve instruction to explicitly require file changes
7ad8bda
feat: add streaming logs for tool usage
0b472f7
fix: add delay before closing Auggie to ensure file writes complete
f4f5585
fix: correct change detection logic in commitAndPush function
4eb4a8d
fix: pull with rebase before pushing to handle remote changes
9bdad7b
refactor: remove rebase logic, rely on workflow checkout instead
cba3c5c
feat: quote original comment in success/failure replies
816aa04
style: fix code formatting issues
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| # Comment Reaction Action - Integration Guide | ||
|
|
||
| ## Summary | ||
|
|
||
| A new GitHub Action has been created in the `augment-agent` repository that can react to user comments with emoji reactions. This action is designed to be used in workflows that respond to PR review comments and issue comments. | ||
|
|
||
| ## Repository Information | ||
|
|
||
| - **Repository**: `augmentcode/augment-agent` | ||
| - **Branch**: `feature/comment-reaction-action` | ||
| - **Action Path**: `comment-reaction/` | ||
| - **Commit**: `826fcce` | ||
|
|
||
| ## What Was Created | ||
|
|
||
| ### Files Created | ||
|
|
||
| 1. **comment-reaction/action.yml** - Action metadata and composite action definition | ||
| 2. **comment-reaction/src/index.ts** - TypeScript implementation | ||
| 3. **comment-reaction/package.json** - Node.js dependencies | ||
| 4. **comment-reaction/tsconfig.json** - TypeScript configuration | ||
| 5. **comment-reaction/README.md** - Documentation and usage examples | ||
| 6. **comment-reaction/package-lock.json** - Dependency lock file | ||
|
|
||
| ### Key Features | ||
|
|
||
| - ✅ React to PR review comments | ||
| - ✅ React to issue comments | ||
| - ✅ Support for all 8 GitHub reaction types (+1, -1, laugh, confused, heart, hooray, rocket, eyes) | ||
| - ✅ Configurable reaction type with sensible default (eyes) | ||
| - ✅ Full TypeScript implementation with type safety | ||
| - ✅ Comprehensive error handling and logging | ||
| - ✅ Output indicating success/failure | ||
|
|
||
| ## How to Reference in assistant.yml | ||
|
|
||
| ### Option 1: Reference the Branch Directly | ||
|
|
||
| ```yaml | ||
| - name: React to original comment with eyes | ||
| uses: augmentcode/augment-agent/comment-reaction@feature/comment-reaction-action | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| comment_id: ${{ github.event.comment.id }} | ||
| event_name: ${{ github.event_name }} | ||
| ``` | ||
|
|
||
| ### Option 2: With Custom Reaction | ||
|
|
||
| ```yaml | ||
| - name: React to original comment with rocket | ||
| uses: augmentcode/augment-agent/comment-reaction@feature/comment-reaction-action | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| comment_id: ${{ github.event.comment.id }} | ||
| event_name: ${{ github.event_name }} | ||
| reaction: rocket | ||
| ``` | ||
|
|
||
| ### Complete Example for assistant.yml | ||
|
|
||
| Replace the existing `actions/github-script@v7` step (lines 31-53) with: | ||
|
|
||
| ```yaml | ||
| - name: React to original comment with eyes | ||
| uses: augmentcode/augment-agent/comment-reaction@feature/comment-reaction-action | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| comment_id: ${{ github.event.comment.id }} | ||
| event_name: ${{ github.event_name }} | ||
| reaction: eyes | ||
| ``` | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Input | Description | Required | Default | | ||
| | -------------- | --------------------------------- | -------- | ------- | | ||
| | `github_token` | GitHub token for API access | Yes | - | | ||
| | `comment_id` | The ID of the comment to react to | Yes | - | | ||
| | `event_name` | The GitHub event name | Yes | - | | ||
| | `reaction` | The reaction type to add | No | `eyes` | | ||
|
|
||
| ## Outputs | ||
|
|
||
| | Output | Description | | ||
| | --------- | --------------------------------------------------------------- | | ||
| | `success` | Whether the reaction was successfully added (`true` or `false`) | | ||
|
|
||
| ## Supported Reactions | ||
|
|
||
| - `+1` - 👍 | ||
| - `-1` - 👎 | ||
| - `laugh` - 😄 | ||
| - `confused` - 😕 | ||
| - `heart` - ❤️ | ||
| - `hooray` - 🎉 | ||
| - `rocket` - 🚀 | ||
| - `eyes` - 👀 | ||
|
|
||
| ## Next Steps | ||
|
|
||
| 1. **Test the Action**: You can now reference this action in the `bumpy/.github/workflows/assistant.yml` file | ||
| 2. **Merge to Main**: Once tested, merge the `feature/comment-reaction-action` branch to `main` | ||
| 3. **Create a Tag**: After merging, create a version tag (e.g., `v1.0.0`) for stable references | ||
| 4. **Update References**: Update workflow files to use the tag instead of the branch name | ||
|
|
||
| ## Example: Full Workflow Integration | ||
|
|
||
| ```yaml | ||
| name: Augment Agent | ||
|
|
||
| on: | ||
| pull_request_review_comment: | ||
| types: [created] | ||
| issue_comment: | ||
| types: [created] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| issues: write | ||
| id-token: write | ||
| actions: read | ||
|
|
||
| jobs: | ||
| auggie-review-comment: | ||
| if: | | ||
| contains(github.event.comment.body, '@augment') || | ||
| contains(github.event.comment.body, '@Augment') | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: ${{ github.repository }} | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
|
|
||
| - name: React to original comment with eyes | ||
| uses: augmentcode/augment-agent/comment-reaction@feature/comment-reaction-action | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| comment_id: ${{ github.event.comment.id }} | ||
| event_name: ${{ github.event_name }} | ||
| reaction: eyes | ||
|
|
||
| # ... rest of your workflow steps | ||
| ``` | ||
|
|
||
| ## Support | ||
|
|
||
| For issues or questions, please refer to the README.md in the comment-reaction directory or create an issue in the augment-agent repository. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,190 @@ | ||
| # PR Assistant Action | ||
|
|
||
| An AI-powered GitHub Action that implements code changes based on PR comments using the Auggie SDK. | ||
|
|
||
| ## Features | ||
|
|
||
| - 🤖 **AI-Powered Implementation**: Uses Auggie SDK to understand and implement requested changes | ||
| - 📋 **Context-Aware**: Gathers full PR context including diff, files, and comment threads | ||
| - 🔄 **Automatic Commits**: Commits and pushes changes directly to the PR branch | ||
| - 💬 **Status Updates**: Posts success/failure comments to the PR | ||
| - 👀 **Visual Feedback**: Adds emoji reactions to show processing status | ||
| - ✅ **Full TypeScript**: Type-safe implementation with comprehensive error handling | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Basic Example | ||
|
|
||
| ```yaml | ||
| - name: PR Assistant | ||
| uses: augmentcode/augment-agent/assistant@feature/comment-reaction-action | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| comment_id: ${{ github.event.comment.id }} | ||
| event_name: ${{ github.event_name }} | ||
| augment_api_token: ${{ secrets.AUGMENT_API_KEY }} | ||
| augment_api_url: ${{ secrets.AUGMENT_API_URL }} | ||
| ``` | ||
|
|
||
| ### With Custom Reaction | ||
|
|
||
| ```yaml | ||
| - name: PR Assistant | ||
| uses: augmentcode/augment-agent/assistant@feature/comment-reaction-action | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| comment_id: ${{ github.event.comment.id }} | ||
| event_name: ${{ github.event_name }} | ||
| reaction: rocket | ||
| augment_api_token: ${{ secrets.AUGMENT_API_KEY }} | ||
| augment_api_url: ${{ secrets.AUGMENT_API_URL }} | ||
| ``` | ||
|
|
||
| ### Complete Workflow Example | ||
|
|
||
| ```yaml | ||
| name: PR Assistant | ||
| on: | ||
| pull_request_review_comment: | ||
| types: [created] | ||
| issue_comment: | ||
| types: [created] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| issues: write | ||
|
|
||
| jobs: | ||
| assistant: | ||
| if: | | ||
| contains(github.event.comment.body, '@augment') || | ||
| contains(github.event.comment.body, '@Augment') | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: ${{ github.repository }} | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
|
|
||
| - name: Run PR Assistant | ||
| uses: augmentcode/augment-agent/assistant@feature/comment-reaction-action | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| comment_id: ${{ github.event.comment.id }} | ||
| event_name: ${{ github.event_name }} | ||
| reaction: eyes | ||
| augment_api_token: ${{ secrets.AUGMENT_API_KEY }} | ||
| augment_api_url: ${{ secrets.AUGMENT_API_URL }} | ||
| ``` | ||
|
|
||
| ## How It Works | ||
|
|
||
| 1. **Trigger**: Workflow is triggered by a comment containing `@augment` or `@Augment` | ||
| 2. **React**: Adds an emoji reaction (default: 👀) to show processing has started | ||
| 3. **Gather Context**: Collects PR metadata, diff, files changed, and comment thread | ||
| 4. **Invoke Auggie**: Sends the context and instruction to Auggie SDK | ||
| 5. **Implement**: Auggie analyzes the request and implements the changes | ||
| 6. **Commit**: Automatically commits changes with a descriptive message | ||
| 7. **Push**: Pushes the commit to the PR's head branch | ||
| 8. **Notify**: Posts a success or failure comment to the PR | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Input | Description | Required | Default | | ||
| | ------------------- | ------------------------------------------------------------------------ | -------- | ------- | | ||
| | `github_token` | GitHub token for API access and git operations | Yes | - | | ||
| | `comment_id` | The ID of the comment that triggered the workflow | Yes | - | | ||
| | `event_name` | The GitHub event name (`pull_request_review_comment` or `issue_comment`) | Yes | - | | ||
| | `augment_api_token` | Augment API token for authentication | Yes | - | | ||
| | `augment_api_url` | Augment API URL endpoint | Yes | - | | ||
| | `reaction` | The reaction type to add (optional) | No | `eyes` | | ||
|
|
||
| ## Supported Reactions | ||
|
|
||
| - `+1` - 👍 | ||
| - `-1` - 👎 | ||
| - `laugh` - 😄 | ||
| - `confused` - 😕 | ||
| - `heart` - ❤️ | ||
| - `hooray` - 🎉 | ||
| - `rocket` - 🚀 | ||
| - `eyes` - 👀 | ||
|
|
||
| ## Outputs | ||
|
|
||
| | Output | Description | | ||
| | --------- | --------------------------------------------------------------- | | ||
| | `success` | Whether the reaction was successfully added (`true` or `false`) | | ||
|
|
||
| ## Permissions | ||
|
|
||
| The action requires the following permissions: | ||
|
|
||
| ```yaml | ||
| permissions: | ||
| contents: read # To read repository content | ||
| pull-requests: write # To add reactions and comments to PRs | ||
| issues: write # To add reactions and comments to issues | ||
| ``` | ||
|
|
||
| ## Setup | ||
|
|
||
| ### 1. Configure Secrets | ||
|
|
||
| Add the following secrets to your repository: | ||
|
|
||
| - `AUGMENT_API_KEY`: Your Augment API token | ||
| - `AUGMENT_API_URL`: Your Augment API URL endpoint | ||
|
|
||
| ### 2. Create Workflow | ||
|
|
||
| Create `.github/workflows/assistant.yml` with the example workflow above. | ||
|
|
||
| ### 3. Test | ||
|
|
||
| Create a test PR and comment with `@augment <your instruction>`. For example: | ||
|
|
||
| ``` | ||
| @augment Add error handling to the login function | ||
| ``` | ||
|
|
||
| The assistant will: | ||
|
|
||
| - React with 👀 to acknowledge | ||
| - Gather PR context | ||
| - Implement the requested changes | ||
| - Commit and push to the PR branch | ||
| - Comment with the result | ||
|
|
||
| ## Example Instructions | ||
|
|
||
| - `@augment Add unit tests for the UserService class` | ||
| - `@augment Refactor this function to use async/await` | ||
| - `@augment Fix the TypeScript errors in this file` | ||
| - `@augment Add JSDoc comments to all exported functions` | ||
| - `@augment Implement the TODO comments in this PR` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### No changes committed | ||
|
|
||
| - Check that Auggie has write access to the repository | ||
| - Verify that the PR branch is not protected | ||
| - Check the workflow logs for errors | ||
|
|
||
| ### Auggie fails to connect | ||
|
|
||
| - Verify `AUGMENT_API_KEY` and `AUGMENT_API_URL` are set correctly | ||
| - Check that the API endpoint is accessible from GitHub Actions | ||
|
|
||
| ### Changes not appearing | ||
|
|
||
| - Ensure the workflow has `contents: write` permission | ||
| - Check that the checkout step uses the correct branch reference | ||
|
|
||
| ## License | ||
|
|
||
| MIT |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this / agent generated?