Skip to content
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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ jobs:
| `service` | Service name for the coverage report | No | - |
| `env` | Environment name (e.g., `ci`, `staging`) | No | - |
| `flags` | Comma-separated flags for grouping (max 32) | No | - |
| `dry-run` | Run without uploading (for testing) | No | `false` |

*Required via input or `DD_API_KEY` / `DATADOG_API_KEY` environment variable

Expand Down
4 changes: 0 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ inputs:
flags:
description: 'Comma-separated list of flags for grouping and filtering (e.g., type:unit-tests,jvm-21)'
required: false
dry-run:
description: 'Run without uploading (for testing)'
required: false
default: 'false'

outputs:
uploaded-files:
Expand Down
27 changes: 10 additions & 17 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48616,7 +48616,6 @@ async function run() {
const service = getInput('service') || process.env.DD_SERVICE;
const env = getInput('env') || process.env.DD_ENV;
const flagsInput = getInput('flags');
const dryRun = getInput('dry-run') === 'true';
if (!apiKey) {
throw new Error('Datadog API key is required. Set it via api-key input, DD_API_KEY, or DATADOG_API_KEY environment variable.');
}
Expand Down Expand Up @@ -48650,23 +48649,17 @@ async function run() {
throw new Error('Could not determine git commit SHA');
}
// Upload files
if (dryRun) {
info('[DRY-RUN] Would upload the following files:');
files.forEach((f) => info(` - ${f.path}`));
}
else {
await uploadCoverageFiles({
apiKey,
site,
files,
context,
service,
env,
flags,
});
}
await uploadCoverageFiles({
apiKey,
site,
files,
context,
service,
env,
flags,
});
const elapsed = (Date.now() - startTime) / 1000;
info(`✅ ${dryRun ? '[DRY-RUN] ' : ''}Uploaded ${files.length} file(s) in ${elapsed.toFixed(2)} seconds`);
info(`✅ Uploaded ${files.length} file(s) in ${elapsed.toFixed(2)} seconds`);
setOutput('uploaded-files', files.length);
setOutput('upload-time', elapsed.toFixed(2));
}
Expand Down
8 changes: 4 additions & 4 deletions jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export default {
coverageReporters: ['text', 'lcov', 'html'],
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80,
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
clearMocks: true,
Expand Down
19 changes: 0 additions & 19 deletions src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ describe("index (run)", () => {
service: "",
env: "",
flags: "",
"dry-run": "false",
};
return inputs[name] || "";
});
Expand Down Expand Up @@ -224,24 +223,6 @@ describe("index (run)", () => {
);
});

it("should run in dry-run mode without uploading", async () => {
mockCore.getInput.mockImplementation((name: string) => {
const inputs: Record<string, string> = {
"api-key": "test-api-key",
files: "**/coverage.xml",
"dry-run": "true",
};
return inputs[name] || "";
});

await runAction();

expect(mockUploadCoverageFiles).not.toHaveBeenCalled();
expect(mockCore.info).toHaveBeenCalledWith(
expect.stringContaining("[DRY-RUN]"),
);
});

it("should parse flags correctly", async () => {
mockCore.getInput.mockImplementation((name: string) => {
const inputs: Record<string, string> = {
Expand Down
28 changes: 10 additions & 18 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ async function run(): Promise<void> {
const service = core.getInput('service') || process.env.DD_SERVICE;
const env = core.getInput('env') || process.env.DD_ENV;
const flagsInput = core.getInput('flags');
const dryRun = core.getInput('dry-run') === 'true';

if (!apiKey) {
throw new Error(
Expand Down Expand Up @@ -63,25 +62,18 @@ async function run(): Promise<void> {
}

// Upload files
if (dryRun) {
core.info('[DRY-RUN] Would upload the following files:');
files.forEach((f) => core.info(` - ${f.path}`));
} else {
await uploadCoverageFiles({
apiKey,
site,
files,
context,
service,
env,
flags,
});
}
await uploadCoverageFiles({
apiKey,
site,
files,
context,
service,
env,
flags,
});

const elapsed = (Date.now() - startTime) / 1000;
core.info(
`✅ ${dryRun ? '[DRY-RUN] ' : ''}Uploaded ${files.length} file(s) in ${elapsed.toFixed(2)} seconds`
);
core.info(`✅ Uploaded ${files.length} file(s) in ${elapsed.toFixed(2)} seconds`);

core.setOutput('uploaded-files', files.length);
core.setOutput('upload-time', elapsed.toFixed(2));
Expand Down