Skip to content

Commit c37299d

Browse files
committed
fix(ci): šŸ› update GHCR image tag retrieval to use GitHub REST API and improve authentication handling
1 parent c2fc348 commit c37299d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

ā€Ž.github/workflows/check-missing-images.ymlā€Ž

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,18 @@ jobs:
2727
2828
- name: Check GHCR for existing images
2929
id: check_images
30+
env:
31+
TOKEN: ${{ secrets.GHCR_READ_TOKEN || secrets.GITHUB_TOKEN }}
3032
run: |
3133
missing_tags=()
32-
# Fetch existing image tags from GHCR using GITHUB_TOKEN for auth
33-
ghcr_tags=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
34-
https://ghcr.io/v2/ophiosdev/codex-cli/tags/list | jq -r '.tags[]')
34+
# Use GitHub REST API to list container image versions (tags)
35+
ghcr_tags=$(curl -sSL \
36+
-H "Accept: application/vnd.github+json" \
37+
-H "X-GitHub-Api-Version: 2022-11-28" \
38+
-H "Authorization: Bearer ${TOKEN}" \
39+
https://api.github.com/orgs/ophiosdev/packages/container/codex-cli/versions \
40+
| jq -r '.[].metadata.container.tags[]?' 2>/dev/null || true)
41+
3542
echo "Existing GHCR tags: $ghcr_tags"
3643
3744
while IFS= read -r tag; do

0 commit comments

Comments
Ā (0)