library(gh)
library(purrr)
library(dplyr)
token <- Sys.getenv("GITHUB_PAT")
REPO <- "my-repo"
OWNER <- "me"
runs <- gh::gh(
"GET /repos/:owner/:repo/actions/runs",
.limit = Inf,
owner = OWNER,
repo = REPO,
.token = token
)
run_ids <- runs$workflow_runs |>
purrr::map(
\(.x) {
list(
id = as.character(.x$id),
display_title = .x$display_title,
status = .x$status,
conclusion = .x$conclusion
)
}
) |>
dplyr::bind_rows()
res <- run_ids |>
dplyr::filter(conclusion == 'failure') |>
dplyr::pull(id) |>
purrr::walk(
\(.x) {
gh::gh(
paste0("DELETE /repos/:owner/:repo/actions/runs/", .x),
owner = OWNER,
repo = REPO,
.token = token
)
}
)
Last active
July 9, 2024 00:14
-
-
Save tonyelhabr/25ade89d541d43b00f17bfc3a0bc984f to your computer and use it in GitHub Desktop.
Delete GitHub action run logs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment