mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-22 00:01:05 -05:00
Use github.getOctokit() for compat with GitHub Enterprise
Thanks @nise-nabe for the inspiration Fixes #885
This commit is contained in:
parent
d8615ccc8b
commit
b5126f31db
5 changed files with 9 additions and 7099 deletions
3546
dist/main/index.js
vendored
3546
dist/main/index.js
vendored
File diff suppressed because it is too large
Load diff
2
dist/main/index.js.map
vendored
2
dist/main/index.js.map
vendored
File diff suppressed because one or more lines are too long
3546
dist/post/index.js
vendored
3546
dist/post/index.js
vendored
File diff suppressed because it is too large
Load diff
2
dist/post/index.js.map
vendored
2
dist/post/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,7 @@ import * as artifact from '@actions/artifact'
|
||||||
import * as github from '@actions/github'
|
import * as github from '@actions/github'
|
||||||
import * as glob from '@actions/glob'
|
import * as glob from '@actions/glob'
|
||||||
import * as toolCache from '@actions/tool-cache'
|
import * as toolCache from '@actions/tool-cache'
|
||||||
import {Octokit} from '@octokit/rest'
|
import {GitHub} from '@actions/github/lib/utils'
|
||||||
|
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
|
@ -63,7 +63,7 @@ async function downloadAndSubmitDependencyGraphs(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function submitDependencyGraphs(dependencyGraphFiles: string[]): Promise<void> {
|
async function submitDependencyGraphs(dependencyGraphFiles: string[]): Promise<void> {
|
||||||
const octokit: Octokit = getOctokit()
|
const octokit = getOctokit()
|
||||||
|
|
||||||
for (const jsonFile of dependencyGraphFiles) {
|
for (const jsonFile of dependencyGraphFiles) {
|
||||||
const jsonContent = fs.readFileSync(jsonFile, 'utf8')
|
const jsonContent = fs.readFileSync(jsonFile, 'utf8')
|
||||||
|
@ -86,7 +86,7 @@ async function retrieveDependencyGraphs(workspaceDirectory: string): Promise<str
|
||||||
}
|
}
|
||||||
|
|
||||||
async function retrieveDependencyGraphsForWorkflowRun(runId: number, workspaceDirectory: string): Promise<string[]> {
|
async function retrieveDependencyGraphsForWorkflowRun(runId: number, workspaceDirectory: string): Promise<string[]> {
|
||||||
const octokit: Octokit = getOctokit()
|
const octokit = getOctokit()
|
||||||
|
|
||||||
// Find the workflow run artifacts named "dependency-graph"
|
// Find the workflow run artifacts named "dependency-graph"
|
||||||
const artifacts = await octokit.rest.actions.listWorkflowRunArtifacts({
|
const artifacts = await octokit.rest.actions.listWorkflowRunArtifacts({
|
||||||
|
@ -136,10 +136,8 @@ async function findDependencyGraphFiles(dir: string): Promise<string[]> {
|
||||||
return graphFiles
|
return graphFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOctokit(): Octokit {
|
function getOctokit(): InstanceType<typeof GitHub> {
|
||||||
return new Octokit({
|
return github.getOctokit(getGithubToken())
|
||||||
auth: getGithubToken()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGithubToken(): string {
|
function getGithubToken(): string {
|
||||||
|
|
Loading…
Reference in a new issue