https://github.com/walshydev/cf-pages-await
Wait for your Cloudflare Pages builds to finish!
https://github.com/walshydev/cf-pages-await
Last synced: about 1 month ago
JSON representation
Wait for your Cloudflare Pages builds to finish!
- Host: GitHub
- URL: https://github.com/walshydev/cf-pages-await
- Owner: WalshyDev
- License: mit
- Created: 2021-10-26T11:18:52.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-20T19:07:27.000Z (8 months ago)
- Last Synced: 2025-03-22T01:39:15.039Z (about 1 month ago)
- Language: TypeScript
- Size: 450 KB
- Stars: 75
- Watchers: 2
- Forks: 16
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
README
# CF Pages Await
Wait for a Cloudflare Pages build to finish so you can do actions like purge cache, update Workers, etc.
## Usage
```yml
name: Deploy
on: push
jobs:
build:
runs-on: ubuntu-latest
# Allow GITHUB_TOKEN to write deployments for my action (https://docs.github.com/en/actions/security-guides/automatic-token-authentication)
permissions:
contents: read
deployments: write
steps:
- name: Await CF Pages
uses: WalshyDev/cf-pages-await@v1
with:
# Uncomment these two lines if you wish to use the Global API Key (Not recommended!)
# accountEmail: ${{ secrets.CF_ACCOUNT_EMAIL }}
# apiKey: ${{ secrets.CF_API_KEY }}# Use an API token (Recommended!)
apiToken: ${{ secrets.CF_API_TOKEN }}accountId: '4e599df4216133509abaac54b109a647'
project: 'example-pages-project'
# Add this if you want GitHub Deployments (see below)
githubToken: ${{ secrets.GITHUB_TOKEN }}
# Add this if you want to wait for a deployment triggered by a specfied commit
commitHash: ${{ steps.push-changes.outputs.commit-hash }}
```### Example
```yml
name: Deploy
on: push
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- uses: actions/checkout@v2
- name: Wait for CF Pages
id: cf-pages
uses: WalshyDev/cf-pages-await@v1
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: '4e599df4216133509abaac54b109a647'
project: 'test'
# Add this if you want GitHub Deployments (see below)
githubToken: ${{ secrets.GITHUB_TOKEN }}
- run: |
curl -X \
-H "Authorization: ${{ secrets.CF_API_TOKEN }}" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}' \
https://api.cloudflare.com/client/v4/zones/8d0c8239f88f98a8cb82ec7bb29b8556/purge_cache
```## Outputs
* `id` - Deployment ID, example: `50ff553c-da5d-4846-8188-25ae82a3bb7d`
* `environment` - Environment for this deployment, either `production` or `preview`
* `url` - URL for this deployment
* `alias` - Alias URL (Will be the branch URL such as `fix-issue.project.pages.dev` or be the deployment URL)
* `success` - If the deployment was successful## GitHub Deployments
GitHub Deployments will show if the deployment was successful or failed right inside GitHub! You can easily see the status, view the website (exact deployment) and see the logs.> **Note**: You need to add the `githubToken` input in order for deployments to work!
### Overview
### Pull Requests
**In Progress**
**Successful**
