From 0e800242d7256d55b864476dafa5e4a3eab74f60 Mon Sep 17 00:00:00 2001 From: grabowski Date: Mon, 11 Aug 2025 11:21:11 +0700 Subject: [PATCH] Fix push URL construction in workflow - Correct URL parsing to properly extract domain and repository path - Fix malformed push URL that was missing proper formatting - Add debug logging to show URL components for troubleshooting - Ensure proper HTTPS authentication URL format: https://user:token@domain/repo.git - Handle both HTTPS and SSH repository URL formats correctly - Fix issue where push was failing due to incorrect URL construction --- .gitea/workflows/auto-sort-files.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/auto-sort-files.yml b/.gitea/workflows/auto-sort-files.yml index 626a8a1..a8b52ec 100644 --- a/.gitea/workflows/auto-sort-files.yml +++ b/.gitea/workflows/auto-sort-files.yml @@ -101,9 +101,9 @@ jobs: # Extract the base URL and repository path if [[ $REPO_URL == https://* ]]; then # HTTPS URL format: https://git.b4l.co.th/B4L/repo-name.git - BASE_URL=$(echo $REPO_URL | sed 's|https://\([^/]*\)/.*|https://\1|') + DOMAIN=$(echo $REPO_URL | sed 's|https://\([^/]*\)/.*|\1|') REPO_PATH=$(echo $REPO_URL | sed 's|https://[^/]*/\(.*\)|\1|') - PUSH_URL="${BASE_URL}/ci-bot:${{ secrets.CI_BOT_TOKEN }}@${REPO_PATH}" + PUSH_URL="https://ci-bot:${{ secrets.CI_BOT_TOKEN }}@${DOMAIN}/${REPO_PATH}" else # SSH URL format: git@git.b4l.co.th:B4L/repo-name.git DOMAIN=$(echo $REPO_URL | sed 's|git@\([^:]*\):.*|\1|') @@ -111,7 +111,10 @@ jobs: PUSH_URL="https://ci-bot:${{ secrets.CI_BOT_TOKEN }}@${DOMAIN}/${REPO_PATH}" fi - echo "Pushing to: $PUSH_URL" + echo "Repository URL: $REPO_URL" + echo "Domain: $DOMAIN" + echo "Repository Path: $REPO_PATH" + echo "Pushing to: https://${DOMAIN}/${REPO_PATH} (with authentication)" git push $PUSH_URL HEAD:${{ github.ref_name }} - name: Create summary