-
Notifications
You must be signed in to change notification settings - Fork 63
ci: add Devin on-label automation workflow #4520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| name: Devin on "devin" label | ||
| on: | ||
| issues: | ||
| types: [labeled] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| issues: write | ||
|
|
||
| jobs: | ||
| create-devin-session: | ||
| if: github.event.label.name == 'devin' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Build prompt | ||
| run: | | ||
| cat > prompt.txt <<'EOF' | ||
| Work on this issue: | ||
| ${{ github.event.issue.html_url }} | ||
|
|
||
| Title: ${{ github.event.issue.title }} | ||
|
|
||
| Body: | ||
| ${{ github.event.issue.body }} | ||
|
|
||
| REQUIREMENTS: | ||
| - When you open a PR, include this exact line in the PR description: | ||
| Fixes ${{ github.repository }}#${{ github.event.issue.number }} | ||
| - For every commit message in that PR, include: | ||
| Refs ${{ github.repository }}#${{ github.event.issue.number }} | ||
| EOF | ||
|
|
||
| - name: Create Devin session | ||
| id: devin | ||
| env: | ||
| DEVIN_API_KEY: ${{ secrets.DEVIN_API_KEY }} | ||
| run: | | ||
| set -eo pipefail | ||
| resp=$(curl -fSs https://api.devin.ai/v1/sessions \ | ||
| -H "Authorization: Bearer $DEVIN_API_KEY" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d "$(jq -n --rawfile prompt prompt.txt \ | ||
| --arg title "Issue #${{ github.event.issue.number }}: ${{ github.event.issue.title }}" \ | ||
| --arg repo "${{ github.repository }}" \ | ||
| --arg issue "${{ github.event.issue.number }}" \ | ||
| '{prompt:$prompt, title:$title, idempotent:true, | ||
| tags:["src:github","label:devin","repo:"+$repo,"issue:"+$issue]}')") | ||
| echo "url=$(echo "$resp" | jq -er '.url')" >> "$GITHUB_OUTPUT" | ||
| echo "is_new_session=$(echo "$resp" | jq -r '.is_new_session // true')" >> "$GITHUB_OUTPUT" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. jq alternative operator converts false to trueMedium Severity The jq expression Reviewed by Cursor Bugbot for commit 52802c6. Configure here. |
||
|
|
||
| - name: Comment session link | ||
| if: steps.devin.outputs.is_new_session == 'true' | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| jq -n --arg url "${{ steps.devin.outputs.url }}" \ | ||
| '{body: "Devin is on it.\n\n**Session:** \($url)"}' | \ | ||
| curl -sS -X POST \ | ||
| -H "Authorization: Bearer $GITHUB_TOKEN" \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| --data @- \ | ||
| "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments" | ||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script injection via unsanitized user input in shell
High Severity
User-controlled values
github.event.issue.bodyandgithub.event.issue.titleare interpolated directly intorunshell scripts via${{ }}expressions. GitHub Actions expands these before the shell executes, so an attacker can craft an issue body containingEOFon its own line to terminate the heredoc and execute arbitrary commands — including exfiltrating theDEVIN_API_KEYsecret. The title similarly breaks out of double quotes on thejq --argline. These values need to be passed throughenv:blocks instead of inline interpolation.Additional Locations (2)
.github/workflows/devin-on-label.yml#L20-L21.github/workflows/devin-on-label.yml#L42-L43Reviewed by Cursor Bugbot for commit 52802c6. Configure here.