-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathaction.yaml
More file actions
85 lines (77 loc) · 2.45 KB
/
action.yaml
File metadata and controls
85 lines (77 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Jules Invoke
description: 'Invoke Jules, an AI-powered coding agent, to perform tasks on your codebase.'
branding:
icon: 'code'
color: 'purple'
inputs:
prompt:
description: 'The prompt to pass to Jules'
required: true
type: string
include_last_commit:
description: 'Whether to pass content of the last commit'
type: boolean
default: false
include_commit_log:
description: 'Whether to pass commit history'
type: boolean
default: false
starting_branch:
description: 'The branch for Jules to start from'
required: false
type: string
default: 'main'
jules_api_key:
description: 'The Jules API key to use for authentication'
required: true
type: string
runs:
using: "composite"
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 30
- name: Create initial prompt
env:
USER_PROMPT: ${{ inputs.prompt }}
shell: bash
run: |
echo "$USER_PROMPT" > prompt.txt
- name: Save last commit content
if: ${{ inputs.include_last_commit }}
shell: bash
run: |
echo -e '\n\nContent of the latest commit (in the format of `git show`):' >> prompt.txt
echo '```' >> prompt.txt
git show >> prompt.txt
echo '```' >> prompt.txt
- name: Save git log
if: ${{ inputs.include_commit_log }}
shell: bash
run: |
echo -e '\n\nLog of the last 20 commits (in the format of `git log --stat`):' >> prompt.txt
echo '```' >> prompt.txt
git log -20 --stat >> prompt.txt
echo '```' >> prompt.txt
- name: Assemble Jules payload
shell: bash
run: |
jq -n --arg jules_prompt "$(cat prompt.txt)" --arg starting_branch "${{ inputs.starting_branch }}" --arg repo_full_name "${{ github.repository }}" '{
"prompt": $jules_prompt,
"sourceContext": {
"source": "sources/github/\($repo_full_name)",
"githubRepoContext": {
"startingBranch": $starting_branch
}
},
"requirePlanApproval": false,
"automationMode": "AUTO_CREATE_PR"
}' > jules_payload.json
- name: Invoke Jules
shell: bash
run: |
curl 'https://jules.googleapis.com/v1alpha/sessions' \
-X POST \
-H "Content-Type: application/json" \
-H "X-Goog-Api-Key: ${{ inputs.jules_api_key }}" \
-d @jules_payload.json