Skip to content

Commit d33cb33

Browse files
committed
Rename github token
1 parent 75e8afc commit d33cb33

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

.github/workflows/deploy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: cloudflare/wrangler-action@v3
1919
with:
2020
apiToken: ${{ secrets.CF_API_TOKEN }}
21-
secrets: ${{ secrets.GITHUB_TOKEN != '' && 'GITHUB_TOKEN' || '' }}
21+
secrets: ${{ secrets.GITHUB_API_TOKEN != '' && 'GITHUB_API_TOKEN' || '' }}
2222
env:
23-
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
24-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
24+
GITHUB_API_TOKEN: ${{ secrets.GITHUB_API_TOKEN }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ Wrangler.toml variables:
88
- `GITHUB_ACCOUNT`: GitHub account name (e.g. `mackenly`)
99
- `GITHUB_REPO`: GitHub repository name (e.g. `my-tauri-app`)
1010

11-
This project works with private GitHub repositories. To enable this, you need to set the `GITHUB_TOKEN` secret in your GitHub repository and it will be picked up by the deployment action. Alternatively, add the secret [manually](https://developers.cloudflare.com/workers/configuration/secrets/#add-secrets-to-your-project). This token should have the `repo` permission.
11+
This project works with private GitHub repositories. To enable this, you need to set the `GITHUB_API_TOKEN` secret in your GitHub repository and it will be picked up by the deployment action. Alternatively, add the secret [manually](https://developers.cloudflare.com/workers/configuration/secrets/#add-secrets-to-your-project) for manual deployments. This token should have the `repo` permission. Create a new token [here](https://github.com/settings/tokens/new).
1212

1313
## Deployment
1414
### With CI/CD GitHub Actions
1515
CI/CD via GitHub Actions is set up to test and lint the code. CD requires the repository owner to set two repository secrets:
1616
- `CF_API_TOKEN` - Cloudflare API token (requires 'Edit Cloudflare Workers' permission template)
17-
- `CF_ACCOUNT_ID` - Cloudflare account ID
17+
- `CLOUDFLARE_ACCOUNT_ID` - Cloudflare account ID
1818

1919
### Manual Deployment
2020
1. Install dependencies: `npm install` and ensure `wrangler` [is installed](https://developers.cloudflare.com/workers/wrangler/install-and-update/).

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Env } from '../worker-configuration'
1414
declare global {
1515
const GITHUB_ACCOUNT: string
1616
const GITHUB_REPO: string
17-
const GITHUB_TOKEN: string
17+
const GITHUB_API_TOKEN: string
1818
}
1919

2020
const SendJSON = (data: Record<string, unknown>) => {
@@ -72,7 +72,7 @@ const handleV1Request = async (
7272
}
7373

7474
const signature = await findAssetSignature(match.name, release.assets)
75-
const proxy = GITHUB_TOKEN?.length
75+
const proxy = GITHUB_API_TOKEN?.length
7676
const downloadURL = proxy
7777
? createProxiedFileUrl(request, env, ctx, match.browser_download_url)
7878
: match.browser_download_url

src/services/github.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export const getReleases = async (
1515
'User-Agent': request.headers.get('User-Agent') as string,
1616
})
1717

18-
if (env.GITHUB_TOKEN?.length)
19-
headers.set('Authorization', `token ${env.GITHUB_TOKEN}`)
18+
if (env.GITHUB_API_TOKEN?.length)
19+
headers.set('Authorization', `token ${env.GITHUB_API_TOKEN}`)
2020

2121
const response = await fetch(reqUrl.toString(), {
2222
method: 'GET',

worker-configuration.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
export interface Env {
55
GITHUB_ACCOUNT: string;
66
GITHUB_REPO: string;
7-
GITHUB_TOKEN?: string;
7+
GITHUB_API_TOKEN?: string;
88
}

0 commit comments

Comments
 (0)