Skip to content

Commit 826fcce

Browse files
author
Tulga Tsogtgerel
committed
feat: add comment-reaction action for responding to user comments
- Create new composite action for adding emoji reactions to GitHub comments - Support both PR review comments and issue comments - Configurable reaction type with sensible default (eyes) - Full TypeScript implementation with type safety - Comprehensive error handling and logging - Includes README with usage examples and documentation
1 parent cd94b92 commit 826fcce

File tree

6 files changed

+1226
-0
lines changed

6 files changed

+1226
-0
lines changed

comment-reaction/README.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Comment Reaction Action
2+
3+
A GitHub Action that adds emoji reactions to comments on pull requests and issues.
4+
5+
## Features
6+
7+
- ✅ React to PR review comments
8+
- ✅ React to issue comments
9+
- ✅ Support for all GitHub reaction types
10+
- ✅ TypeScript implementation with full type safety
11+
- ✅ Detailed error messages and logging
12+
13+
## Usage
14+
15+
### Basic Example
16+
17+
```yaml
18+
- name: React to comment with eyes
19+
uses: augmentcode/augment-agent/comment-reaction@feature/comment-reaction-action
20+
with:
21+
github_token: ${{ secrets.GITHUB_TOKEN }}
22+
comment_id: ${{ github.event.comment.id }}
23+
event_name: ${{ github.event_name }}
24+
```
25+
26+
### Custom Reaction
27+
28+
```yaml
29+
- name: React to comment with rocket
30+
uses: augmentcode/augment-agent/comment-reaction@feature/comment-reaction-action
31+
with:
32+
github_token: ${{ secrets.GITHUB_TOKEN }}
33+
comment_id: ${{ github.event.comment.id }}
34+
event_name: ${{ github.event_name }}
35+
reaction: rocket
36+
```
37+
38+
### Complete Workflow Example
39+
40+
```yaml
41+
name: React to Comments
42+
on:
43+
pull_request_review_comment:
44+
types: [created]
45+
issue_comment:
46+
types: [created]
47+
48+
permissions:
49+
contents: read
50+
pull-requests: write
51+
issues: write
52+
53+
jobs:
54+
react:
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: React to comment
58+
uses: augmentcode/augment-agent/comment-reaction@feature/comment-reaction-action
59+
with:
60+
github_token: ${{ secrets.GITHUB_TOKEN }}
61+
comment_id: ${{ github.event.comment.id }}
62+
event_name: ${{ github.event_name }}
63+
reaction: eyes
64+
```
65+
66+
## Inputs
67+
68+
| Input | Description | Required | Default |
69+
|-------|-------------|----------|---------|
70+
| `github_token` | GitHub token for API access. Must have permissions to add reactions. | Yes | - |
71+
| `comment_id` | The ID of the comment to react to | Yes | - |
72+
| `event_name` | The GitHub event name (`pull_request_review_comment` or `issue_comment`) | Yes | - |
73+
| `reaction` | The reaction type to add | No | `eyes` |
74+
75+
## Supported Reactions
76+
77+
- `+1` - 👍
78+
- `-1` - 👎
79+
- `laugh` - 😄
80+
- `confused` - 😕
81+
- `heart` - ❤️
82+
- `hooray` - 🎉
83+
- `rocket` - 🚀
84+
- `eyes` - 👀
85+
86+
## Outputs
87+
88+
| Output | Description |
89+
|--------|-------------|
90+
| `success` | Whether the reaction was successfully added (`true` or `false`) |
91+
92+
## Permissions
93+
94+
The action requires the following permissions:
95+
96+
```yaml
97+
permissions:
98+
pull-requests: write # For PR review comments
99+
issues: write # For issue comments
100+
```
101+
102+
## License
103+
104+
MIT
105+

comment-reaction/action.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: "Comment Reaction"
2+
description: "React to GitHub comments with emoji reactions"
3+
author: "Augment Code"
4+
branding:
5+
icon: "eye"
6+
color: "blue"
7+
8+
inputs:
9+
github_token:
10+
description: "GitHub token for API access. Must have permissions to add reactions."
11+
required: true
12+
comment_id:
13+
description: "The ID of the comment to react to"
14+
required: true
15+
event_name:
16+
description: "The GitHub event name (pull_request_review_comment or issue_comment)"
17+
required: true
18+
reaction:
19+
description: "The reaction type to add (e.g., eyes, rocket, heart, hooray, confused, +1, -1, laugh)"
20+
required: false
21+
default: "eyes"
22+
23+
outputs:
24+
success:
25+
description: "Whether the reaction was successfully added"
26+
value: ${{ steps.react.outputs.success }}
27+
28+
runs:
29+
using: "composite"
30+
steps:
31+
- name: Setup Node
32+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
33+
with:
34+
node-version: 22
35+
- name: Install Action Dependencies
36+
run: npm install --production
37+
shell: bash
38+
working-directory: ${{ github.action_path }}
39+
- name: React to Comment
40+
id: react
41+
run: npx tsx ${{ github.action_path }}/src/index.ts
42+
shell: bash
43+
env:
44+
INPUT_GITHUB_TOKEN: ${{ inputs.github_token }}
45+
INPUT_COMMENT_ID: ${{ inputs.comment_id }}
46+
INPUT_EVENT_NAME: ${{ inputs.event_name }}
47+
INPUT_REACTION: ${{ inputs.reaction }}
48+
GITHUB_REPOSITORY: ${{ github.repository }}
49+

0 commit comments

Comments
 (0)