Skip to content

Commit 493d90e

Browse files
committed
Comment Devin review link on PR
1 parent 9bc386b commit 493d90e

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

.github/workflows/devin-review.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
timeout-minutes: 5
1717
permissions:
1818
contents: read
19+
issues: write
1920
pull-requests: read
2021

2122
steps:
@@ -64,3 +65,50 @@ jobs:
6465
echo "This workflow intentionally does not use DEVIN_API_KEY."
6566
echo "For automatic Devin statuses or comments inside GitHub, connect the Devin GitHub integration and enable auto-review in Devin settings."
6667
} >> "$GITHUB_STEP_SUMMARY"
68+
69+
- name: Upsert PR comment with Devin Review link
70+
uses: actions/github-script@v8
71+
env:
72+
PR_NUMBER: ${{ steps.review.outputs.number }}
73+
PR_URL: ${{ steps.review.outputs.pr_url }}
74+
REVIEW_URL: ${{ steps.review.outputs.review_url }}
75+
with:
76+
script: |
77+
const marker = '<!-- devin-review-link -->';
78+
const issue_number = Number(process.env.PR_NUMBER);
79+
const body = [
80+
marker,
81+
'Devin Review is available for this pull request.',
82+
'',
83+
`- GitHub PR: ${process.env.PR_URL}`,
84+
`- Devin Review: ${process.env.REVIEW_URL}`,
85+
'',
86+
'This link opens the hosted Devin Review page for the current PR.',
87+
].join('\n');
88+
89+
const comments = await github.paginate(github.rest.issues.listComments, {
90+
owner: context.repo.owner,
91+
repo: context.repo.repo,
92+
issue_number,
93+
per_page: 100,
94+
});
95+
96+
const existing = comments.find((comment) => comment.body && comment.body.includes(marker));
97+
98+
if (existing) {
99+
await github.rest.issues.updateComment({
100+
owner: context.repo.owner,
101+
repo: context.repo.repo,
102+
comment_id: existing.id,
103+
body,
104+
});
105+
core.info(`Updated existing Devin Review comment: ${existing.html_url}`);
106+
} else {
107+
const created = await github.rest.issues.createComment({
108+
owner: context.repo.owner,
109+
repo: context.repo.repo,
110+
issue_number,
111+
body,
112+
});
113+
core.info(`Created Devin Review comment: ${created.data.html_url}`);
114+
}

0 commit comments

Comments
 (0)