From e82e81102513533c3af3025d807c48458f87a439 Mon Sep 17 00:00:00 2001 From: Juan Sebastian Montoya Date: Wed, 26 Nov 2025 11:57:24 -0500 Subject: [PATCH] chore: update CI workflow to use FORGEBOT_ACCESS_TOKEN for authentication and change git user configuration --- .forgejo/workflows/ci.yaml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 02b041d..6d60f54 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -50,6 +50,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 # Fetch all history for tags + token: ${{ secrets.FORGEBOT_ACCESS_TOKEN }} - name: Login to Registry run: | @@ -165,8 +166,22 @@ jobs: echo "📝 Updating version files to: $VERSION" # Configure git - git config user.name "forgejo-actions" - git config user.email "forgejo-actions@forgejo.io" + git config user.name "forgebot" + git config user.email "forgebot@forgejo.io" + + # Configure remote URL with token for authentication + # Extract repository URL and add token + REPO_URL=$(git remote get-url origin) + # Handle both https and git@ formats + if [[ "$REPO_URL" == https://* ]]; then + # Extract domain and path from https URL + REPO_PATH=$(echo "$REPO_URL" | sed 's|https://||' | sed 's|git@||' | sed 's|:|/|') + git remote set-url origin "https://${{ secrets.FORGEBOT_ACCESS_TOKEN }}@${REPO_PATH}" + else + # For git@ format, convert to https with token + REPO_PATH=$(echo "$REPO_URL" | sed 's|git@||' | sed 's|:|/|') + git remote set-url origin "https://${{ secrets.FORGEBOT_ACCESS_TOKEN }}@${REPO_PATH}" + fi # Fetch latest changes to avoid conflicts git fetch origin main || echo "Fetch completed or already up to date" @@ -198,9 +213,9 @@ jobs: exit 0 } - # Push to main branch + # Push to main branch using the token git push origin main || { - echo "⚠️ Push failed (may need manual intervention or branch protection)" + echo "⚠️ Push failed (check token permissions)" exit 0 } -- 2.49.1