initial commit

This commit is contained in:
Federico Builes
2022-03-31 18:31:39 +02:00
commit 3f943b86c9
29 changed files with 28863 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
import * as core from '@actions/core'
import * as githubUtils from '@actions/github/lib/utils'
import * as retry from '@octokit/plugin-retry'
import {Changes, ChangesSchema} from './schemas'
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry)
const octo = new retryingOctokit(
githubUtils.getOctokitOptions(core.getInput('repo-token', {required: true}))
)
export async function compare({
owner,
repo,
baseRef,
headRef
}: {
owner: string
repo: string
baseRef: string
headRef: string
}): Promise<Changes> {
const changes = await octo.paginate(
'GET /repos/{owner}/{repo}/dependency-graph/compare/{basehead}',
{
owner,
repo,
basehead: `${baseRef}...${headRef}`
}
)
return ChangesSchema.parse(changes)
}