Skip to content

Commit ccaad74

Browse files
committed
update README.md
1 parent 3f1d912 commit ccaad74

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# Example Webhook Receiver
1+
# Example to Trigger GitHub Actions from a Render Webhook
22

3-
This basic example receives webhooks and logs the payload.
4-
It will fetch service, Postgres, or Key Value store information from the RENDER API for certain webhook types.
3+
This example triggers a GitHub Action workflow when a deploy ended webhook is received for a specific service.
54

65
## Deploy to Render
76

@@ -10,5 +9,13 @@ It will fetch service, Postgres, or Key Value store information from the RENDER
109

1110
2. Follow [instructions](https://render.com/docs/webhooks) to create a webhook with the URL from your service and `/webhook` path
1211
3. Follow [instructions](https://render.com/docs/api#1-create-an-api-key) to create a Render API Key
13-
4. Set `RENDER_WEBHOOK_SECRET` environment variable to the secret from the webhook created in step 2. SET `RENDER_API_KEY` to the key created in step 3.
14-
5. Trigger a service deploy and watch the webhooks roll in.
12+
4. Follow [instructions](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) to create a GitHub api token with read/write permissions for `Actions`
13+
5. Create a github workflow with a dispatch trigger as shown in the [example](./.github/workflows/example.yaml)
14+
6. Set the following env vars
15+
- `RENDER_WEBHOOK_SECRET` environment variable to the secret from the webhook created in step 2
16+
- `RENDER_API_KEY` to the key created in step 3
17+
- `GITHUB_API_TOKEN` to the token created in step 4
18+
- `GITHUB_OWNER_NAME` to the owner of the GitHub repo the workflow is in (ex. `render-examples`)
19+
- `GITHUB_REPO_NAME` to the GitHub repo the workflow is in (ex. `webhook-github-action`)
20+
- `GITHUB_WORKFLOW_ID` to the ID or filename of the workflow to trigger (ex. `example.yaml`)
21+
7. Trigger a service deploy and watch the GitHub workflow get triggered.

app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const renderAPIURL = process.env.RENDER_API_URL || "https://api.render.com/v1"
1111
// To create a Render API token, follow instructions here: https://render.com/docs/api#1-create-an-api-key
1212
const renderAPIToken = process.env.RENDER_API_TOKEN || '';
1313

14-
const githubAPIToken = process.env.GITHUB_TOKEN || '';
14+
const githubAPIToken = process.env.GITHUB_API_TOKEN || '';
1515
const githubOwnerName = process.env.GITHUB_OWNER_NAME || '';
1616
const githubRepoName = process.env.GITHUB_REPO_NAME || '';
1717
const githubWorkflowID = process.env.GITHUB_WORKFLOW_ID || 'example.yaml';

render.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ services:
66
branch: create-webhook-github-action
77
plan: starter
88
envVars:
9-
- key: RENDER_API_TOKEN
10-
sync: false
119
- key: RENDER_WEBHOOK_SECRET
1210
sync: false
11+
- key: RENDER_API_KEY
12+
sync: false
1313
region: oregon
1414
buildCommand: pnpm install && pnpm run build
1515
startCommand: pnpm run start

0 commit comments

Comments
 (0)