Skip to content

Commit 4aadccd

Browse files
yaarcloudonclaude
andcommitted
fix: Replace docker manifest inspect with docker pull for cross-repo GHCR access
manifest inspect fails when the calling repo's GITHUB_TOKEN lacks package read scope on the org GHCR package. docker pull works after docker login because it uses the authenticated session directly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b472e8f commit 4aadccd

1 file changed

Lines changed: 5 additions & 34 deletions

File tree

action.yml

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -107,43 +107,14 @@ runs:
107107
echo "🔐 Logging into GitHub Container Registry..."
108108
echo "${{ inputs.github_token }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
109109
110-
- name: Determine scanner image
110+
- name: Pull scanner image
111111
id: scanner-image
112112
shell: bash
113113
run: |
114-
echo "🔍 Determining scanner image to use..."
115-
116-
# Determine the appropriate Docker tag
117-
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
118-
TAG="pr-${{ github.event.number }}"
119-
elif [[ "${{ github.ref_name }}" == "main" ]]; then
120-
TAG="${{ inputs.scanner_version }}"
121-
else
122-
# Sanitize branch name for Docker tag
123-
TAG=$(echo "${{ github.ref_name }}" | sed 's/\//-/g')
124-
fi
125-
126-
PRIMARY_IMAGE="ghcr.io/cloudon-one/git-security-scanner:${TAG}"
127-
FALLBACK_IMAGE="ghcr.io/cloudon-one/git-security-scanner:${{ inputs.scanner_version }}"
128-
129-
echo "Primary image: ${PRIMARY_IMAGE}"
130-
echo "Fallback image: ${FALLBACK_IMAGE}"
131-
132-
# Try primary image first
133-
if docker manifest inspect "${PRIMARY_IMAGE}" > /dev/null 2>&1; then
134-
echo "✅ Using primary image: ${PRIMARY_IMAGE}"
135-
echo "image=${PRIMARY_IMAGE}" >> $GITHUB_OUTPUT
136-
else
137-
echo "⚠️ Primary image not found, trying fallback..."
138-
if docker manifest inspect "${FALLBACK_IMAGE}" > /dev/null 2>&1; then
139-
echo "✅ Using fallback image: ${FALLBACK_IMAGE}"
140-
echo "image=${FALLBACK_IMAGE}" >> $GITHUB_OUTPUT
141-
else
142-
echo "❌ No suitable scanner image found!"
143-
echo "Please ensure the scanner image is built and pushed to the registry."
144-
exit 1
145-
fi
146-
fi
114+
IMAGE="ghcr.io/cloudon-one/git-security-scanner:${{ inputs.scanner_version }}"
115+
echo "Pulling scanner image: ${IMAGE}"
116+
docker pull "${IMAGE}"
117+
echo "image=${IMAGE}" >> $GITHUB_OUTPUT
147118
148119
- name: Run security scan
149120
id: scan

0 commit comments

Comments
 (0)