Skip to content

Commit

Permalink
feat: add debug option (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexox committed Apr 24, 2023
1 parent d2cf009 commit 09b709c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -30,6 +30,7 @@ The action's step needs to run after your test suite has outputted an LCOV file.
| `base-path` | _optional_ | Path to the root folder of the project the coverage was collected in. Should be used in monorepos so that coveralls can process the LCOV correctly (e.g. packages/my-project) |
| `git-branch` | _optional_ | Default: GITHUB_REF environment variable. Override the branch name. |
| `git-commit` | _optional_ | Default: GITHUB_SHA environment variable. Override the commit SHA. |
| `debug` | _optional_ | Default: `false`. Set to `true` to enable debug logging. |

### Outputs:

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Expand Up @@ -36,6 +36,10 @@ inputs:
git-commit:
description: 'Override the commit sha'
required: false
debug:
description: 'Enable debug logging'
required: false
default: false
outputs:
coveralls-api-result:
description: 'Result status of Coveralls API post.'
Expand Down
5 changes: 4 additions & 1 deletion dist/index.js
Expand Up @@ -40761,6 +40761,9 @@ const core = __importStar(__nccwpck_require__(6024));
const fs_1 = __importDefault(__nccwpck_require__(7147));
const request_1 = __importDefault(__nccwpck_require__(2956));
const lcov_processor_1 = __nccwpck_require__(6334);
process.env.NODE_COVERALLS_DEBUG = (process.env.COVERALLS_DEBUG == 'true' ||
process.env.COVERALLS_DEBUG == '1' ||
core.getInput('debug') == 'true') ? '1' : '';
const coveralls = __nccwpck_require__(7532);
function run() {
return __awaiter(this, void 0, void 0, function* () {
Expand All @@ -40775,7 +40778,7 @@ function run() {
process.env.COVERALLS_GIT_BRANCH = process.env.GITHUB_REF.toString();
process.env.COVERALLS_FLAG_NAME = process.env.COVERALLS_FLAG_NAME || core.getInput('flag-name');
const event = fs_1.default.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8');
if (process.env.COVERALLS_DEBUG) {
if (process.env.NODE_COVERALLS_DEBUG) {
console.log("Event Name: " + process.env.GITHUB_EVENT_NAME);
console.log(event);
}
Expand Down
8 changes: 7 additions & 1 deletion src/run.ts
Expand Up @@ -5,6 +5,12 @@ import path from 'path';
import request, { Response } from 'request';
import { adjustLcovBasePath } from './lcov-processor';

process.env.NODE_COVERALLS_DEBUG = (
process.env.COVERALLS_DEBUG == 'true' ||
process.env.COVERALLS_DEBUG == '1' ||
core.getInput('debug') == 'true'
) ? '1' : '';

const coveralls = require('coveralls');

interface WebhookResult {
Expand All @@ -30,7 +36,7 @@ export async function run() {

const event = fs.readFileSync(process.env.GITHUB_EVENT_PATH!, 'utf8');

if (process.env.COVERALLS_DEBUG) {
if (process.env.NODE_COVERALLS_DEBUG) {
console.log("Event Name: " + process.env.GITHUB_EVENT_NAME);
console.log(event);
}
Expand Down

0 comments on commit 09b709c

Please sign in to comment.