-
Notifications
You must be signed in to change notification settings - Fork 0
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
EPD-621 Updates for CI #5
Conversation
gonna put this back in draft mode, gonna leave it open while i work on the other pieces |
f07840b
to
1a3481a
Compare
hello |
c8e389d
to
d167a04
Compare
d167a04
to
d29b6c9
Compare
function pullRequestFromEvent(event: unknown): PullRequest | null { | ||
const parsed = zPullRequestSchema.safeParse(event); | ||
if (parsed.success) { | ||
return parsed.data; | ||
} | ||
return null; | ||
} |
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.
should we log the error here?
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.
no because failures are expected for events that aren't pull request events (like push
and schedule
)
b3fb261
to
c67382e
Compare
99be702
to
93f822d
Compare
93f822d
to
20e5096
Compare
} | ||
if (!this.ciContext) { | ||
try { | ||
this.ciContext = await makeCIContext(); |
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.
Was a bit confused on first read through about what this was doing and how it wasn't a function naming conflicts - but I see this works because the maxCIContext
you are defining here is a instance member and what you are calling on line 114 is an import.
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.
Ah yeah I see, any rename suggestions are welcome 😁
gitProvider: ciContext.gitProvider, | ||
repositoryExternalId: ciContext.repoId, | ||
repositoryName: ciContext.repoName, | ||
repositoryHtmlUrl: ciContext.repoHtmlUrl, | ||
branchExternalId: ciContext.branchId, | ||
branchName: ciContext.branchName, | ||
isDefaultBranch: ciContext.branchName === ciContext.defaultBranchName, | ||
ciProvider: ciContext.ciProvider, | ||
buildHtmlUrl: ciContext.buildHtmlUrl, | ||
commitSha: ciContext.commitSha, | ||
commitMessage: ciContext.commitMessage, | ||
commitCommitterName: ciContext.commitCommitterName, | ||
commitCommitterEmail: ciContext.commitCommitterEmail, | ||
commitAuthorName: ciContext.commitAuthorName, | ||
commitAuthorEmail: ciContext.commitAuthorEmail, | ||
commitCommittedDate: ciContext.commitCommittedDate, | ||
pullRequestNumber: ciContext.pullRequestNumber, | ||
pullRequestTitle: ciContext.pullRequestTitle, |
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.
Do we get strong typing for what this endpoint 'builds' expects?
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.
No :( for that we'd need to publish types from our rest API via an open API spec or something
src/handlers/testing/exec/index.ts
Outdated
@@ -102,39 +85,104 @@ class RunManager { | |||
} | |||
|
|||
private async post<T>(path: string, body?: unknown): Promise<T> { | |||
const resp = await fetch(`https://api.autoblocks.ai${path}`, { | |||
const subpath = this.isCI ? '/testing/ci' : '/testing/local'; | |||
const resp = await fetch(`https://api.autoblocks.ai${subpath}${path}`, { |
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.
Should we be storing this domain in a constant?
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.
Sure I'll update
ended up not using the context from
@actions/github
for this, didn't have a lot of stuff i needed so was easier to do it manually (most of this is copied from javascript-sdk)will follow up w/ getting pull request info when it's a
push
event via https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#list-pull-requests-associated-with-a-commit. currently we'll only get pull request info onpull_request
eventssee https://github.com/autoblocksai/cli/actions/runs/7978053008/job/21782347111 for the context for this branch for an example: