Skip to content

Commit f521512

Browse files
committed
fix: use LOCALPIBOX_PAT secret for cross-repo tag creation [skip-version]
- GITHUB_TOKEN is scoped to devstack only, cannot create tags on other repos - Add --header "Authorization: token $LOCALPIBOX_PAT" to gh api calls
1 parent 87b0527 commit f521512

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

.github/workflows/build-and-publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,17 @@ jobs:
154154
echo "Tagging $repo@$VERSION (from $branch)"
155155
sha=$(git ls-remote "https://github.com/$repo.git" "refs/heads/$branch" | awk '{print $1}')
156156
if [ -n "$sha" ]; then
157-
# Create lightweight tags: POST to /git/refs/{ref} with sha body
158-
# Handle 422 (already exists) gracefully by checking if tag exists
157+
# Create lightweight tag using PAT (GITHUB_TOKEN is scoped to devstack only)
159158
if gh api "repos/$repo/git/refs/refs/tags/$VERSION" \
160159
--method POST \
161160
-f sha="$sha" \
161+
--header "Authorization: token $LOCALPIBOX_PAT" \
162162
2>/dev/null; then
163163
echo " ✅ $repo@$VERSION"
164-
elif gh api "repos/$repo/git/ref/tags/$VERSION" 2>/dev/null > /dev/null; then
164+
elif gh api "repos/$repo/git/ref/tags/$VERSION" --header "Authorization: token $LOCALPIBOX_PAT" 2>/dev/null > /dev/null; then
165165
echo " ✅ $repo@$VERSION (already exists)"
166166
else
167-
echo " ⚠️ $repo tag creation failed (tag doesn't exist)"
167+
echo " ⚠️ $repo tag creation failed"
168168
fi
169169
else
170170
echo " ⚠️ $repo:$branch not found, skipping tag"

0 commit comments

Comments
 (0)