Added the ability to delete run logs
This commit is contained in:
@@ -11,13 +11,12 @@ on:
|
||||
workflow_dispatch: # 可以手动执行
|
||||
|
||||
jobs:
|
||||
# 删除运行记录
|
||||
DeleteOldRuns_1:
|
||||
# 检查成绩
|
||||
DeleteOldRuns:
|
||||
name: DeleteOldRuns
|
||||
|
||||
# 在最新版的Ubuntu系统上运行
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 360
|
||||
|
||||
steps:
|
||||
# 使用GitHub Actions提供的动作来检出代码库
|
||||
@@ -83,30 +82,3 @@ jobs:
|
||||
run: |
|
||||
# 删除__pycache__文件夹
|
||||
rm -rf __pycache__
|
||||
|
||||
# 删除运行记录
|
||||
DeleteOldRuns_2:
|
||||
name: DeleteOldRuns
|
||||
needs: DeleteOldRuns_1
|
||||
|
||||
# 在最新版的Ubuntu系统上运行
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 360
|
||||
|
||||
steps:
|
||||
- name: Run main program
|
||||
id: run_main_program
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GHTOKEN }}
|
||||
REPOSITORY_NAME: ${{ github.repository }}
|
||||
|
||||
run: |
|
||||
# 运行主程序
|
||||
export BEIJING_TIME="$(TZ='Asia/Shanghai' date +'%Y-%m-%d %H:%M:%S:%3N')"
|
||||
echo "BEIJING_TIME=$BEIJING_TIME" >> $GITHUB_OUTPUT
|
||||
if [ -n "$GITHUB_TOKEN" ]; then
|
||||
python delete_old_runs.py
|
||||
echo "------"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
+1
-1
@@ -36,7 +36,7 @@ class GitHubActionsManager:
|
||||
f"Failed to delete run with ID {run_id}. Status code: {response.status_code}"
|
||||
) # 打印错误信息
|
||||
|
||||
def delete_old_runs(self, max_workers=64):
|
||||
def delete_old_runs(self, max_workers=2):
|
||||
next_page = self.runs_url # 初始化下一页的URL为第一页
|
||||
while next_page: # 循环直到没有下一页
|
||||
print(beijing_time) # 打印时间
|
||||
|
||||
Reference in New Issue
Block a user