Added the ability to delete run logs

This commit is contained in:
NianBroken
2024-05-10 22:51:24 +08:00 Unverified
parent d96cdefcd7
commit d43e68c68f
+34 -4
View File
@@ -7,16 +7,17 @@ run-name: DeleteOldRuns
# 指定此工作流的触发器
on:
schedule:
- cron: '0 16 * * *' # 每天0点触发工作流(基于北京时间)
- cron: "0 16 * * *" # 每天0点触发工作流(基于北京时间)
workflow_dispatch: # 可以手动执行
jobs:
# 检查成绩
DeleteOldRuns:
# 删除运行记录
DeleteOldRuns_1:
name: DeleteOldRuns
# 在最新版的Ubuntu系统上运行
runs-on: ubuntu-latest
timeout-minutes: 360
steps:
# 使用GitHub Actions提供的动作来检出代码库
@@ -64,6 +65,8 @@ jobs:
if [ -n "$GITHUB_TOKEN" ]; then
python delete_old_runs.py
echo "------"
else
exit 1
fi
# 方便通过截图快速定位到用户
@@ -79,4 +82,31 @@ jobs:
- name: Delete __pycache__ folder
run: |
# 删除__pycache__文件夹
rm -rf __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