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

feat: add debug option #168

Merged
merged 2 commits into from Apr 24, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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