refactor(cleanup-release): 移除 RUNNER_TOKEN 輸入,一律改用 Gitea 自動 token
CI / 2. TEST (pull_request) Successful in 3m55s
CI / 3. RESULT (pull_request) Successful in 1s
CI / 1. BUILD (pull_request) Successful in 2s

- action.yml 移除 RUNNER_TOKEN input 與 secrets 回退鏈,env 簡化為 GITEA_TOKEN: ${{ gitea.token }}
- src/index.js 環境變數與 log 訊息同步改名為 GITEA_TOKEN,遮罩行為不變
- 自動 token 權限僅限當前 repo 且 job 結束即失效,已足夠本 action 的 release/tag 清理需求

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jeffery
2026-07-15 11:21:08 +08:00
co-authored by Claude Fable 5
parent 888d503d1d
commit adab16fb45
2 changed files with 8 additions and 12 deletions
+5 -5
View File
@@ -400,7 +400,7 @@ function hasBatchFailure(results) {
async function main() {
const GITEA_SERVER_URL = normalizeEnvValue(process.env.GITEA_SERVER_URL);
const GITEA_REPOSITORY = normalizeEnvValue(process.env.GITEA_REPOSITORY);
const RUNNER_TOKEN = normalizeEnvValue(process.env.RUNNER_TOKEN) ?? '';
const GITEA_TOKEN = normalizeEnvValue(process.env.GITEA_TOKEN) ?? '';
const KEEP_COUNT = normalizeEnvValue(process.env.KEEP_COUNT) ?? '';
const MAX_PAGES = normalizeEnvValue(process.env.MAX_PAGES) ?? '';
@@ -421,11 +421,11 @@ async function main() {
const keepCount = Number(KEEP_COUNT);
const authHeaders = {};
if (isEmptyOrNull(RUNNER_TOKEN)) {
warn('RUNNER_TOKEN is empty; release API calls will be anonymous');
if (isEmptyOrNull(GITEA_TOKEN)) {
warn('GITEA_TOKEN is empty; release API calls will be anonymous');
} else {
info('RUNNER_TOKEN=[redacted]');
authHeaders.Authorization = `token ${RUNNER_TOKEN}`;
info('GITEA_TOKEN=[redacted]');
authHeaders.Authorization = `token ${GITEA_TOKEN}`;
}
const serverBase = new URL(GITEA_SERVER_URL);