-
Notifications
You must be signed in to change notification settings - Fork 167
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
Add tests for installWrangler #322
Conversation
9ddd73a
to
8202ba4
Compare
8202ba4
to
f6b774f
Compare
import { semverCompare } from "./utils"; | ||
import { getDetailedPagesDeployOutput } from "./wranglerArtifactManager"; | ||
|
||
export type WranglerActionConfig = z.infer<typeof wranglerActionConfig>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we're defining a type for config, we should use it when instantiating config
in index.ts
here https://github.com/cloudflare/wrangler-action/pull/322/files#diff-a2a171449d862fe29692ce031981047d7ab755ae7f84c707aef80701b3ea0c80L40
/**
* A configuration object that contains all the inputs & immutable state for the action.
*/
const config: WranglerActionConfig = {
WRANGLER_VERSION: getInput("wranglerVersion") || DEFAULT_WRANGLER_VERSION,
didUserProvideWranglerVersion: Boolean(getInput("wranglerVersion")),
secrets: getMultilineInput("secrets"),
workingDirectory: checkWorkingDirectory(getInput("workingDirectory")),
CLOUDFLARE_API_TOKEN: getInput("apiToken"),
CLOUDFLARE_ACCOUNT_ID: getInput("accountId"),
ENVIRONMENT: getInput("environment"),
VARS: getMultilineInput("vars"),
COMMANDS: getMultilineInput("command"),
QUIET_MODE: getBooleanInput("quiet"),
PACKAGE_MANAGER: getInput("packageManager"),
WRANGLER_OUTPUT_DIR: `${join(tmpdir(), "wranglerArtifacts")}`,
} ;
Or you could put the runtime validation there:
const config = WranglerActionConfig.parse({
WRANGLER_VERSION: getInput("wranglerVersion") || DEFAULT_WRANGLER_VERSION,
didUserProvideWranglerVersion: Boolean(getInput("wranglerVersion")),
secrets: getMultilineInput("secrets"),
workingDirectory: checkWorkingDirectory(getInput("workingDirectory")),
CLOUDFLARE_API_TOKEN: getInput("apiToken"),
CLOUDFLARE_ACCOUNT_ID: getInput("accountId"),
ENVIRONMENT: getInput("environment"),
VARS: getMultilineInput("vars"),
COMMANDS: getMultilineInput("command"),
QUIET_MODE: getBooleanInput("quiet"),
PACKAGE_MANAGER: getInput("packageManager"),
WRANGLER_OUTPUT_DIR: `${join(tmpdir(), "wranglerArtifacts")}`,
} satisfies WranglerActionConfig);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Thanks!
f6b774f
to
81f8814
Compare
.github/workflows/deploy.yml
Outdated
@@ -14,7 +14,7 @@ jobs: | |||
- name: Setup Node.js | |||
uses: actions/setup-node@v3 | |||
with: | |||
node-version: "latest" | |||
node-version: "22.11.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could just pin it to 22?
8127c74
to
2b4b3d2
Compare
2b4b3d2
to
9bf87ca
Compare
Baby step refactor to get more tests into this repo:
Also pins the node version to avoid compatibility issues with the newly released version 23
Tested by running this version on a demo site: