CI: website.yml hourly cron rebuilds and redeploys unconditionally — add change detection #494

Closed
opened 2026-06-06 15:36:41 +00:00 by guettlibot · 1 comment
guettlibot commented 2026-06-06 15:36:41 +00:00 (Migrated from codeberg.org)

Problem

website.yml runs on a cron every hour (0 * * * *) and unconditionally rebuilds and redeploys the entire website — even when nothing in website/ has changed since the last deploy.

By contrast, deploy.yml already has sophisticated change detection: it finds the last successfully deployed SHA and diffs against it, skipping deploys when nothing relevant changed.

website.yml has a push trigger with path filters for website/**, but the hourly cron bypasses all filtering and always runs task publish-website.

Fix

Add a check-changes job (like deploy.yml does) that detects whether any website/-relevant files changed in the last hour. Skip the deploy if not.

Alternatively, use the same head_sha comparison approach from deploy.yml:

  1. Query the Forgejo API for the last successful website.yml run.
  2. Compare its head_sha to HEAD.
  3. If equal, skip. If different, check if any website/** or scripts/website-verify.sh files changed.

Simplest option — a quick git check at the top of the deploy job:

- name: Check for website changes since last deploy
  id: changes
  run: |
    SINCE=2026-06-06T14:31:41
    CHANGED=
    if [ -n "$CHANGED" ]; then
      echo "has_changes=true" >> "$GITHUB_OUTPUT"
    else
      echo "has_changes=false" >> "$GITHUB_OUTPUT"
    fi

- name: Build & Update Website
  if: steps.changes.outputs.has_changes == 'true' || github.event_name != 'schedule'
  ...

Expected impact

  • Eliminates ~23 wasteful website rebuilds per day when nothing changed.
  • Frees up the runner and Dagger remote engine for actual work.
  • No change to push-triggered deploys — those already only run when website/** changes.

Files to change

  • .forgejo/workflows/website.yml
## Problem `website.yml` runs on a cron every hour (`0 * * * *`) and unconditionally rebuilds and redeploys the entire website — even when nothing in `website/` has changed since the last deploy. By contrast, `deploy.yml` already has sophisticated change detection: it finds the last successfully deployed SHA and diffs against it, skipping deploys when nothing relevant changed. `website.yml` has a push trigger with path filters for `website/**`, but the hourly cron bypasses all filtering and always runs `task publish-website`. ## Fix Add a `check-changes` job (like `deploy.yml` does) that detects whether any `website/`-relevant files changed in the last hour. Skip the deploy if not. Alternatively, use the same `head_sha` comparison approach from `deploy.yml`: 1. Query the Forgejo API for the last successful `website.yml` run. 2. Compare its `head_sha` to `HEAD`. 3. If equal, skip. If different, check if any `website/**` or `scripts/website-verify.sh` files changed. Simplest option — a quick git check at the top of the deploy job: ```yaml - name: Check for website changes since last deploy id: changes run: | SINCE=2026-06-06T14:31:41 CHANGED= if [ -n "$CHANGED" ]; then echo "has_changes=true" >> "$GITHUB_OUTPUT" else echo "has_changes=false" >> "$GITHUB_OUTPUT" fi - name: Build & Update Website if: steps.changes.outputs.has_changes == 'true' || github.event_name != 'schedule' ... ``` ## Expected impact - Eliminates ~23 wasteful website rebuilds per day when nothing changed. - Frees up the runner and Dagger remote engine for actual work. - No change to push-triggered deploys — those already only run when `website/**` changes. ## Files to change - `.forgejo/workflows/website.yml`
guettlibot commented 2026-06-07 00:31:46 +00:00 (Migrated from codeberg.org)

The PR is open and auto-merge is enabled. Here's what was done:


Summary

PR: https://codeberg.org/guettli/sharedinbox/pulls/515

What changed: Added a check-changes job to .forgejo/workflows/website.yml that prevents the hourly cron from rebuilding and redeploying the website when nothing relevant has changed.

How it works:

  • On push or workflow_dispatch: always deploys (unchanged behaviour)
  • On schedule (cron): queries the Forgejo API for the last successful website.yml run, compares its head_sha to HEAD; if they differ, diffs the changed files against website/**, scripts/website-verify.sh, and .forgejo/workflows/website.yml; skips the deploy if none of those paths changed
  • Falls back to deploying if the last SHA can't be determined (safe default)

The implementation mirrors the check-changes job pattern already used in deploy.yml. The existing deploy steps are unchanged; the job simply gains needs: [check-changes] and an if: needs.check-changes.outputs.has_changes == 'true' condition.

The PR is open and auto-merge is enabled. Here's what was done: --- ## Summary **PR:** https://codeberg.org/guettli/sharedinbox/pulls/515 **What changed:** Added a `check-changes` job to `.forgejo/workflows/website.yml` that prevents the hourly cron from rebuilding and redeploying the website when nothing relevant has changed. **How it works:** - On `push` or `workflow_dispatch`: always deploys (unchanged behaviour) - On `schedule` (cron): queries the Forgejo API for the last successful `website.yml` run, compares its `head_sha` to `HEAD`; if they differ, diffs the changed files against `website/**`, `scripts/website-verify.sh`, and `.forgejo/workflows/website.yml`; skips the deploy if none of those paths changed - Falls back to deploying if the last SHA can't be determined (safe default) The implementation mirrors the `check-changes` job pattern already used in `deploy.yml`. The existing deploy steps are unchanged; the job simply gains `needs: [check-changes]` and an `if: needs.check-changes.outputs.has_changes == 'true'` condition.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: guettli/sharedinbox#494