ci(merge_main): fix auth for self-hosted Gitea Actions #46

Merged
admin merged 2 commits from hermes/brencher:fix/gitea-actions-merge-workflows into main 2026-09-04 13:08:08 +02:00
Contributor

Problem

Both merge_main.yaml and merge_main_and_squash.yaml were written for github.com and rely on:

  • secrets.GITHUB_TOKEN — doesn't exist on this self-hosted Gitea.
  • github.repository and a hardcoded https://github.com/admin/brencher.git URL.

When main brencher gets a push, merge_main.yaml runs and tries to fetch --all --prune against github.com — fails with:

remote: Invalid username or token. Password authentication is not supported for Git operations.
fatal: Authentication failed for 'https://github.com/admin/brencher.git/'

Last failing run: https://gitea.rudolf.keenetic.link/admin/brencher/actions/runs/63/jobs/812 (Run #63).

Fix

  • Use a new repo-level secret GITEA_PUSH_TOKEN (PAT with write access) instead of the GitHub GITHUB_TOKEN.
  • Build the origin URL from GITHUB_REPOSITORY and GITEA_SERVER_URL (both Gitea Actions-injected env vars), instead of hardcoding github.com.
  • Use gitea-actions[bot]@noreply.localhost as the commit author identity.

Deploy notes

Before merging this PR, create the secret in admin/brencher:

  1. Generate a PAT for your account (or a dedicated bot) with write access to admin/brencher.
  2. Repo → Secrets → Add: name GITEA_PUSH_TOKEN, value = PAT.

Until the secret is set, the workflow will fail with "secret GITEA_PUSH_TOKEN not found" — same outcome as today (fails), but the failure mode is now correct and the URL works as soon as the secret is added.

Verification (post-merge)

After deploying the secret, the next push to main should make the rebase job succeed: it will fetch all branches from the self-hosted Gitea (using the new URL) and merge main into each.

## Problem Both `merge_main.yaml` and `merge_main_and_squash.yaml` were written for github.com and rely on: - `secrets.GITHUB_TOKEN` — doesn't exist on this self-hosted Gitea. - `github.repository` and a hardcoded `https://github.com/admin/brencher.git` URL. When `main` brencher gets a push, `merge_main.yaml` runs and tries to `fetch --all --prune` against github.com — fails with: ``` remote: Invalid username or token. Password authentication is not supported for Git operations. fatal: Authentication failed for 'https://github.com/admin/brencher.git/' ``` Last failing run: https://gitea.rudolf.keenetic.link/admin/brencher/actions/runs/63/jobs/812 (Run #63). ## Fix - Use a new repo-level secret `GITEA_PUSH_TOKEN` (PAT with write access) instead of the GitHub `GITHUB_TOKEN`. - Build the origin URL from `GITHUB_REPOSITORY` and `GITEA_SERVER_URL` (both Gitea Actions-injected env vars), instead of hardcoding `github.com`. - Use `gitea-actions[bot]@noreply.localhost` as the commit author identity. ## Deploy notes Before merging this PR, create the secret in admin/brencher: 1. Generate a PAT for your account (or a dedicated bot) with `write` access to `admin/brencher`. 2. Repo → Secrets → Add: name `GITEA_PUSH_TOKEN`, value = PAT. Until the secret is set, the workflow will fail with "secret GITEA_PUSH_TOKEN not found" — same outcome as today (fails), but the failure mode is now correct and the URL works as soon as the secret is added. ## Verification (post-merge) After deploying the secret, the next push to `main` should make the `rebase` job succeed: it will fetch all branches from the self-hosted Gitea (using the new URL) and merge `main` into each.
hermes added 1 commit 2026-09-04 10:04:20 +02:00
ci(merge_main): fix auth for self-hosted Gitea Actions
Python package / build (flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics, 3.12.3) (pull_request) Successful in 2m13s
Python package / build (flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics, 3.13) (pull_request) Successful in 35s
Python package / build (flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics, 3.14) (pull_request) Successful in 40s
Python package / build (flake8 . --count --select=E9,F63,F7,F82 --ignore=F824 --show-source --statistics, 3.12.3) (pull_request) Successful in 37s
Python package / build (flake8 . --count --select=E9,F63,F7,F82 --ignore=F824 --show-source --statistics, 3.13) (pull_request) Successful in 34s
Python package / build (flake8 . --count --select=E9,F63,F7,F82 --ignore=F824 --show-source --statistics, 3.14) (pull_request) Successful in 34s
Python package / build (mypy --no-incremental --config-file mypy.ini backend tests, 3.12.3) (pull_request) Successful in 1m41s
Python package / build (mypy --no-incremental --config-file mypy.ini backend tests, 3.13) (pull_request) Successful in 1m39s
Python package / build (mypy --no-incremental --config-file mypy.ini backend tests, 3.14) (pull_request) Successful in 1m41s
Python package / build (pip list, 3.12.3) (pull_request) Successful in 31s
Python package / build (pip list, 3.13) (pull_request) Successful in 29s
Python package / build (pip list, 3.14) (pull_request) Successful in 32s
Python package / build (python -c "import sys; print(f'Python {sys.version}'); print(f'Build: {sys.version_info}'); print(f'Implementation: {sys.implementation}')", 3.12.3) (pull_request) Successful in 27s
Python package / build (python -c "import sys; print(f'Python {sys.version}'); print(f'Build: {sys.version_info}'); print(f'Implementation: {sys.implementation}')", 3.13) (pull_request) Successful in 29s
Python package / build (python -c "import sys; print(f'Python {sys.version}'); print(f'Build: {sys.version_info}'); print(f'Implementation: {sys.implementation}')", 3.14) (pull_request) Successful in 29s
1c0580750d
Both workflows were written for github.com and relied on the implicit
secrets.GITHUB_TOKEN + github.repository + a hardcoded github.com URL.
On this self-hosted Gitea instance (ghauth.rudolf.keenetic.link) they fail
with "Invalid username or token. Password authentication is not supported
for Git operations." against https://github.com/admin/brencher.git.

The fix:
- Read the push token from a new repo-level secret GITEA_PUSH_TOKEN
  (admin/brencher). Same value is injected into the checkout and into the
  rewritten remote URL so push can succeed.
- Build the origin URL from Gitea-injected GITHUB_REPOSITORY and
  GITEA_SERVER_URL instead of hardcoding github.com.
- Update git user.email/name for the Gitea Actions identity.

To enable: create secret GITEA_PUSH_TOKEN in admin/brencher (a PAT with
write access to the repo) via the Gitea UI before merging this PR.
hermes added 1 commit 2026-09-04 13:02:01 +02:00
ci(merge_main): use PUSH_TOKEN instead of GITEA_PUSH_TOKEN
Python package / build (flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics, 3.12.3) (pull_request) Successful in 34s
Python package / build (flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics, 3.13) (pull_request) Successful in 33s
Python package / build (flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics, 3.14) (pull_request) Successful in 33s
Python package / build (flake8 . --count --select=E9,F63,F7,F82 --ignore=F824 --show-source --statistics, 3.12.3) (pull_request) Successful in 33s
Python package / build (flake8 . --count --select=E9,F63,F7,F82 --ignore=F824 --show-source --statistics, 3.13) (pull_request) Successful in 32s
Python package / build (flake8 . --count --select=E9,F63,F7,F82 --ignore=F824 --show-source --statistics, 3.14) (pull_request) Successful in 35s
Python package / build (mypy --no-incremental --config-file mypy.ini backend tests, 3.12.3) (pull_request) Successful in 1m39s
Python package / build (mypy --no-incremental --config-file mypy.ini backend tests, 3.13) (pull_request) Successful in 1m55s
Python package / build (mypy --no-incremental --config-file mypy.ini backend tests, 3.14) (pull_request) Successful in 2m0s
Python package / build (pip list, 3.12.3) (pull_request) Successful in 31s
Python package / build (pip list, 3.13) (pull_request) Successful in 33s
Python package / build (pip list, 3.14) (pull_request) Successful in 32s
Python package / build (python -c "import sys; print(f'Python {sys.version}'); print(f'Build: {sys.version_info}'); print(f'Implementation: {sys.implementation}')", 3.12.3) (pull_request) Successful in 32s
Python package / build (python -c "import sys; print(f'Python {sys.version}'); print(f'Build: {sys.version_info}'); print(f'Implementation: {sys.implementation}')", 3.13) (pull_request) Successful in 29s
Python package / build (python -c "import sys; print(f'Python {sys.version}'); print(f'Build: {sys.version_info}'); print(f'Implementation: {sys.implementation}')", 3.14) (pull_request) Successful in 29s
b0e32f835a
Match the secret name already created in admin/brencher.
admin merged commit 7dc36d7487 into main 2026-09-04 13:08:08 +02:00
admin deleted branch fix/gitea-actions-merge-workflows 2026-09-04 13:08:09 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/brencher#46