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 8630882
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
10 changes: 6 additions & 4 deletions dist/post_run/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6852,16 +6852,17 @@ 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, false, 4));
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" }))
.listForRef(Object.assign(Object.assign({}, ctx.repo), { ref, status: `in_progress`, filter: `latest` }))
.catch((e) => {
throw `Error getting Check Run Data: ${e}`;
});
Expand Down Expand Up @@ -6906,6 +6907,7 @@ function annotateLintIssues(issues) {
});
let checkRun;
const { data: checkRunsResponse } = yield checkRunsPromise;
core.info(util_1.inspect(checkRunsResponse, false, 4));
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
10 changes: 6 additions & 4 deletions dist/run/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6862,16 +6862,17 @@ 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, false, 4));
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" }))
.listForRef(Object.assign(Object.assign({}, ctx.repo), { ref, status: `in_progress`, filter: `latest` }))
.catch((e) => {
throw `Error getting Check Run Data: ${e}`;
});
Expand Down Expand Up @@ -6916,6 +6917,7 @@ function annotateLintIssues(issues) {
});
let checkRun;
const { data: checkRunsResponse } = yield checkRunsPromise;
core.info(util_1.inspect(checkRunsResponse, false, 4));
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
9 changes: 6 additions & 3 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,13 +236,15 @@ async function annotateLintIssues(issues: LintIssue[]): Promise<void> {
return
}
const ctx = github.context
const ref = ctx.payload.after
core.info(inspect(ctx, false, 4))
const ref = ctx.payload.after ?? ctx.sha
const octokit = github.getOctokit(core.getInput(`github-token`, { required: true }))
const checkRunsPromise = octokit.checks
.listForRef({
...ctx.repo,
ref,
status: "in_progress",
status: `in_progress`,
filter: `latest`,
})
.catch((e) => {
throw `Error getting Check Run Data: ${e}`
Expand Down Expand Up @@ -293,6 +295,7 @@ async function annotateLintIssues(issues: LintIssue[]): Promise<void> {
)
let checkRun: CheckRun | undefined
const { data: checkRunsResponse } = await checkRunsPromise
core.info(inspect(checkRunsResponse, false, 4))
if (checkRunsResponse.check_runs.length === 0) {
throw `octokit.checks.listForRef(${ref}) returned no results`
} else {
Expand Down

0 comments on commit 8630882

Please sign in to comment.