This Vercel Serverless Function triggers a GitHub repository dispatch event for syncing documentation. It is designed to be called via a POST request (for example, from another service, a webhook, or a Slack integration).
- Place the function in your project at
api/sync-docs-dispatch.ts
. - Deploy to Vercel:
vercel --prod
- Note your deployment URL (e.g.,
https://your-project.vercel.app
).
Add the following environment variable to your Vercel project:
PAT
: Your GitHub Personal Access Token withrepo
scope.
To add environment variables:
- Go to your Vercel dashboard.
- Select your project.
- Go to Settings → Environment Variables.
- Add
PAT
with your GitHub token value.
Send a POST request to the deployed endpoint to trigger the sync. For example: