The publish job cannot push version bumps to a protected branch #40

Open
opened 2026-11-14 14:27:11 +00:00 by claude-bot · 3 comments
Member

Observed

Since develop is protected, the publish job publishes the changed packages to npm and then fails on git push origin HEAD:develop (runs 32 and 47):

remote: Forgejo: Internal Server Error (no message for end users)
 ! [remote rejected] HEAD -> develop (pre-receive hook declined)

The forge logs at the same second:

hook_pre_receive.go:368:preReceiveBranch() [E] Unable to GetUserByID for commits ... user does not exist [uid: -2, name: ]

-2 is the internal account of the automatic workflow token. The pre-receive hook of a protected branch loads the pushing account to check its rights and fails on this one (Forgejo 15.0.11).

Consequence

Versions published to npm are not recorded in the repository. On main, the release tags would not be created either, since they come after this push.

Expected

The job pushes with the token of a service account that the branch protection allows to push, and stops before publishing when that token is missing.

## Observed Since `develop` is protected, the `publish` job publishes the changed packages to npm and then fails on `git push origin HEAD:develop` (runs 32 and 47): ``` remote: Forgejo: Internal Server Error (no message for end users) ! [remote rejected] HEAD -> develop (pre-receive hook declined) ``` The forge logs at the same second: ``` hook_pre_receive.go:368:preReceiveBranch() [E] Unable to GetUserByID for commits ... user does not exist [uid: -2, name: ] ``` `-2` is the internal account of the automatic workflow token. The pre-receive hook of a protected branch loads the pushing account to check its rights and fails on this one (Forgejo 15.0.11). ## Consequence Versions published to npm are not recorded in the repository. On `main`, the release tags would not be created either, since they come after this push. ## Expected The job pushes with the token of a service account that the branch protection allows to push, and stops before publishing when that token is missing.
Author
Member

The maintainer changed the branch rights rather than adding a service account (pull request 41 closed). To close once a push to develop gets through the publish job, including the commit chore: release versions & update hashes.

Catch-up expected on that run: @quatrain/backend-postgres@1.2.14-beta.0 and @quatrain/identifiers@1.0.0-beta.1 are already on npm; the script computes the same versions again, skips their publication and records them.

The maintainer changed the branch rights rather than adding a service account (pull request 41 closed). To close once a push to `develop` gets through the `publish` job, including the commit `chore: release versions & update hashes`. Catch-up expected on that run: `@quatrain/backend-postgres@1.2.14-beta.0` and `@quatrain/identifiers@1.0.0-beta.1` are already on npm; the script computes the same versions again, skips their publication and records them.
Author
Member

Status on 2026-11-15.

Cause: a Forgejo defect. On any protected branch, the pre-receive hook looks up the pushing user in the database (routers/private/hook_pre_receive.go, step 5). The automatic Actions token belongs to the built-in user -2, which has no row, so the hook answers 500. No branch protection setting avoids it; changing the branch rights did not help (run 71 failed the same way).

Reported upstream: https://codeberg.org/forgejo/forgejo/issues/15275 (an earlier report, forgejo/forgejo#11159, was closed by its author after a workaround, without a fix).

Decision: no workaround here (no service account, no deploy key, branch protection kept) while upstream answers. Until then the publish job publishes to npm, then fails on the push, and version bumps do not reach develop. #47 makes each run publish the current code under the next free beta.

This issue stays open until a push to develop passes the publish job.

Status on 2026-11-15. **Cause**: a Forgejo defect. On any protected branch, the pre-receive hook looks up the pushing user in the database (`routers/private/hook_pre_receive.go`, step 5). The automatic Actions token belongs to the built-in user `-2`, which has no row, so the hook answers 500. No branch protection setting avoids it; changing the branch rights did not help (run 71 failed the same way). **Reported upstream**: https://codeberg.org/forgejo/forgejo/issues/15275 (an earlier report, forgejo/forgejo#11159, was closed by its author after a workaround, without a fix). **Decision**: no workaround here (no service account, no deploy key, branch protection kept) while upstream answers. Until then the publish job publishes to npm, then fails on the push, and version bumps do not reach `develop`. #47 makes each run publish the current code under the next free beta. This issue stays open until a push to `develop` passes the publish job.
Author
Member

Update, 2026-11-15: the branch protection rules were removed by the maintainer as a temporary measure. Run 76 on develop then published and pushed the version bump (3d9b1fe).

Allowing pushes to everyone with write access was tried first and did not help: any protection rule triggers the failing lookup (run 74).

This issue stays open as the reminder to restore the branch protection once https://codeberg.org/forgejo/forgejo/issues/15275 is fixed in the deployed Forgejo version.

Update, 2026-11-15: the branch protection rules were removed by the maintainer as a temporary measure. Run 76 on `develop` then published and pushed the version bump (`3d9b1fe`). Allowing pushes to everyone with write access was tried first and did not help: any protection rule triggers the failing lookup (run 74). This issue stays open as the reminder to **restore the branch protection** once https://codeberg.org/forgejo/forgejo/issues/15275 is fixed in the deployed Forgejo version.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
quatrain/core#40
No description provided.