Skip to content
  • English Deutsch

benjamin-abt.com

Performance is a feature | Cloud - AI - Azure - .NET - Sustainability

  • Home
  • Blog
  • Portfolio
    • Overview
    • Workshops & Training
    • Publications
  • Contact
  • Home
  • Blog

Scheduled Builds for Cloudflare Deployments with GitHub Actions

Scheduled Builds for Cloudflare Deployments with GitHub Actions
July 14, 2025 4 min read BEN ABT
Cloudflare GitHub Actions DevOps

Static site generators like Hugo do not have a built-in mechanism to automatically publish content–such as blog posts–at a specific time. If you want a post to go live at a certain hour, you need to rebuild and redeploy your site at that moment. This means you have to trigger the build process yourself, which can be inconvenient or easy to forget.

Automated deployments are a key part of modern web development. For static sites or JAMstack projects hosted on Cloudflare Pages , it can be useful to trigger builds on a schedule–even if there are no code changes. This ensures that dynamic content fetched from APIs or other sources stays up to date.

Why Scheduled Builds?

By default, Cloudflare Pages only rebuilds your site when changes are pushed to the repository. But what if your site displays content that updates regularly without code changes? For example, a blog that pulls in external data (RSS feeds, weather or API content). Scheduled builds help keep your site fresh by rebuilding it automatically at set intervals.

Publishing Dates in Hugo: Frontmatter vs. Filename

Traditionally, Hugo required you to specify the publication date and time for a post using the date property in the frontmatter of your Markdown file. This was the only way to control when a post would be published.

However, since my GitHub issue (Support yyyy-MM-dd-HH-mm-ss in filenames ) and with the release of Hugo version 0.148.0, there is now a new option: you can specify the publication date and even the time directly in the filename of your Markdown file or in the name of the parent folder. This makes scheduling and managing post publication much more flexible and transparent, especially when combined with scheduled builds.

For example, a file named 2025-07-14_08-00-00_my-post.md or a folder named 2025-07-14_08-00-00_my-post/ will be recognized by Hugo and used to determine the publish date and time, without needing to set it in the frontmatter.

Generate the Build Trigger URL in Cloudflare Pages

To automate builds via GitHub Actions, you need a special build trigger URL from Cloudflare Pages . Here’s how to generate it:

  1. Go to your Cloudflare Pages project dashboard.
  2. Click on Settings > Builds & Deployments.
  3. Scroll down to the Build hooks section.
  4. Click Add build hook and give it a name (e.g., “GitHub Scheduled Build”).
  5. Select the branch you want to trigger builds for (usually main or master).
  6. Click Save. Cloudflare will generate a unique URL for you.
  7. Copy this URL and add it as a secret in your GitHub repository (e.g., CLOUDFLARE_BUILD_TRIGGER_URL).

This URL can now be used in your GitHub Actions workflow to trigger builds securely and automatically.

Implementation with GitHub Actions

You can set up a GitHub Actions workflow to trigger a build at specific times. Here’s an example workflow:

YAML
 1name: Cloudflare Scheduled Build
 2
 3on:
 4  schedule:
 5    # Runs every 8 hours (at 00:01, 08:01 and 16:01 UTC)
 6    - cron: '1 */8 * * *'
 7  workflow_dispatch: # Allows manual triggering
 8
 9jobs:
10  call-url:
11    runs-on: ubuntu-latest
12    steps:
13      - name: Call Cloudflare Build Trigger URL
14        run: |
15          if [ -z "${{ secrets.CLOUDFLARE_BUILD_TRIGGER_URL }}" ]; then
16            echo "❌ TARGET_URL secret is not set"
17            exit 1
18          fi
19          echo "🔄 Calling URL from secrets..."
20          response=$(curl -s -o /dev/null -w "%{http_code}" -X POST "${{ secrets.CLOUDFLARE_BUILD_TRIGGER_URL }}")
21          if [ $response -eq 200 ]; then
22            echo "✅ URL call successful (HTTP $response)"
23          else
24            echo "⚠️ URL call returned HTTP $response"
25          fi
26          echo "📅 Called at: $(date -u)"
27        env:
28          TARGET_URL: ${{ secrets.CLOUDFLARE_BUILD_TRIGGER_URL }}
29      - name: Log execution
30        run: |
31          echo "🕐 Scheduled execution completed at $(date -u)"

What does this do?

  • The workflow runs every 8 hours automatically. In my case I want to deploy on e.g. 08:00 because usually my blog posts go live on 0800 or 1600.
  • It uses a secret build trigger URL (CLOUDFLARE_BUILD_TRIGGER_URL) provided by Cloudflare Pages to send a POST request and start a new build.
  • The response is logged, but the workflow does not fail if the build trigger returns a non-200 response.
  • The workflow can also be triggered manually.

Conclusion

Scheduled builds with GitHub Actions are a simple and effective way to keep your Cloudflare Pages site up to date. This is especially valuable for projects with dynamic or API-driven content. If you want to extend your automation even further, you can also look into Cloudflare Workers for custom serverless logic.

Related articles

Cloudflare Workers with wrangler.toml: Preview URLs, production routes and SEO-safe SPA handling

May 10, 2026 - 9 min read

Cloudflare Workers with wrangler.toml: Preview URLs, production routes and SEO-safe SPA handling

Cloudflare Workers can separate production and preview traffic cleanly without sacrificing canonical URL control. For search visibility, …

Automate Pull Request Comments with GitHub Actions

Jan 4, 2026 - 2 min read

Automate Pull Request Comments with GitHub Actions

When working with Pull Requests (PRs) in GitHub, it is often helpful to provide immediate feedback or relevant information directly in the …

Serve SPAs correctly on Cloudflare Workers

Jan 5, 2026 - 2 min read

Serve SPAs correctly on Cloudflare Workers

Single Page Applications like React expect the server to always return index.html and let the client-side router take over. On Cloudflare …


BEN ABT

BEN ABT

Ben is Chief Engineering Officer and Principal Software Engineer at Medialesson.de, with a strong focus on .NET and Microsoft Azure. In his professional role, he designs and builds highly scalable platforms for hybrid and cloud-based scenarios. He also advises companies and C-levels on migrating to the sovereign cloud.

He runs myCSharp.de, the largest and most active German-speaking C# community forum, actively contributes to both his own and external open-source projects and regularly shares his knowledge through his blog, at community events, conferences and as a writer for technical magazines.

Let's Work Together

Looking for an experienced Platform Architect or Engineer for your next project? Whether it's cloud migration, platform modernization or building new solutions from scratch - I'm here to help you succeed.

New Platforms

Modernization

Training & Consulting

Contact Me
X Facebook LinkedIn WhatsApp
Back Next Blog Post

Open for work!

Contact Me
BEN ABT BEN ABT Software Engineer · Microsoft MVP Passionate about .NET, Azure, performance optimization and sustainable software engineering.

Medialesson GmbH Logo

Microsoft MVP Logo

Recent posts

View all
Stop Using nginx as Your Default Static File Server in Docker

Stop Using nginx as Your Default Static File Server in …

Oct 24, 2026
Containerizing .NET in 2026 Without a Dockerfile

Containerizing .NET in 2026 Without a Dockerfile

Oct 20, 2026
Problem Details in ASP.NET Core and .NET 11

Problem Details in ASP.NET Core and .NET 11

Oct 5, 2026
Resilience in .NET with Microsoft.Extensions.Resilience

Resilience in .NET with Microsoft.Extensions.Resilience

Sep 21, 2026
What Matters in ASP.NET Core 11

What Matters in ASP.NET Core 11

Sep 14, 2026

Tags

.NET (192) Csharp (96) ASP.NET Core (48) Azure (41) DevOps (17) Docker (14) Microsoft (14) EF Core (11) Microsoft MVP (11) AI (10) GitHub (10) GitHub Copilot (10) ASP.NET (9) Security (9) Synology (9) Architecture (8) Raspberry (8) Azure Functions (7) Cloudflare (7) Bicep (6)
benjamin-abt.com

About BEN

Benjamin Abt is a Software Engineer, Platform Architect and Microsoft MVP specializing in .NET, Azure, cloud architecture, performance optimization and sustainable software development.

Connect

  • Follow me on GitHub
  • Follow me on LinkedIn
  • Follow me on Mastodon
  • Microsoft MVP profile
  • Follow SchwabenCode on GitHub
  • Follow me on X

Quick Links

  • Portfolio
  • Blog
  • Workshops & Training
  • Publications
  • Get in Touch
  • Sitemap
Open for Work

© Copyright Benjamin Abt & SchwabenCode | 2011 - 2026

Content licensed under CC BY 4.0 unless otherwise noted.

  • Impressum
  • Privacy
  • Contact