//native
/**
* List last job commits
* Returns list of the last 100 commits made on the repository linked to the job
*/
export async function main(
auth: RT.Qovery,
jobId: string,
startId?: string | undefined,
gitCommitId?: string | undefined
) {
const url = new URL(`https://api.qovery.com/job/${jobId}/commit`)
for (const [k, v] of [
['startId', startId],
['gitCommitId', gitCommitId]
]) {
if (v !== undefined && v !== '') {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'Token ' + auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago