Compare commits

...

323 Commits

Author SHA1 Message Date
Maximo Guk 9fde81df51 test branch 2025-02-09 17:11:11 -06:00
Maximo Guk 4ff07f4310 Use wrangler outputs for version upload and wrangler deploy 2025-02-09 17:10:09 -06:00
Maximo Guk 4fb15f8b7a Bump @changesets/cli to 2.27.12 and vitest to 2.1.9 2025-02-09 16:51:41 -06:00
Maximo Guk e8cd5f0968 Merge pull request #350 from cloudflare/maximo/handle-failures-in-create-github-deployment-and-job-summary
Handle failures in createGitHubDeployment and createGitHubJobSummary
2025-02-09 16:51:09 -06:00
Maximo Guk e209094e62 Handle failures in createGitHubDeployment and createGitHubJobSummary 2025-02-09 16:49:07 -06:00
Maximo Guk 181b9fb5d6 Merge pull request #346 from cloudflare/changeset-release/main
Version Packages
2025-01-17 09:54:16 -06:00
github-actions[bot] aac328d155 Version Packages 2025-01-17 15:47:45 +00:00
Maximo Guk fc89533f1e Merge pull request #345 from cloudflare/fix/pages-gh-deployment
fix: pages github deployment not triggering due to incorrect condition #2
2025-01-17 09:47:27 -06:00
Maximo Guk e819570b2d Remove stages from pages-deploy-detailed artifact and add changeset 2025-01-17 09:31:23 -06:00
Alexandre Pereira 923db6f87f fix: pages github deployment not triggering due to missing pages artifact stages 2025-01-17 11:30:50 +00:00
Courtney Sims d5031c3dbe Merge pull request #340 from armandsalle/patch-1
Update typo in README.md
2024-12-18 16:22:28 -06:00
Armand SALLE 17da943335 Update typo in README.md 2024-12-14 23:12:56 +01:00
Maximo Guk 3aee84cd6d Merge pull request #330 from cloudflare/changeset-release/main
Version Packages
2024-11-26 16:09:40 -04:00
github-actions[bot] 9d9bee8bfd Version Packages 2024-11-26 19:27:54 +00:00
Maximo Guk ee57f258dc Merge pull request #334 from cloudflare/maximo/bump-default-wrangler-version
Bump default wrangler version to 3.90.0
2024-11-26 15:26:40 -04:00
Maximo Guk 9fed19aa4e Bump default wrangler version to 3.90.0 2024-11-26 07:47:24 -06:00
Maximo Guk 3c6e4da7b3 Merge pull request #332 from uFloppyDisk/chore/action-input-fix
chore(action.yml): rename gitHubToken input in action.yml;
2024-11-25 23:09:49 -04:00
Pawel Bartusiak 1c0eef186f chore(action.yml): rename input;
Rename 'githubToken' input to 'gitHubToken' in action.yml to reflect the key used for intake in the script;
2024-11-25 19:00:09 -08:00
Maximo Guk b19342b08c Merge pull request #325 from cloudflare/maximo/add-github-deployments-parity-for-pages-deployments-in-wrangler-action
Add GitHub deployments for parity with pages-action
2024-11-21 14:52:58 -04:00
Jacob Hands d44c80928a Merge pull request #315 from Alexkuva/patch-1
chore: Add environment parameter for worker secret
2024-11-19 14:34:40 -06:00
Maximo Guk cada7a6312 Add tests for github service, and move all github deployments logic to be inside of github.ts 2024-11-19 12:08:36 -06:00
Maximo Guk 1e92eee7d2 Restructure text fixtures directories, add test-utils.ts and add msw dep 2024-11-19 11:38:18 -06:00
Maximo Guk e7e5400334 Remove pages specific outputs from wrangler deploy command 2024-11-19 11:38:18 -06:00
Maximo Guk d58f116d72 Add github deployments to wrangler action for pages parity 2024-11-19 11:38:18 -06:00
Maximo Guk 64b6339110 Update dependencies and add @actions/github 2024-11-19 11:38:17 -06:00
Courtney Sims ac2fd0ec8f Merge pull request #324 from cloudflare/courtney-sims-documentation-update
Update documentation
2024-11-13 16:49:06 -06:00
Courtney Sims 0140ffbc93 Update documentation 2024-11-13 12:06:27 -06:00
Courtney Sims cc4ede3f06 Merge pull request #322 from cloudflare/courtney-sims-testing
Add tests for installWrangler
2024-11-13 09:15:02 -06:00
Courtney Sims 9bf87caf2b Pin node version 2024-11-12 17:25:56 -06:00
Courtney Sims 81f8814855 BANDA-484: Add tests for InstallWrangler 2024-11-12 11:54:43 -06:00
Maximo Guk 6c6d3321ef Merge pull request #320 from cloudflare/changeset-release/main
Version Packages
2024-11-06 11:27:06 -04:00
github-actions[bot] bc61e66e47 Version Packages 2024-11-05 21:26:00 +00:00
Maximo Guk 0e2b86ba21 Merge pull request #319 from cloudflare/maximo/add-changeset-for-wrangler-artifacts-dir
Add missing changeset for using randomUUID for wrangler artifacts dir
2024-11-05 17:25:38 -04:00
Maximo Guk 59c0462940 Add missing changeset for using randomUUID for wrangler artifacts dir 2024-11-05 15:20:12 -06:00
Maximo Guk 4c3f0c27ea Merge pull request #318 from cloudflare/maximo/use-random-uuid-for-wrangler-artifacts-dir
Use random UUID when creating wrangler artifacts output directory
2024-11-05 17:05:58 -04:00
Maximo Guk 4d045615a9 Use random UUID when creating wrangler artifacts output directory 2024-11-05 14:41:27 -06:00
Maximo Guk a7a2388d7b Merge pull request #313 from cloudflare/changeset-release/main
Version Packages
2024-11-04 11:31:39 -04:00
Alex 95555f6ed0 add environment parameter for worker secret
Add environment parameter for worker secret in readme.md

linked issue example: https://github.com/cloudflare/wrangler-action/issues/251
2024-11-02 17:02:18 +01:00
github-actions[bot] 2171bbdd69 Version Packages 2024-11-01 18:40:47 +00:00
Maximo Guk 4f4ff59d17 Merge pull request #312 from cloudflare/maximo/unrevert-add-parity-with-wrangler-action
Unrevert add parity with wrangler action
2024-11-01 15:40:25 -03: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 b2be7abbfc Merge pull request #310 from cloudflare/changeset-release/main
Version Packages
2024-10-24 11:56:05 -03:00
github-actions[bot] b7158dc9a4 Version Packages 2024-10-24 14:49:52 +00:00
Maximo Guk 43767e73de Merge pull request #309 from cloudflare/maximo/revert-add-parity-with-pages-action
Revert add parity with pages action
2024-10-24 11:48:43 -03: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 c01035706f Merge pull request #305 from cloudflare/changeset-release/main
Version Packages
2024-10-23 15:53:47 -05:00
github-actions[bot] fa96c39bd4 Version Packages 2024-10-23 19:55:00 +00:00
Courtney Sims 78dad1df07 Merge pull request #303 from cloudflare/courtney-sims-enable-outputs
Add parity with pages-action for Pages deploy outputs
2024-10-23 14:54:26 -05:00
Courtney Sims 3ec7f8943e Add parity with pages-action for pages deploy outputs 2024-10-23 10:18:55 -05:00
Maximo Guk cd8a317efb Merge pull request #299 from cloudflare/changeset-release/main
Version Packages
2024-10-08 13:03:50 -03:00
github-actions[bot] 6aa2e8946a Version Packages 2024-10-07 21:39:16 +00:00
Maximo Guk de0526e09b Merge pull request #278 from acusti/patch-1
When checking for existing wrangler install, match wrangler version even if multiline output
2024-10-07 18:38:52 -03:00
Maximo Guk 84316ca95c Merge pull request #298 from cloudflare/maximo/add-changeset-for-update-wrangler-version
Add changeset for update wrangler version from 3.13.2 to 3.78.10
2024-10-07 18:37:59 -03:00
Maximo Guk 134b5c2a32 Add changeset for update wrangler version from 3.13.2 to 3.78.10 2024-10-07 16:30:14 -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 66334dff0a Merge pull request #297 from cloudflare/changeset-release/main
Version Packages
2024-10-02 11:46:26 -03:00
github-actions[bot] 9966912c1b Version Packages 2024-10-01 22:12:10 +00: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
Maximo Guk bcff5386ec Merge pull request #294 from Cherry/chore/bun-lockfile-new
chore: add support for new bun.lock
2024-09-26 12:38:45 -03:00
Maximo Guk c15498da36 Merge pull request #293 from cloudflare/hrushikeshdeshpande-updating-semgrep-docker-image
Updating semgrep docker image for the exising semgrep workflow.
2024-09-26 12:32:17 -03:00
James Ross 8bc5c5f050 chore: add support for new bun.lock 2024-09-26 01:02:47 +01:00
Hrushikesh Deshpande ac21b71592 Updating semgrep docker image for the exising semgrep workflow. 2024-09-25 18:32:41 -04:00
Maximo Guk f111269956 Merge pull request #292 from cloudflare/hrushikeshdeshpande-updating-semgrep-yml
Update semgrep.yml
2024-09-21 12:54:17 -05:00
hrushikeshdeshpande 570d521df6 Update semgrep.yml
Updating Semgrep.yml file - Semgrep is a tool that will be used to scan Cloudflare's public repos for Supply chain, code and secrets. This work is part of Application & Product Security team's initiative to onboard Semgrep onto all of Cloudflare's public repos.

In case of any questions, please reach out to "Hrushikesh Deshpande" on cf internal chat.
2024-09-21 12:06:53 -04:00
Hrushikesh Deshpande 174337b3b4 Adding semgrep yaml file 2024-09-19 21:54:02 -04: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 3ea6e3f132 Merge pull request #272 from cloudflare/changeset-release/main
Version Packages
2024-07-02 08:31:12 -05:00
github-actions[bot] ea11499226 Version Packages 2024-06-20 21:23:25 +00:00
Maximo Guk 8f2f89521c Merge pull request #271 from cloudflare/maximo/fixup-235
Unreverts #235 and don't automatically install wrangler when checking if it present
2024-06-20 16:23:02 -05: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 b84268f0e0 Merge pull request #268 from cloudflare/changeset-release/main
Version Packages
2024-05-24 10:18:03 -05:00
github-actions[bot] d1b97ebf4d Version Packages 2024-05-24 15:16:10 +00:00
Jacob Hands baf8bc61f1 Merge pull request #265 from Maximo-Guk/maximo/revert-235
Revert "(feat): Use existing wrangler installation when appropriate #235"
2024-05-24 10:15:49 -05:00
Jacob Hands 8edd152f63 Update CODEOWNERS (#266) 2024-05-24 16:13:49 +01: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
github-actions[bot] 8ef515f899 Version Packages (#262)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-23 15:58:20 +01:00
dependabot[bot] 9b27cf271c Bump undici from 5.28.3 to 5.28.4 (#249)
Bumps [undici](https://github.com/nodejs/undici) from 5.28.3 to 5.28.4.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.3...v5.28.4)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-15 14:01:17 +01:00
dependabot[bot] 405a82610b Bump vite from 5.0.12 to 5.2.8 (#248)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.0.12 to 5.2.8.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.2.8/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-15 13:13:16 +01: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
Somhairle MacLeòid ea5754c9ad Merge pull request #257 from cloudflare/changeset-release/main
Version Packages
2024-05-01 10:03:22 +01:00
github-actions[bot] 983b6349c2 Version Packages 2024-04-30 12:52:35 +00:00
Rahul Sethi b05934f581 Merge pull request #255 from matthewdavidrodgers/legacy-concurrent-secret-uploads
Stop racing secret uploads
2024-04-30 13:52:11 +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
Ema Suriano 88906781f0 docs: Update README.md (#252) 2024-04-11 08:50:40 +01:00
Somhairle MacLeòid ebef541795 Delete .github/workflows/pullrequests.yml (#243)
* Delete .github/workflows/pullrequests.yml

* fixup! Delete .github/workflows/pullrequests.yml

---------

Co-authored-by: Peter Bacon Darwin <pbacondarwin@cloudflare.com>
2024-04-08 10:37:04 +01:00
Rahul Sethi 9d4ca0f255 Merge pull request #247 from cloudflare/versions-upload
Add `versions upload` instructions to README
2024-04-04 13:42:17 +01:00
Rahul Sethi 1be73b90f6 update copy 2024-04-03 18:31:44 +01:00
Rahul Sethi 180648017b add minimum wrangler version info 2024-04-03 18:27:15 +01:00
Rahul Sethi 9003b06015 add versions upload instructions to README 2024-04-03 18:17:45 +01:00
Igor Minar fd98a7c990 Merge pull request #245 from Cherry/fix/packageManager
docs: remove warning about packageManager and pnpm default
2024-03-26 15:22:04 -07:00
Igor Minar 4bf3047bb8 Update README.md 2024-03-26 11:07:50 -07:00
Igor Minar f2c22accd3 Update README.md
remote ws
2024-03-26 11:03:23 -07:00
James Ross 0c36639f72 docs: add brief docs about packageManager 2024-03-26 00:31:15 +00:00
James Ross d5a1abb013 docs: remove warning about packageManager and pnpm default 2024-03-25 22:04:20 +00:00
Jiri Spac c214b69bae docs: add warning about packageManager config (#242) 2024-03-11 09:16:06 +00:00
dependabot[bot] bac2829d42 Bump undici from 5.28.2 to 5.28.3 (#237)
Bumps [undici](https://github.com/nodejs/undici) from 5.28.2 to 5.28.3.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.2...v5.28.3)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-19 08:49:35 +00:00
Raphael Boidol 78c994fb95 Update README.md to remove deprecation warnings (#236)
`actions/checkout@v3` runs on node16 which is sunset by GitHub Action runners.
2024-02-16 13:12:01 +00:00
dependabot[bot] e3434a7e98 Bump vite from 5.0.7 to 5.0.12 (#230)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.0.7 to 5.0.12.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.0.12/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.0.12/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-01 15:23:55 +00:00
lrapoport-cf 08514fdece Merge pull request #228 from cloudflare/changeset-release/main
Version Packages
2024-01-09 12:32:52 -05:00
github-actions[bot] 7451182d38 Version Packages 2024-01-05 18:08:21 +00:00
Cina Saffary 522c117b7d Merge pull request #227 from AdiRishi/arishi-secrets-error
(enhancement): Surface inner exception when secret:bulk upload command fails
2024-01-05 12:07:56 -06:00
Adishwar Rishi b92719544e Remove extra debug description for err.stack 2024-01-05 18:08:54 +11:00
Adishwar Rishi bbedd8e54f Add changeset 2024-01-05 18:06:15 +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
Cina Saffary 2521ec00cc Merge pull request #220 from davwheat/patch-1
docs: update link to api token generation instructions
2023-12-19 20:10:21 -06:00
David Wheatley ba0f485178 docs: update link to api token generation instructions 2023-12-20 02:07:57 +00:00
Cina Saffary 2de0b3dfd8 Merge pull request #218 from cloudflare/changeset-release/main
Version Packages
2023-12-19 11:52:32 -06:00
github-actions[bot] f2d9b652c4 Version Packages 2023-12-13 17:17:49 +00:00
Cina Saffary 0e62acaf21 Merge pull request #213 from GrantBirki/write-results-to-a-file
Save Wrangler Command Output to a Variable
2023-12-13 11:17:24 -06:00
Cina Saffary bd3857047e Apply suggestions from code review 2023-12-13 11:15:50 -06:00
GrantBirki d13856dfc9 add changeset 2023-12-13 10:10:20 -07: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 9dd38ad790 Update package.json 2023-12-12 22:34:31 -07:00
Grant Birkinbine 1599928d8e Update src/index.ts 2023-12-12 22:24:09 -07:00
Grant Birkinbine 0fff39f4b7 Update action.yml
Co-authored-by: Cina Saffary <itscina@gmail.com>
2023-12-12 22:19:53 -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 5ee7b681bc update readme 2023-12-07 22:27:25 -07:00
GrantBirki 74a612d924 swap from file to output variable 2023-12-07 22:26:06 -07:00
GrantBirki 0558fc8c04 swap to commandOutput 2023-12-07 22:13:33 -07:00
GrantBirki 976ec4d78c bump minor version 2023-12-01 11:12:34 -07:00
GrantBirki a8845f6d95 update docs 2023-12-01 11:10:27 -07:00
GrantBirki 8d6fade5ad save primary wrangler command output to a file (optionally) 2023-12-01 11:04:51 -07:00
Cina Saffary 65996a5230 Merge pull request #205 from cloudflare/cina/184-skip-release-if-tags-exist
Don't attempt to publish when there's no pending release
2023-10-31 10:54:14 -05:00
Cina Saffary 2b7ed1316d Don't trigger release process when there's no release
Currently our release process is kicked off whenever a PR is merged and there are no changesets within the `.changeset` directory. Typically this happens when we intend to publish a release, just after we merge a "Version Packages" PR which removes the changesets and adds the entries to our changelog.

However, this also means that merging any PR without user-facing changes during the period after we've made a release will trigger another release (which luckily fails because the created tag already exists on the remote. See #184).

This change avoids that scenario by fetching tags when checking out the repo. Now when `npx changeset tag` runs, it will see that the tag already exists and skip creating it (`🦋  Skipping tag (already exists):  v3.3.2`). The `git push --tags` step will no longer throw an error ("Everything up-to-date"). And lastly, the publish step won't get triggered because the output from `npx changeset tag` doesn't contain the string `"New tag:"`. The action should just finish successfully with nothing to left do.

Fixes #184
2023-10-31 10:21:29 -05:00
Cina Saffary 9554b3575b Merge pull request #204 from jgentes/patch-1
Swap CF_API_TOKEN with CLOUDFLARE_API_TOKEN
2023-10-30 15:21:15 -05:00
James Gentes 57159ca2ed updated CF_ACCOUNT_ID 2023-10-30 13:17:34 -07:00
James Gentes 7dd5c3621b Swap CF_API_TOKEN with CLOUDFLARE_API_TOKEN
If the token isn't specified, wrangler throws this error, indicating the CLOUDFLARE_API_TOKEN should be set, so it's worth being consistent so folks can copy/paste the examples and have it work out of the box:
```
In a non-interactive environment, it's necessary to set a CLOUDFLARE_API_TOKEN environment variable for wrangler to work.
```
2023-10-29 17:34:03 -07:00
Cina Saffary 581e17bc51 Merge pull request #201 from cloudflare/changeset-release/main
Version Packages
2023-10-24 13:45:26 -05:00
github-actions[bot] 21a8414ba3 Version Packages 2023-10-19 17:39:52 +00:00
Cina Saffary 819ea006e6 Merge pull request #171 from cloudflare/cina/refactor-subprocess-exec
Refactor subprocess execution to use `@actions/exec`
2023-10-19 12:39:18 -05:00
Cina Saffary 473d9cbd29 Bump DEFAULT_WRANGLER_VERSION to 3.13.2 2023-10-18 17:04:41 -05:00
Cina Saffary 76d614f400 Add changeset 2023-10-18 16:42:34 -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
Somhairle MacLeòid 533097350a Merge pull request #196 from cloudflare/penalosa-patch-1 2023-10-12 00:55:30 +01:00
Cina Saffary bc7253f187 Merge pull request #195 from cloudflare/changeset-release/main
Version Packages
2023-10-11 11:33:03 -05:00
github-actions[bot] b2e459a047 Version Packages 2023-10-11 16:31:53 +00:00
Cina Saffary 96c3774b77 Merge pull request #197 from cloudflare/cina/add-missing-licenses-to-test-packages
Add missing licenses to dummy test packages
2023-10-11 11:31:22 -05:00
Cina Saffary b00f94ea6f Merge pull request #183 from cloudflare/dependabot/npm_and_yarn/postcss-8.4.31
Bump postcss from 8.4.27 to 8.4.31
2023-10-11 11:08:41 -05:00
dependabot[bot] c649733249 Bump postcss from 8.4.27 to 8.4.31
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.27 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.4.27...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-11 16:04:26 +00:00
Cina Saffary d43f9c81c7 Set dummy test packages as private 2023-10-11 10:59:27 -05:00
Cina Saffary 219a0887d7 Add missing licenses to dummy test packages
This is mostly to prevent yarn from throwing a warning during our test runs
2023-10-11 10:56:07 -05:00
Somhairle MacLeòid 25b114f472 Update pullrequests.yml 2023-10-11 15:24:12 +01:00
Cina Saffary f40a9f5f82 Merge pull request #193 from cloudflare/cina/fix-packagemanager-default
Don't set `packageManager` default via action.yml
2023-10-11 03:54:35 -05:00
Cina Saffary bd06b290b1 Fix code formatting errors 2023-10-10 18:00:40 -05:00
Cina Saffary a4509d507c Don't set packageManager default via action.yml
We need to distinguish between when the value is and isn't set in order to perform inference based on lockfile and only fallback to the default of npm if inference fails.
2023-10-10 18:00:32 -05:00
Cina Saffary 0e6f0d3080 Merge pull request #192 from cloudflare/changeset-release/main
Version Packages
2023-10-10 15:23:32 -05:00
github-actions[bot] 326ba30882 Version Packages 2023-10-10 20:20:04 +00:00
Cina Saffary 032a7248fa Merge pull request #188 from simpleauthority/feat/add-bun-support
Add bun support
2023-10-10 15:19:09 -05:00
Jacob Andersen 080373bdb6 Add bun as a package manager option in action.yml 2023-10-10 13:17:05 -07:00
Cina Saffary 231d787db1 Update test/bun/package.json 2023-10-10 15:05:59 -05:00
Jacob Andersen d9a0a00f8b Add changeset 2023-10-10 12:41:00 -07:00
Jacob Andersen 779191a652 add bun support 2023-10-10 12:36:03 -07:00
Cina Saffary 556068fb59 Merge pull request #191 from cloudflare/changeset-release/main
Version Packages
2023-10-10 09:25:51 -05:00
github-actions[bot] caa59485d0 Version Packages 2023-10-10 14:16:00 +00:00
Cina Saffary c2494c1ca6 Merge pull request #190 from cloudflare/cina/180-fix-undefined-package-manager
Use npm as fallback if no `packageManager` specified
2023-10-10 09:14:13 -05: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
lrapoport-cf bd50d10af9 Merge pull request #185 from cloudflare/lrapoport/fix-issue-workflow
Fix issue workflow
2023-10-05 15:34:02 -04:00
lrapoport-cf 2513ffc6cc Fix workflow syntax for multiple conditions 2023-10-05 15:29:35 -04:00
lrapoport-cf 9df50d42e4 Merge pull request #182 from cloudflare/lrapoport/update-issues-workflow
Update issues workflow
2023-10-05 15:06:06 -04:00
lrapoport-cf 4611c14c05 Fix format 2023-10-05 15:01:41 -04:00
lrapoport-cf ac3f259fcf Add PR workflow 2023-10-02 11:29:17 -04:00
lrapoport-cf b2645622e9 Rename issue workflow and job 2023-10-02 11:29:03 -04:00
lrapoport-cf f4e6269765 Add transferred issues to workers-sdk GH project 2023-10-02 11:26:14 -04:00
Cina Saffary 72931e59b2 Merge pull request #174 from cloudflare/changeset-release/main
Version Packages
2023-10-02 10:23:58 -05:00
github-actions[bot] e0254d06bc Version Packages 2023-09-18 19:12:19 +00:00
Jacob M-G Evans 13d70757d2 Merge pull request #166 from nix6839/many-package-manager
Support many package managers
2023-09-18 14:11:51 -05:00
Han Yeong-woo aec73ae744 Add wangler files in fixtures 2023-09-19 03:52:00 +09:00
Han Yeong-woo f0cc3efccf Install yarn and pnpm on test 2023-09-19 03:51:27 +09:00
Han Yeong-woo 50b529e7b8 Fix pass arg issue 2023-09-19 03:50:54 +09:00
Han Yeong-woo 6771675815 Run format 2023-09-19 01:37:01 +09:00
Jacob M-G Evans 4ae0557f8d Update two-rocks-hope.md 2023-09-18 11:33:50 -05:00
Han Yeong-woo 7d7b98826e Add changeset 2023-09-19 01:30:36 +09:00
Han Yeong-woo d1073d57ba Run format 2023-09-19 01:30:35 +09:00
Han Yeong-woo c3b99e2c18 Ignore to pnpm-lock.yaml in formatting 2023-09-19 01:30:35 +09:00
Han Yeong-woo 2375787b23 Move test fixtures to parent directory 2023-09-19 01:30:35 +09:00
Han Yeong-woo 11f981cea4 Add tests for package managers support 2023-09-19 01:30:34 +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
Jacob M-G Evans fcf2d83f3d Merge pull request #172 from cloudflare/demosjarco/main
Node 20 update
2023-09-18 11:29:49 -05:00
DemosJarco f5d1ca36ae Added comment with link 2023-09-04 11:54:36 -07:00
DemosJarco 4d6d6abfb4 Update action.yml 2023-09-04 11:50:59 -07:00
Cina Saffary 416205365a Merge pull request #165 from cloudflare/cina/fix-release-workflow-pt2
Build action before pushing dist-tags
2023-08-31 10:55:48 -05:00
Cina Saffary 7292a4ae99 Build action before pushing dist-tags 2023-08-31 10:26:14 -05:00
Cina Saffary 4528b66125 Merge pull request #164 from cloudflare/cina/fix-release-workflow
add `tag_name` input to Tag & Release Action step of release workflow
2023-08-31 09:51:29 -05:00
Cina Saffary ee3e2a9b37 add tag_name input to Tag & Release Action 2023-08-30 17:27:17 -05:00
Cina Saffary 361844799a Merge pull request #163 from cloudflare/changeset-release/main
Version Packages
2023-08-30 09:39:11 -05:00
github-actions[bot] 26103fa86c Version Packages 2023-08-30 14:04:59 +00:00
Cina Saffary 47d4afdbd8 Merge pull request #161 from cloudflare/cina/throw-on-failures
Refactor error handling to stop execution on errors
2023-08-30 09:04:22 -05:00
Cina Saffary d7637bf514 workaround to fix failing workflow. Refs #162
The action fails to upload secrets during one of the testing steps since the Worker doesn't exist yet.
2023-08-29 19:39:50 -05:00
Cina Saffary 71199d2757 prettier scripts incorrectly set --ignore-path
--ignore-path is meant to be the path of an ignore-file, not the actual directories to ignore.
2023-08-29 18:27:03 -05: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 b076e889fb Merge pull request #159 from cloudflare/jacobmgevans/gh-workflow
Automation release
2023-08-24 15:45:07 -05:00
Jacob M-G Evans 30e126d1a4 consolidated workflows and triggers Action release based on changeset event output 'publish' being true 2023-08-24 15:35:32 -05:00
Jacob M-G Evans fcf648c789 Merge pull request #158 from cloudflare/changeset-release/main
Version Packages
2023-08-17 11:06:50 -05:00
github-actions[bot] fcbabec21e Version Packages 2023-08-16 15:55:01 +00: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 ad7441b6ad Merge pull request #157 from EstebanBorai/main
fix: use `wrangler@3.5.1` by default
2023-08-16 10:51:54 -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
lrapoport-cf 62ce9d23a3 Merge pull request #155 from ethanppl/fix-readme
Fix examples in README.md
2023-08-14 13:23:31 -04:00
Ethan f089b0a195 Update README.md
Co-authored-by: lrapoport-cf <107272160+lrapoport-cf@users.noreply.github.com>
2023-08-14 22:06:06 +08:00
Ethan Pang 4318a2fb97 Fix examples in README.md 2023-08-14 18:19:03 +08:00
lrapoport-cf c8bbc2b667 Merge pull request #153 from cloudflare/lrapoport/update-codeowners
Add wrangler-admin as codeowner
2023-08-11 14:32:08 -04:00
lrapoport-cf 3c262de2e3 Add wrangler-admin as codeowner 2023-08-11 14:29:40 -04:00
Jacob M-G Evans 36ba30dcc9 Merge pull request #152 from cloudflare/JacobMGEvans-patch-1
Update README.md
2023-08-11 11:40:47 -05:00
Jacob M-G Evans a9ac89cd00 Update README.md 2023-08-11 11:37:23 -05:00
Jacob M-G Evans 93b26a6664 Merge pull request #151 from cloudflare/jacobmgevans/release-trigger
Changing publish trigger for build & tagging to released or edit
2023-08-10 17:10:35 -05:00
Jacob M-G Evans 9641d961b5 Changing publish trigger for build & tagging to released or edit 2023-08-10 17:09:55 -05:00
Jacob M-G Evans 5b3d60c156 Testing Changeset behavior 2023-08-10 16:51:52 -05:00
Jacob M-G Evans 3252711404 hotfix 2023-08-10 16:46:29 -05:00
Jacob M-G Evans 2faabf36a2 Merge pull request #150 from cloudflare/jacobmgevans/changesets-tag-cli
Changesets needs a tag created for release
2023-08-10 16:45:05 -05:00
Jacob M-G Evans b734d85d74 Changesets needs a tag created for release 2023-08-10 16:40:12 -05:00
Jacob M-G Evans 8ca2ff1612 Merge pull request #148 from cloudflare/changeset-release/main
Version Packages
2023-08-10 16:19:21 -05:00
Jacob M-G Evans 7d08a8657e Merge pull request #149 from cloudflare/jacobmgevans/changesets-needs-publish
Spoofing publish for Changeset Action
2023-08-10 16:18:55 -05:00
Jacob M-G Evans e193627f19 Spoofing publish for Changeset Action 2023-08-10 16:17:56 -05:00
github-actions[bot] 55b80c5f62 Version Packages 2023-08-10 21:11:56 +00:00
Jacob M-G Evans f61dc4d5a9 Merge pull request #147 from cloudflare/revert-146-changeset-release/main
Revert "Version Packages"
2023-08-10 16:11:27 -05:00
Jacob M-G Evans 58f274b9f7 Revert "Version Packages" 2023-08-10 16:11:02 -05:00
Jacob M-G Evans ef7686b259 Merge pull request #146 from cloudflare/changeset-release/main
Version Packages
2023-08-10 16:06:17 -05:00
github-actions[bot] d63b9dc486 Version Packages 2023-08-10 21:06:00 +00:00
Jacob M-G Evans 88ccce72e0 Merge pull request #145 from cloudflare/revert-140-changeset-release/main
Revert "Version Packages"
2023-08-10 16:05:37 -05:00
Jacob M-G Evans 554eea134a Revert "Version Packages" 2023-08-10 16:05:14 -05:00
Jacob M-G Evans a584cc5606 Merge pull request #140 from cloudflare/changeset-release/main
Version Packages
2023-08-10 16:00:53 -05:00
github-actions[bot] 0f5076c3e7 Version Packages 2023-08-10 20:55:38 +00:00
Jacob M-G Evans c7d1bd35bf Merge pull request #143 from cloudflare/jacobmgevans/version-syntax-support
Update documentation to include new versioning syntax support
2023-08-10 15:55:12 -05:00
Jacob M-G Evans 3c728e1d5d Update README.md
Co-authored-by: lrapoport-cf <107272160+lrapoport-cf@users.noreply.github.com>
2023-08-10 15:45:08 -05:00
Jacob M-G Evans a333df3c9e Update documentation to include new versioning syntax support 2023-08-10 15:30:29 -05:00
Jacob M-G Evans bb0133dcfc Merge pull request #141 from cloudflare/jacobmgevans/add-more-error-handling
Additional Error Handling
2023-08-10 14:54:16 -05: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 559dd40fe6 Merge pull request #139 from cloudflare/jacobmgevans/gh-permissions
Another GH permission for GH Token for Changesets
2023-08-09 16:45:52 -05:00
Jacob M-G Evans 9930080b73 Another GH permission for GH Token for Changesets 2023-08-09 16:39:06 -05:00
Jacob M-G Evans 43bbbb16ab Merge pull request #138 from cloudflare/jacobmgevans/changeset-gh-dep
Add missing GH github dep
2023-08-09 15:42:57 -05:00
Jacob M-G Evans 598c6b4043 Add missing GH github dep 2023-08-09 15:38:59 -05:00
Jacob M-G Evans 0c094f5307 Merge pull request #132 from cloudflare/jacobmgevans/changesets
Add Changesets
2023-08-09 15:28:38 -05:00
Jacob M-G Evans 6ea2e616f2 Update .github/workflows/changesets.yml
Co-authored-by: Cina Saffary <itscina@gmail.com>
2023-08-09 15:17:25 -05:00
Jacob M-G Evans 1b4a61cee9 Remove unnecessary context from fetch depth and node_env 2023-08-09 14:50:06 -05:00
Jacob M-G Evans 8e3876a0c9 Update .github/workflows/changesets.yml
Co-authored-by: Cina Saffary <itscina@gmail.com>
2023-08-09 14:43:50 -05:00
Jacob M-G Evans 8fab856f8d Update .github/workflows/changesets.yml
Co-authored-by: Cina Saffary <itscina@gmail.com>
2023-08-09 14:43:40 -05:00
Jacob M-G Evans ce1ea4e7c3 Merge pull request #136 from cloudflare/jacobmgevans/esm-support
Updating build script to convert to .mjs for ESM support
2023-08-09 11:28:16 -05:00
Jacob M-G Evans e420d29d0a Updating build script to convert to .mjs for ESM support 2023-08-09 11:19:52 -05:00
Jacob M-G Evans 311d514d9d Add Changesets 2023-08-08 17:14:09 -05:00
Jacob M-G Evans d05a65f82b Merge pull request #129 from cloudflare/jacobmgevans/README-action-update
Update README with newer version of checkout action
2023-08-08 15:13:50 -05:00
Jacob M-G Evans c9da75b82e Update README with newer version of checkout action 2023-08-08 15:13:05 -05:00
Jacob M-G Evans 29cef5effc Merge pull request #131 from cloudflare/jacobmgevans/action-permissions
Add permissions to Action
2023-08-08 14:51:16 -05:00
Jacob M-G Evans ee60b7bd5e Add permissions to Action 2023-08-08 14:50:15 -05:00
Jacob M-G Evans 0ab3500d54 Merge pull request #128 from cloudflare/jacobmgevans/automate-action-publish
Automate Action Release
2023-08-08 14:14:19 -05:00
Jacob M-G Evans dfa59a861f start script not needed, using Act locally 2023-08-08 13:28:05 -05:00
Jacob M-G Evans 342e6243b7 remove dist & node_modules from repo 2023-08-08 13:21:44 -05:00
Jacob M-G Evans d6590f86f4 Automate Action Release
Utilizing build & tag action to automate the deps and build steps for releasing the Action. Additionally using NCC for the build process to easy compile the deps into a small executable with the JS file.
2023-08-08 13:03:11 -05:00
Jacob M-G Evans 97e54f3396 Merge pull request #127 from cloudflare/lrapoport/add-issues-to-gh-project
Automatically add issues to workers-sdk GH project
2023-08-08 08:35:11 -05:00
lrapoport-cf f85e1acfa7 Add workflow to add issues to GH project 2023-08-07 22:10:59 -04:00
lrapoport-cf e18e1dfc82 Merge pull request #124 from cloudflare/lrapoport/publish-to-deploy
Update publish to deploy
2023-08-07 16:31:50 -04:00
Jacob M-G Evans 20ea506049 Temp fix for deps issue 2023-08-07 15:11:15 -05:00
lrapoport-cf 45c57ae013 Update publish to deploy 2023-08-07 15:57:12 -04:00
Jacob M-G Evans a5fd4fdd34 Merge pull request #121 from cloudflare/jacobmgevans/codeowners
Owners: Wrangler Team
2023-08-07 14:42:13 -05:00
Jacob M-G Evans 002bb083fa Update README.md
Co-authored-by: lrapoport-cf <107272160+lrapoport-cf@users.noreply.github.com>
2023-08-07 14:42:06 -05:00
Jacob M-G Evans 42c609b2d6 included README update 2023-08-07 14:29:10 -05:00
Jacob M-G Evans c8f756bccf Fix Prettier check with /dist 2023-08-07 14:23:56 -05:00
Jacob M-G Evans 81fb6a9681 Owners: Wrangler Team 2023-08-07 14:11:03 -05:00
Jacob M-G Evans 6231e31709 hotfix missing dist 2023-08-07 14:06:55 -05:00
Jacob M-G Evans 0c419bee6c Merge pull request #119 from cloudflare/jacobmgevans/remove-v1-examples
Update README to remove v1 suggestions/examples
2023-08-07 13:30:09 -05:00
Jacob M-G Evans 74a9b9885f Update README to remove v1 suggestions/examples 2023-08-07 13:18:56 -05:00
Jacob M-G Evans 3dd57ff2bb Merge pull request #112 from cloudflare/jacobmgevans/typescript-overhaul
v4 w/ TypeScript Overhaul
2023-08-07 13:08:09 -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
Sunil Pai 4c10c1822a Merge pull request #72 from WalshyDev/walshy/pages-996-support-wrangler2
Support wrangler2 - v2
2022-05-09 12:02:45 +01:00
Daniel Walsh 3d1979ca8e Support wrangler2 - v2.0.0 2022-05-09 11:49:03 +01:00
Adam Janiš 6f62debcf8 Merge pull request #56 from ItalyPaleAle/patch-1
Update Node.js to 16
2022-03-15 12:30:29 +01:00
Kristian Freeman 006366c1ae Merge pull request #46 from whoabuddy/patch-1
Update README.md release version
2021-07-19 10:19:25 -05:00
Alessandro (Ale) Segala 95ac136231 Update Node.js to 16 2021-05-12 22:21:56 -07:00
Jason Schrader a33b48c9fe Update README.md release version
This change updates the release version for cloudflare/wrangler-action in all examples from `1.2.0` to `1.3.0`.

It also corrects a typo on the last example changing `TOML` to `YAML` based on the code below it.
2020-11-13 07:56:23 -07:00
Kristian Freeman 60c377d0bf Merge pull request #42 from Indigenuity/master
Suggest workflow_dispatch for manual deploys
2020-09-16 12:46:23 -05:00
Kristian Freeman 39c3d279a1 Merge pull request #43 from chromy/patch-1
Update Readme to reference v1.3.0
2020-09-16 12:45:29 -05:00
Hector Dearman 8df5ab90b3 Update Readme to reference v1.3.0
The readme mentions v1.2.0 but some of the commands (for example publish)
are only present in v1.3.0. Update readme to use v1.3.0 instead.
2020-09-11 22:05:51 +01:00
JD Kemsley f4e53e2753 Suggest workflow_dispatch for manual deploys 2020-09-11 12:53:43 -05:00
Kristian Freeman 3424d15af2 Merge pull request #35 from bradyjoslin/pre-post-commands
Add support for running pre and post commands
2020-08-21 11:31:16 -05:00
Brady Joslin 212d5a5125 eval the input command 2020-08-13 00:12:47 -05:00
Joslin, Brady W (Brady) bc7b76075d update explanation of publish option 2020-08-11 22:53:34 -05:00
Joslin, Brady W (Brady) 176cda2c0e add ability to skip publish 2020-08-11 22:46:42 -05:00
Joslin, Brady W (Brady) 93b9408aec pre-post-commands 2020-08-07 16:36:37 -05:00
Avery Harnish 6531840e6e Merge pull request #32 from jbampton/fix-word-case
Fix word case
2020-07-02 10:07:55 -05:00
John Bampton f871e6782e Fix word case 2020-07-02 17:17:05 +10:00
Kristian Freeman aab79315b4 Merge pull request #30 from bradyjoslin/patch-1
update secrets example in readme
2020-06-29 09:29:28 -05:00
Brady Joslin c511ea2eb5 Update README.md 2020-06-27 10:38:37 -05:00
Kristian Freeman 21f14faa06 Bump version in README 2020-06-22 10:32:48 -05:00
Kristian Freeman e5fc9a726a Merge pull request #28 from bradyjoslin/master
add secrets publishing
2020-06-22 10:27:18 -05:00
Brady Joslin 4259a86a6b Update deploy.yml 2020-06-22 10:02:00 -05:00
Joslin, Brady W (Brady) aabd478947 update test worker for testing secrets 2020-06-22 09:35:46 -05:00
Joslin, Brady W (Brady) 3123fc538b add secrets publishing 2020-06-15 23:09:55 -05:00
Jason Gill 1202bb2fe9 Remove nvm to speed build time
The Dockerfile already pulls the node:12 image, so there's no need for NVM to be downloaded and installed as well. Removing this speeds up the image build time (making Github Actions go faster)
2020-05-05 13:31:27 -05:00
Kristian Freeman e5160f5528 Merge pull request #14 from cloudflare/kristian/workflow
re-add GitHub Actions workflow
2020-05-05 13:01:29 -05:00
Kristian Freeman 1e37135bae Update workflow and separate into multiple jobs 2020-05-05 12:52:41 -05:00
Kristian Freeman 1c9291f9bf Merge pull request #23 from mscoutermarsh/patch-1
Improvements to the readme
2020-04-06 10:59:14 -05:00
Mike Coutermarsh 8dd9410702 Improvements to the readme
Setting checkout to V2 and fixing the environment link
2020-04-04 20:57:36 -07:00
Kristian Freeman 844c30604b Add workflow 2019-12-13 15:29:17 -06:00
Kristian Freeman 312aaaeeaa Merge pull request #11 from cloudflare/1.1.0
📡 1.1.0
2019-12-09 12:37:26 -06:00
Kristian Freeman 1827c33732 Temporarily disable GitHub Actions in this repo 2019-12-09 12:37:08 -06:00
Kristian Freeman 9e7e2ec6db It's wrangler-action 1.1.0! 📡
- Support `apiToken` as an authentication method
  - Deprecates `apiKey` and `email`, making them optional parameters and encouraging `apiToken` usage in build logs
- Support `wranglerVersion` for installing a specific Wrangler version for your build
- Per #7, support for `workingDirectory` to run `wrangler-action` in a specific directory in your repo
- Adds a test Workers project under the `test` directory. This is used in the repo's new set of workflows (see below)
- Adds a GitHub Action workflow that:
  - Lints `entrypoint.sh` to ensure that the shell script looks correct
  - Runs the action with various config options to ensure future pushes don't introduce regressions
2019-12-09 11:13:30 -06:00
Kristian Freeman 2360296525 Merge pull request #7 from replicatedhq/workingdir
Add workingDirectory option for publishing a subdirectory
2019-11-22 10:40:19 -06:00
Frank Shotwell bc0254d9f8 Add workingDirectory option for publishing a subdirectory 2019-11-07 13:15:49 -08:00
Kristian Freeman 05e5e7ad0d Merge pull request #2 from adaptive/patch-1
changed secrets naming
2019-10-30 10:03:53 -05:00
Hugo Romano 6b4d853121 naming convention to CF_ 2019-10-27 19:48:39 +00:00
Hugo Romano b190740662 changed secrets naming 2019-10-27 01:37:10 +01:00
Kristian Freeman 8da7fa65b4 Merge pull request #1 from adamschwartz/patch-1
Recommend adding `name` to action
2019-10-25 11:39:57 -05:00
Adam Schwartz d5240e236f recommend adding name to action 2019-10-24 18:31:04 -04:00
Kristian Freeman e9594b6880 Release version 1.0 2019-10-24 09:19:53 -05:00
Kristian Freeman 051abafa82 Update README with use cases 2019-10-17 16:29:40 -05:00
112 changed files with 44348 additions and 91 deletions
+8
View File
@@ -0,0 +1,8 @@
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and deploy your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
+13
View File
@@ -0,0 +1,13 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "cloudflare/wrangler-action" }
],
"commit": false,
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
+5
View File
@@ -0,0 +1,5 @@
---
"wrangler-action": patch
---
Handle failures in createGitHubDeployment and createGitHubJobSummary
+5
View File
@@ -0,0 +1,5 @@
---
"wrangler-action": minor
---
Use wrangler outputs for version upload and wrangler deploy
+165
View File
@@ -0,0 +1,165 @@
name: Wrangler Action Self Testing
on:
pull_request:
branches:
- main
jobs:
wrangler_action_self_testing:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
# Pinned due to compatibility issues on 23.2.0
node-version: "22"
cache: "npm"
- name: Install modules and build
run: npm ci && npm run build
- name: Unit Tests
run: npm run test
- name: Check Formatting
run: npm run check
- name: Only build app
uses: ./
with:
workingDirectory: "./src/test/fixtures/only-build"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy --dry-run
- name: Only build app w/ quiet enabled
uses: ./
with:
quiet: true
workingDirectory: "./src/test/fixtures/build-quiet"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy --dry-run
- name: Environment support
uses: ./
with:
workingDirectory: "./src/test/fixtures/environment"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
environment: dev
preCommands: npx wrangler deploy --env dev # https://github.com/cloudflare/wrangler-action/issues/162
postCommands: npx wrangler delete --name wrangler-action-dev-environment-test --force
secrets: |
SECRET1
SECRET2
env:
SECRET1: ${{ secrets.SECRET1 }}
SECRET2: ${{ secrets.SECRET2 }}
# START Setup and teardown of Workers w/ Secrets Tests
- name: Deploy app secrets w/ hardcoded Wrangler v2
uses: ./
with:
wranglerVersion: "2.20.0"
workingDirectory: "./src/test/fixtures/secrets-v2"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
secrets: |
SECRET1
SECRET2
env:
SECRET1: ${{ secrets.SECRET1 }}
SECRET2: ${{ secrets.SECRET2 }}
- name: Health Check Deployed Worker
run: node .github/workflows/workerHealthCheck.cjs wrangler-action-test-secrets-v2
shell: bash
- name: Deploy app secrets w/ default version
uses: ./
with:
workingDirectory: "./src/test/fixtures/secrets-default"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
secrets: |
SECRET1
SECRET2
env:
SECRET1: ${{ secrets.SECRET1 }}
SECRET2: ${{ secrets.SECRET2 }}
- name: Health Check Deployed Worker
run: node .github/workflows/workerHealthCheck.cjs wrangler-action-test-secrets-default
shell: bash
- name: Clean Up Deployed Workers
uses: ./
with:
workingDirectory: "./src/test/fixtures/secrets-default"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: delete --name wrangler-action-test-secrets-v2 --force
postCommands: npx wrangler delete --name wrangler-action-test-secrets-default --force
# END Setup and teardown of Workers w/ Secrets Tests
- name: Support packageManager variable
uses: ./
with:
workingDirectory: "./src/test/fixtures/specify-package-manager"
packageManager: "npm"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy --dry-run
- name: Support unspecified packageManager with no lockfile
uses: ./
with:
workingDirectory: "./src/test/fixtures/unspecified-package-manager"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy --dry-run
- name: Support npm package manager
uses: ./
with:
workingDirectory: "./src/test/fixtures/npm"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy --dry-run
- name: Install yarn
run: npm i -g yarn
- name: Support yarn package manager
uses: ./
with:
workingDirectory: "./src/test/fixtures/yarn"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy --dry-run
- name: Install pnpm
run: npm i -g pnpm
- name: Support pnpm package manager
uses: ./
with:
workingDirectory: "./src/test/fixtures/pnpm"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy --dry-run
- name: Change directory to pre-installed-wrangler and install dependencies
run: |
cd ./src/test/fixtures/pre-installed-wrangler
npm install
- name: Support pre-installed wrangler
uses: ./
with:
workingDirectory: "./src/test/fixtures/pre-installed-wrangler"
command: action-test
+56
View File
@@ -0,0 +1,56 @@
name: Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
if: ${{ github.repository_owner == 'cloudflare' }}
name: Release
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: write
issues: read
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-tags: true
- name: Setup Node.js
uses: actions/setup-node@v3
with:
# Pinned due to compatibility issues on 23.2.0
node-version: "22"
cache: "npm"
- name: Install modules
run: npm ci
- name: Create Version PR
id: changesets
uses: changesets/action@v1
with:
createGithubReleases: true
publish: npx changeset tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build action
if: steps.changesets.outputs.published == 'true'
run: npm run build
- name: Push dist-tags
if: steps.changesets.outputs.published == 'true'
uses: JasonEtco/build-and-tag-action@v2
with:
tag_name: v${{ fromJSON(steps.changesets.outputs.publishedPackages)[0].version }}
env:
GITHUB_TOKEN: ${{ github.token }}
+24
View File
@@ -0,0 +1,24 @@
on:
pull_request: {}
workflow_dispatch: {}
push:
branches:
- main
- master
schedule:
- cron: "0 0 * * *"
name: Semgrep config
jobs:
semgrep:
name: semgrep/ci
runs-on: ubuntu-latest
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
SEMGREP_URL: https://cloudflare.semgrep.dev
SEMGREP_APP_URL: https://cloudflare.semgrep.dev
SEMGREP_VERSION_CHECK_URL: https://cloudflare.semgrep.dev/api/check-version
container:
image: semgrep/semgrep
steps:
- uses: actions/checkout@v4
- run: semgrep ci
+28
View File
@@ -0,0 +1,28 @@
const { execSync } = require("child_process");
function workerHealthCheck(workerName) {
const url = `https://${workerName}.devprod-testing7928.workers.dev/secret-health-check`;
const buffer = execSync(`curl ${url}`);
const response = buffer.toString();
if (response.includes("OK")) {
console.log(`Status: Worker is up! Response: ${response}`);
} else {
throw new Error(`Worker is down! Response: ${response}`);
}
return response;
}
const args = Array.from(process.argv);
const workerName = args.pop();
if (!workerName) {
throw new Error(
"Please provide the worker name as an argument when calling this program.",
);
}
workerHealthCheck(workerName);
+94
View File
@@ -0,0 +1,94 @@
.idea
.vscode
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Node ###
node_modules
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Moved from ./templates for ignoring all locks in templates
templates/**/*-lock.*
templates/**/*.lock
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
+1
View File
@@ -0,0 +1 @@
pnpm-lock.yaml
+6
View File
@@ -0,0 +1,6 @@
{
"printWidth": 80,
"singleQuote": false,
"semi": true,
"useTabs": true
}
+239
View File
@@ -0,0 +1,239 @@
# Changelog
## 3.13.1
### Patch Changes
- [#345](https://github.com/cloudflare/wrangler-action/pull/345) [`e819570`](https://github.com/cloudflare/wrangler-action/commit/e819570b2d0a69816a1c2e9d2f2954e278748d80) Thanks [@Maximo-Guk](https://github.com/Maximo-Guk)! - fix: Pages GitHub Deployment not triggering
## 3.13.0
### Minor Changes
- [#325](https://github.com/cloudflare/wrangler-action/pull/325) [`cada7a6`](https://github.com/cloudflare/wrangler-action/commit/cada7a63124ded3471bef7e8001b76356b838e40) Thanks [@Maximo-Guk](https://github.com/Maximo-Guk)! - Add GitHub deployments and job summaries for parity with pages-action
- [#334](https://github.com/cloudflare/wrangler-action/pull/334) [`9fed19a`](https://github.com/cloudflare/wrangler-action/commit/9fed19aa4ed79946f009e8aad7437a922e62d523) Thanks [@Maximo-Guk](https://github.com/Maximo-Guk)! - Bump default wrangler version to 3.90.0
## 3.12.1
### Patch Changes
- [#319](https://github.com/cloudflare/wrangler-action/pull/319) [`59c04629408d58978884fadd18755f1a15f96157`](https://github.com/cloudflare/wrangler-action/commit/59c04629408d58978884fadd18755f1a15f96157) Thanks [@Maximo-Guk](https://github.com/Maximo-Guk)! - Fixes #317: Generate a new output directory with a randomUUID in the tmpDir, so that when the action is executed multiple times, we use the artifacts from that run, opposed to the artifacts from a previous run.
## 3.12.0
### Minor Changes
- [#312](https://github.com/cloudflare/wrangler-action/pull/312) [`122ee5cf5b66847e0b6cfa67ecd9e03e38a67a42`](https://github.com/cloudflare/wrangler-action/commit/122ee5cf5b66847e0b6cfa67ecd9e03e38a67a42) Thanks [@Maximo-Guk](https://github.com/Maximo-Guk)! - This reapplies [303](https://github.com/cloudflare/wrangler-action/pull/303) add parity with pages-action for pages deploy outputs. Thanks @courtney-sims! - Support pages-deployment-id, pages-environment, pages-deployment-alias-url and deployment-url outputs for Pages deploys when wrangler version is >=3.81.0. deployment-alias-url was also deprecated in favour of pages-deployment-alias.
## 3.11.0
### Minor Changes
- [#309](https://github.com/cloudflare/wrangler-action/pull/309) [`10d5b9c1c1826adaec0a9ee49fdf5b91113508ef`](https://github.com/cloudflare/wrangler-action/commit/10d5b9c1c1826adaec0a9ee49fdf5b91113508ef) Thanks [@Maximo-Guk](https://github.com/Maximo-Guk)! - Revert "Add parity with pages-action for pages deploy outputs"
## 3.10.0
### Minor Changes
- [#303](https://github.com/cloudflare/wrangler-action/pull/303) [`3ec7f8943ef83351f743cfaa8763a9056ef70993`](https://github.com/cloudflare/wrangler-action/commit/3ec7f8943ef83351f743cfaa8763a9056ef70993) Thanks [@courtney-sims](https://github.com/courtney-sims)! - Support id, environment, url, and alias outputs for Pages deploys.
## 3.9.0
### Minor Changes
- [#298](https://github.com/cloudflare/wrangler-action/pull/298) [`134b5c2a3252d66b8c4d1cddd0b9baaeed6a4daa`](https://github.com/cloudflare/wrangler-action/commit/134b5c2a3252d66b8c4d1cddd0b9baaeed6a4daa) Thanks [@Maximo-Guk](https://github.com/Maximo-Guk)! - Update wrangler version from 3.13.2 to 3.78.10
### Patch Changes
- [#278](https://github.com/cloudflare/wrangler-action/pull/278) [`47d51f25c113ee9205110728599b43ed6a1e273b`](https://github.com/cloudflare/wrangler-action/commit/47d51f25c113ee9205110728599b43ed6a1e273b) Thanks [@acusti](https://github.com/acusti)! - fix: Detect existing wrangler install even when wrangler version output is multiline
## 3.8.0
### Minor Changes
- [#291](https://github.com/cloudflare/wrangler-action/pull/291) [`a1467a0c8f2a058f8d43a4d0c40a55176ed5efe6`](https://github.com/cloudflare/wrangler-action/commit/a1467a0c8f2a058f8d43a4d0c40a55176ed5efe6) Thanks [@Ambroos](https://github.com/Ambroos)! - Adds `deployment-alias-url` output for Pages deployment aliases (since Wrangler v3.78.0): https://github.com/cloudflare/workers-sdk/pull/6643
## 3.7.0
### Minor Changes
- [#271](https://github.com/cloudflare/wrangler-action/pull/271) [`66efca2cbb82a5a49df6af2e14c4b58d53b0e266`](https://github.com/cloudflare/wrangler-action/commit/66efca2cbb82a5a49df6af2e14c4b58d53b0e266) Thanks [@Maximo-Guk](https://github.com/Maximo-Guk)! - This unreverts #235 ensuring wrangler-action will re-use existing wrangler installations, thanks @AdiRishi! and ensures we don't automatically install wrangler when checking if it present
## 3.6.1
### Patch Changes
- [#265](https://github.com/cloudflare/wrangler-action/pull/265) [`2d275a8f2d279dc91912c1ff8023af109ef3280c`](https://github.com/cloudflare/wrangler-action/commit/2d275a8f2d279dc91912c1ff8023af109ef3280c) Thanks [@Maximo-Guk](https://github.com/Maximo-Guk)! - Reverts #235 which may have caused the latest version of wrangler to be installed, if no wrangler version was found
## 3.6.0
### Minor Changes
- [#235](https://github.com/cloudflare/wrangler-action/pull/235) [`0545ad285acaff2b92053d636ee17fb303b4c5f5`](https://github.com/cloudflare/wrangler-action/commit/0545ad285acaff2b92053d636ee17fb303b4c5f5) Thanks [@AdiRishi](https://github.com/AdiRishi)! - wrangler-action will now re-use existing wrangler installations when available
## 3.5.0
### Minor Changes
- [#255](https://github.com/cloudflare/wrangler-action/pull/255) [`31a6263ef3ec73ff2d03cb4c0260379f96f7598c`](https://github.com/cloudflare/wrangler-action/commit/31a6263ef3ec73ff2d03cb4c0260379f96f7598c) Thanks [@matthewdavidrodgers](https://github.com/matthewdavidrodgers)! - 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.
## 3.4.1
### Patch Changes
- [#227](https://github.com/cloudflare/wrangler-action/pull/227) [`bbedd8e54f256d36f81f81f1f05b90937d533bb7`](https://github.com/cloudflare/wrangler-action/commit/bbedd8e54f256d36f81f81f1f05b90937d533bb7) Thanks [@AdiRishi](https://github.com/AdiRishi)! - Surface inner exception when secret:bulk upload command fails
## 3.4.0
### Minor Changes
- [#213](https://github.com/cloudflare/wrangler-action/pull/213) [`d13856dfc92816473ebf47f66e263a2668a97896`](https://github.com/cloudflare/wrangler-action/commit/d13856dfc92816473ebf47f66e263a2668a97896) Thanks [@GrantBirki](https://github.com/GrantBirki)! - This change introduces three new GitHub Actions output variables. These variables are as follows:
- `command-output` - contains the string results of `stdout`
- `command-stderr` - contains the string results of `stderr`
- `deployment-url` - contains the string results of the URL that was deployed (ex: `https://<your_pages_site>.pages.dev`)
These output variables are intended to be used by more advanced workflows that require the output results or deployment url from Wrangler commands in subsequent workflow steps.
### Patch Changes
- [#216](https://github.com/cloudflare/wrangler-action/pull/216) [`9aba9c34daabca23a88191a5fe1b81fa721c1f11`](https://github.com/cloudflare/wrangler-action/commit/9aba9c34daabca23a88191a5fe1b81fa721c1f11) Thanks [@Cherry](https://github.com/Cherry)! - Fixes issues with semver comparison, where version parts were treated lexicographically instead of numerically.
Bulk secret uploading was introduced in wrangler `3.4.0`, and this action tries to check if the version used is greater than `3.4.0`, and then if so, using the new bulk secret API which is faster. Due to a bug in the semver comparison, `3.19.0` was being considered less than `3.4.0`, and then using an older and slower method for uploading secrets.
Now the semver comparison is fixed, the faster bulk method is used for uploading secrets when available.
## 3.3.2
### Patch Changes
- [#171](https://github.com/cloudflare/wrangler-action/pull/171) [`76d614f`](https://github.com/cloudflare/wrangler-action/commit/76d614f400bd92237ed23c3df559f2c31b14a790) Thanks [@1000hz](https://github.com/1000hz)! - Fixed issues that caused the action to fail if any secret or var values contained shell metacharacters.
- [#171](https://github.com/cloudflare/wrangler-action/pull/171) [`473d9cb`](https://github.com/cloudflare/wrangler-action/commit/473d9cbd296528b41c653af10062faba6540a7ab) Thanks [@1000hz](https://github.com/1000hz)! - Bumped `DEFAULT_WRANGLER_VERSION` to 3.13.2
## 3.3.1
### Patch Changes
- [#193](https://github.com/cloudflare/wrangler-action/pull/193) [`a4509d5`](https://github.com/cloudflare/wrangler-action/commit/a4509d507c62dd7f49fba7df7d2db3997222393a) Thanks [@1000hz](https://github.com/1000hz)! - Fixed the package manager not being inferred based on lockfile when the `packageManager` input isn't set.
## 3.3.0
### Minor Changes
- [#188](https://github.com/cloudflare/wrangler-action/pull/188) [`d9a0a00`](https://github.com/cloudflare/wrangler-action/commit/d9a0a00f8bc502ceea2a60e5af258416b35a85b9) Thanks [@simpleauthority](https://github.com/simpleauthority)! - Added support for Bun as a package manager
## 3.2.1
### Patch Changes
- [#190](https://github.com/cloudflare/wrangler-action/pull/190) [`528687a`](https://github.com/cloudflare/wrangler-action/commit/528687aaf436f67565918533ffd15c250f39c47b) Thanks [@1000hz](https://github.com/1000hz)! - Fixed action failure when no `packageManager` specified and no lockfile is found. The action now falls back to using npm.
## 3.2.0
### Minor Changes
- [#166](https://github.com/cloudflare/wrangler-action/pull/166) [`7d7b988`](https://github.com/cloudflare/wrangler-action/commit/7d7b98826e14e9ad422870a7263b7074b40bf16f) Thanks [@nix6839](https://github.com/nix6839)! - Support for package managers other than npm, such as pnpm and yarn.
fixes #156
## 3.1.1
### Patch Changes
- [#161](https://github.com/cloudflare/wrangler-action/pull/161) [`e5251df`](https://github.com/cloudflare/wrangler-action/commit/e5251df52154e9ebc98edb02ee0598c7210dcf0f) Thanks [@1000hz](https://github.com/1000hz)! - Refactored error handling to stop execution when action fails. Previously, the action would continue executing to completion if one of the steps encountered an error. Fixes #160.
## 3.1.0
### Minor Changes
- [#154](https://github.com/cloudflare/wrangler-action/pull/154) [`3f40637`](https://github.com/cloudflare/wrangler-action/commit/3f40637a1c48016d2101e412a7a06f1eb4b9c2fd) Thanks [@JacobMGEvans](https://github.com/JacobMGEvans)! - feat: Quiet mode
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
## 3.0.2
### Patch Changes
- [#147](https://github.com/cloudflare/wrangler-action/pull/147) [`58f274b`](https://github.com/cloudflare/wrangler-action/commit/58f274b9f70867447519c6fa983c813e2b167b85) Thanks [@JacobMGEvans](https://github.com/JacobMGEvans)! - Added more error logging when a command fails to execute
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
- [#147](https://github.com/cloudflare/wrangler-action/pull/147) [`58f274b`](https://github.com/cloudflare/wrangler-action/commit/58f274b9f70867447519c6fa983c813e2b167b85) Thanks [@JacobMGEvans](https://github.com/JacobMGEvans)! - Adding Changesets
- [Version 3.0.0](#version-300)
- [Version 2.0.0](#version-200)
## Version 3.0.0 (Breaking update)
### Additions
- **Rewritten Wrangler Action in TypeScript.**
- Bulk secrets API utilization from Wrangler.
- Added testing for improved reliability.
- Implemented multiline support for the `command` input to allow running multiple Wrangler commands.
- Now using Node for the Action engine/runner.
- Open discussions with the community on all changes through GitHub Discussions and monitored Issues.
### Removals
- Removed Docker as a dependency.
- Dropped support for Wrangler v1.
### Changes
- Fixed CI/CD issues.
### Breaking changes
- Wrangler v1 is no longer supported.
- Please update to the latest version of Wrangler.
- Updated default version of Wrangler to v3.4.0
### Additional Notes
- Major Version Default: [DEVX-632](https://jira.cfdata.org/browse/DEVX-632)
- Rewrite Project Tickets: [DEVX-804](https://jira.cfdata.org/browse/DEVX-804), [DEVX-802](https://jira.cfdata.org/browse/DEVX-802), [DEVX-800](https://jira.cfdata.org/browse/DEVX-800), [DEVX-632](https://jira.cfdata.org/browse/DEVX-632)
---
## Version 2.0.0 (Breaking update)
### Additions
- New `command` input
- This allows you to specify the Wrangler command you would like to run.
For example, if you want to publish the production version of your Worker you may run `publish --env=production`.
- This opens up other possibilities too like publishing a Pages project: `pages publish <directory> --project-name=<name>`.
- New `accountId` input
- This allows you to specify your account ID.
### Removals
- Removed `publish` input (refer to [Breaking changes](#breaking-changes)).
### Changes
-- no changes --
### Breaking changes
- `publish` has been removed.
- You should instead do `command:
+3
View File
@@ -0,0 +1,3 @@
* @cloudflare/wrangler @cloudflare/banda-team
CHANGELOG.md @cloudflare/wrangler-admins @cloudflare/banda-team
+21
View File
@@ -0,0 +1,21 @@
# Contributing Guide
## Releases
### Changesets
Every non-trivial change to the project - those that should appear in the changelog - must be captured in a "changeset". We use the changesets tool for creating changesets, publishing versions and updating the changelog.
Create a changeset for the current change.
> npx changeset
> Select which workspaces are affected by the change and whether the version requires a major, minor or patch release.
> Update the generated changeset with a description of the change.
> Include the generate changeset in the current commit.
> git add ./changeset/\*.md
### Version Packages PRs
Once you merge your PR, a new Version Packages PR will be opened in the wrangler-action repo. Once that PR is merged, your change will be released. Example: https://github.com/cloudflare/wrangler-action/pull/305
Note: Version Packages PRs are only generated if there's been at least one PR merged with a changeset.
-5
View File
@@ -1,5 +0,0 @@
FROM node:12
ENV XDG_CONFIG_HOME /github/workspace
ENV WRANGLER_HOME /github/workspace
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
+331 -34
View File
@@ -1,86 +1,383 @@
# Wrangler GitHub Action
✨ Zero-config [Cloudflare Workers](https://workers.cloudflare.com) deployment using [Wrangler](https://github.com/cloudflare/wrangler) and [GitHub Actions](https://github.com/actions)
Easy-to-use GitHub Action to use [Wrangler](https://developers.cloudflare.com/workers/cli-wrangler/). Makes deploying Workers a breeze.
## Big Changes in v3
- Wrangler v1 is no longer supported.
- Global API key & Email Auth no longer supported
- Action version syntax is newly supported. This means e.g. `uses: cloudflare/wrangler-action@v3`, `uses: cloudflare/wrangler-action@v3.x`, and `uses: cloudflare/wrangler-action@v3.x.x` are all now valid syntax. Previously supported syntax e.g. `uses: cloudflare/wrangler-action@3.x.x` is no longer supported -- the prefix `v` is now necessary.
[Refer to Changelog for more information](CHANGELOG.md).
## Usage
Add `wrangler-action` to the workflow for your Workers application. The below example will publish your application on pushes to the `master` branch:
Add `wrangler-action` to the workflow for your Workers/Pages application. The below example will deploy a Worker on a `git push` to the `main` branch:
```yaml
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v4
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
```
## Authentication
You'll need to configure Wrangler using GitHub's Secrets feature - go to "Settings -> Secrets" and add your Cloudflare API token (for help finding this, see the [Workers documentation](https://developers.cloudflare.com/workers/wrangler/ci-cd/#api-token)). Your API token is encrypted by GitHub, and the action won't print it into logs, so it should be safe!
With your API token set as a secret for your repository, pass it to the action in the `with` block of your workflow. Below, I've set the secret name to `CLOUDFLARE_API_TOKEN`:
```yaml
jobs:
deploy:
name: Deploy
steps:
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
```
## Configuration
If you need to install a specific version of Wrangler to use for deployment, you can also pass the input `wranglerVersion` to install a specific version of Wrangler from NPM. This should be a [SemVer](https://semver.org/)-style version number, such as `2.20.0`:
```yaml
jobs:
deploy:
steps:
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
wranglerVersion: "2.20.0"
```
Optionally, you can also pass a `workingDirectory` key to the action. This will allow you to specify a subdirectory of the repo to run the Wrangler command from.
```yaml
jobs:
deploy:
steps:
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
workingDirectory: "subfoldername"
```
[Worker secrets](https://developers.cloudflare.com/workers/tooling/wrangler/secrets/) can optionally be passed in via `secrets` as a string of names separated by newlines. Each secret name must match the name of an environment variable specified in the `env` field. This creates or replaces the value for the Worker secret using the `wrangler secret put` command. It's also possible to specify worker environment using environment parameter.
```yaml
jobs:
deploy:
steps:
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
environment: production
secrets: |
SECRET1
SECRET2
env:
SECRET1: ${{ secrets.SECRET1 }}
SECRET2: ${{ secrets.SECRET2 }}
```
If you need to run additional shell commands before or after your command, you can specify them as input to `preCommands` (before `deploy`) or `postCommands` (after `deploy`). These can include additional `wrangler` commands (that is, `whoami`, `kv:key put`) or any other commands available inside the `wrangler-action` context.
```yaml
jobs:
deploy:
steps:
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
preCommands: echo "*** pre command ***"
postCommands: |
echo "*** post commands ***"
wrangler kv:key put --binding=MY_KV key2 value2
echo "******"
```
You can use the `command` option to do specific actions such as running `wrangler whoami` against your project:
```yaml
jobs:
deploy:
steps:
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: whoami
```
You can also add a command that spans multiple lines:
```yaml
jobs:
deploy:
steps:
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: |
pages project list
pages deploy .vercel/output/static --project-name=demo-actions --branch=test
```
## Use cases
### Deploy when commits are merged to main
The above workflow examples have already shown how to run `wrangler-action` when new commits are merged to the main branch. For most developers, this workflow will easily replace manual deploys and be a great first integration step with `wrangler-action`:
```yaml
on:
push:
branches:
- master
- main
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@master
- name: Publish
uses: signalnerve/wrangler-action@0.1.4
- uses: actions/checkout@v4
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiKey: ${{ secrets.apiKey }}
email: ${{ secrets.email }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
```
## Configuration
Note that there are a number of possible events, like `push`, that can be used to trigger a workflow. For more details on the events available, refer to the [GitHub Actions documentation](https://help.github.com/en/articles/workflow-syntax-for-github-actions#on).
You'll need to configure Wrangler using GitHub's Secrets feature - go to "Settings -> Secrets" and add your Cloudflare API key and email (for help finding these, see the [Workers documentation](https://developers.cloudflare.com/workers/quickstart/#finding-your-cloudflare-api-keys)). Your API key and email are encrypted by GitHub, and the action won't print them into logs, so they should be safe!
### Deploy your Pages site (production & preview)
With your API key and email set as secrets for your repository, pass them to the action in the `with` block of your workflow. Below, I've set the secret names to `apiKey` and `email`:
If you want to deploy your Pages project with GitHub Actions rather than the built-in continous integration (CI), then this is a great way to do it. Wrangler 2 will populate the commit message and branch for you. You only need to pass the project name. If a push to a non-production branch is done, it will deploy as a preview deployment:
```yaml
on: [push]
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
permissions:
contents: read
deployments: write
steps:
- uses: actions/checkout@v4
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy YOUR_DIST_FOLDER --project-name=example
# Optional: Enable this if you want to have GitHub Deployments triggered
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
```
### Deploying on a schedule
If you would like to deploy your Workers application on a recurring basis for example, every hour, or daily the `schedule` trigger allows you to use cron syntax to define a workflow schedule. The below example will deploy at the beginning of every hour:
```yaml
on:
schedule:
- cron: "0 * * * *"
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
uses: signalnerve/wrangler-action@0.1.4
with:
apiKey: ${{ secrets.apiKey }}
email: ${{ secrets.email }}
- uses: actions/checkout@v4
- name: Deploy app
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
```
Optionally, you can also pass an `environment` key to the action. If you're using Wrangler's [environments](https://github.com/cloudflare/wrangler/blob/master/docs/content/environments.md) feature, you can customize _where_ the action deploys to by passing the matching environment in the `with` block of your workflow:
If you need help defining the correct cron syntax, check out [crontab.guru](https://crontab.guru/), which provides a friendly user interface for validating your cron schedule.
### Manually triggering a deployment
If you need to trigger a workflow at-will, you can use GitHub's `workflow_dispatch` [event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch) in your workflow file. By setting your workflow to trigger on that event, you will be able to deploy your application via the GitHub UI. The UI also accepts inputs that can be used to configure the action:
```yaml
on:
workflow_dispatch:
inputs:
environment:
description: "Choose an environment to deploy to: <dev|staging|prod>"
required: true
default: "dev"
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v4
- name: Deploy app
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: deploy --env ${{ github.event.inputs.environment }}
```
For more advanced usage or to programmatically trigger the workflow from scripts, refer to [the GitHub documentation](https://docs.github.com/en/rest/reference/actions#create-a-workflow-dispatch-event) for making API calls.
### Upload a Worker Version
To create a new version of your Worker that is not deployed immediately, use the `wrangler versions upload` command. Worker versions created in this way can then be deployed all at once at a later time or gradually deployed using the `wrangler versions deploy` command or via the Cloudflare dashboard under the Deployments tab. Wrangler v3.40.0 or above is required to use this feature.
```yaml
jobs:
upload:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v4
- name: Upload Worker Version
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: versions upload
```
## Advanced Usage
### Setting A Worker Secret for A Specific Environment
There is an environment parameter that can be set within the workflow to enable this. Example:
```yaml
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: deploy --env production
secrets: |
SUPER_SECRET
environment: production
env:
SUPER_SECRET: ${{ secrets.SUPER_SECRET }}
```
### Using Wrangler Command Output in Subsequent Steps
More advanced workflows may need to parse the resulting output of Wrangler commands. To do this, you can use the `command-output` output variable in subsequent steps. For example, if you want to print the output of the Wrangler command, you can do the following:
```yaml
- name: Deploy
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy --project-name=example
- name: print wrangler command output
env:
CMD_OUTPUT: ${{ steps.deploy.outputs.command-output }}
run: echo $CMD_OUTPUT
```
Now when you run your workflow, you will see the full output of the Wrangler command in your workflow logs. You can also use this output in subsequent workflow steps to parse the output for specific values.
> Note: the `command-stderr` output variable is also available if you need to parse the standard error output of the Wrangler command.
### Using the `deployment-url` and `pages-deployment-alias-url` Output Variables
If you are executing a Wrangler command that results in either a Workers or Pages deployment, you can utilize the `deployment-url` output variable to get the URL of the deployment. For example, if you want to print the deployment URL after deploying your application, you can do the following:
```yaml
- name: Deploy
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy --project-name=example
- name: print deployment-url
env:
DEPLOYMENT_URL: ${{ steps.deploy.outputs.deployment-url }}
run: echo $DEPLOYMENT_URL
```
The resulting output will look something like this:
```text
https://<your_pages_site>.pages.dev
```
Pages deployments will also provide their alias URL (since Wrangler v3.78.0). You can use the `pages-deployment-alias-url` output variable to get the URL of the deployment alias. This is useful for, for example, branch aliases for preview deployments.
If the sample action above was used to deploy a branch other than main, you could use the following to get the branch URL:
```yaml
- name: print pages-deployment-alias-url
env:
DEPLOYMENT_ALIAS_URL: ${{ steps.deploy.outputs.pages-deployment-alias-url }}
run: echo $DEPLOYMENT_ALIAS_URL
```
Resulting in:
```text
https://new-feature.<your_pages_site>.pages.dev
```
### Using a different package manager
By default, this action will detect which package manager to use, based on the presence of a `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, or `bun.lockb`/`bun.lock` file.
If you need to use a specific package manager for your application, you can set the `packageManager` input to `npm`, `yarn`, `pnpm`, or `bun`. You don't need to set this option unless you want to override the default behavior.
```yaml
jobs:
deploy:
# ... previous configuration ...
steps:
uses: signalnerve/wrangler-action@0.1.4
uses: cloudflare/wrangler-action@v3
with:
# ... api key and email ...
environment: 'production'
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
packageManager: pnpm
```
## Troubleshooting
This action is in beta, and I'm looking for folks to use it! If something goes wrong, please file an issue! That being said, there's a couple things you should know:
### "I just started using Workers/Wrangler and I don't know what this is!"
No problem! Check out the [Quick Start guide](https://developers.cloudflare.com/workers/quickstart) in our docs to get started. Once you have a Workers application, you may want to set it up to automatically deploy from GitHub whenever you change your project. That's where this action comes in - nice!
Refer to the [Quick Start guide](https://developers.cloudflare.com/workers/quickstart) to get started. Once you have a Workers application, you may want to set it up to automatically deploy from GitHub whenever you change your project.
### "I'm trying to deploy my static site but it isn't working!"
### "[ERROR] No account id found, quitting.."
To deploy static sites and frontend applications to Workers, check out the documentation for [Workers Sites](https://developers.cloudflare.com/workers/sites).
Note that this action makes no assumptions about _how_ your project is built! **If you need to run a pre-publish step, like building your application, you need to specify a build step in your Workflow.** For instance, if I have an NPM command called `build`, my workflow TOML might resemble the following:
You will need to add `account_id = ""` in your `wrangler.toml` file or set `accountId` in this GitHub Action.
```yaml
on: [push]
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@master
- name: Build site
run: 'npm run build'
- name: Publish
uses: signalnerve/wrangler-action@0.1.4
- uses: actions/checkout@v4
- name: Deploy app
uses: cloudflare/wrangler-action@v3
with:
apiKey: ${{ secrets.apiKey }}
email: ${{ secrets.email }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
```
+58 -13
View File
@@ -1,17 +1,62 @@
name: 'Deploy to Cloudflare Workers with Wrangler'
name: "Deploy to Cloudflare Workers with Wrangler"
branding:
icon: 'upload-cloud'
color: 'orange'
description: 'Deploy your Cloudflare Workers applications and sites directly from GitHub, using Wrangler'
icon: "upload-cloud"
color: "orange"
description: "Deploy your Cloudflare projects from GitHub using Wrangler"
runs:
using: 'docker'
image: 'Dockerfile'
# Possible values: https://github.com/actions/runner/blob/main/src/Runner.Common/Util/NodeUtil.cs#L9
using: "node20"
main: "dist/index.mjs"
inputs:
apiKey:
description: "Your Cloudflare API Key"
required: true
email:
description: "Your Cloudflare Email"
required: true
apiToken:
description: "Your Cloudflare API Token"
required: false
accountId:
description: "Your Cloudflare Account ID"
required: false
quiet:
description: "Supresses output from Wrangler commands, defaults to `false`"
required: false
default: "false"
environment:
description: "The environment you'd like to publish your Workers project to - must be defined in wrangler.toml"
description: "The environment you'd like to deploy your Workers project to - must be defined in wrangler.toml"
workingDirectory:
description: "The relative path which Wrangler commands should be run from"
required: false
wranglerVersion:
description: "The version of Wrangler you'd like to use to deploy your Workers project"
required: false
secrets:
description: "A string of environment variable names, separated by newlines. These will be bound to your Worker as Secrets and must match the names of environment variables declared in `env` of this workflow."
required: false
preCommands:
description: "Commands to execute before deploying the Workers project"
required: false
postCommands:
description: "Commands to execute after deploying the Workers project"
required: false
command:
description: 'The Wrangler command (along with any arguments) you wish to run. Multiple Wrangler commands can be run by separating each command with a newline. Defaults to `"deploy"`.'
required: false
vars:
description: "A string of environment variable names, separated by newlines. These will be bound to your Worker using the values of matching environment variables declared in `env` of this workflow."
required: false
packageManager:
description: "The package manager you'd like to use to install and run wrangler. If not specified, the preferred package manager will be inferred based on the presence of a lockfile or fallback to using npm if no lockfile is found. Valid values are `npm` | `pnpm` | `yarn` | `bun`."
required: false
gitHubToken:
description: "GitHub Token"
required: false
outputs:
command-output:
description: "The output of the Wrangler command (comes from stdout)"
command-stderr:
description: "The error output of the Wrangler command (comes from stderr)"
deployment-url:
description: "If the command was a Workers or Pages deployment, this will be the URL of the deployment"
pages-deployment-alias-url:
description: "If the command was a Pages deployment, this will be the URL of the deployment alias (if it exists) - needs wrangler >= 3.78.0"
pages-deployment-id:
description: "If the command was a Pages deployment, this will be the ID of the deployment - needs wrangler >= 3.81.0"
pages-environment:
description: "If the command was a Pages deployment, this will be the environment of the deployment - needs wrangler >= 3.81.0"
+2
View File
@@ -0,0 +1,2 @@
import { WranglerActionConfig } from "./wranglerAction";
export declare function handleCommandOutputParsing(config: WranglerActionConfig, command: string, stdOut: string): Promise<void>;
+6
View File
@@ -0,0 +1,6 @@
import { exec as _childProcessExec } from "node:child_process";
export { exec } from "@actions/exec";
declare const childProcessExec: typeof _childProcessExec.__promisify__;
export declare function execShell(command: string, { silent, ...options }?: Parameters<typeof childProcessExec>[1] & {
silent?: boolean;
}): Promise<number | null>;
+1
View File
@@ -0,0 +1 @@
export {};
+37332
View File
File diff suppressed because one or more lines are too long
+3
View File
@@ -0,0 +1,3 @@
{
"type": "module"
}
+24
View File
@@ -0,0 +1,24 @@
export interface PackageManager {
install: string;
exec: string;
execNoInstall: string;
}
export declare function getPackageManager(name: string, { workingDirectory }?: {
workingDirectory?: string;
}): {
readonly install: "npm i";
readonly exec: "npx";
readonly execNoInstall: "npx --no-install";
} | {
readonly install: "yarn add";
readonly exec: "yarn";
readonly execNoInstall: "yarn";
} | {
readonly install: "pnpm add";
readonly exec: "pnpm exec";
readonly execNoInstall: "pnpm exec";
} | {
readonly install: "bun i";
readonly exec: "bunx";
readonly execNoInstall: "bun run";
};
+1
View File
@@ -0,0 +1 @@
export {};
+23
View File
@@ -0,0 +1,23 @@
import { getOctokit } from "@actions/github";
import { OutputEntryPagesDeployment } from "../wranglerArtifactManager";
import { WranglerActionConfig } from "../wranglerAction";
type Octokit = ReturnType<typeof getOctokit>;
export declare function createGitHubDeployment({ config, octokit, productionBranch, environment, deploymentId, projectName, deploymentUrl, }: {
config: WranglerActionConfig;
octokit: Octokit;
productionBranch: string;
environment: string;
deploymentId: string | null;
projectName: string;
deploymentUrl?: string;
}): Promise<void>;
export declare function createJobSummary({ commitHash, deploymentUrl, aliasUrl, }: {
commitHash: string;
deploymentUrl?: string;
aliasUrl?: string;
}): Promise<void>;
/**
* Create github deployment, if GITHUB_TOKEN is present in config
*/
export declare function createGitHubDeploymentAndJobSummary(config: WranglerActionConfig, pagesArtifactFields: OutputEntryPagesDeployment): Promise<void>;
export {};
+1
View File
@@ -0,0 +1 @@
export {};
+8
View File
@@ -0,0 +1,8 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
declare const _default: {
fetch(request: Request, env: Env): Response;
};
export default _default;
+8
View File
@@ -0,0 +1,8 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
declare const _default: {
fetch(request: Request, env: Env): Response;
};
export default _default;
+8
View File
@@ -0,0 +1,8 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
declare const _default: {
fetch(request: Request, env: Env): Response;
};
export default _default;
+8
View File
@@ -0,0 +1,8 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
declare const _default: {
fetch(request: Request, env: Env): Response;
};
export default _default;
+8
View File
@@ -0,0 +1,8 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
declare const _default: {
fetch(request: Request, env: Env): Response;
};
export default _default;
+8
View File
@@ -0,0 +1,8 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
declare const _default: {
fetch(request: Request, env: Env): Response;
};
export default _default;
+8
View File
@@ -0,0 +1,8 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
declare const _default: {
fetch(request: Request, env: Env): Response;
};
export default _default;
+8
View File
@@ -0,0 +1,8 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
declare const _default: {
fetch(request: Request, env: Env): Response;
};
export default _default;
+8
View File
@@ -0,0 +1,8 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
declare const _default: {
fetch(request: Request, env: Env): Response;
};
export default _default;
+2
View File
@@ -0,0 +1,2 @@
declare const _default: {};
export default _default;
@@ -0,0 +1,2 @@
declare const _default: {};
export default _default;
+8
View File
@@ -0,0 +1,8 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
declare const _default: {
fetch(request: Request, env: Env): Response;
};
export default _default;
+6
View File
@@ -0,0 +1,6 @@
export declare function mockGithubDeployments({ githubUser, githubRepoName, }: {
githubUser: string;
githubRepoName: string;
}): {
handlers: import("msw").HttpHandler[];
};
+4
View File
@@ -0,0 +1,4 @@
import { WranglerActionConfig } from "../wranglerAction";
export declare function getTestConfig({ config, }?: {
config?: Partial<WranglerActionConfig>;
}): WranglerActionConfig;
+9
View File
@@ -0,0 +1,9 @@
import { WranglerActionConfig } from "./wranglerAction";
/**
* A helper function to compare two semver versions. If the second arg is greater than the first arg, it returns true.
*/
export declare function semverCompare(version1: string, version2: string): boolean;
export declare function checkWorkingDirectory(workingDirectory?: string): string;
export declare function info(config: WranglerActionConfig, message: string, bypass?: boolean): void;
export declare function warn(config: WranglerActionConfig, message: string, bypass?: boolean): void;
export declare function error(config: WranglerActionConfig, message: string, bypass?: boolean): void;
+1
View File
@@ -0,0 +1 @@
export {};
+54
View File
@@ -0,0 +1,54 @@
import { z } from "zod";
import { PackageManager } from "./packageManagers";
import { info } from "./utils";
export type WranglerActionConfig = z.infer<typeof wranglerActionConfig>;
export declare const wranglerActionConfig: z.ZodObject<{
WRANGLER_VERSION: z.ZodString;
didUserProvideWranglerVersion: z.ZodBoolean;
secrets: z.ZodArray<z.ZodString, "many">;
workingDirectory: z.ZodString;
CLOUDFLARE_API_TOKEN: z.ZodString;
CLOUDFLARE_ACCOUNT_ID: z.ZodString;
ENVIRONMENT: z.ZodString;
VARS: z.ZodArray<z.ZodString, "many">;
COMMANDS: z.ZodArray<z.ZodString, "many">;
QUIET_MODE: z.ZodBoolean;
PACKAGE_MANAGER: z.ZodString;
WRANGLER_OUTPUT_DIR: z.ZodString;
GITHUB_TOKEN: z.ZodString;
}, "strip", z.ZodTypeAny, {
WRANGLER_VERSION: string;
didUserProvideWranglerVersion: boolean;
secrets: string[];
workingDirectory: string;
CLOUDFLARE_API_TOKEN: string;
CLOUDFLARE_ACCOUNT_ID: string;
ENVIRONMENT: string;
VARS: string[];
COMMANDS: string[];
QUIET_MODE: boolean;
PACKAGE_MANAGER: string;
WRANGLER_OUTPUT_DIR: string;
GITHUB_TOKEN: string;
}, {
WRANGLER_VERSION: string;
didUserProvideWranglerVersion: boolean;
secrets: string[];
workingDirectory: string;
CLOUDFLARE_API_TOKEN: string;
CLOUDFLARE_ACCOUNT_ID: string;
ENVIRONMENT: string;
VARS: string[];
COMMANDS: string[];
QUIET_MODE: boolean;
PACKAGE_MANAGER: string;
WRANGLER_OUTPUT_DIR: string;
GITHUB_TOKEN: string;
}>;
declare function main(config: WranglerActionConfig, packageManager: PackageManager): Promise<void>;
declare function installWrangler(config: WranglerActionConfig, packageManager: PackageManager): Promise<void>;
declare function authenticationSetup(config: WranglerActionConfig): void;
declare function execCommands(config: WranglerActionConfig, packageManager: PackageManager, commands: string[], cmdType: string): Promise<void>;
declare function uploadSecrets(config: WranglerActionConfig, packageManager: PackageManager): Promise<void>;
declare function wranglerCommands(config: WranglerActionConfig, packageManager: PackageManager): Promise<void>;
export { authenticationSetup, execCommands, info, installWrangler, main, uploadSecrets, wranglerCommands, };
+1
View File
@@ -0,0 +1 @@
export {};
+200
View File
@@ -0,0 +1,200 @@
import { z } from "zod";
export type OutputEntryPagesDeployment = z.infer<typeof OutputEntryPagesDeployment>;
declare const OutputEntryPagesDeployment: z.ZodObject<z.objectUtil.extendShape<{
version: z.ZodLiteral<1>;
type: z.ZodString;
}, {
type: z.ZodLiteral<"pages-deploy-detailed">;
pages_project: z.ZodNullable<z.ZodString>;
deployment_id: z.ZodNullable<z.ZodString>;
url: z.ZodOptional<z.ZodString>;
alias: z.ZodOptional<z.ZodString>;
environment: z.ZodEnum<["production", "preview"]>;
production_branch: z.ZodOptional<z.ZodString>;
deployment_trigger: z.ZodOptional<z.ZodObject<{
metadata: z.ZodObject<{
/** Commit hash of the deployment trigger metadata for the pages project */
commit_hash: z.ZodString;
}, "strip", z.ZodTypeAny, {
commit_hash: string;
}, {
commit_hash: string;
}>;
}, "strip", z.ZodTypeAny, {
metadata: {
commit_hash: string;
};
}, {
metadata: {
commit_hash: string;
};
}>>;
}>, "strip", z.ZodTypeAny, {
type: "pages-deploy-detailed";
environment: "production" | "preview";
version: 1;
pages_project: string | null;
deployment_id: string | null;
url?: string | undefined;
alias?: string | undefined;
production_branch?: string | undefined;
deployment_trigger?: {
metadata: {
commit_hash: string;
};
} | undefined;
}, {
type: "pages-deploy-detailed";
environment: "production" | "preview";
version: 1;
pages_project: string | null;
deployment_id: string | null;
url?: string | undefined;
alias?: string | undefined;
production_branch?: string | undefined;
deployment_trigger?: {
metadata: {
commit_hash: string;
};
} | undefined;
}>;
export type OutputEntryDeployment = z.infer<typeof OutputEntryDeployment>;
declare const OutputEntryDeployment: z.ZodObject<z.objectUtil.extendShape<{
version: z.ZodLiteral<1>;
type: z.ZodString;
}, {
type: z.ZodLiteral<"deploy">;
/** A list of URLs that represent the HTTP triggers associated with this deployment */
/** basically, for wrangler-action purposes this is the deployment urls */
targets: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}>, "strip", z.ZodTypeAny, {
type: "deploy";
version: 1;
targets?: string[] | undefined;
}, {
type: "deploy";
version: 1;
targets?: string[] | undefined;
}>;
export type OutputEntryVersionUpload = z.infer<typeof OutputEntryVersionUpload>;
declare const OutputEntryVersionUpload: z.ZodObject<z.objectUtil.extendShape<{
version: z.ZodLiteral<1>;
type: z.ZodString;
}, {
type: z.ZodLiteral<"version-upload">;
/** The preview URL associated with this version upload */
preview_url: z.ZodOptional<z.ZodString>;
}>, "strip", z.ZodTypeAny, {
type: "version-upload";
version: 1;
preview_url?: string | undefined;
}, {
type: "version-upload";
version: 1;
preview_url?: string | undefined;
}>;
export type SupportedOutputEntry = z.infer<typeof SupportedOutputEntry>;
declare const SupportedOutputEntry: z.ZodDiscriminatedUnion<"type", [z.ZodObject<z.objectUtil.extendShape<{
version: z.ZodLiteral<1>;
type: z.ZodString;
}, {
type: z.ZodLiteral<"pages-deploy-detailed">;
pages_project: z.ZodNullable<z.ZodString>;
deployment_id: z.ZodNullable<z.ZodString>;
url: z.ZodOptional<z.ZodString>;
alias: z.ZodOptional<z.ZodString>;
environment: z.ZodEnum<["production", "preview"]>;
production_branch: z.ZodOptional<z.ZodString>;
deployment_trigger: z.ZodOptional<z.ZodObject<{
metadata: z.ZodObject<{
/** Commit hash of the deployment trigger metadata for the pages project */
commit_hash: z.ZodString;
}, "strip", z.ZodTypeAny, {
commit_hash: string;
}, {
commit_hash: string;
}>;
}, "strip", z.ZodTypeAny, {
metadata: {
commit_hash: string;
};
}, {
metadata: {
commit_hash: string;
};
}>>;
}>, "strip", z.ZodTypeAny, {
type: "pages-deploy-detailed";
environment: "production" | "preview";
version: 1;
pages_project: string | null;
deployment_id: string | null;
url?: string | undefined;
alias?: string | undefined;
production_branch?: string | undefined;
deployment_trigger?: {
metadata: {
commit_hash: string;
};
} | undefined;
}, {
type: "pages-deploy-detailed";
environment: "production" | "preview";
version: 1;
pages_project: string | null;
deployment_id: string | null;
url?: string | undefined;
alias?: string | undefined;
production_branch?: string | undefined;
deployment_trigger?: {
metadata: {
commit_hash: string;
};
} | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{
version: z.ZodLiteral<1>;
type: z.ZodString;
}, {
type: z.ZodLiteral<"deploy">;
/** A list of URLs that represent the HTTP triggers associated with this deployment */
/** basically, for wrangler-action purposes this is the deployment urls */
targets: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}>, "strip", z.ZodTypeAny, {
type: "deploy";
version: 1;
targets?: string[] | undefined;
}, {
type: "deploy";
version: 1;
targets?: string[] | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{
version: z.ZodLiteral<1>;
type: z.ZodString;
}, {
type: z.ZodLiteral<"version-upload">;
/** The preview URL associated with this version upload */
preview_url: z.ZodOptional<z.ZodString>;
}>, "strip", z.ZodTypeAny, {
type: "version-upload";
version: 1;
preview_url?: string | undefined;
}, {
type: "version-upload";
version: 1;
preview_url?: string | undefined;
}>]>;
/**
* Parses file names in a directory to find wrangler artifact files
*
* @param artifactDirectory
* @returns All artifact files from the directory
*/
export declare function getWranglerArtifacts(artifactDirectory: string): Promise<string[]>;
/**
* Searches for a supported wrangler OutputEntry
*
* @param artifactDirectory
* @returns The first SupportedOutputEntry found within a wrangler artifact directory
*/
export declare function getOutputEntry(artifactDirectory: string): Promise<SupportedOutputEntry | null>;
export {};
+1
View File
@@ -0,0 +1 @@
export {};
-39
View File
@@ -1,39 +0,0 @@
#!/bin/sh
set -e
export HOME="/github/workspace"
export NVM_DIR="/github/workspace/nvm"
export WRANGLER_HOME="/github/workspace"
# h/t https://github.com/elgohr/Publish-Docker-Github-Action
sanitize() {
if [ -z "${1}" ]
then
>&2 echo "Unable to find ${2}. Did you add a GitHub secret called key ${2}, and pass in secrets.${2} in your workflow?"
exit 1
fi
}
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
mkdir -p "$HOME/.wrangler"
chmod -R 770 "$HOME/.wrangler"
sanitize "${INPUT_EMAIL}" "email"
sanitize "${INPUT_APIKEY}" "apiKey"
export CF_EMAIL="$INPUT_EMAIL"
export CF_API_KEY="$INPUT_APIKEY"
npm i @cloudflare/wrangler -g
if [ -z "$INPUT_ENVIRONMENT" ]
then
wrangler publish
else
wrangler publish -e "$INPUT_ENVIRONMENT"
fi
+3413
View File
File diff suppressed because it is too large Load Diff
+52
View File
@@ -0,0 +1,52 @@
{
"name": "wrangler-action",
"version": "3.13.1",
"description": "GitHub Action to use [Wrangler](https://developers.cloudflare.com/workers/cli-wrangler/).",
"author": "wrangler@cloudflare.com",
"license": "MIT OR Apache-2.0",
"bugs": {
"url": "https://github.com/cloudflare/wrangler-action/issues"
},
"homepage": "https://github.com/cloudflare/wrangler-action#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/cloudflare/wrangler-action.git"
},
"keywords": [
"script",
"cli",
"serverless",
"cloudflare",
"cloudflare-workers",
"typescript"
],
"type": "module",
"main": "dist/index.mjs",
"scripts": {
"build": "npx ncc build ./src/index.ts && mv ./dist/index.js ./dist/index.mjs",
"test": "vitest",
"format": "prettier --write .",
"check": "prettier --check ."
},
"dependencies": {
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.12",
"@cloudflare/workers-types": "^4.20241022.0",
"@types/mock-fs": "^4.13.4",
"@types/node": "^22.9.0",
"@types/semver": "^7.5.8",
"@vercel/ncc": "^0.38.2",
"mock-fs": "^5.4.1",
"msw": "^2.6.4",
"prettier": "^3.3.3",
"semver": "^7.6.3",
"typescript": "^5.6.3",
"vitest": "^2.1.9"
}
}
+180
View File
@@ -0,0 +1,180 @@
import { setOutput } from "@actions/core";
import { info, WranglerActionConfig } from "./wranglerAction";
import {
getOutputEntry,
OutputEntryDeployment,
OutputEntryPagesDeployment,
OutputEntryVersionUpload,
} from "./wranglerArtifactManager";
import { createGitHubDeploymentAndJobSummary } from "./service/github";
// fallback to trying to extract the deployment-url and pages-deployment-alias-url from stdout for wranglerVersion < 3.81.0
function extractDeploymentUrlsFromStdout(stdOut: string): {
deploymentUrl?: string;
aliasUrl?: string;
} {
let deploymentUrl = "";
let aliasUrl = "";
// Try to extract the deployment URL
const deploymentUrlMatch = stdOut.match(/https?:\/\/[a-zA-Z0-9-./]+/);
if (deploymentUrlMatch && deploymentUrlMatch[0]) {
deploymentUrl = deploymentUrlMatch[0].trim();
}
// And also try to extract the alias URL (since wrangler@3.78.0)
const aliasUrlMatch = stdOut.match(/alias URL: (https?:\/\/[a-zA-Z0-9-./]+)/);
if (aliasUrlMatch && aliasUrlMatch[1]) {
aliasUrl = aliasUrlMatch[1].trim();
}
return { deploymentUrl, aliasUrl };
}
async function handlePagesDeployOutputEntry(
config: WranglerActionConfig,
pagesDeployOutputEntry: OutputEntryPagesDeployment,
) {
setOutput("deployment-url", pagesDeployOutputEntry.url);
// DEPRECATED: deployment-alias-url in favour of pages-deployment-alias, drop in next wrangler-action major version change
setOutput("deployment-alias-url", pagesDeployOutputEntry.alias);
setOutput("pages-deployment-alias-url", pagesDeployOutputEntry.alias);
setOutput("pages-deployment-id", pagesDeployOutputEntry.deployment_id);
setOutput("pages-environment", pagesDeployOutputEntry.environment);
// Create github deployment, if GITHUB_TOKEN is present in config
await createGitHubDeploymentAndJobSummary(config, pagesDeployOutputEntry);
}
/**
* If no wrangler output file found, fallback to extracting deployment-url from stdout.
* @deprecated Use {@link handlePagesDeployOutputEntry} instead.
*/
function handlePagesDeployCommand(
config: WranglerActionConfig,
stdOut: string,
) {
info(
config,
"Unable to find a WRANGLER_OUTPUT_DIR, environment and id fields will be unavailable for output. Have you updated wrangler to version >=3.81.0?",
);
// DEPRECATED: deployment-alias-url in favour of pages-deployment-alias, drop in next wrangler-action major version change
const { deploymentUrl, aliasUrl } = extractDeploymentUrlsFromStdout(stdOut);
setOutput("deployment-url", deploymentUrl);
// DEPRECATED: deployment-alias-url in favour of pages-deployment-alias, drop in next wrangler-action major version change
setOutput("deployment-alias-url", aliasUrl);
setOutput("pages-deployment-alias-url", aliasUrl);
}
function handleWranglerDeployOutputEntry(
config: WranglerActionConfig,
wranglerDeployOutputEntry: OutputEntryDeployment,
) {
// If no deployment urls found in wrangler output file, log that we couldn't find any urls and return.
if (
!wranglerDeployOutputEntry.targets ||
wranglerDeployOutputEntry.targets.length === 0
) {
info(config, "No deployment-url found in wrangler deploy output file");
return;
}
// If more than 1 deployment url found, log that we're going to set deployment-url to the first match.
// In a future wrangler-action version we should consider how we're going to output multiple deployment-urls
if (wranglerDeployOutputEntry.targets.length > 1) {
info(
config,
"Multiple deployment urls found in wrangler deploy output file, deployment-url will be set to the first url",
);
}
setOutput("deployment-url", wranglerDeployOutputEntry.targets[0]);
}
/**
* If no wrangler output file found, fallback to extracting deployment-url from stdout.
* @deprecated Use {@link handleWranglerDeployOutputEntry} instead.
*/
function handleWranglerDeployCommand(
config: WranglerActionConfig,
stdOut: string,
) {
info(
config,
"Unable to find a WRANGLER_OUTPUT_DIR, deployment-url may have an unreliable output. Have you updated wrangler to version >=3.88.0?",
);
const { deploymentUrl } = extractDeploymentUrlsFromStdout(stdOut);
setOutput("deployment-url", deploymentUrl);
}
function handleVersionsUploadOutputEntry(
versionsOutputEntry: OutputEntryVersionUpload,
) {
setOutput("deployment-url", versionsOutputEntry.preview_url);
}
/**
* If no wrangler output file found, log a message stating deployment-url will be unavailable for output.
* @deprecated Use {@link handleVersionsOutputEntry} instead.
*/
function handleVersionsOutputCommand(config: WranglerActionConfig) {
info(
config,
"Unable to find a WRANGLER_OUTPUT_DIR, deployment-url will be unavailable for output. Have you updated wrangler to version >=3.88.0?",
);
}
function handleDeprectatedStdoutParsing(
config: WranglerActionConfig,
command: string,
stdOut: string,
) {
// Check if this command is a pages deployment
if (
command.startsWith("pages deploy") ||
command.startsWith("pages publish")
) {
handlePagesDeployCommand(config, stdOut);
return;
}
// Check if this command is a workers deployment
if (command.startsWith("deploy") || command.startsWith("publish")) {
handleWranglerDeployCommand(config, stdOut);
return;
}
// Check if this command is a versions deployment
if (command.startsWith("versions upload")) {
handleVersionsOutputCommand(config);
return;
}
}
export async function handleCommandOutputParsing(
config: WranglerActionConfig,
command: string,
stdOut: string,
) {
// get first OutputEntry found within wrangler artifact output directory
const outputEntry = await getOutputEntry(config.WRANGLER_OUTPUT_DIR);
if (outputEntry === null) {
// if no outputEntry found, fallback to deprecated stdOut parsing
handleDeprectatedStdoutParsing(config, command, stdOut);
return;
}
switch (outputEntry.type) {
case "pages-deploy-detailed":
await handlePagesDeployOutputEntry(config, outputEntry);
break;
case "deploy":
handleWranglerDeployOutputEntry(config, outputEntry);
break;
case "version-upload":
handleVersionsUploadOutputEntry(outputEntry);
break;
}
}
+54
View File
@@ -0,0 +1,54 @@
import {
exec as _childProcessExec,
type ExecException,
} from "node:child_process";
import { EOL } from "node:os";
import { promisify } from "node:util";
export { exec } from "@actions/exec";
const childProcessExec = promisify(_childProcessExec);
type ExecAsyncException = ExecException & {
stderr: string;
stdout: string;
};
function isExecAsyncException(err: unknown): err is ExecAsyncException {
return err instanceof Error && "code" in err && "stderr" in err;
}
export async function execShell(
command: string,
{
silent = false,
...options
}: Parameters<typeof childProcessExec>[1] & { silent?: boolean } = {},
) {
if (!silent) {
process.stdout.write("[command]" + command + EOL);
}
try {
const promise = childProcessExec(command, {
...options,
});
const { child } = promise;
if (!silent) {
child.stdout?.on("data", (data: Buffer) => process.stdout.write(data));
child.stderr?.on("data", (data: Buffer) => process.stderr.write(data));
}
await promise;
return child.exitCode;
} catch (err) {
if (isExecAsyncException(err)) {
process.stderr.write(err.stderr);
throw new Error(`Process failed with exit code ${err.code}`);
}
throw err;
}
}
Executable
+36
View File
@@ -0,0 +1,36 @@
import { getBooleanInput, getInput, getMultilineInput } from "@actions/core";
import { tmpdir } from "os";
import { join } from "path";
import { getPackageManager } from "./packageManagers";
import { checkWorkingDirectory } from "./utils";
import { main, WranglerActionConfig } from "./wranglerAction";
const DEFAULT_WRANGLER_VERSION = "3.90.0";
/**
* 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-${crypto.randomUUID()}`,
)}`,
GITHUB_TOKEN: getInput("gitHubToken", { required: false }),
} as const;
const packageManager = getPackageManager(config.PACKAGE_MANAGER, {
workingDirectory: config.workingDirectory,
});
main(config, packageManager);
+110
View File
@@ -0,0 +1,110 @@
import { describe, expect, test } from "vitest";
import { getPackageManager } from "./packageManagers";
describe("getPackageManager", () => {
test("should use provided value instead of inferring from lockfile", () => {
expect(
getPackageManager("npm", { workingDirectory: "src/test/fixtures/npm" }),
).toMatchInlineSnapshot(`
{
"exec": "npx",
"execNoInstall": "npx --no-install",
"install": "npm i",
}
`);
expect(
getPackageManager("yarn", { workingDirectory: "src/test/fixtures/npm" }),
).toMatchInlineSnapshot(`
{
"exec": "yarn",
"execNoInstall": "yarn",
"install": "yarn add",
}
`);
expect(
getPackageManager("pnpm", { workingDirectory: "src/test/fixtures/npm" }),
).toMatchInlineSnapshot(`
{
"exec": "pnpm exec",
"execNoInstall": "pnpm exec",
"install": "pnpm add",
}
`);
expect(
getPackageManager("bun", { workingDirectory: "src/test/fixtures/bun" }),
).toMatchInlineSnapshot(`
{
"exec": "bunx",
"execNoInstall": "bun run",
"install": "bun i",
}
`);
});
test("should use npm if no value provided and package-lock.json exists", () => {
expect(getPackageManager("", { workingDirectory: "src/test/fixtures/npm" }))
.toMatchInlineSnapshot(`
{
"exec": "npx",
"execNoInstall": "npx --no-install",
"install": "npm i",
}
`);
});
test("should use yarn if no value provided and yarn.lock exists", () => {
expect(
getPackageManager("", { workingDirectory: "src/test/fixtures/yarn" }),
).toMatchInlineSnapshot(`
{
"exec": "yarn",
"execNoInstall": "yarn",
"install": "yarn add",
}
`);
});
test("should use pnpm if no value provided and pnpm-lock.yaml exists", () => {
expect(
getPackageManager("", { workingDirectory: "src/test/fixtures/pnpm" }),
).toMatchInlineSnapshot(`
{
"exec": "pnpm exec",
"execNoInstall": "pnpm exec",
"install": "pnpm add",
}
`);
});
test("should use bun if no value provided and bun.lockb exists", () => {
expect(getPackageManager("", { workingDirectory: "src/test/fixtures/bun" }))
.toMatchInlineSnapshot(`
{
"exec": "bunx",
"execNoInstall": "bun run",
"install": "bun i",
}
`);
});
test("should use npm if no value provided and no lockfile is present", () => {
expect(
getPackageManager("", { workingDirectory: "src/test/fixtures/empty" }),
).toMatchInlineSnapshot(`
{
"exec": "npx",
"execNoInstall": "npx --no-install",
"install": "npm i",
}
`);
});
test("should throw if an invalid value is provided", () => {
expect(() =>
getPackageManager("cargo", { workingDirectory: "src/test/fixtures/npm" }),
).toThrowError();
});
});
+76
View File
@@ -0,0 +1,76 @@
import { existsSync } from "node:fs";
import * as path from "node:path";
export interface PackageManager {
install: string;
exec: string;
execNoInstall: string;
}
const PACKAGE_MANAGERS = {
npm: {
install: "npm i",
exec: "npx",
execNoInstall: "npx --no-install",
},
yarn: {
install: "yarn add",
exec: "yarn",
execNoInstall: "yarn",
},
pnpm: {
install: "pnpm add",
exec: "pnpm exec",
execNoInstall: "pnpm exec",
},
bun: {
install: "bun i",
exec: "bunx",
execNoInstall: "bun run",
},
} as const satisfies Readonly<Record<string, PackageManager>>;
type PackageManagerValue = keyof typeof PACKAGE_MANAGERS;
function detectPackageManager(
workingDirectory = ".",
): PackageManagerValue | null {
if (existsSync(path.join(workingDirectory, "package-lock.json"))) {
return "npm";
}
if (existsSync(path.join(workingDirectory, "yarn.lock"))) {
return "yarn";
}
if (existsSync(path.join(workingDirectory, "pnpm-lock.yaml"))) {
return "pnpm";
}
if (
existsSync(path.join(workingDirectory, "bun.lockb")) ||
existsSync(path.join(workingDirectory, "bun.lock"))
) {
return "bun";
}
return null;
}
function assertValidPackageManagerValue(
name: string,
): asserts name is PackageManagerValue | "" {
if (name && !Object.keys(PACKAGE_MANAGERS).includes(name)) {
throw new TypeError(
`invalid value provided for "packageManager": ${name}
Value must be one of: [${Object.keys(PACKAGE_MANAGERS).join(", ")}]`,
);
}
}
export function getPackageManager(
name: string,
{ workingDirectory = "." }: { workingDirectory?: string } = {},
) {
assertValidPackageManagerValue(name);
return PACKAGE_MANAGERS[
name || detectPackageManager(workingDirectory) || "npm"
];
}
+59
View File
@@ -0,0 +1,59 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { setupServer } from "msw/node";
import { createGitHubDeployment, createJobSummary } from "./github";
import { getOctokit } from "@actions/github";
import { mockGithubDeployments } from "../test/mocks";
import { getTestConfig } from "../test/test-utils";
import mockfs from "mock-fs";
import { readFile } from "fs/promises";
afterEach(() => {
mockfs.restore();
});
describe("github", () => {
it("Calls createGitHubDeployment successfully", async () => {
const githubUser = "mock-user";
const githubRepoName = "wrangler-action";
const server = setupServer(
...mockGithubDeployments({ githubUser, githubRepoName }).handlers,
);
server.listen({ onUnhandledRequest: "error" });
vi.stubEnv("GITHUB_REPOSITORY", `${githubUser}/${githubRepoName}`);
const testConfig = getTestConfig();
const octokit = getOctokit(testConfig.GITHUB_TOKEN, { request: fetch });
await createGitHubDeployment({
config: testConfig,
octokit,
productionBranch: "production-branch",
deploymentId: "fake-deployment-id",
projectName: "fake-project-name",
deploymentUrl: "https://fake-deployment-url.com",
environment: "production",
});
server.close();
});
it("Calls createJobSummary successfully", async () => {
vi.stubEnv("GITHUB_STEP_SUMMARY", "summary");
mockfs({
summary: mockfs.file(),
});
await createJobSummary({
commitHash: "fake-commit-hash",
deploymentUrl: "https://fake-deployment-url.com",
aliasUrl: "https://fake-alias-url.com",
});
expect((await readFile("summary")).toString()).toMatchInlineSnapshot(`
"
# Deploying with Cloudflare Pages
| Name | Result |
| ----------------------- | - |
| **Last commit:** | fake-commit-hash |
| **Preview URL**: | https://fake-deployment-url.com |
| **Branch Preview URL**: | https://fake-alias-url.com |
"
`);
});
});
+128
View File
@@ -0,0 +1,128 @@
import { summary } from "@actions/core";
import { context, getOctokit } from "@actions/github";
import { env } from "process";
import { info, warn } from "../utils";
import { OutputEntryPagesDeployment } from "../wranglerArtifactManager";
import { WranglerActionConfig } from "../wranglerAction";
type Octokit = ReturnType<typeof getOctokit>;
export async function createGitHubDeployment({
config,
octokit,
productionBranch,
environment,
deploymentId,
projectName,
deploymentUrl,
}: {
config: WranglerActionConfig;
octokit: Octokit;
productionBranch: string;
environment: string;
deploymentId: string | null;
projectName: string;
deploymentUrl?: string;
}) {
const githubBranch = env.GITHUB_HEAD_REF || env.GITHUB_REF_NAME;
const productionEnvironment = githubBranch === productionBranch;
const deployment = await octokit.rest.repos.createDeployment({
owner: context.repo.owner,
repo: context.repo.repo,
ref: githubBranch || context.ref,
auto_merge: false,
description: "Cloudflare Pages",
required_contexts: [],
environment,
production_environment: productionEnvironment,
});
if (deployment.status !== 201) {
info(config, "Error creating GitHub deployment");
return;
}
await octokit.rest.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: deployment.data.id,
environment,
environment_url: deploymentUrl,
production_environment: productionEnvironment,
// don't have project_name or deployment_id I think
log_url: `https://dash.cloudflare.com/${config.CLOUDFLARE_ACCOUNT_ID}/pages/view/${projectName}/${deploymentId}`,
description: "Cloudflare Pages",
state: "success",
auto_inactive: false,
});
}
export async function createJobSummary({
commitHash,
deploymentUrl,
aliasUrl,
}: {
commitHash: string;
deploymentUrl?: string;
aliasUrl?: string;
}) {
await summary
.addRaw(
`
# Deploying with Cloudflare Pages
| Name | Result |
| ----------------------- | - |
| **Last commit:** | ${commitHash} |
| **Preview URL**: | ${deploymentUrl} |
| **Branch Preview URL**: | ${aliasUrl} |
`,
)
.write();
}
/**
* Create github deployment, if GITHUB_TOKEN is present in config
*/
export async function createGitHubDeploymentAndJobSummary(
config: WranglerActionConfig,
pagesArtifactFields: OutputEntryPagesDeployment,
) {
if (
config.GITHUB_TOKEN &&
pagesArtifactFields.production_branch &&
pagesArtifactFields.pages_project &&
pagesArtifactFields.deployment_trigger
) {
const octokit = getOctokit(config.GITHUB_TOKEN);
const [createGitHubDeploymentRes, createJobSummaryRes] =
await Promise.allSettled([
createGitHubDeployment({
config,
octokit,
deploymentUrl: pagesArtifactFields.url,
productionBranch: pagesArtifactFields.production_branch,
environment: pagesArtifactFields.environment,
deploymentId: pagesArtifactFields.deployment_id,
projectName: pagesArtifactFields.pages_project,
}),
createJobSummary({
commitHash:
pagesArtifactFields.deployment_trigger.metadata.commit_hash.substring(
0,
8,
),
deploymentUrl: pagesArtifactFields.url,
aliasUrl: pagesArtifactFields.alias,
}),
]);
if (createGitHubDeploymentRes.status === "rejected") {
warn(config, "Creating Github Deployment failed");
}
if (createJobSummaryRes.status === "rejected") {
warn(config, "Creating Github Job summary failed");
}
}
}
+25
View File
@@ -0,0 +1,25 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
export default {
fetch(request: Request, env: Env) {
const url = new URL(request.url);
if (url.pathname === "/secret-health-check") {
const { SECRET1, SECRET2 } = env;
if (SECRET1 !== "SECRET_1_VALUE" || SECRET2 !== "SECRET_2_VALUE") {
throw new Error("SECRET1 or SECRET2 is not defined");
}
return new Response("OK");
}
return Response.json({
...request,
headers: Object.fromEntries(request.headers),
});
},
};
+10
View File
@@ -0,0 +1,10 @@
{
"name": "wrangler-action-test",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "wrangler-action-test"
}
}
}
+5
View File
@@ -0,0 +1,5 @@
{
"name": "wrangler-action-test",
"license": "MIT",
"private": true
}
+4
View File
@@ -0,0 +1,4 @@
name = "wrangler-action-test-build-quiet"
main = "./index.ts"
compatibility_date = "2023-07-07"
workers_dev = true
View File
+25
View File
@@ -0,0 +1,25 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
export default {
fetch(request: Request, env: Env) {
const url = new URL(request.url);
if (url.pathname === "/secret-health-check") {
const { SECRET1, SECRET2 } = env;
if (SECRET1 !== "SECRET_1_VALUE" || SECRET2 !== "SECRET_2_VALUE") {
throw new Error("SECRET1 or SECRET2 is not defined");
}
return new Response("OK");
}
return Response.json({
...request,
headers: Object.fromEntries(request.headers),
});
},
};
+5
View File
@@ -0,0 +1,5 @@
{
"name": "wrangler-action-bun-test",
"license": "MIT",
"private": true
}
+4
View File
@@ -0,0 +1,4 @@
name = "wrangler-action-test"
main = "./index.ts"
compatibility_date = "2023-07-07"
workers_dev = true
+20
View File
@@ -0,0 +1,20 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
export default {
fetch(request: Request, env: Env) {
const url = new URL(request.url);
if (url.pathname === "/secret") {
const { SECRET1 = "", SECRET2 = "" } = env;
return new Response(`${SECRET1} ${SECRET2}`);
}
return Response.json({
...request,
headers: Object.fromEntries(request.headers),
});
},
};
+10
View File
@@ -0,0 +1,10 @@
{
"name": "wrangler-action-environment-test",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "wrangler-action-environment-test"
}
}
}
+5
View File
@@ -0,0 +1,5 @@
{
"name": "wrangler-action-environment-test",
"license": "MIT",
"private": true
}
+9
View File
@@ -0,0 +1,9 @@
name = "wrangler-action-environment-test"
main = "./index.ts"
compatibility_date = "2023-07-07"
workers_dev = true
[env.dev]
name = "wrangler-action-dev-environment-test"
[env.dev.vars]
DEV_VAR = "example_production_token"
+25
View File
@@ -0,0 +1,25 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
export default {
fetch(request: Request, env: Env) {
const url = new URL(request.url);
if (url.pathname === "/secret-health-check") {
const { SECRET1, SECRET2 } = env;
if (SECRET1 !== "SECRET_1_VALUE" || SECRET2 !== "SECRET_2_VALUE") {
throw new Error("SECRET1 or SECRET2 is not defined");
}
return new Response("OK");
}
return Response.json({
...request,
headers: Object.fromEntries(request.headers),
});
},
};
+10
View File
@@ -0,0 +1,10 @@
{
"name": "wrangler-action-npm-test",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "wrangler-action-npm-test"
}
}
}
+3
View File
@@ -0,0 +1,3 @@
{
"name": "wrangler-action-npm-test"
}
+4
View File
@@ -0,0 +1,4 @@
name = "wrangler-action-test"
main = "./index.ts"
compatibility_date = "2023-07-07"
workers_dev = true
+25
View File
@@ -0,0 +1,25 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
export default {
fetch(request: Request, env: Env) {
const url = new URL(request.url);
if (url.pathname === "/secret-health-check") {
const { SECRET1, SECRET2 } = env;
if (SECRET1 !== "SECRET_1_VALUE" || SECRET2 !== "SECRET_2_VALUE") {
throw new Error("SECRET1 or SECRET2 is not defined");
}
return new Response("OK");
}
return Response.json({
...request,
headers: Object.fromEntries(request.headers),
});
},
};
+10
View File
@@ -0,0 +1,10 @@
{
"name": "wrangler-action-test",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "wrangler-action-test"
}
}
}
+5
View File
@@ -0,0 +1,5 @@
{
"name": "wrangler-action-test",
"license": "MIT",
"private": true
}
+4
View File
@@ -0,0 +1,4 @@
name = "wrangler-action-test-only-build"
main = "./index.ts"
compatibility_date = "2023-07-07"
workers_dev = true
+25
View File
@@ -0,0 +1,25 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
export default {
fetch(request: Request, env: Env) {
const url = new URL(request.url);
if (url.pathname === "/secret-health-check") {
const { SECRET1, SECRET2 } = env;
if (SECRET1 !== "SECRET_1_VALUE" || SECRET2 !== "SECRET_2_VALUE") {
throw new Error("SECRET1 or SECRET2 is not defined");
}
return new Response("OK");
}
return Response.json({
...request,
headers: Object.fromEntries(request.headers),
});
},
};
+5
View File
@@ -0,0 +1,5 @@
{
"name": "wrangler-action-pnpm-test",
"license": "MIT",
"private": true
}
+5
View File
@@ -0,0 +1,5 @@
lockfileVersion: '6.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
+4
View File
@@ -0,0 +1,4 @@
name = "wrangler-action-test"
main = "./index.ts"
compatibility_date = "2023-07-07"
workers_dev = true
+25
View File
@@ -0,0 +1,25 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
export default {
fetch(request: Request, env: Env) {
const url = new URL(request.url);
if (url.pathname === "/secret-health-check") {
const { SECRET1, SECRET2 } = env;
if (SECRET1 !== "SECRET_1_VALUE" || SECRET2 !== "SECRET_2_VALUE") {
throw new Error("SECRET1 or SECRET2 is not defined");
}
return new Response("OK");
}
return Response.json({
...request,
headers: Object.fromEntries(request.headers),
});
},
};
@@ -0,0 +1,18 @@
#!/usr/bin/env node
"use strict";
const args = Array.from(process.argv);
const command = args.pop();
switch (command) {
case "--version":
console.log(`
⛅️ wrangler 1.1.1 (update available 1.2.3)
------------------------------------------`);
process.exit(0);
case "action-test":
console.log("Test successful.");
process.exit(0);
default:
console.error("Invalid command");
process.exit(1);
}
@@ -0,0 +1,7 @@
{
"private": true,
"name": "wrangler",
"version": "1.1.1",
"main": "index.js",
"bin": "index.js"
}
+30
View File
@@ -0,0 +1,30 @@
{
"name": "wrangler-action-pre-installed-wrangler-test",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "wrangler-action-pre-installed-wrangler-test",
"license": "MIT",
"devDependencies": {
"wrangler": "file:mock_packages/wrangler"
}
},
"mock_packages/wrangler": {
"version": "1.1.1",
"dev": true,
"bin": {
"wrangler": "index.js"
}
},
"node_modules/wrangler": {
"resolved": "mock_packages/wrangler",
"link": true
}
},
"dependencies": {
"wrangler": {
"version": "file:mock_packages/wrangler"
}
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"name": "wrangler-action-pre-installed-wrangler-test",
"license": "MIT",
"private": true,
"devDependencies": {
"wrangler": "file:mock_packages/wrangler"
}
}
+25
View File
@@ -0,0 +1,25 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
export default {
fetch(request: Request, env: Env) {
const url = new URL(request.url);
if (url.pathname === "/secret-health-check") {
const { SECRET1, SECRET2 } = env;
if (SECRET1 !== "SECRET_1_VALUE" || SECRET2 !== "SECRET_2_VALUE") {
throw new Error("SECRET1 or SECRET2 is not defined");
}
return new Response("OK");
}
return Response.json({
...request,
headers: Object.fromEntries(request.headers),
});
},
};
+10
View File
@@ -0,0 +1,10 @@
{
"name": "wrangler-action-test",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "wrangler-action-test"
}
}
}
+5
View File
@@ -0,0 +1,5 @@
{
"name": "wrangler-action-test",
"license": "MIT",
"private": true
}
+4
View File
@@ -0,0 +1,4 @@
name = "wrangler-action-test-secrets-default"
main = "./index.ts"
compatibility_date = "2023-07-07"
workers_dev = true
+25
View File
@@ -0,0 +1,25 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
export default {
fetch(request: Request, env: Env) {
const url = new URL(request.url);
if (url.pathname === "/secret-health-check") {
const { SECRET1, SECRET2 } = env;
if (SECRET1 !== "SECRET_1_VALUE" || SECRET2 !== "SECRET_2_VALUE") {
throw new Error("SECRET1 or SECRET2 is not defined");
}
return new Response("OK");
}
return Response.json({
...request,
headers: Object.fromEntries(request.headers),
});
},
};
+10
View File
@@ -0,0 +1,10 @@
{
"name": "wrangler-action-test",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "wrangler-action-test"
}
}
}
+5
View File
@@ -0,0 +1,5 @@
{
"name": "wrangler-action-test",
"license": "MIT",
"private": true
}
+4
View File
@@ -0,0 +1,4 @@
name = "wrangler-action-test-secrets-v2"
main = "./index.ts"
compatibility_date = "2023-07-07"
workers_dev = true
+1
View File
@@ -0,0 +1 @@
export default {};
@@ -0,0 +1,5 @@
{
"name": "wrangler-action-detect-package-manager-test",
"license": "MIT",
"private": true
}
@@ -0,0 +1,4 @@
name = "wrangler-action-test-specify-package-manager"
main = "./index.ts"
compatibility_date = "2023-07-07"
workers_dev = true
@@ -0,0 +1 @@
export default {};
@@ -0,0 +1,5 @@
{
"name": "wrangler-action-detect-package-manager-test",
"license": "MIT",
"private": true
}
@@ -0,0 +1,4 @@
name = "wrangler-action-test-unspecified-package-manager"
main = "./index.ts"
compatibility_date = "2023-07-07"
workers_dev = true
+25
View File
@@ -0,0 +1,25 @@
type Env = {
SECRET1?: string;
SECRET2?: string;
};
export default {
fetch(request: Request, env: Env) {
const url = new URL(request.url);
if (url.pathname === "/secret-health-check") {
const { SECRET1, SECRET2 } = env;
if (SECRET1 !== "SECRET_1_VALUE" || SECRET2 !== "SECRET_2_VALUE") {
throw new Error("SECRET1 or SECRET2 is not defined");
}
return new Response("OK");
}
return Response.json({
...request,
headers: Object.fromEntries(request.headers),
});
},
};

Some files were not shown because too many files have changed in this diff Show More