11name : Devin Review
22
33on :
4- pull_request_target :
4+ pull_request :
55 types : [opened, synchronize, reopened, ready_for_review]
66 workflow_dispatch :
77 inputs :
1212
1313jobs :
1414 devin-review :
15- if : ${{ github.event_name == 'workflow_dispatch' || !github.event.pull_request.draft }}
1615 runs-on : ubuntu-latest
17- timeout-minutes : 10
18- env :
19- DEVIN_API_KEY : ${{ secrets.DEVIN_API_KEY }}
16+ timeout-minutes : 5
2017 permissions :
2118 contents : read
2219 pull-requests : read
2320
2421 steps :
25- - name : Resolve pull request context
26- id : pr
22+ - name : Resolve Devin Review URL
23+ id : review
2724 uses : actions/github-script@v8
2825 env :
2926 WORKFLOW_PR_NUMBER : ${{ inputs.pr_number }}
@@ -39,109 +36,31 @@ jobs:
3936 }
4037
4138 const { owner, repo } = context.repo;
42- const { data: pr } = await github.rest.pulls.get({
43- owner,
44- repo,
45- pull_number: prNumber,
46- });
47- const files = await github.paginate(github.rest.pulls.listFiles, {
48- owner,
49- repo,
50- pull_number: prNumber,
51- per_page: 100,
52- });
39+ const reviewUrl = `https://devinreview.com/${owner}/${repo}/pull/${prNumber}`;
40+ const prUrl = `https://github.com/${owner}/${repo}/pull/${prNumber}`;
5341
5442 core.setOutput('number', String(prNumber));
55- core.setOutput('url', pr.html_url);
56- core.setOutput('title', pr.title);
57- core.setOutput('author', pr.user.login);
58- core.setOutput('head_sha', pr.head.sha);
59- core.setOutput('head_repo', pr.head.repo.full_name);
60- core.setOutput('base_repo', pr.base.repo.full_name);
61- core.setOutput('files_json', JSON.stringify(files.map((file) => file.filename)));
43+ core.setOutput('pr_url', prUrl);
44+ core.setOutput('review_url', reviewUrl);
6245
63- - name : Validate Devin API configuration
64- if : ${{ env.DEVIN_API_KEY == '' }}
46+ - name : Warm Devin Review page
47+ env :
48+ REVIEW_URL : ${{ steps.review.outputs.review_url }}
6549 run : |
66- echo "DEVIN_API_KEY is not configured for this repository or organization." >&2
67- echo "Configure DEVIN_API_KEY before using the API-based Devin review workflow." >&2
68- exit 1
50+ curl --fail --silent --show-error --location "$REVIEW_URL" --output /dev/null
6951
70- - name : Start Devin review session
71- id : devin
52+ - name : Publish Devin Review summary
7253 env :
73- PR_NUMBER : ${{ steps.pr.outputs.number }}
74- PR_URL : ${{ steps.pr.outputs.url }}
75- PR_TITLE : ${{ steps.pr.outputs.title }}
76- PR_AUTHOR : ${{ steps.pr.outputs.author }}
77- PR_HEAD_SHA : ${{ steps.pr.outputs.head_sha }}
78- PR_HEAD_REPO : ${{ steps.pr.outputs.head_repo }}
79- PR_BASE_REPO : ${{ steps.pr.outputs.base_repo }}
80- PR_FILES_JSON : ${{ steps.pr.outputs.files_json }}
81- REPOSITORY : ${{ github.repository }}
54+ PR_NUMBER : ${{ steps.review.outputs.number }}
55+ PR_URL : ${{ steps.review.outputs.pr_url }}
56+ REVIEW_URL : ${{ steps.review.outputs.review_url }}
8257 run : |
83- PROMPT=$(cat <<EOF
84- You are reviewing pull request #${PR_NUMBER} in ${REPOSITORY}.
85-
86- Repository:
87- - Base repository: ${PR_BASE_REPO}
88- - Head repository: ${PR_HEAD_REPO}
89-
90- Pull request:
91- - Title: ${PR_TITLE}
92- - Author: ${PR_AUTHOR}
93- - URL: ${PR_URL}
94- - Head SHA: ${PR_HEAD_SHA}
95-
96- Changed files JSON:
97- ${PR_FILES_JSON}
98-
99- Tasks:
100- 1. Review the current pull request diff and related repository context for PR #${PR_NUMBER}.
101- 2. Never commit, push, or open a new pull request.
102- 3. Never ask the user for confirmation and never wait for user messages.
103- 4. Leave at most 3 total review comments.
104- 5. Use inline review comments with precise line references when possible.
105- 6. Before commenting, check whether the same issue was already raised or already fixed in the current PR discussion.
106- 7. If no issues are found, leave a short summary comment saying everything looks good.
107- 8. Follow repository instruction files such as AGENTS.md, CLAUDE.md, CONTRIBUTING.md, and REVIEW.md if present.
108-
109- Focus on bugs, regressions, missing tests, and clear correctness issues. Avoid speculative nits.
110- EOF
111- )
112-
113- PAYLOAD=$(jq -n \
114- --arg prompt "$PROMPT" \
115- --arg title "PR Review #${PR_NUMBER} (${REPOSITORY})" \
116- '{
117- prompt: $prompt,
118- idempotent: true,
119- title: $title,
120- tags: ["github-actions", "devin-review", "pull-request"]
121- }')
122-
123- RESPONSE=$(curl --fail --silent --show-error \
124- --request POST \
125- --url https://api.devin.ai/v1/sessions \
126- --header "Authorization: Bearer ${DEVIN_API_KEY}" \
127- --header "Content-Type: application/json" \
128- --data "$PAYLOAD")
129-
130- SESSION_ID=$(echo "$RESPONSE" | jq -r '.session_id')
131- SESSION_URL=$(echo "$RESPONSE" | jq -r '.url')
132-
133- if [[ -z "$SESSION_ID" || "$SESSION_ID" == "null" || -z "$SESSION_URL" || "$SESSION_URL" == "null" ]]; then
134- echo "Unexpected Devin API response: $RESPONSE" >&2
135- exit 1
136- fi
137-
138- echo "session_id=$SESSION_ID" >> "$GITHUB_OUTPUT"
139- echo "session_url=$SESSION_URL" >> "$GITHUB_OUTPUT"
140-
14158 {
142- echo "Started Devin review session."
59+ echo "Devin Review is available for PR #${PR_NUMBER}."
60+ echo
61+ echo "- GitHub PR: ${PR_URL}"
62+ echo "- Devin Review: ${REVIEW_URL}"
14363 echo
144- echo "- PR: #${PR_NUMBER}"
145- echo "- Session ID: ${SESSION_ID}"
146- echo "- Session URL: ${SESSION_URL}"
64+ echo "This workflow intentionally does not use DEVIN_API_KEY."
65+ echo "For automatic Devin statuses or comments inside GitHub, connect the Devin GitHub integration and enable auto-review in Devin settings."
14766 } >> "$GITHUB_STEP_SUMMARY"
0 commit comments