fix(worker): start with a repository-only token
Validate game templates / validate (push) Successful in 20s
Validate game templates / boot-test (push) Skipped
Validate game templates / publish (push) Skipped

The start-up check read the token's account with GET /user, which needs the
read:user scope. A token with only repository scope, which is all the worker
needs, got 403 and the worker exited in a restart loop. On 403 it now
names the commit author from BOT_NAME (default gbr-bot) and still checks
push access on the games repo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gregandClaude Opus 5.5 committed 2026-10-25 17:18:22 -04:00
1 parent 425c242ae7
commit 0c868f7bac
3 files changed
+30 -1

No files matched your search

+6 -1
View File
@@ -60,7 +60,12 @@ func (c *workerConfig) checkBot() error {
Email string `json:"email"`
}
if err := c.giteaGet("/user", &user); err != nil {
return fmt.Errorf("GITEA_TOKEN: %w", err)
if !strings.HasPrefix(err.Error(), "HTTP 403") {
return fmt.Errorf("GITEA_TOKEN: %w", err)
}
// A repository-only token (all the worker needs) may not read its own account: name the author from
// BOT_NAME instead. Whether it can push is still checked below.
user.Login = envOr("BOT_NAME", "gbr-bot")
}
var repo struct {
Permissions struct {