mirror of
https://github.com/actions/create-github-app-token.git
synced 2026-11-16 19:41:09 +00:00
## Summary When `private-key` resolves to an empty value, the action currently lets Octokit fail with `[@octokit/auth-app] privateKey option is required`, which points at an implementation detail instead of the action input. This adds action-level validation so users get the same non-empty input guidance used for missing `client-id` or `app-id`. - Validate `private-key` before creating app auth - Add a regression test and snapshot for the missing private key path - Leave valid private key handling unchanged, including escaped newlines Co-authored-by: Copilot <[email protected]>
19 lines
600 B
JavaScript
19 lines
600 B
JavaScript
import { DEFAULT_ENV } from "./main.js";
|
|
|
|
for (const [key, value] of Object.entries({
|
|
...DEFAULT_ENV,
|
|
"INPUT_PRIVATE-KEY": "",
|
|
})) {
|
|
process.env[key] = value;
|
|
}
|
|
|
|
// Log only the error message, not the full stack trace, because the stack
|
|
// trace contains environment-specific paths and ANSI codes that differ
|
|
// between local and CI environments.
|
|
const _error = console.error;
|
|
console.error = (err) => _error(err?.message ?? err);
|
|
|
|
// Verify `main` exits with an error when `private-key` is not set.
|
|
const { default: promise } = await import("../main.js");
|
|
await promise;
|
|
process.exitCode = 0;
|