-
Notifications
You must be signed in to change notification settings - Fork 11
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
base: main
Are you sure you want to change the base?
Changes from all commits
826fcce
3d222a3
20355b3
ec23cde
9ed3faf
854736b
0388a20
cb8d090
38713fd
1bb3c66
d9f39d7
0484fd3
7ad8bda
0b472f7
f4f5585
4eb4a8d
9bdad7b
cba3c5c
816aa04
7dd2275
7a5530e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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. |
| 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't feel right to me.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I decided to create new repo for the comment actions and going to move things there. https://github.com/augmentcode/augment-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 | ||
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?
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.
Yeah this was agent generated gonna remove.