Skip to content

Commit

Permalink
Fix: use execa for its larger max buffer size
Browse files Browse the repository at this point in the history
Related to #1.
  • Loading branch information
jdkato committed Nov 1, 2019
1 parent cca7f43 commit 9e61f24
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 26 deletions.
17 changes: 4 additions & 13 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,25 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const exec = __importStar(require("@actions/exec"));
const github = __importStar(require("@actions/github"));
const tmp = __importStar(require("tmp"));
const execa = require("execa");
const check_1 = require("./check");
const input = __importStar(require("./input"));
function run(actionInput) {
return __awaiter(this, void 0, void 0, function* () {
const startedAt = new Date().toISOString();
let output = '';
yield exec.exec('vale', actionInput.args, {
silent: true,
cwd: actionInput.workspace,
listeners: {
stdout: (buffer) => output = buffer.toString().trim(),
}
});
const alertResp = yield execa('vale', actionInput.args);
let runner = new check_1.CheckRunner();
runner.makeAnnotations(output);
runner.makeAnnotations(alertResp.stdout);
yield runner.executeCheck({
token: actionInput.token,
name: 'Vale',
owner: github.context.repo.owner,
repo: github.context.repo.repo,
head_sha: github.context.sha,
started_at: startedAt,
context: {
vale: actionInput.version
}
context: { vale: actionInput.version }
});
});
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@actions/tool-cache": "^1.0.0",
"@types/request-promise-native": "^1.0.17",
"@types/tmp": "^0.1.0",
"execa": "^3.2.0",
"request": "^2.88.0",
"request-promise-native": "^1.0.7",
"tmp": "^0.1.0"
Expand Down
17 changes: 4 additions & 13 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as github from '@actions/github';

import * as tmp from 'tmp';
import execa = require('execa');

import {CheckRunner} from './check';
import * as input from './input';

export async function run(actionInput: input.Input): Promise<void> {
const startedAt = new Date().toISOString();
const alertResp = await execa('vale', actionInput.args);

let output = '';
await exec.exec('vale', actionInput.args, {
silent: true,
cwd: actionInput.workspace,
listeners: {
stdout: (buffer: Buffer) => output = buffer.toString().trim(),
}
});
let runner = new CheckRunner();
runner.makeAnnotations(alertResp.stdout);

runner.makeAnnotations(output);
await runner.executeCheck({
token: actionInput.token,
name: 'Vale',
owner: github.context.repo.owner,
repo: github.context.repo.repo,
head_sha: github.context.sha,
started_at: startedAt,
context: {
vale: actionInput.version
}
context: {vale: actionInput.version}
});
}

Expand Down

0 comments on commit 9e61f24

Please sign in to comment.