Skip to content
Merged
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
53 changes: 53 additions & 0 deletions .github/workflows/pr-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Comment on PR

on:
pull_request:
branches:
- main
types: [opened, synchronize]

jobs:
trigger-bot-review:
name: Trigger Bot Review
runs-on: ubuntu-latest
timeout-minutes: 5
env:
GITHUB_TOKEN: ${{ secrets.BOT_REVIEW_COMMENT_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@v2

- name: Add comment on PR creation to trigger bot review
if: github.event.action == 'opened' && github.base_ref == 'main'
uses: actions/github-script@v7
continue-on-error: true
timeout-minutes: 5
Comment on lines +21 to +23
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Errors are silently ignored 🐞 Bug ☼ Reliability

Both comment steps use continue-on-error: true, so authentication/permission/API failures won’t fail
the job and the workflow can appear successful while posting no trigger comment. This makes the
automation unreliable and hard to debug.
Agent Prompt
### Issue description
The workflow suppresses failures when creating PR comments, which can hide breakages in the bot-trigger mechanism.

### Issue Context
If the token is invalid/missing or the API call fails, the workflow should fail (or at least emit explicit errors) so maintainers can diagnose why bot review wasn’t triggered.

### Fix Focus Areas
- .github/workflows/pr-comment.yml[19-24]
- .github/workflows/pr-comment.yml[37-42]

### Suggested change
Remove `continue-on-error: true` (or replace with explicit try/catch + `core.setFailed(...)` after logging).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

with:
github-token: ${{ env.GITHUB_TOKEN }}
script: |
const comments = ['/agentic_describe', '/agentic_review'];
for (const comment of comments) {
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: comment
});
}
Comment on lines +26 to +35
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Unawaited comment api calls 🐞 Bug ≡ Correctness

The github-script steps call github.rest.issues.createComment(...) without awaiting the returned
Promise, so the step can finish before the HTTP requests complete and comments may not be created
reliably. This breaks the core purpose of the workflow (posting the trigger commands).
Agent Prompt
### Issue description
The workflow fires `github.rest.issues.createComment(...)` calls without awaiting them, which can cause the step to complete before the GitHub API requests finish.

### Issue Context
This workflow’s primary function is to reliably post PR comments (`/agentic_describe`, `/agentic_review`). Non-awaited promises can lead to missing comments.

### Fix Focus Areas
- .github/workflows/pr-comment.yml[26-35]
- .github/workflows/pr-comment.yml[44-53]

### Suggested change
Use `await` inside the loop (or `await Promise.all(...)`). Example:
```js
const comments = ['/agentic_describe', '/agentic_review'];
for (const body of comments) {
  await github.rest.issues.createComment({
    owner: context.repo.owner,
    repo: context.repo.repo,
    issue_number: context.issue.number,
    body,
  });
}
```

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


- name: Add comment on PR update
if: github.event.action == 'synchronize' && github.base_ref == 'main'
uses: actions/github-script@v7
continue-on-error: true
timeout-minutes: 5
with:
github-token: ${{ env.GITHUB_TOKEN }}
script: |
const comments = ['/agentic_review'];
for (const comment of comments) {
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: comment
});
}
Loading