Skip to content

Commit 3521a3d

Browse files
committed
fix: update tag retrieval method to use GitHub CLI for improved reliability
1 parent 2012770 commit 3521a3d

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

.github/workflows/publish-alpha.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,24 @@ jobs:
3232

3333
- name: Clean install dependencies
3434
run: npm clean-install
35-
35+
36+
- name: Set up GitHub CLI
37+
uses: cli/cli@v3
38+
3639
- name: Determine next alpha version
3740
id: version
41+
env:
42+
GH_TOKEN: ${{ secrets.GHCR_PAT }}
3843
run: |
3944
BASE_VERSION=$(node -p "require('./package.json').version")
4045
BASE_VERSION=$(echo "$BASE_VERSION" | sed 's/-.*//')
4146
IMAGE_NAME=ghcr.io/${{ github.repository }}/podverse-api
4247
43-
# Use a PAT with read:packages scope
44-
TOKEN="${{ secrets.GHCR_PAT }}"
45-
TAGS_JSON=$(curl -s -H "Authorization: Bearer $TOKEN" \
46-
"https://ghcr.io/v2/${{ github.repository_owner }}/podverse-api/tags/list")
48+
# Use GitHub CLI to get tags
49+
TAGS_JSON=$(gh api -H "Accept: application/vnd.github+json" \
50+
/orgs/${GITHUB_REPOSITORY%/*}/packages/container/podverse-api/versions)
4751
echo "Raw tags JSON: $TAGS_JSON"
48-
TAGS=$(echo "$TAGS_JSON" | jq -r '.tags[]' | grep "alpha" || true)
52+
TAGS=$(echo "$TAGS_JSON" | jq -r '.[].metadata.container.tags[]' | grep "alpha" || true)
4953
echo "Filtered alpha tags: $TAGS"
5054
5155
# Try to get the current alpha version (e.g., 5.1.1-alpha.3)

0 commit comments

Comments
 (0)