From 586d9d455faf02a84ab3bb5d92d32a42343dc16f Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 5 Jun 2024 11:58:31 +0900 Subject: [PATCH] Remove payload from dump data --- README.md | 5 +++-- action.yml | 4 ---- dist/index.js | 13 ++++--------- src/input.ts | 7 ++----- src/main.ts | 11 ++++------- src/schema.ts | 1 - 6 files changed, 13 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index fd8e37ab..13896ae8 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/action.yml b/action.yml index 0a856158..3f983bb9 100644 --- a/action.yml +++ b/action.yml @@ -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..outputs.dump for debugging purposes' - required: false - default: 'false' dry-run: description: 'Avoid http requests for tests' required: false diff --git a/dist/index.js b/dist/index.js index 581f4d77..422e9064 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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), @@ -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 }), @@ -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/universal-user-agent@7.0.2/node_modules/universal-user-agent/index.js @@ -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 { @@ -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) { @@ -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: diff --git a/src/input.ts b/src/input.ts index ec29c993..f3816f0c 100644 --- a/src/input.ts +++ b/src/input.ts @@ -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, @@ -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({ @@ -51,7 +49,6 @@ export function parseInput(): { trigger: Trigger; options: Options; githubToken: skipList: JSON.parse(getInput('skip-list', { required: true })), isEarlyExit, shouldSkipSameWorkflow, - shouldDump, isDryRun, }); @@ -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 }; } diff --git a/src/main.ts b/src/main.ts index 2b282536..87b88bcb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -28,7 +28,6 @@ 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; @@ -36,10 +35,10 @@ interface Result { 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; } @@ -47,7 +46,7 @@ interface Dumper { async function run(): Promise { const startedAt = performance.now(); startGroup('Parameters'); - const { trigger, options, githubToken, payload } = parseInput(); + const { trigger, options, githubToken } = parseInput(); info(JSON.stringify( // Do NOT include payload { @@ -68,7 +67,7 @@ async function run(): Promise { } // - Do not include secret even in debug mode - const dumper: Dumper = { trigger, options, payload, results: {} }; + const dumper: Dumper = { trigger, options, results: {} }; for (;;) { attempts += 1; @@ -162,9 +161,7 @@ async function run(): Promise { } } - if (options.shouldDump) { - setOutput('dump', JSON.stringify(dumper, null, 2)); - } + setOutput('dump', JSON.stringify(dumper, null, 2)); } void run(); diff --git a/src/schema.ts b/src/schema.ts index d7f91a6f..8857ad79 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -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),