环境变量

export OWNER="用户名"
export REPOSITORY="仓库名"

查询 workflow 运行记录

gh api -X GET "/repos/$OWNER/$REPOSITORY/actions/runs?per_page=300" | jq '.workflow_runs[] | .id' | xargs -I{} echo {}

删除 workflow 运行记录

gh api -X GET "/repos/$OWNER/$REPOSITORY/actions/runs?per_page=300" | jq '.workflow_runs[] | .id' | xargs -I{} sh -c 'echo {} && gh api --silent -X DELETE /repos/$OWNER/$REPOSITORY/actions/runs/{}'