{"id":13726854,"url":"https://github.com/cloudflare/wrangler-action","last_synced_at":"2025-10-23T13:41:17.695Z","repository":{"id":37561599,"uuid":"213471363","full_name":"cloudflare/wrangler-action","owner":"cloudflare","description":"🧙‍♀️ easily deploy cloudflare workers applications using wrangler and github actions","archived":false,"fork":false,"pushed_at":"2025-03-15T02:01:34.000Z","size":24119,"stargazers_count":1456,"open_issues_count":23,"forks_count":178,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-04-30T10:37:28.134Z","etag":null,"topics":["cloudflare","cloudflare-workers","github-actions","wrangler"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudflare.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-07T19:42:01.000Z","updated_at":"2025-04-30T09:09:35.000Z","dependencies_parsed_at":"2024-02-19T09:53:02.014Z","dependency_job_id":"a87c08a2-a5b5-4db0-84ab-bd54b3ef4a06","html_url":"https://github.com/cloudflare/wrangler-action","commit_stats":{"total_commits":239,"total_committers":46,"mean_commits":5.195652173913044,"dds":0.8368200836820083,"last_synced_commit":"d5031c3dbe9d5d1da55af39b63510d22d31fb202"},"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fwrangler-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fwrangler-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fwrangler-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fwrangler-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudflare","download_url":"https://codeload.github.com/cloudflare/wrangler-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254040323,"owners_count":22004506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudflare","cloudflare-workers","github-actions","wrangler"],"created_at":"2024-08-03T01:03:27.541Z","updated_at":"2025-10-23T13:41:17.551Z","avatar_url":"https://github.com/cloudflare.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Official","Developer Tools","Shell"],"sub_categories":["CLI \u0026 Development"],"readme":"# Wrangler GitHub Action\n\nEasy-to-use GitHub Action to use [Wrangler](https://developers.cloudflare.com/workers/cli-wrangler/). Makes deploying Workers a breeze.\n\n## Big Changes in v3\n\n- Wrangler v1 is no longer supported.\n- Global API key \u0026 Email Auth no longer supported\n- 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.\n\n[Refer to Changelog for more information](CHANGELOG.md).\n\n## Usage\n\nAdd `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:\n\n```yaml\nname: Deploy\n\non:\n  push:\n    branches:\n      - main\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    name: Deploy\n    steps:\n      - uses: actions/checkout@v4\n      - name: Deploy\n        uses: cloudflare/wrangler-action@v3\n        with:\n          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n```\n\n## Authentication\n\nYou'll need to configure Wrangler using GitHub's Secrets feature - go to \"Settings -\u003e 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!\n\nWith 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`:\n\n```yaml\njobs:\n  deploy:\n    name: Deploy\n    steps:\n      uses: cloudflare/wrangler-action@v3\n      with:\n        apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n```\n\n## Configuration\n\nIf 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`:\n\n```yaml\njobs:\n  deploy:\n    steps:\n      uses: cloudflare/wrangler-action@v3\n      with:\n        apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n        wranglerVersion: \"2.20.0\"\n```\n\nOptionally, 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.\n\n```yaml\njobs:\n  deploy:\n    steps:\n      uses: cloudflare/wrangler-action@v3\n      with:\n        apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n        workingDirectory: \"subfoldername\"\n```\n\n[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.\n\n```yaml\njobs:\n  deploy:\n    steps:\n      uses: cloudflare/wrangler-action@v3\n      with:\n        apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n        environment: production\n        secrets: |\n          SECRET1\n          SECRET2\n      env:\n        SECRET1: ${{ secrets.SECRET1 }}\n        SECRET2: ${{ secrets.SECRET2 }}\n```\n\nIf 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.\n\n```yaml\njobs:\n  deploy:\n    steps:\n      uses: cloudflare/wrangler-action@v3\n      with:\n        apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n        preCommands: echo \"*** pre command ***\"\n        postCommands: |\n          echo \"*** post commands ***\"\n          wrangler kv:key put --binding=MY_KV key2 value2\n          echo \"******\"\n```\n\nYou can use the `command` option to do specific actions such as running `wrangler whoami` against your project:\n\n```yaml\njobs:\n  deploy:\n    steps:\n      uses: cloudflare/wrangler-action@v3\n      with:\n        apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n        command: whoami\n```\n\nYou can also add a command that spans multiple lines:\n\n```yaml\njobs:\n  deploy:\n    steps:\n      uses: cloudflare/wrangler-action@v3\n      with:\n        apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n        command: |\n          pages project list\n          pages deploy .vercel/output/static --project-name=demo-actions --branch=test\n```\n\n## Use cases\n\n### Deploy when commits are merged to main\n\nThe 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`:\n\n```yaml\non:\n  push:\n    branches:\n      - main\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    name: Deploy\n    steps:\n      - uses: actions/checkout@v4\n      - name: Deploy\n        uses: cloudflare/wrangler-action@v3\n        with:\n          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n```\n\nNote 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).\n\n### Deploy your Pages site (production \u0026 preview)\n\nIf 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:\n\n```yaml\non: [push]\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    name: Deploy\n    permissions:\n      contents: read\n      deployments: write\n    steps:\n      - uses: actions/checkout@v4\n      - name: Deploy\n        uses: cloudflare/wrangler-action@v3\n        with:\n          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}\n          command: pages deploy YOUR_DIST_FOLDER --project-name=example\n          # Optional: Enable this if you want to have GitHub Deployments triggered\n          gitHubToken: ${{ secrets.GITHUB_TOKEN }}\n```\n\n### Deploying on a schedule\n\nIf 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:\n\n```yaml\non:\n  schedule:\n    - cron: \"0 * * * *\"\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    name: Deploy\n    steps:\n      - uses: actions/checkout@v4\n      - name: Deploy app\n        uses: cloudflare/wrangler-action@v3\n        with:\n          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n```\n\nIf 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.\n\n### Manually triggering a deployment\n\nIf 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:\n\n```yaml\non:\n  workflow_dispatch:\n    inputs:\n      environment:\n        description: \"Choose an environment to deploy to: \u003cdev|staging|prod\u003e\"\n        required: true\n        default: \"dev\"\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    name: Deploy\n    steps:\n      - uses: actions/checkout@v4\n      - name: Deploy app\n        uses: cloudflare/wrangler-action@v3\n        with:\n          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n          command: deploy --env ${{ github.event.inputs.environment }}\n```\n\nFor 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.\n\n### Upload a Worker Version\n\nTo 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.\n\n```yaml\njobs:\n  upload:\n    runs-on: ubuntu-latest\n    name: Deploy\n    steps:\n      - uses: actions/checkout@v4\n      - name: Upload Worker Version\n        uses: cloudflare/wrangler-action@v3\n        with:\n          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}\n          command: versions upload\n```\n\n## Advanced Usage\n\n### Setting A Worker Secret for A Specific Environment\n\nThere is an environment parameter that can be set within the workflow to enable this. Example:\n\n```yaml\n- uses: cloudflare/wrangler-action@v3\n  with:\n    apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n    command: deploy --env production\n    secrets: |\n      SUPER_SECRET\n    environment: production\n  env:\n    SUPER_SECRET: ${{ secrets.SUPER_SECRET }}\n```\n\n### Using Wrangler Command Output in Subsequent Steps\n\nMore 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:\n\n```yaml\n- name: Deploy\n  id: deploy\n  uses: cloudflare/wrangler-action@v3\n  with:\n    apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n    accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}\n    command: pages deploy --project-name=example\n\n- name: print wrangler command output\n  env:\n    CMD_OUTPUT: ${{ steps.deploy.outputs.command-output }}\n  run: echo $CMD_OUTPUT\n```\n\nNow 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.\n\n\u003e Note: the `command-stderr` output variable is also available if you need to parse the standard error output of the Wrangler command.\n\n### Using the `deployment-url` and `pages-deployment-alias-url` Output Variables\n\nIf 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:\n\n```yaml\n- name: Deploy\n  id: deploy\n  uses: cloudflare/wrangler-action@v3\n  with:\n    apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n    accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}\n    command: pages deploy --project-name=example\n\n- name: print deployment-url\n  env:\n    DEPLOYMENT_URL: ${{ steps.deploy.outputs.deployment-url }}\n  run: echo $DEPLOYMENT_URL\n```\n\nThe resulting output will look something like this:\n\n```text\nhttps://\u003cyour_pages_site\u003e.pages.dev\n```\n\nPages 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.\n\nIf the sample action above was used to deploy a branch other than main, you could use the following to get the branch URL:\n\n```yaml\n- name: print pages-deployment-alias-url\n  env:\n    DEPLOYMENT_ALIAS_URL: ${{ steps.deploy.outputs.pages-deployment-alias-url }}\n  run: echo $DEPLOYMENT_ALIAS_URL\n```\n\nResulting in:\n\n```text\nhttps://new-feature.\u003cyour_pages_site\u003e.pages.dev\n```\n\n### Using a different package manager\n\nBy 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.\n\nIf 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.\n\n```yaml\njobs:\n  deploy:\n    steps:\n      uses: cloudflare/wrangler-action@v3\n      with:\n        apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n        packageManager: pnpm\n```\n\n## Troubleshooting\n\n### \"I just started using Workers/Wrangler and I don't know what this is!\"\n\nRefer 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.\n\n### \"[ERROR] No account id found, quitting..\"\n\nYou will need to add `account_id = \"\"` in your `wrangler.toml` file or set `accountId` in this GitHub Action.\n\n```yaml\non: [push]\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    name: Deploy\n    steps:\n      - uses: actions/checkout@v4\n      - name: Deploy app\n        uses: cloudflare/wrangler-action@v3\n        with:\n          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}\n          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Fwrangler-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudflare%2Fwrangler-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Fwrangler-action/lists"}