Skip to content

Commit

Permalink
WHAT DO YOU SEEEEEE
Browse files Browse the repository at this point in the history
  • Loading branch information
thebeline committed Apr 5, 2021
1 parent 6910ba7 commit d54a20d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
8 changes: 5 additions & 3 deletions dist/post_run/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6852,13 +6852,14 @@ const logLintIssues = (issues) => {
});
};
function annotateLintIssues(issues) {
var _a;
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
if (!issues.length) {
return;
}
const ctx = github.context;
const ref = ctx.payload.after;
core.info(util_1.inspect(ctx));
const ref = (_a = ctx.payload.after) !== null && _a !== void 0 ? _a : ctx.sha;
const octokit = github.getOctokit(core.getInput(`github-token`, { required: true }));
const checkRunsPromise = octokit.checks
.listForRef(Object.assign(Object.assign({}, ctx.repo), { ref, status: "in_progress" }))
Expand Down Expand Up @@ -6906,6 +6907,7 @@ function annotateLintIssues(issues) {
});
let checkRun;
const { data: checkRunsResponse } = yield checkRunsPromise;
core.info(util_1.inspect(checkRunsResponse));
if (checkRunsResponse.check_runs.length === 0) {
throw `octokit.checks.listForRef(${ref}) returned no results`;
}
Expand All @@ -6915,7 +6917,7 @@ function annotateLintIssues(issues) {
if (!(checkRun === null || checkRun === void 0 ? void 0 : checkRun.id)) {
throw `Could not find current check run`;
}
const title = (_a = checkRun.output.title) !== null && _a !== void 0 ? _a : `GolangCI-Lint`;
const title = (_b = checkRun.output.title) !== null && _b !== void 0 ? _b : `GolangCI-Lint`;
const summary = `There are {issueCounts.failure} failures, {issueCounts.wairning} warnings, and {issueCounts.notice} notices.`;
Array.from({ length: Math.ceil(githubAnnotations.length / chunkSize) }, (v, i) => githubAnnotations.slice(i * chunkSize, i * chunkSize + chunkSize)).forEach((annotations) => {
octokit.checks
Expand Down
8 changes: 5 additions & 3 deletions dist/run/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6862,13 +6862,14 @@ const logLintIssues = (issues) => {
});
};
function annotateLintIssues(issues) {
var _a;
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
if (!issues.length) {
return;
}
const ctx = github.context;
const ref = ctx.payload.after;
core.info(util_1.inspect(ctx));
const ref = (_a = ctx.payload.after) !== null && _a !== void 0 ? _a : ctx.sha;
const octokit = github.getOctokit(core.getInput(`github-token`, { required: true }));
const checkRunsPromise = octokit.checks
.listForRef(Object.assign(Object.assign({}, ctx.repo), { ref, status: "in_progress" }))
Expand Down Expand Up @@ -6916,6 +6917,7 @@ function annotateLintIssues(issues) {
});
let checkRun;
const { data: checkRunsResponse } = yield checkRunsPromise;
core.info(util_1.inspect(checkRunsResponse));
if (checkRunsResponse.check_runs.length === 0) {
throw `octokit.checks.listForRef(${ref}) returned no results`;
}
Expand All @@ -6925,7 +6927,7 @@ function annotateLintIssues(issues) {
if (!(checkRun === null || checkRun === void 0 ? void 0 : checkRun.id)) {
throw `Could not find current check run`;
}
const title = (_a = checkRun.output.title) !== null && _a !== void 0 ? _a : `GolangCI-Lint`;
const title = (_b = checkRun.output.title) !== null && _b !== void 0 ? _b : `GolangCI-Lint`;
const summary = `There are {issueCounts.failure} failures, {issueCounts.wairning} warnings, and {issueCounts.notice} notices.`;
Array.from({ length: Math.ceil(githubAnnotations.length / chunkSize) }, (v, i) => githubAnnotations.slice(i * chunkSize, i * chunkSize + chunkSize)).forEach((annotations) => {
octokit.checks
Expand Down
6 changes: 4 additions & 2 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { exec, ExecOptions } from "child_process"
import * as fs from "fs"
import * as path from "path"
import { dir } from "tmp"
import { promisify } from "util"
import { inspect, promisify } from "util"

import { restoreCache, saveCache } from "./cache"
import { installGo, installLint } from "./install"
Expand Down Expand Up @@ -236,7 +236,8 @@ async function annotateLintIssues(issues: LintIssue[]): Promise<void> {
return
}
const ctx = github.context
const ref = ctx.payload.after
core.info(inspect(ctx))
const ref = ctx.payload.after ?? ctx.sha
const octokit = github.getOctokit(core.getInput(`github-token`, { required: true }))
const checkRunsPromise = octokit.checks
.listForRef({
Expand Down Expand Up @@ -293,6 +294,7 @@ async function annotateLintIssues(issues: LintIssue[]): Promise<void> {
)
let checkRun: CheckRun | undefined
const { data: checkRunsResponse } = await checkRunsPromise
core.info(inspect(checkRunsResponse))
if (checkRunsResponse.check_runs.length === 0) {
throw `octokit.checks.listForRef(${ref}) returned no results`
} else {
Expand Down

0 comments on commit d54a20d

Please sign in to comment.