Commit graph

23 commits

Author SHA1 Message Date
Cina Saffary
473d9cbd29 Bump DEFAULT_WRANGLER_VERSION to 3.13.2 2023-10-18 17:04:41 -05:00
Cina Saffary
d647227bbc Refactor subprocess execution to use @actions/exec
Instead of using a mix of `child_process.exec`, `child_process.execSync` and a promisified version of `child_process.exec`, we now (mostly) just use `@actions/exec`. That runs `child_process.spawn` under the hood and handles a lot of character escaping for us. We can also now pass Buffers directly into the subprocess as stdin instead of relying on shell piping.

This ends up fixing a few problems we had where secrets and env var values containing shell metacharacters were being misinterpreted.

Unfortunately, `@actions/exec` doesn't support running with a shell. That means we still have to roll our own wrapper around `child_process.exec` to avoid a breaking change to `preCommands` and `postCommands`, since users might be expecting these to run within a shell.

Also worth noting that we're no longer hiding stdout and stderr from the secret uploading step. We were previously doing this out of an abundance of caution, but it made debugging issues very difficult if secret upload failed for some reason. I feel ok doing this since we're no longer echoing & piping the secret values, wrangler doesn't ever output secret values, and as a last line of defense GitHub masks any secret values that accidentally get logged.
2023-10-18 16:42:34 -05:00
Cina Saffary
bd06b290b1 Fix code formatting errors 2023-10-10 18:00:40 -05:00
Jacob Andersen
779191a652
add bun support 2023-10-10 12:36:03 -07:00
Cina Saffary
528687aaf4 Refactor to use npm as a fallback if no packageManager specified...
and no lockfile is present. Fixes #180
2023-10-09 17:20:09 -05:00
Han Yeong-woo
50b529e7b8
Fix pass arg issue 2023-09-19 03:50:54 +09:00
Han Yeong-woo
2375787b23
Move test fixtures to parent directory 2023-09-19 01:30:35 +09:00
Han Yeong-woo
868dbd9a40
Remove unused function 2023-09-19 01:30:34 +09:00
Han Yeong-woo
a009342d77
Add packageManager setting 2023-09-19 01:30:34 +09:00
Han Yeong-woo
f2e4cda4dd
Detect package manager and uses its commands
Fix #156
2023-09-19 01:30:33 +09:00
Han Yeong-woo
f4f2e854d7
Add isValidPackcageManager() util 2023-09-19 01:30:33 +09:00
Han Yeong-woo
cbe5f5b523
Add detect package manager util function 2023-09-19 01:30:33 +09:00
Cina Saffary
2962e94ac8 Move unit-tested modules into utils file
This fixes the issue where running the unit tests invoked the entire action since index.ts calls `main()` at the top-level scope.
2023-08-29 18:16:41 -05:00
Cina Saffary
5517edbb28 Avoid double "Error: Error:" logging 2023-08-29 18:00:03 -05:00
Cina Saffary
f74c325efc Limit error logging on secret upload 2023-08-29 17:57:19 -05:00
Cina Saffary
105f191b19 Update snapshot for checkWorkingDirectory test 2023-08-29 17:43:29 -05:00
Cina Saffary
e5251df521 Refactor error handling to stop execution on errors. Fixes #160. 2023-08-29 16:36:50 -05:00
Jacob M-G Evans
0aa12f0c2b
Merge pull request #154 from cloudflare/jacobmgevans/silence-mode
Quiet feature
2023-08-16 10:54:36 -05:00
Jacob M-G Evans
3f40637a1c
Quiet feature
Some of the stderr, stdout, info & groupings can be a little noisy for some users and use cases.
This feature allows for a option to be passed 'quiet: true' this would significantly reduce the noise.

There will still be output that lets the user know Wrangler Installed and Wrangler Action completed successfully.
Any failure status will still be output to the user as well, to prevent silent failures.

resolves #142
2023-08-16 09:37:29 -05:00
Esteban Borai
4132892387
fix: use wrangler@3.5.1 by default 2023-08-15 17:23:30 -04:00
Jacob M-G Evans
88466ea5ae
Update .changeset/itchy-buses-grow.md
Co-authored-by: Cina Saffary <itscina@gmail.com>
2023-08-10 14:51:00 -05:00
Jacob M-G Evans
74433eb31e
Additional Error Handling
Previously, we prevented any error logs from propagating too far to prevent leaking of any potentially sensitive information. However, this made it difficult for developers to debug their code.

In this release, we have updated our error handling to allow for more error messaging from pre/post and custom commands. We still discourage the use of these commands for secrets or other sensitive information, but we believe this change will make it easier for developers to debug their code.

Relates to #137
2023-08-10 10:11:35 -05:00
Jacob M-G Evans
edb2a58814
feat: rewrite Wrangler Action in TypeScript
* Removes dependencies such as Docker, decreasing spin-up time
* Adds community-requested features, including bulk secrets API utilization from Wrangler
* Fixes CI/CD
* Adds testing
* Improves command implementation
* Begins using Node for the Action engine/runner
* Openly discusses all changes with the community
  GitHub Discussions opened and Issues monitored

BREAKING CHANGES:
* Docker is no longer a dependency
* Wrangler v1 is no longer supported

Additional related Internal tickets:
Major Version Default: https://jira.cfdata.org/browse/DEVX-632
Rewrite Project: DEVX-804,802,800,632
2023-08-07 13:05:09 -05:00