Skip to content

fix(ci): lowercase GHCR owner in Trivy image ref - #13

Merged
KingPin merged 1 commit into
masterfrom
fix/trivy-lowercase-image-ref
Apr 13, 2026
Merged

KingPin merged 1 commit into
masterfrom
fix/trivy-lowercase-image-ref

Conversation

@KingPin

@KingPin KingPin commented Apr 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • github.repository_owner preserves casing (KingPin), but GHCR requires a fully lowercase reference — hence the could not parse reference fatal error
  • Add a step that lowercases GITHUB_REPOSITORY_OWNER via bash ${var,,} expansion into OWNER_LC env var (safe — uses the env var directly, no expression interpolation in run)
  • Use ${{ env.OWNER_LC }} in the Trivy image-ref

Test plan

  • Verify the Security Scan workflow runs without the could not parse reference fatal error

github.repository_owner preserves case (KingPin), but GHCR requires
lowercase. Use ${GITHUB_REPOSITORY_OWNER,,} bash expansion to set
OWNER_LC env var safely, then reference it in the image-ref.
Copilot AI review requested due to automatic review settings April 13, 2026 20:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Trivy Security Scan workflow to avoid GHCR image reference parsing failures caused by mixed-case github.repository_owner, by introducing a lowercased owner environment variable for the image reference.

Changes:

  • Add a workflow step that writes a lowercased OWNER_LC value to $GITHUB_ENV.
  • Update Trivy image-ref to use ${{ env.OWNER_LC }} when referencing the GHCR image.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set lowercase owner

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step relies on Bash-specific parameter expansion (${VAR,,}), which will fail if the default shell is changed (e.g., to sh) or if this workflow is later run on a non-Linux runner. To make the dependency explicit and future-proof, set shell: bash for this step (or replace with a POSIX-compatible lowercasing approach).

Suggested change
- name: Set lowercase owner
- name: Set lowercase owner
shell: bash

Copilot uses AI. Check for mistakes.
@KingPin
KingPin merged commit d1a3754 into master Apr 13, 2026
12 checks passed
@KingPin
KingPin deleted the fix/trivy-lowercase-image-ref branch April 13, 2026 20:23
KingPin added a commit that referenced this pull request May 4, 2026
github.repository_owner preserves case (KingPin), but GHCR requires
lowercase. Use ${GITHUB_REPOSITORY_OWNER,,} bash expansion to set
OWNER_LC env var safely, then reference it in the image-ref.

Co-authored-by: kingpin <kingpin@localhost>
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.

2 participants