You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 1, 2025. It is now read-only.
Copy file name to clipboardexpand all lines: README.md
+38-6
Original file line number
Diff line number
Diff line change
@@ -7,16 +7,44 @@ This simple action calls the [Cloudflare API](https://api.cloudflare.com/#zone-p
7
7
8
8
## Usage
9
9
10
-
### Configuration
11
-
12
10
All sensitive variables should be [set as encrypted secrets](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) in the action's configuration.
|`CLOUDFLARE_ZONE`| The Zone ID of your domain, which can be found in the right sidebar of your domain's overview page on the Cloudflare dashboard. For example, `xyz321xyz321xyz321xyz321xyz321xy`. |`secret`|**Yes**|
17
-
|`CLOUDFLARE_EMAIL`| The email address you registered your Cloudflare account with. For example, `[email protected]`. |`secret`|**Yes**|
18
-
|`CLOUDFLARE_KEY`| Your Cloudflare API key, which can be generated using [these instructions](https://support.cloudflare.com/hc/en-us/articles/200167836-Where-do-I-find-my-Cloudflare-API-key-). For example, `abc123abc123abc123abc123abc123abc123abc123abc`. |`secret`|**Yes**|
19
-
|`PURGE_URLS`|**Optional.** An array of **fully qualified URLs** to purge. For example: `["https://jarv.is/style.css", "https://jarv.is/favicon.ico"]`. If unset, the action will purge everything (which is [suggested](#purging-specific-files)). |`env`| No |
17
+
|`CLOUDFLARE_ZONE`|**Required for both methods below.** The Zone ID of your domain, which can be found in the right sidebar of your domain's overview page on the Cloudflare dashboard. For example, `xyz321xyz321xyz321xyz321xyz321xy`. |`secret`|**Yes**|
18
+
|`PURGE_URLS`|**Optional.** An array of **fully qualified URLs** to purge. For example: `["https://jarv.is/style.css", "https://jarv.is/favicon.ico"]`. If unset, the action will purge everything (which is suggested — [more info below](#purging-specific-files)). |`env`| No |
19
+
20
+
21
+
### Authentication Variables
22
+
23
+
Both authentication methods below require you to grab information from the [API Tokens page in the dashboard](https://dash.cloudflare.com/profile/api-tokens). Details on the inner workings of each method can be found [in Cloudflare's API docs](https://api.cloudflare.com/#getting-started-requests).
24
+
25
+
26
+
#### Option 1: Restricted API Token
27
+
28
+
API Tokens are [a new feature](https://blog.cloudflare.com/api-tokens-general-availability/) as of August 2019. They allow you to restrict the scope of this action to only purging the cache of zones you specify. In other words, this is much safer than allowing this action complete control of your entire Cloudflare account. (I'm not evil though, I promise. 😊)
29
+
30
+
| Key | Value | Type |
31
+
| ------------- | ------------- | ------------- |
32
+
|`CLOUDFLARE_TOKEN`| The restricted API Token with permissions to purge the cache of one or more zones. |`secret`|
33
+
34
+
Creating a token can be tricky, so here's what you should enter [on this page](https://dash.cloudflare.com/profile/api-tokens) to create a token for purging the cache of a single domain on your account:
35
+
36
+

37
+
38
+
39
+
#### Option 2: Global API Key
40
+
41
+
This is the "traditional" method of authenticating — simply grab your "Global API Key" from [the dashboard](https://dash.cloudflare.com/profile/api-tokens). Using this method also **requires a second environment variable** with the email address linked to your account.
42
+
43
+
| Key | Value | Type |
44
+
| ------------- | ------------- | ------------- |
45
+
|`CLOUDFLARE_EMAIL`| The email address you registered your Cloudflare account with. For example, `[email protected]`. |`secret`|
46
+
|`CLOUDFLARE_KEY`| Your Cloudflare API key, which can be generated using [these instructions](https://support.cloudflare.com/hc/en-us/articles/200167836-Where-do-I-find-my-Cloudflare-API-key-). |`secret`|
0 commit comments