Skip to content

Instantly share code, notes, and snippets.

@retyui
Last active August 10, 2023 16:17
Show Gist options
  • Select an option

  • Save retyui/ab8a171b7489d9f83880a9fcb63f58af to your computer and use it in GitHub Desktop.

Select an option

Save retyui/ab8a171b7489d9f83880a9fcb63f58af to your computer and use it in GitHub Desktop.

Revisions

  1. retyui revised this gist Aug 10, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-all.md
    Original file line number Diff line number Diff line change
    @@ -41,5 +41,5 @@ gh api "repos/$user/$repo/actions/runs?workflow_id=21456768"
    gh api "repos/$user/$repo/actions/runs?created=*..2022-07-16" --paginate -q '.workflow_runs[] | "\(.id)"' | xargs -n1 -I % gh api repos/$user/$repo/actions/runs/% -X DELETE

    gh api "repos/$user/$repo/actions/runs?created=*..2022-07-16" --paginate -q '.workflow_runs[] | "\(.id)"' > ids.txt
    cat ids.txs | xargs -n1 -I % gh api repos/$user/$repo/actions/runs/% -X DELETE
    cat ids.txt | xargs -n1 -I % gh api repos/$user/$repo/actions/runs/% -X DELETE
    ```
  2. retyui revised this gist Aug 10, 2023. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions remove-all.md
    Original file line number Diff line number Diff line change
    @@ -6,10 +6,10 @@ export user=NameOrOrgName
    export repo=RepoName


    gh api repos/$user/$repo/actions/runs --paginate -q '.workflow_runs[] | select(.workflow_id = 21456768) | "\(.id)"' | xargs -n1 -I % gh api repos/$user/$repo/actions/runs/% -X DELETE
    gh api repos/$user/$repo/actions/runs --paginate -q '.workflow_runs[] | "\(.id)"' | xargs -n1 -I % gh api repos/$user/$repo/actions/runs/% -X DELETE


    gh api "repos/$user/$repo/actions/runs?created=*..2022-07-16" --paginate -q '.workflow_runs[] | select(.workflow_id == 21456768) | "\(.id)"' | xargs -n1 -I % gh api repos/$user/$repo/actions/runs/% -X DELETE
    gh api "repos/$user/$repo/actions/runs?created=*..2022-07-16" --paginate -q '.workflow_runs[] | "\(.id)"' | xargs -n1 -I % gh api repos/$user/$repo/actions/runs/% -X DELETE

    gh api repos/$user/$repo/actions/runs?created=2022-06-15..2022-07-16

    @@ -38,8 +38,8 @@ gh api "repos/$user/$repo/actions/runs?workflow_id=21456768"



    gh api "repos/$user/$repo/actions/runs?created=*..2022-07-16" --paginate -q '.workflow_runs[] | select(.workflow_id == 21456768) | "\(.id)"' | xargs -n1 -I % gh api repos/$user/$repo/actions/runs/% -X DELETE
    gh api "repos/$user/$repo/actions/runs?created=*..2022-07-16" --paginate -q '.workflow_runs[] | "\(.id)"' | xargs -n1 -I % gh api repos/$user/$repo/actions/runs/% -X DELETE

    gh api "repos/$user/$repo/actions/runs?created=*..2022-07-16" --paginate -q '.workflow_runs[] | select(.workflow_id == 21456768) | "\(.id)"' > ids.txt
    gh api "repos/$user/$repo/actions/runs?created=*..2022-07-16" --paginate -q '.workflow_runs[] | "\(.id)"' > ids.txt
    cat ids.txs | xargs -n1 -I % gh api repos/$user/$repo/actions/runs/% -X DELETE
    ```
  3. retyui renamed this gist Aug 1, 2022. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. retyui created this gist Aug 1, 2022.
    45 changes: 45 additions & 0 deletions remove all
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    # Simple way to remove all workflow runs in Github Actions:


    ```bash
    export user=NameOrOrgName
    export repo=RepoName


    gh api repos/$user/$repo/actions/runs --paginate -q '.workflow_runs[] | select(.workflow_id = 21456768) | "\(.id)"' | xargs -n1 -I % gh api repos/$user/$repo/actions/runs/% -X DELETE


    gh api "repos/$user/$repo/actions/runs?created=*..2022-07-16" --paginate -q '.workflow_runs[] | select(.workflow_id == 21456768) | "\(.id)"' | xargs -n1 -I % gh api repos/$user/$repo/actions/runs/% -X DELETE

    gh api repos/$user/$repo/actions/runs?created=2022-06-15..2022-07-16

    gh api "repos/$user/$repo/actions/runs?workflow_id=21456768"


    {
    "id": 2677488357,
    "name": "aaaa",
    "node_id": "WFR_kwLOFhRH7c6flzrl",
    "head_branch": "name",
    "head_sha": "e90657391639ee0d1f645ca83bb7ef1e1218ed32",
    "path": ".github/workflows/name.yml",
    "run_number": 4759,
    "event": "pull_request",
    "status": "completed",
    "conclusion": "success",
    "workflow_id": 21456768,
    "check_suite_id": 7375336252,
    "check_suite_node_id": "CS_kwDOFhRH7c8AAAABt5qzPA",
    "url": "https://api.github.com/repos/name/repo/actions/runs/2677488357",
    "html_url": "https://github.com/name/repo/actions/runs/2677488357",
    "pull_requests": [],
    "created_at": "2022-07-15T14:35:25Z",
    "updated_at": "2022-07-15T14:49:51Z",



    gh api "repos/$user/$repo/actions/runs?created=*..2022-07-16" --paginate -q '.workflow_runs[] | select(.workflow_id == 21456768) | "\(.id)"' | xargs -n1 -I % gh api repos/$user/$repo/actions/runs/% -X DELETE

    gh api "repos/$user/$repo/actions/runs?created=*..2022-07-16" --paginate -q '.workflow_runs[] | select(.workflow_id == 21456768) | "\(.id)"' > ids.txt
    cat ids.txs | xargs -n1 -I % gh api repos/$user/$repo/actions/runs/% -X DELETE
    ```