Skip to content

CI: Build workflow should test merge result, not fork branch in isolation #561

@madolson

Description

@madolson

Problem

The zola-deploy.yml workflow checks out the PR's head branch directly from the fork repo:

- name: Checkout
  uses: actions/checkout@v4
  with:
    ref: >-
      ${{ github.event_name == 'pull_request' &&
          github.head_ref || 'main' }}
    repository: >-
      ${{ github.event_name == 'pull_request' &&
          github.event.pull_request.head.repo.full_name || 'valkey-io/valkey-io.github.io' }}
    path: website

This means it builds the fork's branch in isolation without merging it with the target branch (main). If main has changes the PR depends on (like taxonomy definitions in config.toml), the build fails even though the actual merge result would build fine.

This bit us on #523 where the fork predated #488 (which added blog_type taxonomy to config.toml). The blog post used the taxonomy correctly but the fork's config didn't have it yet.

Fix

Use GitHub's merge ref instead:

- name: Checkout
  uses: actions/checkout@v4
  with:
    ref: ${{ github.event_name == 'pull_request' && format('refs/pull/{0}/merge', github.event.pull_request.number) || 'main' }}
    path: website

This checks out the result of merging the PR into main, which is what will actually be deployed. It's what most CI workflows do and avoids false failures from stale forks.

This issue was generated by AI but verified, with love, by a human.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions