netlify-build-github-actions
netlify-build-github-actions copied to clipboard
An example of triggering a Netlify build using Github Actions Scheduled Events
⏰ Trigger Netlify builds on a schedule using Github Actions
-
Add a Build hook to your site using the Netlify Dashboard
Settings > Build & Deploy > Continuous Deployment > Build hooks
-
Create a
.github/workflows/main.ymlfile in your Github repo, replacing YOUR_BUILD_HOOK with the build hook you just created.name: Trigger Netlify Build on: schedule: - cron: '*/15 * * * *' # every 15 mins jobs: build: name: Request Netlify Webhook runs-on: ubuntu-latest steps: - name: Curl request run: curl -X POST -d {} YOUR_BUILD_HOOK -
Adjust the
cronsettings to determine how often the build will be triggered.
15 8 * * *would run every day at 0815
0 0,12 * * *would run at midday and midnight every day
crontab guru can help you generate the correct cron syntax.
See the Github Actions Docs for more info. -
Open the Actions tab in you Github repo to watch the workflow complete. 🎉