refactor: remove dry run support
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
- 依序嘗試取得 Gitea API token。
|
||||
- 預設每個套件保留最新 `2` 個版本。
|
||||
- 預設為 `dry_run=true`,只列出候選,不會真的刪除。
|
||||
- 直接刪除超出保留數量的舊版本。
|
||||
- 輸出可搜尋的 log,包含 API status、request id 與 summary。
|
||||
|
||||
## Token 來源順序
|
||||
@@ -25,7 +25,6 @@ Action 會依序嘗試以下來源:
|
||||
| --- | --- | --- | --- |
|
||||
| `RUNNER_TOKEN` | string | - | Gitea API token,優先順序最高 |
|
||||
| `KEEP_VERSIONS` | integer string | `2` | 每個套件要保留的最新版本數,必須是整數且 `>= 0` |
|
||||
| `DRY_RUN` | boolean string | `true` | `true` 只列出候選,`false` 才會呼叫 DELETE API |
|
||||
|
||||
## Log 行為
|
||||
|
||||
@@ -34,17 +33,13 @@ Action 會依序嘗試以下來源:
|
||||
- `Trying token from ...`
|
||||
- `Using token from ...`
|
||||
- `keep_versions=...`
|
||||
- `dry_run=...`
|
||||
- `GET /api/v1/... -> 200 OK`
|
||||
- `Candidate to delete: ...`
|
||||
- `[DRY-RUN] Would delete ...`
|
||||
- `Deleted package ... -> 204 No Content`
|
||||
- `Summary: packages=... versions=... kept=... candidates=... deleted=... skipped=... errors=...`
|
||||
- `Summary: packages=... versions=... kept=... candidates=... deleted=... errors=...`
|
||||
|
||||
## Workflow 範例
|
||||
|
||||
### Dry-run
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
cleanup:
|
||||
@@ -54,21 +49,6 @@ jobs:
|
||||
with:
|
||||
RUNNER_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
KEEP_VERSIONS: 2
|
||||
DRY_RUN: true
|
||||
```
|
||||
|
||||
### 實際刪除
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
cleanup:
|
||||
runs-on: ubuntu
|
||||
steps:
|
||||
- uses: ./
|
||||
with:
|
||||
RUNNER_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
KEEP_VERSIONS: 2
|
||||
DRY_RUN: false
|
||||
```
|
||||
|
||||
## 測試
|
||||
|
||||
Reference in New Issue
Block a user