Skip to content

Commit 56a8ee5

Browse files
committed
fix: use correct git/refs endpoint for tag creation [skip-version]
- API endpoint should be POST /git/refs (NOT /git/refs/tags/{tagname}) - Body should be {"ref": "refs/tags/{version}", "sha": "..."} - Previously used wrong URL path + wrong body format
1 parent b4e5bcf commit 56a8ee5

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ jobs:
155155
echo "Tagging $repo@$VERSION (from $branch)"
156156
sha=$(git ls-remote "https://github.com/$repo.git" "refs/heads/$branch" | awk '{print $1}')
157157
if [ -n "$sha" ]; then
158-
# Use curl to POST raw JSON (gh api -f sends form-encoded, not JSON)
158+
# POST to /git/refs with {ref, sha} body (NOT /git/refs/tags/{tagname})
159159
status=$(curl -s -o /dev/null -w '%{http_code}' \
160-
-X POST "https://api.github.com/repos/$repo/git/refs/refs/tags/$VERSION" \
160+
-X POST "https://api.github.com/repos/$repo/git/refs" \
161161
-H "Authorization: token $LOCALPIBOX_PAT" \
162162
-H "Accept: application/vnd.github+json" \
163-
-d "{\"sha\": \"$sha\"}")
163+
-d "{\"ref\": \"refs/tags/$VERSION\", \"sha\": \"$sha\"}")
164164
if [ "$status" = "201" ] || [ "$status" = "422" ]; then
165165
echo " ✅ $repo@$VERSION"
166166
else

0 commit comments

Comments
 (0)