Have you ever had the need to trigger a webhook on a schedule, like every hour? In this short article we'll take a look at how you can trigger a Vercel webhook every hour using Github workflows.
This approach will work for any webhook url from any service.
There are three steps to doing this:
- Create a file (you can call it whatever you want) at the root of your project
- Add a cron job (see the code below)
- Push the file to Github
name: Run build every hour on: schedule: - cron: "*/60 * * * *" jobs: cron: runs-on: ubuntu-latest steps: - name: Calling Vercel webhook for my-env run: | curl --request POST \ --url 'https://api.vercel.com/v1/integrations/deploy/an_id'
This job will now run every hour from the default branch on Github. It doesn't matter if the file is found on multiple branches, it will only run from the default branch.