fix: gitea update
All checks were successful
Check / check (push) Successful in 1m5s
Check / update (push) Has been skipped
Check / push (push) Successful in 13s

This commit is contained in:
2025-06-16 13:45:13 -04:00
parent 99379efa15
commit 6f87b1f4da
2 changed files with 10 additions and 9 deletions

View File

@ -35,24 +35,25 @@ jobs:
env: env:
PAT: ${{ secrets.PAT }} PAT: ${{ secrets.PAT }}
run: | run: |
git push origin update --force
URL="${{ gitea.server_url }}" URL="${{ gitea.server_url }}"
REPO_OWNER_SLASH_NAME="${{ gitea.repository }}" REPO_OWNER_SLASH_NAME="${{ gitea.repository }}"
if ! git ls-remote --exit-code origin update; then PRS=$(curl -s -X GET -H "Authorization: token $PAT" \
git push origin update --force -H "Content-Type: application/json" \
"$URL/api/v1/repos/$REPO_OWNER_SLASH_NAME/pulls?state=open")
PR_UPDATE=$(echo "$PRS" | jq -cr '.[] | select( .title | contains("update") )')
PR_RESPONSE=$(curl -s -X POST -H "Authorization: token $PAT" \ if [ ! -z "$PR_UPDATE" ]; then
PR_CREATE=$(curl -s -X POST -H "Authorization: token $PAT" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{"title":"update","body":"automatic update","head":"update","base":"main"}' \ -d '{"title":"update","body":"automatic update","head":"update","base":"main"}' \
"$URL/api/v1/repos/$REPO_OWNER_SLASH_NAME/pulls") "$URL/api/v1/repos/$REPO_OWNER_SLASH_NAME/pulls")
PR_NUMBER=$(echo "$PR_CREATE" | jq -r '.number')
PR_NUMBER=$(echo "$PR_RESPONSE" | jq -r '.number')
curl -s -X POST -H "Authorization: token $PAT" \ curl -s -X POST -H "Authorization: token $PAT" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{"Do":"merge","merge_when_checks_succeed":true,"delete_branch_after_merge":true}' \ -d '{"Do":"merge","merge_when_checks_succeed":true,"delete_branch_after_merge":true}' \
"$URL/api/v1/repos/$REPO_OWNER_SLASH_NAME/pulls/$PR_NUMBER/merge" "$URL/api/v1/repos/$REPO_OWNER_SLASH_NAME/pulls/$PR_NUMBER/merge"
else
git push origin update --force
fi fi

View File

@ -5,7 +5,7 @@ updated=false
echo "updating nix flake" echo "updating nix flake"
cd "${git_root}" cd "${git_root}"
nix flake update nix flake update --accept-flake-config
if ! git diff --exit-code flake.lock; then if ! git diff --exit-code flake.lock; then
git add flake.lock git add flake.lock
git commit -m "build(nix): updated nix dependencies" git commit -m "build(nix): updated nix dependencies"