Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aidenwallis/cloudflare-pages-badges
Render custom badges for Cloudflare Pages projects
https://github.com/aidenwallis/cloudflare-pages-badges
Last synced: about 6 hours ago
JSON representation
Render custom badges for Cloudflare Pages projects
- Host: GitHub
- URL: https://github.com/aidenwallis/cloudflare-pages-badges
- Owner: aidenwallis
- License: apache-2.0
- Created: 2022-07-08T18:17:37.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-01T07:56:54.000Z (almost 2 years ago)
- Last Synced: 2023-03-06T02:28:25.831Z (almost 2 years ago)
- Language: TypeScript
- Size: 62.5 KB
- Stars: 8
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE_APACHE
Awesome Lists containing this project
README
# cloudflare-pages-badges
**Add status badges to your [Cloudflare Pages](https://pages.cloudflare.com/) projects.**
This project is deployed using [Cloudflare Workers](https://workers.cloudflare.com/), to set it up yourself, follow the [Deployment](#deployment) section.
Badges are rendered using [shields.io](https://shields.io) - it makes use of the `endpoint` functionality, all this worker does is provide a JSON response that tells shields how to render your badge.
## Contributions
This project is pretty much complete, however, feel free to submit a PR or issue for any changes/additions you feel are worth adding!
## Required Secrets
You must add the following secrets to your Workers runtime in order for the Worker to function correctly:
- `CLOUDFLARE_ACCOUNT_ID` is the ID of the Cloudflare account that contains the Pages projects.
- `CLOUDFLARE_API_KEY` is the generated API key for the account that contains the Pages projects. To generate the correct API key, follow [this section](#generating-api-tokens).## Deployment
To deploy this project:
1. Clone this git repo
1. Install [wrangler2](https://developers.cloudflare.com/workers/wrangler/get-started/).
1. Run `wrangler publish`
1. Take note of the `workers.dev` URL you are given.
1. Go to the Cloudflare Dashboard, get your account ID and an [API token](#generating-api-tokens).
1. Add your account ID to the worker config: `wrangler secret put CLOUDFLARE_ACCOUNT_ID`.
1. Add your Cloudflare API token to the worker config: `wrangler secret put CLOUDFLARE_API_KEY`.
1. Use the following URL to get a badge:
```
https://img.shields.io/endpoint?url=https:///?projectName=
```## Generating API tokens
You will need to generate a Cloudflare API key in order to use this Worker.
1. First, go to the [API Tokens](https://dash.cloudflare.com/profile/api-tokens) page.
1. Click `Create Token` in the top right.
1. Scroll down and create a `Custom Token`.
1. Create the token:
- Name the token `Cloudflare Pages Badges`.
- Under permissions, set to `Account` -> `Cloudflare Pages` -> `Read`.
- Under Account Resources, only select the relevant account under `Include`.
- Do not define any IP address filtering, or a TTL.
- Click `Continue to summary`. Your response should look something like:
```
Cloudflare Pages Badges API token summary
This API token will affect the below accounts and zones, along with their respective permissions's Account - Cloudflare Pages:Read
```