Skip to content

Commit 5a28e5a

Browse files
vikram@dagger.iovikram@dagger.io
authored andcommitted
Switch to external github-api module
Signed-off-by: vikram@dagger.io <Vikram Vaswani>
1 parent aa36dcf commit 5a28e5a

5 files changed

Lines changed: 365 additions & 314 deletions

File tree

.dagger/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/.venv
22
/**/__pycache__
33
/sdk
4+
/.env

.dagger/src/book/main.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ async def fix_local(
173173
.with_string_output("summary", "list of changes made")
174174
)
175175

176-
prompt_file = dag.current_module().source().file("prompts/fix.txt")
176+
prompt_file = dag.current_module().source().file("src/book/prompt.fix.txt")
177177

178178
work = (
179179
dag.llm()
@@ -199,7 +199,7 @@ async def fix_ci(
199199
.with_string_output("summary", "list of changes made")
200200
)
201201

202-
prompt_file = dag.current_module().source().file("prompts/fix.txt")
202+
prompt_file = dag.current_module().source().file("src/book/prompt.fix.txt")
203203

204204
work = (
205205
dag.llm()
@@ -226,14 +226,16 @@ async def fix_ci(
226226
.file("/tmp/a.diff")
227227
)
228228

229-
pr_url = await dag.workspace(source=source, token=token).open_pr(repository, ref, diff_file)
229+
#pr_url = await dag.workspace(source=source, token=token).open_pr(repository, ref, diff_file)
230+
pr_url = await dag.github_api().create_pr(repository, ref, diff_file, token)
230231

231232
diff = await diff_file.contents()
232233

233234
# post comment with changes
234235
comment_body = f"{summary}\n\nDiff:\n\n```{diff}```"
235236
comment_body += f"\n\nPR with fixes: {pr_url}"
236237

237-
comment_url = await dag.workspace(source=source, token=token).comment(repository, ref, comment_body)
238+
#comment_url = await dag.workspace(source=source, token=token).comment(repository, ref, comment_body)
239+
comment_url = await dag.github_api().comment(repository, ref, comment_body, token)
238240

239241
return f"Comment posted: {comment_url}"

0 commit comments

Comments
 (0)