Scheduling Webhook and API Calls With GitHub Actions

Lloyd Atkinson
Scheduling Webhook and API Calls With GitHub Actions

GitHub Actions are a great way to automate workflows and build pipelines. For example, I previously discussed using GitHub Actions to automate labels on pull requests. This time, I will be showing how to schedule Webhook/API calls on a schedule.

It’s straightforward to set up, so this will be a short post. I will use one of the GitHub Actions workflows I use on this site to demonstrate. I wished to build my site automatically once a day. Although it is built and deployed automatically on push anyway, I recently added the ability to display the number of times site visits have read an article. I didn’t want to have to wait for a push to see the updated number of views.

name: Scheduled Build
on:
schedule:
- cron: '0 9 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Netlify Webhook
run: |
curl -X POST https://api.netlify.com/build_hooks/<id>

Share:

Spotted a typo or want to leave a comment? Send feedback

Stay up to date

Subscribe to my newsletter to stay up to date on my articles and projects

© Lloyd Atkinson 2024 ✌

I'm available for work 💡