Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Reviewdog URL an input #112

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ inputs:
required: false
default: ""

reviewdog_url:
description: "The URL to a tar.gz build of reviewdog to use in the action"
required: false
default: ""

token:
description: "The GitHub token to use."
required: false
Expand Down
2 changes: 1 addition & 1 deletion lib/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function get(tok, dir) {
yield exec.exec('gem', ['install', 'asciidoctor', '--user-install']);
logIfDebug('`gem install asciidoctor --user-install` complete');
const localVale = yield (0, install_1.installLint)(core.getInput('version'));
const localReviewDog = yield (0, install_1.installReviewDog)("0.15.0");
const localReviewDog = yield (0, install_1.installReviewDog)("0.15.0", core.getInput('reviewdog_url'));
const valeFlags = core.getInput("vale_flags");
let version = '';
yield exec.exec(localVale, ['-v'], {
Expand Down
8 changes: 5 additions & 3 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ function installLint(version) {
});
}
exports.installLint = installLint;
function installReviewDog(version) {
function installReviewDog(version, url) {
return __awaiter(this, void 0, void 0, function* () {
core.info(`Installing ReviewDog version '${version}' ...`);
const url = `https://github.com/reviewdog/reviewdog/releases/download/v${version}/reviewdog_${version}_Linux_x86_64.tar.gz`;
if (!url) {
url = `https://github.com/reviewdog/reviewdog/releases/download/v${version}/reviewdog_${version}_Linux_x86_64.tar.gz`;
}
const archivePath = yield tc.downloadTool(url);
let extractedDir = '';
const args = ['xz'];
Expand All @@ -77,7 +79,7 @@ function installReviewDog(version) {
}
extractedDir = yield tc.extractTar(archivePath, process.env.HOME, args);
const reviewdogPath = path_1.default.join(extractedDir, `reviewdog`);
core.info(`Installed version '${version}' into '${reviewdogPath}'.`);
core.info(`Installed reviewdog from '${url}' into '${reviewdogPath}'.`);
return reviewdogPath;
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function get(tok: string, dir: string): Promise<Input> {
logIfDebug('`gem install asciidoctor --user-install` complete');

const localVale = await installLint(core.getInput('version'));
const localReviewDog = await installReviewDog("0.15.0");
const localReviewDog = await installReviewDog("0.15.0", core.getInput('reviewdog_url'));
const valeFlags = core.getInput("vale_flags");

let version = '';
Expand Down
9 changes: 6 additions & 3 deletions src/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ export async function installLint(version: string): Promise<string> {
return lintPath;
}

export async function installReviewDog(version: string): Promise<string> {
export async function installReviewDog(version: string, url?: string): Promise<string> {
core.info(`Installing ReviewDog version '${version}' ...`);

const url = `https://github.com/reviewdog/reviewdog/releases/download/v${version}/reviewdog_${version}_Linux_x86_64.tar.gz`;
if (!url){
url = `https://github.com/reviewdog/reviewdog/releases/download/v${version}/reviewdog_${version}_Linux_x86_64.tar.gz`;
}

const archivePath = await tc.downloadTool(url);

let extractedDir = '';
Expand All @@ -47,7 +50,7 @@ export async function installReviewDog(version: string): Promise<string> {
extractedDir = await tc.extractTar(archivePath, process.env.HOME, args);

const reviewdogPath = path.join(extractedDir, `reviewdog`);
core.info(`Installed version '${version}' into '${reviewdogPath}'.`);

core.info(`Installed reviewdog from '${url}' into '${reviewdogPath}'.`);
return reviewdogPath;
}