mirror of
https://github.com/blackboxprogramming/simulation-theory.git
synced 2026-03-18 00:34:01 -05:00
Update pr-agent.yml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
22
.github/workflows/pr-agent.yml
vendored
22
.github/workflows/pr-agent.yml
vendored
@@ -156,9 +156,31 @@ Be rigorous, constructive, and precise. Keep the tone academic and professional.
|
|||||||
const safeAnalysisText = sanitizeAnalysisText(analysisText);
|
const safeAnalysisText = sanitizeAnalysisText(analysisText);
|
||||||
|
|
||||||
const comment = `## 🤖 Agent Review\n\n${safeAnalysisText}\n\n---\n*This comment was generated automatically by the PR Agent workflow.*`;
|
const comment = `## 🤖 Agent Review\n\n${safeAnalysisText}\n\n---\n*This comment was generated automatically by the PR Agent workflow.*`;
|
||||||
|
// Try to find an existing PR Agent comment to update, to avoid spamming the thread
|
||||||
|
const { data: existingComments } = await github.rest.issues.listComments({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: prNumber
|
||||||
|
});
|
||||||
|
|
||||||
|
const existingAgentComment = existingComments.find(c =>
|
||||||
|
c &&
|
||||||
|
c.body &&
|
||||||
|
c.body.includes('This comment was generated automatically by the PR Agent workflow.')
|
||||||
|
);
|
||||||
|
|
||||||
|
if (existingAgentComment) {
|
||||||
|
await github.rest.issues.updateComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
comment_id: existingAgentComment.id,
|
||||||
|
body: comment
|
||||||
|
});
|
||||||
|
} else {
|
||||||
await github.rest.issues.createComment({
|
await github.rest.issues.createComment({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
issue_number: prNumber,
|
issue_number: prNumber,
|
||||||
body: comment
|
body: comment
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user