Browse Source

fix: Remove unnecessary image tag logic for PR workflows

Addresses reviewer feedback from @ameijer. The workflow already skips
container image SBOM generation on PRs (only scans source code), but
the image tag step was still running and setting an unused value.

Changes:
- Add condition to skip "Set OpenCost Image Tag" step on PRs
- Remove dead PR-specific logic since IMAGE_TAG is never used on PRs
- Clarifies that PRs only generate source code SBOMs

On PRs: Only source code SBOMs are generated
On releases: Both source code and container image SBOMs are generated
Claude 6 months ago
parent
commit
626b42a85b
1 changed files with 2 additions and 5 deletions
  1. 2 5
      .github/workflows/sbom.yml

+ 2 - 5
.github/workflows/sbom.yml

@@ -71,15 +71,12 @@ jobs:
 
       - name: Set OpenCost Image Tag
         id: image_tag
+        if: github.event_name != 'pull_request'
         env:
           REPO_OWNER: ${{ github.repository_owner }}
           RELEASE_VERSION: ${{ steps.version_number.outputs.RELEASE_VERSION }}
         run: |
-          if [ "${{ github.event_name }}" == "pull_request" ]; then
-            echo "IMAGE_TAG=ghcr.io/$REPO_OWNER/opencost:develop-latest" >> $GITHUB_OUTPUT
-          else
-            echo "IMAGE_TAG=ghcr.io/$REPO_OWNER/opencost:$RELEASE_VERSION" >> $GITHUB_OUTPUT
-          fi
+          echo "IMAGE_TAG=ghcr.io/$REPO_OWNER/opencost:$RELEASE_VERSION" >> $GITHUB_OUTPUT
 
       # Generate SBOM for source code
       - name: Generate SBOM for Source Code