Skip to content

Commit d2ea4bf

Browse files
committed
docs: make documentation less verbose
1 parent ae1518a commit d2ea4bf

3 files changed

Lines changed: 11 additions & 187 deletions

File tree

README.md

Lines changed: 9 additions & 185 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,19 @@
11
# replace-comment
22

3-
A GitHub Action that finds, deletes, and recreates a comment to move it to the bottom of the conversation. This is perfect for CI/CD status updates, bot notifications, and any content you want to keep highly visible.
4-
5-
## Why Replace Instead of Update?
6-
7-
When you **update** a comment, it stays in its original chronological position. When you **delete and recreate**, the new comment appears at the bottom of the conversation - much more visible!
8-
9-
**Perfect for:**
10-
- ✅ CI/CD test results
11-
- ✅ Build status updates
12-
- ✅ Bot notifications
13-
- ✅ Status reports
14-
- ✅ Any content that should stay at the bottom for visibility
3+
GitHub Action that finds, deletes, and recreates comments to keep them at the bottom of PR conversations. Perfect for CI/CD status updates and bot notifications.
154

165
## Usage
176

18-
### Basic Example
19-
207
```yaml
21-
- name: Replace E2E Test Results Comment
8+
- name: Replace Comment
229
uses: johanwulf/replace-comment@v1.0.0
2310
with:
2411
issue-number: ${{ github.event.pull_request.number }}
25-
body-includes: '<!-- e2e-test-results -->'
26-
comment-author: 'github-actions[bot]'
12+
body-includes: '<!-- test-results -->'
2713
body: |
28-
<!-- e2e-test-results -->
29-
## 🧪 E2E Test Results
30-
14+
<!-- test-results -->
15+
## Test Results
3116
✅ All tests passed!
32-
33-
- **Total tests:** 42
34-
- **Duration:** 3m 24s
35-
- **Browser:** Chrome 120
36-
```
37-
38-
### Advanced Example with File Body
39-
40-
```yaml
41-
- name: Replace Build Report
42-
uses: johanwulf/replace-comment@v1.0.0
43-
with:
44-
token: ${{ secrets.GITHUB_TOKEN }}
45-
repository: ${{ github.repository }}
46-
issue-number: ${{ github.event.pull_request.number }}
47-
body-regex: '<!-- build-report-\\d+ -->'
48-
comment-author: 'build-bot[bot]'
49-
body-path: './build-report.md'
50-
reactions: 'rocket,eyes'
5117
```
5218
5319
## Inputs
@@ -80,152 +46,10 @@ When you **update** a comment, it stays in its original chronological position.
8046

8147
## How It Works
8248

83-
1. **🔍 Find**: Uses [peter-evans/find-comment](https://github.com/peter-evans/find-comment) to search for existing comments
84-
2. **🗑️ Delete**: Removes the found comment using GitHub's REST API (if any)
85-
3. **✨ Create**: Uses [peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment) to create a new comment at the bottom
86-
87-
This action is a **composite action** that combines the excellent work of Peter Evans into a simple "find-delete-create" workflow.
88-
89-
## Examples
90-
91-
### CI/CD Test Results
92-
93-
```yaml
94-
name: Tests
95-
on: [push, pull_request]
96-
97-
jobs:
98-
test:
99-
runs-on: ubuntu-latest
100-
steps:
101-
- uses: actions/checkout@v4
102-
103-
- name: Run tests
104-
id: tests
105-
run: |
106-
# Your test commands here
107-
echo "result=✅ All tests passed!" >> $GITHUB_OUTPUT
108-
109-
- name: Update test results comment
110-
if: github.event_name == 'pull_request'
111-
uses: johanwulf/replace-comment@v1.0.0
112-
with:
113-
issue-number: ${{ github.event.pull_request.number }}
114-
body-includes: '<!-- test-results -->'
115-
comment-author: 'github-actions[bot]'
116-
body: |
117-
<!-- test-results -->
118-
## 🧪 Test Results
119-
120-
${{ steps.tests.outputs.result }}
121-
122-
**Commit:** ${{ github.sha }}
123-
**Workflow:** [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
124-
```
125-
126-
### Deployment Status
127-
128-
```yaml
129-
- name: Update deployment status
130-
uses: johanwulf/replace-comment@v1.0.0
131-
with:
132-
issue-number: ${{ github.event.pull_request.number }}
133-
body-regex: '<!-- deploy-status-.*? -->'
134-
body: |
135-
<!-- deploy-status-${{ github.run_id }} -->
136-
## 🚀 Deployment Status
137-
138-
**Environment:** staging
139-
**Status:** ${{ job.status }}
140-
**URL:** https://staging-${{ github.event.pull_request.number }}.example.com
141-
**Deploy time:** $(date)
142-
reactions: 'rocket'
143-
```
144-
145-
### Build Artifacts Report
146-
147-
```yaml
148-
- name: Generate build report
149-
run: |
150-
echo "## 📦 Build Artifacts" > build-report.md
151-
echo "" >> build-report.md
152-
echo "| File | Size |" >> build-report.md
153-
echo "|------|------|" >> build-report.md
154-
ls -la dist/ | awk '{print "| " $9 " | " $5 " |"}' >> build-report.md
155-
156-
- name: Post build report
157-
uses: johanwulf/replace-comment@v1.0.0
158-
with:
159-
issue-number: ${{ github.event.pull_request.number }}
160-
body-includes: '<!-- build-artifacts -->'
161-
body-path: './build-report.md'
162-
```
163-
164-
## Tips
165-
166-
### Unique Comment Identification
167-
168-
Use HTML comments to uniquely identify your comments:
169-
170-
```yaml
171-
body: |
172-
<!-- my-unique-identifier -->
173-
Your visible content here
174-
```
175-
176-
### Multiple Bot Comments
177-
178-
Use different identifiers for different types of comments:
179-
180-
```yaml
181-
# Test results
182-
body-includes: '<!-- test-results -->'
183-
184-
# Build status
185-
body-includes: '<!-- build-status -->'
186-
187-
# Deploy status
188-
body-includes: '<!-- deploy-status -->'
189-
```
190-
191-
### Conditional Comments
192-
193-
Only create comments when needed:
194-
195-
```yaml
196-
- name: Replace comment
197-
if: github.event_name == 'pull_request' && failure()
198-
uses: johanwulf/replace-comment@v1.0.0
199-
with:
200-
# ... your config
201-
```
202-
203-
## Comparison with Other Actions
204-
205-
| Action | Find | Update | Delete+Create | Use Case |
206-
|--------|------|--------|---------------|----------|
207-
| `peter-evans/create-or-update-comment` | ✅ | ✅ | ❌ | Update existing content |
208-
| `edumserrano/find-create-or-update-comment` | ✅ | ✅ | ❌ | Simplified find+update |
209-
| `replace-comment` (this action) | ✅ | ❌ | ✅ | Keep comments at bottom |
210-
211-
## Development
212-
213-
This is a composite GitHub Action that leverages:
214-
- [peter-evans/find-comment](https://github.com/peter-evans/find-comment) for finding comments
215-
- [peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment) for creating comments
216-
- GitHub REST API for deleting comments
217-
218-
No build step required! The action runs directly from the `action.yml` file.
219-
220-
## Contributing
221-
222-
Contributions are welcome! Please feel free to submit a Pull Request.
49+
1. Find existing comment using search criteria
50+
2. Delete the found comment (if any)
51+
3. Create new comment at the bottom
22352

22453
## License
22554

226-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
227-
228-
## Acknowledgments
229-
230-
- Inspired by the excellent work of [Peter Evans](https://github.com/peter-evans) on GitHub Actions for comments
231-
- Built to fill the gap for delete+create comment workflows
55+
MIT License - see [LICENSE](LICENSE) file for details.

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Replace Comment'
2-
description: 'Find, delete, and recreate a GitHub issue or pull request comment to move it to the bottom of the conversation'
2+
description: 'Find, delete, and recreate GitHub comments to keep them at the bottom of conversations'
33
author: 'johanwulf'
44
branding:
55
icon: 'message-circle'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "replace-comment",
33
"version": "1.0.0",
4-
"description": "Find, delete, and recreate a GitHub issue or pull request comment to move it to the bottom of the conversation",
4+
"description": "Find, delete, and recreate GitHub comments to keep them at the bottom of conversations",
55
"repository": {
66
"type": "git",
77
"url": "git+https://github.com/johanwulf/replace-comment.git"

0 commit comments

Comments
 (0)