Fix typo in package.json homepage URL #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Devin Issue Review | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
issue_comment: | |
types: [created] | |
permissions: | |
issues: read | |
pull-requests: read | |
jobs: | |
review-issue: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check for @devin mention | |
id: check-mention | |
run: | | |
echo "Issue Comment: ${{ github.event.comment.body }}" | |
echo "Comment Author: ${{ github.event.comment.user.login }}" | |
# Check if the comment author is riderx | |
if [[ "${{ github.event.comment.user.login }}" != "riderx" ]]; then | |
echo "Comment not from riderx. Ignoring." | |
exit 0 | |
fi | |
# Check for @devin mention | |
if [[ "${{ github.event.comment.body }}" != *"@devin"* ]]; then | |
echo "No @devin mention found. Exiting." | |
exit 0 | |
fi | |
- name: Fetch issue comments | |
id: fetch-comments | |
run: | | |
COMMENTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments") | |
# Extract just the comment bodies into a simpler format | |
echo "$COMMENTS" | jq -r 'map(.body) | join("\n---\n")' > comments.txt | |
echo "Comments fetched and parsed" | |
- name: Create Devin Review Session | |
id: devin-review | |
env: | |
DEVIN_API_KEY: ${{ secrets.DEVIN_API_KEY }} | |
PROMPT_TEMPLATE: | | |
You are a code-review assistant. Please review the GitHub issue #$ISSUE_NUMBER in repository $REPO. | |
Context: | |
Issue Title: $ISSUE_TITLE | |
Issue Body: $ISSUE_BODY | |
Discussion Comments: $COMMENTS | |
Tasks: | |
1. Review the issue and provide recommendations for addressing the performance concerns | |
2. Leave a detailed comment on the Github issue with your findings using the GitHub API | |
3. Create a PR with your proposed fixes | |
Guidelines for Response: | |
1. Be thorough in your analysis and provide concrete, actionable solutions | |
2. Include code snippets in markdown format when discussing issues | |
3. Make specific references to problematic code sections | |
4. Provide clear steps for implementing the improvements | |
5. Consider both immediate fixes and long-term optimizations | |
How to post comments: | |
Use the GitHub API to post your findings as a comment on the issue. Format your comment with: | |
- Clear section headers | |
- Markdown-formatted code blocks | |
- Bullet points for action items | |
- Links to relevant documentation | |
run: | | |
# Gather issue details | |
export ISSUE_TITLE="${{ github.event.issue.title }}" | |
export ISSUE_BODY="${{ github.event.issue.body }}" | |
export ISSUE_NUMBER="${{ github.event.issue.number }}" | |
export REPO="${{ github.repository }}" | |
export COMMENTS=$(cat comments.txt) | |
# Generate prompt using environment variables | |
REVIEW_PROMPT=$(echo "$PROMPT_TEMPLATE" | envsubst) | |
# Convert to JSON-safe format | |
ESCAPED_PROMPT=$(echo "$REVIEW_PROMPT" | jq -Rs .) | |
# Call the Devin API to create a new review session | |
RESPONSE=$(curl -s -X POST \ | |
-H "Authorization: Bearer $DEVIN_API_KEY" \ | |
-H "Content-Type: application/json" \ | |
-d "{\"prompt\": $ESCAPED_PROMPT, \"idempotent\": true}" \ | |
"https://api.devin.ai/v1/sessions") | |
# Check for errors in the response | |
ERROR_MSG=$(echo "$RESPONSE" | jq -r '.error') | |
if [ "$ERROR_MSG" != "null" ]; then | |
echo "Error creating Devin session: $ERROR_MSG" | |
exit 1 | |
fi | |
# Extract and validate session details | |
SESSION_ID=$(echo "$RESPONSE" | jq -r '.session_id') | |
SESSION_URL=$(echo "$RESPONSE" | jq -r '.url') | |
if [ -z "$SESSION_ID" ] || [ -z "$SESSION_URL" ]; then | |
echo "Error: Devin session details are missing from the response." | |
exit 1 | |
fi | |
# Set output variables | |
echo "session-id=$SESSION_ID" >> $GITHUB_OUTPUT | |
echo "session-url=$SESSION_URL" >> $GITHUB_OUTPUT | |
echo "Devin session created successfully: $RESPONSE" |