fix: action failure status (#151)
Close #149 * chore: fix path to .gitconfig
This commit is contained in:
parent
de65f3e128
commit
94853340b9
3 changed files with 23 additions and 23 deletions
2
Makefile
2
Makefile
|
@ -3,7 +3,7 @@ msg := ""
|
||||||
IMAGE_NAME := actions_hugo_dev:latest
|
IMAGE_NAME := actions_hugo_dev:latest
|
||||||
NODE_VERSION := $(shell cat ./.nvmrc)
|
NODE_VERSION := $(shell cat ./.nvmrc)
|
||||||
DOCKER_BUILD := docker build . -t $(IMAGE_NAME) --build-arg NODE_VERSION=$(NODE_VERSION)
|
DOCKER_BUILD := docker build . -t $(IMAGE_NAME) --build-arg NODE_VERSION=$(NODE_VERSION)
|
||||||
DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/etc/gitconfig $(IMAGE_NAME)
|
DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/root/.gitconfig $(IMAGE_NAME)
|
||||||
|
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
import * as core from '@actions/core';
|
||||||
import * as main from './main';
|
import * as main from './main';
|
||||||
|
|
||||||
main.run();
|
try {
|
||||||
|
main.run();
|
||||||
|
} catch (e) {
|
||||||
|
core.setFailed(`Action failed with error ${e}`);
|
||||||
|
}
|
||||||
|
|
37
src/main.ts
37
src/main.ts
|
@ -34,28 +34,23 @@ export async function showVersion(
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function run(): Promise<ActionResult> {
|
export async function run(): Promise<ActionResult> {
|
||||||
try {
|
const toolVersion: string = core.getInput('hugo-version');
|
||||||
const toolVersion: string = core.getInput('hugo-version');
|
let installVersion = '';
|
||||||
let installVersion = '';
|
|
||||||
|
|
||||||
let result: ActionResult = {
|
let result: ActionResult = {
|
||||||
exitcode: 0,
|
exitcode: 0,
|
||||||
output: ''
|
output: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
if (toolVersion === '' || toolVersion === 'latest') {
|
if (toolVersion === '' || toolVersion === 'latest') {
|
||||||
installVersion = await getLatestVersion(Tool.Org, Tool.Repo, 'brew');
|
installVersion = await getLatestVersion(Tool.Org, Tool.Repo, 'brew');
|
||||||
} else {
|
} else {
|
||||||
installVersion = toolVersion;
|
installVersion = toolVersion;
|
||||||
}
|
|
||||||
|
|
||||||
core.info(`${Tool.Name} version: ${installVersion}`);
|
|
||||||
await installer(installVersion);
|
|
||||||
result = await showVersion(Tool.CmdName, [Tool.CmdOptVersion]);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
} catch (e) {
|
|
||||||
core.setFailed(`Action failed with error ${e}`);
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
core.info(`${Tool.Name} version: ${installVersion}`);
|
||||||
|
await installer(installVersion);
|
||||||
|
result = await showVersion(Tool.CmdName, [Tool.CmdOptVersion]);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue