fix(ci): use Gitea file API to push CHANGELOG.md — eliminates non-fast-forward rejection
All checks were successful
Test / rust-fmt-check (pull_request) Successful in 14s
PR Review Automation / review (pull_request) Successful in 2m57s
Test / frontend-typecheck (pull_request) Successful in 1m15s
Test / frontend-tests (pull_request) Successful in 1m18s
Test / rust-clippy (pull_request) Successful in 5m34s
Test / rust-tests (pull_request) Successful in 6m52s
All checks were successful
Test / rust-fmt-check (pull_request) Successful in 14s
PR Review Automation / review (pull_request) Successful in 2m57s
Test / frontend-typecheck (pull_request) Successful in 1m15s
Test / frontend-tests (pull_request) Successful in 1m18s
Test / rust-clippy (pull_request) Successful in 5m34s
Test / rust-tests (pull_request) Successful in 6m52s
git push origin HEAD:master fails when master advances between the job's fetch and its push. Replace with PUT /repos/.../contents/CHANGELOG.md which atomically updates the file on master regardless of HEAD position.
This commit is contained in:
parent
2f6d5c1865
commit
2da529fb75
@ -135,14 +135,24 @@ jobs:
|
||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
run: |
|
||||
set -eu
|
||||
git add CHANGELOG.md
|
||||
if git diff --staged --quiet; then
|
||||
echo "No changelog changes"
|
||||
else
|
||||
TAG=$(git describe --tags --abbrev=0)
|
||||
git commit -m "chore: update CHANGELOG.md for ${TAG} [skip ci]"
|
||||
git push origin HEAD:master
|
||||
fi
|
||||
API="http://172.0.0.29:3000/api/v1/repos/$GITHUB_REPOSITORY"
|
||||
TAG=$(git describe --tags --abbrev=0)
|
||||
# Get current file SHA from master (required by API if the file already exists)
|
||||
CURRENT_SHA=$(curl -sf "$API/contents/CHANGELOG.md?ref=master" \
|
||||
-H "Authorization: token $RELEASE_TOKEN" | jq -r '.sha // empty')
|
||||
# Base64-encode the generated file (no line wrapping)
|
||||
CONTENT=$(base64 -w 0 CHANGELOG.md)
|
||||
# PUT atomically updates (or creates) the file on master — no fast-forward needed
|
||||
curl -sf -X PUT "$API/contents/CHANGELOG.md" \
|
||||
-H "Authorization: token $RELEASE_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"message\": \"chore: update CHANGELOG.md for ${TAG} [skip ci]\",
|
||||
\"content\": \"$CONTENT\",
|
||||
\"sha\": \"$CURRENT_SHA\",
|
||||
\"branch\": \"master\"
|
||||
}"
|
||||
echo "✓ CHANGELOG.md committed to master"
|
||||
|
||||
- name: Upload CHANGELOG.md as release asset
|
||||
env:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user