Skip to content

Commit fa7dc87

Browse files
authored
Merge pull request #103 from boesing/bugfix/debug-logging
Ensure github actions `core` is available
2 parents 34f2531 + e37d277 commit fa7dc87

File tree

3 files changed

+5
-52
lines changed

3 files changed

+5
-52
lines changed

src/action/github.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import core from '@actions/core';
21
import {Action} from '../action';
32
import {Output} from '../config/output';
43
import {Logger} from '../logging';
54

5+
/* eslint-disable-next-line import/no-commonjs, @typescript-eslint/no-var-requires */
6+
const core = require('@actions/core');
7+
68
export class Github implements Action {
79
publish(variable: string, output: Output): void {
810
core.setOutput(variable, JSON.stringify(output));
@@ -16,11 +18,7 @@ export class Github implements Action {
1618
getLogger(): Logger {
1719
return {
1820
debug(message: string): void {
19-
if (!core.isDebug()) {
20-
return;
21-
}
22-
23-
core.info(message);
21+
core.debug(message);
2422
},
2523

2624
info(message: string): void {

src/action/local.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/main.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
11
import { App } from './app';
22
import { Action } from './action';
3-
import { Local } from './action/local';
43
import { Github } from './action/github';
54
import { SPACES_TO_INDENT_JSON } from './json';
65
import {Logger} from './logging';
76

8-
let action: Action = new Github();
9-
10-
/**
11-
* Default environment variable provided by GHA to each run
12-
* https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
13-
*/
14-
if (process.env.GITHUB_ACTIONS !== 'true') {
15-
action = new Local();
16-
}
7+
const action: Action = new Github();
178

189
const logger: Logger = action.getLogger();
1910
const app = new App(action, logger);

0 commit comments

Comments
 (0)