Skip to content

Make Docker image labels dynamic based on repository#7

Merged
chaptersix merged 1 commit intomainfrom
fix-ghcr-registry-prefix
Nov 21, 2025
Merged

Make Docker image labels dynamic based on repository#7
chaptersix merged 1 commit intomainfrom
fix-ghcr-registry-prefix

Conversation

@chaptersix
Copy link
Owner

Summary

Makes the Docker image OCI labels dynamic so GitHub correctly associates the package with the right repository. This fixes the issue where images from chaptersix/temporal-cli were being associated with temporalio/cli.

Problem

GitHub uses the org.opencontainers.image.source label to determine which repository a package belongs to. The labels were hardcoded to temporalio/cli, causing GitHub to incorrectly associate packages from forks.

Changes

.github/docker/docker-bake.hcl

  • Add GITHUB_REPOSITORY variable (defaults to "temporalio/cli")
  • Update labels to use ${GITHUB_REPOSITORY} instead of hardcoded "temporalio/cli"
  • Affects labels:
    • org.opencontainers.image.url
    • org.opencontainers.image.source

.github/workflows/build-and-publish.yml

  • Pass GITHUB_REPOSITORY: ${{ github.repository }} to both build steps
  • This automatically provides the correct repository name for each fork

Result

  • temporalio/cli → Package links to https://github.com/temporalio/cli
  • chaptersix/temporal-cli → Package links to https://github.com/chaptersix/temporal-cli
  • Each fork's packages are correctly associated with their own repository

Testing

After merging and pushing an image, verify the package appears under the correct repository in GitHub Packages.

Add GITHUB_REPOSITORY variable and use it in OCI labels so GitHub
correctly associates the package with the right repository.

This fixes the issue where chaptersix/temporal-cli images were being
associated with temporalio/cli repository.
@chaptersix chaptersix merged commit 90d4238 into main Nov 21, 2025
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant