Skip to content

Commit

Permalink
Remove payload from dump data
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Jun 5, 2024
1 parent b421c79 commit 586d9d4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 28 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ permissions:

(Since v3.4.0)

If used in debug mode, this action outputs the used resources into the `dump` key.\
This data is only provided for debugging purposes, so the schema is not defined.
- `dump`\
Collected resources which keeps fields then logged.\
This data is only provided for debugging purposes, so the schema is not defined.

## Examples

Expand Down
4 changes: 0 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ inputs:
description: 'Skip jobs defined in the same workflow which using this action'
required: false
default: 'false'
dump:
description: 'Output resources into jobs.<job_id>.outputs.dump for debugging purposes'
required: false
default: 'false'
dry-run:
description: 'Avoid http requests for tests'
required: false
Expand Down
13 changes: 4 additions & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31091,7 +31091,6 @@ var Options = z2.object({
attemptLimits: z2.number().min(1),
isEarlyExit: z2.boolean(),
shouldSkipSameWorkflow: z2.boolean(),
shouldDump: z2.boolean(),
isDryRun: z2.boolean()
}).strict().readonly().refine(
({ waitList, skipList }) => !(waitList.length > 0 && skipList.length > 0),
Expand Down Expand Up @@ -31144,7 +31143,6 @@ function parseInput() {
);
const isEarlyExit = (0, import_core.getBooleanInput)("early-exit", { required: true, trimWhitespace: true });
const shouldSkipSameWorkflow = (0, import_core.getBooleanInput)("skip-same-workflow", { required: true, trimWhitespace: true });
const shouldDump = (0, import_core.getBooleanInput)("dump", { required: true, trimWhitespace: true });
const isDryRun = (0, import_core.getBooleanInput)("dry-run", { required: true, trimWhitespace: true });
const options = Options.parse({
initialDuration: Durationable.parse({ seconds: waitSecondsBeforeFirstPolling }),
Expand All @@ -31155,13 +31153,12 @@ function parseInput() {
skipList: JSON.parse((0, import_core.getInput)("skip-list", { required: true })),
isEarlyExit,
shouldSkipSameWorkflow,
shouldDump,
isDryRun
});
const trigger = { ...repo, ref: commitSha, runId, jobName: job, eventName };
const githubToken = (0, import_core.getInput)("github-token", { required: true, trimWhitespace: false });
(0, import_core.setSecret)(githubToken);
return { trigger, options, githubToken, payload };
return { trigger, options, githubToken };
}

// node_modules/.pnpm/[email protected]/node_modules/universal-user-agent/index.js
Expand Down Expand Up @@ -32555,7 +32552,7 @@ function colorize(severity, message) {
async function run() {
const startedAt = performance.now();
(0, import_core3.startGroup)("Parameters");
const { trigger, options, githubToken, payload } = parseInput();
const { trigger, options, githubToken } = parseInput();
(0, import_core3.info)(JSON.stringify(
// Do NOT include payload
{
Expand All @@ -32573,7 +32570,7 @@ async function run() {
if (options.isDryRun) {
return;
}
const dumper = { trigger, options, payload, results: {} };
const dumper = { trigger, options, results: {} };
for (; ; ) {
attempts += 1;
if (attempts > options.attemptLimits) {
Expand Down Expand Up @@ -32647,9 +32644,7 @@ async function run() {
break;
}
}
if (options.shouldDump) {
(0, import_core3.setOutput)("dump", JSON.stringify(dumper, null, 2));
}
(0, import_core3.setOutput)("dump", JSON.stringify(dumper, null, 2));
}
void run();
/*! Bundled license information:
Expand Down
7 changes: 2 additions & 5 deletions src/input.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { getInput, getBooleanInput, setSecret, error } from '@actions/core';
import { WebhookPayload } from '@actions/github/lib/interfaces.ts';
import { context } from '@actions/github';

import { Durationable, Options, Trigger } from './schema.ts';

export function parseInput(): { trigger: Trigger; options: Options; githubToken: string; payload: WebhookPayload } {
export function parseInput(): { trigger: Trigger; options: Options; githubToken: string } {
const {
repo,
payload,
Expand Down Expand Up @@ -39,7 +38,6 @@ export function parseInput(): { trigger: Trigger; options: Options; githubToken:
);
const isEarlyExit = getBooleanInput('early-exit', { required: true, trimWhitespace: true });
const shouldSkipSameWorkflow = getBooleanInput('skip-same-workflow', { required: true, trimWhitespace: true });
const shouldDump = getBooleanInput('dump', { required: true, trimWhitespace: true });
const isDryRun = getBooleanInput('dry-run', { required: true, trimWhitespace: true });

const options = Options.parse({
Expand All @@ -51,7 +49,6 @@ export function parseInput(): { trigger: Trigger; options: Options; githubToken:
skipList: JSON.parse(getInput('skip-list', { required: true })),
isEarlyExit,
shouldSkipSameWorkflow,
shouldDump,
isDryRun,
});

Expand All @@ -61,5 +58,5 @@ export function parseInput(): { trigger: Trigger; options: Options; githubToken:
const githubToken = getInput('github-token', { required: true, trimWhitespace: false });
setSecret(githubToken);

return { trigger, options, githubToken, payload };
return { trigger, options, githubToken };
}
11 changes: 4 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,25 @@ import { Report, Severity, generateReport, getSummaries, readableDuration } from
import { getInterval, wait } from './wait.ts';
import { Temporal } from 'temporal-polyfill';
import { Check, Options, Trigger } from './schema.ts';
import { WebhookPayload } from '@actions/github/lib/interfaces.ts';

interface Result {
elapsed: Temporal.Duration;
checks: Check[];
report: Report;
}

// `payload` is intentionally omitted for now: https://github.com/kachick/wait-other-jobs/pull/832#discussion_r1625952633
interface Dumper {
trigger: Trigger;
options: Options;
payload: WebhookPayload;
// - Do not include all pollings in one file, it might be large size
results: Record<number, Result>;
}

async function run(): Promise<void> {
const startedAt = performance.now();
startGroup('Parameters');
const { trigger, options, githubToken, payload } = parseInput();
const { trigger, options, githubToken } = parseInput();
info(JSON.stringify(
// Do NOT include payload
{
Expand All @@ -68,7 +67,7 @@ async function run(): Promise<void> {
}

// - Do not include secret even in debug mode
const dumper: Dumper = { trigger, options, payload, results: {} };
const dumper: Dumper = { trigger, options, results: {} };

for (;;) {
attempts += 1;
Expand Down Expand Up @@ -162,9 +161,7 @@ async function run(): Promise<void> {
}
}

if (options.shouldDump) {
setOutput('dump', JSON.stringify(dumper, null, 2));
}
setOutput('dump', JSON.stringify(dumper, null, 2));
}

void run();
1 change: 0 additions & 1 deletion src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ export const Options = z.object({
attemptLimits: z.number().min(1),
isEarlyExit: z.boolean(),
shouldSkipSameWorkflow: z.boolean(),
shouldDump: z.boolean(),
isDryRun: z.boolean(),
}).strict().readonly().refine(
({ waitList, skipList }) => !(waitList.length > 0 && skipList.length > 0),
Expand Down

0 comments on commit 586d9d4

Please sign in to comment.