Eos and bos tokens can be redefined as additional tokens with other ids #477
This file contains hidden or 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 on "devin" label | |
| on: | |
| issues: | |
| types: [labeled] | |
| # allow commenting on the issue | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| create-devin-session: | |
| if: ${{ github.event.label.name == 'devin' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Ensure jq is available | |
| run: | | |
| if ! command -v jq >/dev/null; then | |
| sudo apt-get update && sudo apt-get install -y jq | |
| fi | |
| - name: Build prompt file | |
| run: | | |
| cat > prompt.txt <<'EOF' | |
| Triage this issue: | |
| ${{ github.event.issue.html_url }} | |
| Title: ${{ github.event.issue.title }} | |
| Body: | |
| ${{ github.event.issue.body }} | |
| 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 "$resp" > resp.json | |
| # required outputs (fail if url missing) | |
| url=$(jq -er '.url' resp.json) | |
| echo "url=$url" >> "$GITHUB_OUTPUT" | |
| session_id=$(jq -r '.session_id' resp.json) | |
| echo "session_id=$session_id" >> "$GITHUB_OUTPUT" | |
| is_new=$(jq -r '.is_new_session // true' resp.json) | |
| echo "is_new_session=$is_new" >> "$GITHUB_OUTPUT" | |
| - name: Comment on the issue with session link (newline-safe) | |
| if: ${{ steps.devin.outputs.url != '' && 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)"}' > body.json | |
| curl -sS -X POST \ | |
| -H "Authorization: Bearer $GITHUB_TOKEN" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| --data @body.json \ | |
| "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments" |