feat(gitea): use a dedicated admin token for recruitment
CI / quality (push) Failing after 45s

Recruitment needs `write:admin` and `write:organization`, which the everyday
token must not carry. A second token keeps the repository and issue scopes
least privileged, falls back to `GITEA_TOKEN` so existing installs keep
working, and a 403 now names the missing scope instead of pretending Gitea
did not answer.
This commit is contained in:
BlackAngelTV committed 2026-12-06 18:01:43 +01:00
1 parent 9b45c9bf89
commit adc96e4d75
9 files changed
+141 -34

No files matched your search

+16
View File
@@ -37,6 +37,22 @@ describe('env schema', () => {
}
});
it('keeps the recruitment token separate and admin-scoped', () => {
const token = BY_KEY.GITEA_RECRUITMENT_TOKEN;
assert.equal(token.type, 'secret');
assert.equal(token.testable, 'gitea-recruitment');
assert.match(token.help, /write:admin/);
assert.match(token.help, /write:organization/);
assert.match(token.help, /read:user/);
});
it('warns when a Gitea token has no URL to talk to', () => {
const warnings = crossCheck({ GITEA_RECRUITMENT_TOKEN: 'jeton-admin' });
assert.ok(warnings.some((warning) => warning.includes('GITEA_URL')));
});
it('covers the variables the bot refuses to start without', () => {
assert.deepEqual(requiredKeys().sort(), ['DISCORD_CLIENT_ID', 'DISCORD_GUILD_ID', 'DISCORD_TOKEN']);
});