Commit graph

51 commits

Author SHA1 Message Date
Maximo Guk
4d045615a9
Use random UUID when creating wrangler artifacts output directory 2024-11-05 14:41:27 -06:00
Maximo Guk
122ee5cf5b
Moves wrangler output to tmpdir rather than /opt/ since /opt/ is owned by root.
- Github self hosted runners may not have permissions to write to /opt/

- Also fallsback to trying to extract the deployment-url and deployment-alias-url from stdout when WRANGLER_OUTPUT_DIR is not specified
2024-11-01 13:29:38 -05:00
Maximo Guk
44d79edf44
Reapply "Add parity with pages-action for pages deploy outputs"
This reverts commit 10d5b9c1c1.
2024-10-31 00:47:44 -05:00
Maximo Guk
10d5b9c1c1
Revert "Add parity with pages-action for pages deploy outputs"
This reverts commit 3ec7f8943e.
2024-10-24 08:45:19 -05:00
Courtney Sims
3ec7f8943e Add parity with pages-action for pages deploy outputs 2024-10-23 10:18:55 -05:00
Andrew Patton
47d51f25c1 Match wrangler version even if multiline output cloudflare#277 2024-10-07 20:54:34 +00:00
Somhairle MacLeòid
93fff4f656
Merge pull request #295 from Ankcorn/main 2024-10-04 22:01:44 +01:00
Maximo Guk
7b9aec5185
Merge pull request #291 from Ambroos/add-pages-deployment-alias
Add deployment-alias-url for pages deployments with Wrangler 3.78.0+
2024-10-01 19:11:49 -03:00
Ankcorn
c0e117f512
WO-202: update wrangler version 2024-09-27 11:42:53 +01:00
James Ross
8bc5c5f050
chore: add support for new bun.lock 2024-09-26 01:02:47 +01:00
Ambroos Vaes
a1467a0c8f
Add deployment-alias-url for pages deployments with Wrangler 3.78.0+ 2024-09-19 18:54:02 +02:00
Maximo Guk
66efca2cbb
Invoke wrangler to check if it's installed, but don't auto-install through npx/bunx 2024-06-15 23:22:47 -05:00
Maximo Guk
aa5d18dd1e
Revert "Revert "(feat): Use existing wrangler installation when appropriate (#235)""
This reverts commit 2d275a8f2d.
2024-06-15 22:57:11 -05:00
Maximo Guk
2d275a8f2d
Revert "(feat): Use existing wrangler installation when appropriate (#235)"
This reverts commit 0545ad285a.
2024-05-24 10:04:14 -05:00
Adishwar Rishi
0545ad285a
(feat): Use existing wrangler installation when appropriate (#235)
* (feat): Check for existing wrangler installation

* Add test for pre-installed wrangler

* Add changeset

* Address CR comments - check for an exact wrangler version match

* Tweak the fixture test for the pre-installed-wrangler test

* Simplify if/else logic for checking wrangler versions as per review notes

* fix(test): Fix execution for fake wrangler installation

* fixup! fix(test): Fix execution for fake wrangler installation

* Setup new CI test convention for wrangler-action

* Remove unncessary ts-expect-error comments

---------

Co-authored-by: Peter Bacon Darwin <pbacondarwin@cloudflare.com>
2024-05-15 09:53:41 +01:00
Matthew Rodgers
31a6263ef3 Stop racing secret uploads
For up to date versions of wrangler, secrets are uploaded via the
'secret:bulk' command, which batches updates in a single API call.

For versions of wrangler without that capability, the action falls back
to the single 'secret put' command for each secret. It races all these
with a Promise.all()

Unfortunately, the single secret API cannot handle concurrency - at
best, these calls have to wait on one another, holding requests open
all the while. Often it times out and errors.

This fixes the legacy secret upload errors by making these calls
serially instead of concurrently.
2024-04-26 15:44:18 -07:00
Adishwar Rishi
b92719544e
Remove extra debug description for err.stack 2024-01-05 18:08:54 +11:00
Adishwar Rishi
ebaf896045
Improve debug error message for secret:bulk command failure 2024-01-03 13:19:58 +11:00
Adishwar Rishi
7e684fbad9
Surface inner exception when secret:bulk upload command fails 2024-01-03 13:07:49 +11:00
Grant Birkinbine
f88aee4953
Merge branch 'main' into write-results-to-a-file 2023-12-13 10:04:14 -07:00
Grant Birkinbine
a5f361f3f0
Update src/index.ts
Co-authored-by: Cina Saffary <itscina@gmail.com>
2023-12-13 10:02:54 -07:00
James Ross
9aba9c34da
fix: semver comparison (#216)
* fix: semver comparison

chore: bump dependencies

* chore: add changeset

* fix: update snapshot for error test
2023-12-13 09:53:47 +00:00
Grant Birkinbine
1599928d8e
Update src/index.ts 2023-12-12 22:24:09 -07:00
GrantBirki
ca0bf5eeba
properly check for pages deployments 2023-12-07 23:17:03 -07:00
GrantBirki
97c920b38e
parse and set the deployment-url 2023-12-07 22:48:10 -07:00
GrantBirki
11fa60953d
set another output for stderr as it will almost always contain 'some' data 2023-12-07 22:30:51 -07:00
GrantBirki
74a612d924
swap from file to output variable 2023-12-07 22:26:06 -07:00
GrantBirki
8d6fade5ad
save primary wrangler command output to a file (optionally) 2023-12-01 11:04:51 -07:00
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