Skip to content

Commit 0e59416

Browse files
committed
update github action
1 parent 8e32034 commit 0e59416

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

.github/scripts/on_tag_deleted.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ REPO_OWNER="${GITHUB_REPOSITORY_OWNER:-eclipsevortex}"
1010
REPO_NAME="subvortex-${COMPONENT//_/-}"
1111
IMAGE="ghcr.io/$REPO_OWNER/$REPO_NAME"
1212

13-
GHCR_USERNAME="${GHCR_USERNAME:-}"
14-
GHCR_TOKEN="${GHCR_TOKEN:-}"
13+
GH_TOKEN="${GH_TOKEN:-}"
1514

16-
if [[ -z "$GHCR_USERNAME" || -z "$GHCR_TOKEN" ]]; then
15+
if [[ -z "$GH_TOKEN" ]]; then
1716
echo "❌ Missing Docker credentials (GHCR_USERNAME / GHCR_TOKEN)"
1817
exit 1
1918
fi
@@ -22,7 +21,6 @@ echo "🔍 Searching for Version ID corresponding to tag: $VERSION..."
2221

2322
# Step 1: Find the Version ID from the tag
2423
VERSION_ID=$(gh api "user/packages/container/${REPO_NAME}/versions" \
25-
-H "Authorization: Bearer $GHCR_TOKEN" \
2624
| jq -r --arg VERSION "$VERSION" ".[] | select(.metadata.container.tags[]? == \"$VERSION\") | .id")
2725

2826
if [[ -z "$VERSION_ID" ]]; then
@@ -36,7 +34,7 @@ echo "🔍 Found Version ID: $VERSION_ID"
3634
echo "🗑️ Deleting $IMAGE:$VERSION (Version ID: $VERSION_ID) from GitHub Container Registry..."
3735

3836
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -X DELETE \
39-
-H "Authorization: Bearer $GHCR_TOKEN" \
37+
-H "Authorization: Bearer $GH_TOKEN" \
4038
-H "Accept: application/vnd.github.v3+json" \
4139
"https://api.github.com/user/packages/container/${REPO_NAME}/versions/${VERSION_ID}")
4240

.github/workflows/docker-workflow.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ jobs:
150150
run: |
151151
.github/scripts/on_tag_deleted.sh "${{ matrix.component }}" "${{ matrix.service }}" "${{ github.event.ref }}"
152152
env:
153-
GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
154-
GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}
153+
GH_TOKEN: ${{ secrets.GHCR_TOKEN }}
155154

156155
release:
157156
if: github.event_name == 'release'

0 commit comments

Comments
 (0)