【GitHubActions】GitHubActionsの実行履歴(flow)をまとめて削除する手順

テストや検証でひたすら GitHub Actions を実行すると、下図のように実行履歴がたまっていきます。

 

【GitHubActions】GitHubActionsの実行履歴(flow)をまとめて削除する手順

 

 

何かのタイミングで、このたまった過去のワークフローを削除したくなることがあります。

(例えば検証段階が終わったとか、新しいフェーズに入ったとか)

 

その際にワークフローを1つ1つ選択して削除をしていくこともできますが上図のように300近いワークフローを1つ1つ手動で削除していくのは工数がかなり取られます。(無駄な時間です。)

 

そこで、コマンドで一気に過去のワークフローの履歴を削除してみました。

 

 

brewをインストールする

初めに brew をインストールします。

brew をインストールした後に gh と jq をインストールする流れとなります。

 

■インストールシェルをダウンロードする

$ curl -fsSL -o install.sh https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh

 

 

■brewをインストールする

$ /bin/bash install.sh 
==> Checking for `sudo` access (which may request your password)… 
==> Select a Homebrew installation directory: 
– Enter your password to install to /home/linuxbrew/.linuxbrew (recommended) 
– Press Control-D to install to /home/ec2-user/.linuxbrew 
– Press Control-C to cancel installation 
 
We trust you have received the usual lecture from the local System 
Administrator. It usually boils down to these three things: 
 
    #1) Respect the privacy of others. 
    #2) Think before you type. 
    #3) With great power comes great responsibility. 
 
[sudo] password for ec2-user: 
sudo: no password was provided 
==> This script will install: 
/home/ec2-user/.linuxbrew/bin/brew 
/home/ec2-user/.linuxbrew/share/doc/homebrew 
/home/ec2-user/.linuxbrew/share/man/man1/brew.1 
/home/ec2-user/.linuxbrew/share/zsh/site-functions/_brew 
/home/ec2-user/.linuxbrew/etc/bash_completion.d/brew 
/home/ec2-user/.linuxbrew/Homebrew 
==> The following new directories will be created: 
/home/ec2-user/.linuxbrew/bin 
/home/ec2-user/.linuxbrew/etc 
/home/ec2-user/.linuxbrew/include 
/home/ec2-user/.linuxbrew/lib 
/home/ec2-user/.linuxbrew/sbin 
/home/ec2-user/.linuxbrew/share 
/home/ec2-user/.linuxbrew/var 
/home/ec2-user/.linuxbrew/opt 
/home/ec2-user/.linuxbrew/share/zsh 
/home/ec2-user/.linuxbrew/share/zsh/site-functions 
/home/ec2-user/.linuxbrew/var/homebrew 
/home/ec2-user/.linuxbrew/var/homebrew/linked 
/home/ec2-user/.linuxbrew/Cellar 
/home/ec2-user/.linuxbrew/Caskroom 
/home/ec2-user/.linuxbrew/Frameworks 
 
Press RETURN/ENTER to continue or any other key to abort: 
==> /usr/bin/install -d -o ec2-user -g ec2-user -m 0755 /home/ec2-user/.linuxbrew 
==> /bin/mkdir -p /home/ec2-user/.linuxbrew/bin /home/ec2-user/.linuxbrew/etc /home/ec2-user/.linuxbrew/include /home/ec2-user/.linuxbrew/lib /home/ec2-user/.linuxbrew/sbin /home/ec2-user/.linuxbrew/share /home/ec2-user/.linuxbrew/var /home/ec2-user/.linuxbrew/opt /home/ec2-user/.linuxbrew/share/zsh /home/ec2-user/.linuxbrew/share/zsh/site-functions /home/ec2-user/.linuxbrew/var/homebrew /home/ec2-user/.linuxbrew/var/homebrew/linked /home/ec2-user/.linuxbrew/Cellar /home/ec2-user/.linuxbrew/Caskroom /home/ec2-user/.linuxbrew/Frameworks 
==> /bin/chmod ug=rwx /home/ec2-user/.linuxbrew/bin /home/ec2-user/.linuxbrew/etc /home/ec2-user/.linuxbrew/include /home/ec2-user/.linuxbrew/lib /home/ec2-user/.linuxbrew/sbin /home/ec2-user/.linuxbrew/share /home/ec2-user/.linuxbrew/var /home/ec2-user/.linuxbrew/opt /home/ec2-user/.linuxbrew/share/zsh /home/ec2-user/.linuxbrew/share/zsh/site-functions /home/ec2-user/.linuxbrew/var/homebrew /home/ec2-user/.linuxbrew/var/homebrew/linked /home/ec2-user/.linuxbrew/Cellar /home/ec2-user/.linuxbrew/Caskroom /home/ec2-user/.linuxbrew/Frameworks 
==> /bin/chmod go-w /home/ec2-user/.linuxbrew/share/zsh /home/ec2-user/.linuxbrew/share/zsh/site-functions 
==> /bin/chown ec2-user /home/ec2-user/.linuxbrew/bin /home/ec2-user/.linuxbrew/etc /home/ec2-user/.linuxbrew/include /home/ec2-user/.linuxbrew/lib /home/ec2-user/.linuxbrew/sbin /home/ec2-user/.linuxbrew/share /home/ec2-user/.linuxbrew/var /home/ec2-user/.linuxbrew/opt /home/ec2-user/.linuxbrew/share/zsh /home/ec2-user/.linuxbrew/share/zsh/site-functions /home/ec2-user/.linuxbrew/var/homebrew /home/ec2-user/.linuxbrew/var/homebrew/linked /home/ec2-user/.linuxbrew/Cellar /home/ec2-user/.linuxbrew/Caskroom /home/ec2-user/.linuxbrew/Frameworks 
==> /bin/chgrp ec2-user /home/ec2-user/.linuxbrew/bin /home/ec2-user/.linuxbrew/etc /home/ec2-user/.linuxbrew/include /home/ec2-user/.linuxbrew/lib /home/ec2-user/.linuxbrew/sbin /home/ec2-user/.linuxbrew/share /home/ec2-user/.linuxbrew/var /home/ec2-user/.linuxbrew/opt /home/ec2-user/.linuxbrew/share/zsh /home/ec2-user/.linuxbrew/share/zsh/site-functions /home/ec2-user/.linuxbrew/var/homebrew /home/ec2-user/.linuxbrew/var/homebrew/linked /home/ec2-user/.linuxbrew/Cellar /home/ec2-user/.linuxbrew/Caskroom /home/ec2-user/.linuxbrew/Frameworks 
==> /bin/mkdir -p /home/ec2-user/.linuxbrew/Homebrew 
==> /bin/chown -R ec2-user:ec2-user /home/ec2-user/.linuxbrew/Homebrew 
==> Downloading and installing Homebrew… 
remote: Enumerating objects: 216834, done. 
remote: Counting objects: 100% (177/177), done. 
remote: Compressing objects: 100% (121/121), done. 
remote: Total 216834 (delta 67), reused 156 (delta 53), pack-reused 216657 
Receiving objects: 100% (216834/216834), 61.09 MiB | 21.63 MiB/s, done. 
Resolving deltas: 100% (159509/159509), done. 
From https://github.com/Homebrew/brew 
 * [new branch]          master     -> origin/master 
 * [new tag]             0.1        -> 0.1 
 * [new tag]             0.2        -> 0.2 
 * [new tag]             0.3        -> 0.3 
 * [new tag]             0.4        -> 0.4 
 * [new tag]             0.5        -> 0.5 
 * [new tag]             0.6        -> 0.6 
 * [new tag]             0.7        -> 0.7 
 * [new tag]             0.7.1      -> 0.7.1 
 * [new tag]             0.8        -> 0.8 
 * [new tag]             0.8.1      -> 0.8.1 
 * [new tag]             0.9        -> 0.9 
 * [new tag]             0.9.1      -> 0.9.1 
 * [new tag]             0.9.2      -> 0.9.2 
 * [new tag]             0.9.3      -> 0.9.3 
 * [new tag]             0.9.4      -> 0.9.4 
 * [new tag]             0.9.5      -> 0.9.5 
 * [new tag]             0.9.8      -> 0.9.8 
 * [new tag]             0.9.9      -> 0.9.9 
 * [new tag]             1.0.0      -> 1.0.0 
 * [new tag]             1.0.1      -> 1.0.1 
 * [new tag]             1.0.2      -> 1.0.2 
 * [new tag]             1.0.3      -> 1.0.3 
 * [new tag]             1.0.4      -> 1.0.4 
 * [new tag]             1.0.5      -> 1.0.5 
 * [new tag]             1.0.6      -> 1.0.6 
 * [new tag]             1.0.7      -> 1.0.7 
 * [new tag]             1.0.8      -> 1.0.8 
 * [new tag]             1.0.9      -> 1.0.9 
 * [new tag]             1.1.0      -> 1.1.0 
 * [new tag]             1.1.1      -> 1.1.1 
 * [new tag]             1.1.10     -> 1.1.10 
 * [new tag]             1.1.11     -> 1.1.11 
 * [new tag]             1.1.12     -> 1.1.12 
 * [new tag]             1.1.13     -> 1.1.13 
 * [new tag]             1.1.2      -> 1.1.2 
 * [new tag]             1.1.3      -> 1.1.3 
 * [new tag]             1.1.4      -> 1.1.4 
 * [new tag]             1.1.5      -> 1.1.5 
 * [new tag]             1.1.6      -> 1.1.6 
 * [new tag]             1.1.7      -> 1.1.7 
 * [new tag]             1.1.8      -> 1.1.8 
 * [new tag]             1.1.9      -> 1.1.9 
 * [new tag]             1.2.0      -> 1.2.0 
 * [new tag]             1.2.1      -> 1.2.1 
 * [new tag]             1.2.2      -> 1.2.2 
 * [new tag]             1.2.3      -> 1.2.3 
 * [new tag]             1.2.4      -> 1.2.4 
 * [new tag]             1.2.5      -> 1.2.5 
 * [new tag]             1.2.6      -> 1.2.6 
 * [new tag]             1.3.0      -> 1.3.0 
 * [new tag]             1.3.1      -> 1.3.1 
 * [new tag]             1.3.2      -> 1.3.2 
 * [new tag]             1.3.3      -> 1.3.3 
 * [new tag]             1.3.4      -> 1.3.4 
 * [new tag]             1.3.5      -> 1.3.5 
 * [new tag]             1.3.6      -> 1.3.6 
 * [new tag]             1.3.7      -> 1.3.7 
 * [new tag]             1.3.8      -> 1.3.8 
 * [new tag]             1.3.9      -> 1.3.9 
 * [new tag]             1.4.0      -> 1.4.0 
 * [new tag]             1.4.1      -> 1.4.1 
 * [new tag]             1.4.2      -> 1.4.2 
 * [new tag]             1.4.3      -> 1.4.3 
 * [new tag]             1.5.0      -> 1.5.0 
 * [new tag]             1.5.1      -> 1.5.1 
 * [new tag]             1.5.10     -> 1.5.10 
 * [new tag]             1.5.11     -> 1.5.11 
 * [new tag]             1.5.12     -> 1.5.12 
 * [new tag]             1.5.13     -> 1.5.13 
 * [new tag]             1.5.14     -> 1.5.14 
 * [new tag]             1.5.2      -> 1.5.2 
 * [new tag]             1.5.3      -> 1.5.3 
 * [new tag]             1.5.4      -> 1.5.4 
 * [new tag]             1.5.5      -> 1.5.5 
 * [new tag]             1.5.6      -> 1.5.6 
 * [new tag]             1.5.7      -> 1.5.7 
 * [new tag]             1.5.8      -> 1.5.8 
 * [new tag]             1.5.9      -> 1.5.9 
 * [new tag]             1.6.0      -> 1.6.0 
 * [new tag]             1.6.1      -> 1.6.1 
 * [new tag]             1.6.10     -> 1.6.10 
 * [new tag]             1.6.11     -> 1.6.11 
 * [new tag]             1.6.12     -> 1.6.12 
 * [new tag]             1.6.13     -> 1.6.13 
 * [new tag]             1.6.14     -> 1.6.14 
 * [new tag]             1.6.15     -> 1.6.15 
 * [new tag]             1.6.16     -> 1.6.16 
 * [new tag]             1.6.17     -> 1.6.17 
 * [new tag]             1.6.2      -> 1.6.2 
 * [new tag]             1.6.3      -> 1.6.3 
 * [new tag]             1.6.4      -> 1.6.4 
 * [new tag]             1.6.5      -> 1.6.5 
 * [new tag]             1.6.6      -> 1.6.6 
 * [new tag]             1.6.7      -> 1.6.7 
 * [new tag]             1.6.8      -> 1.6.8 
 * [new tag]             1.6.9      -> 1.6.9 
 * [new tag]             1.7.0      -> 1.7.0 
 * [new tag]             1.7.1      -> 1.7.1 
 * [new tag]             1.7.2      -> 1.7.2 
 * [new tag]             1.7.3      -> 1.7.3 
 * [new tag]             1.7.4      -> 1.7.4 
 * [new tag]             1.7.5      -> 1.7.5 
 * [new tag]             1.7.6      -> 1.7.6 
 * [new tag]             1.7.7      -> 1.7.7 
 * [new tag]             1.8.0      -> 1.8.0 
 * [new tag]             1.8.1      -> 1.8.1 
 * [new tag]             1.8.2      -> 1.8.2 
 * [new tag]             1.8.3      -> 1.8.3 
 * [new tag]             1.8.4      -> 1.8.4 
 * [new tag]             1.8.5      -> 1.8.5 
 * [new tag]             1.8.6      -> 1.8.6 
 * [new tag]             1.9.0      -> 1.9.0 
 * [new tag]             1.9.1      -> 1.9.1 
 * [new tag]             1.9.2      -> 1.9.2 
 * [new tag]             1.9.3      -> 1.9.3 
 * [new tag]             2.0.0      -> 2.0.0 
 * [new tag]             2.0.1      -> 2.0.1 
 * [new tag]             2.0.2      -> 2.0.2 
 * [new tag]             2.0.3      -> 2.0.3 
 * [new tag]             2.0.4      -> 2.0.4 
 * [new tag]             2.0.5      -> 2.0.5 
 * [new tag]             2.0.6      -> 2.0.6 
 * [new tag]             2.1.0      -> 2.1.0 
 * [new tag]             2.1.1      -> 2.1.1 
 * [new tag]             2.1.10     -> 2.1.10 
 * [new tag]             2.1.11     -> 2.1.11 
 * [new tag]             2.1.12     -> 2.1.12 
 * [new tag]             2.1.13     -> 2.1.13 
 * [new tag]             2.1.14     -> 2.1.14 
 * [new tag]             2.1.15     -> 2.1.15 
 * [new tag]             2.1.16     -> 2.1.16 
 * [new tag]             2.1.2      -> 2.1.2 
 * [new tag]             2.1.3      -> 2.1.3 
 * [new tag]             2.1.4      -> 2.1.4 
 * [new tag]             2.1.5      -> 2.1.5 
 * [new tag]             2.1.6      -> 2.1.6 
 * [new tag]             2.1.7      -> 2.1.7 
 * [new tag]             2.1.8      -> 2.1.8 
 * [new tag]             2.1.9      -> 2.1.9 
 * [new tag]             2.2.0      -> 2.2.0 
 * [new tag]             2.2.1      -> 2.2.1 
 * [new tag]             2.2.10     -> 2.2.10 
 * [new tag]             2.2.11     -> 2.2.11 
 * [new tag]             2.2.12     -> 2.2.12 
 * [new tag]             2.2.13     -> 2.2.13 
 * [new tag]             2.2.14     -> 2.2.14 
 * [new tag]             2.2.15     -> 2.2.15 
 * [new tag]             2.2.16     -> 2.2.16 
 * [new tag]             2.2.17     -> 2.2.17 
 * [new tag]             2.2.2      -> 2.2.2 
 * [new tag]             2.2.3      -> 2.2.3 
 * [new tag]             2.2.4      -> 2.2.4 
 * [new tag]             2.2.5      -> 2.2.5 
 * [new tag]             2.2.6      -> 2.2.6 
 * [new tag]             2.2.7      -> 2.2.7 
 * [new tag]             2.2.8      -> 2.2.8 
 * [new tag]             2.2.9      -> 2.2.9 
 * [new tag]             2.3.0      -> 2.3.0 
 * [new tag]             2.4.0      -> 2.4.0 
 * [new tag]             2.4.1      -> 2.4.1 
 * [new tag]             2.4.10     -> 2.4.10 
 * [new tag]             2.4.11     -> 2.4.11 
 * [new tag]             2.4.12     -> 2.4.12 
 * [new tag]             2.4.13     -> 2.4.13 
 * [new tag]             2.4.14     -> 2.4.14 
 * [new tag]             2.4.15     -> 2.4.15 
 * [new tag]             2.4.16     -> 2.4.16 
 * [new tag]             2.4.2      -> 2.4.2 
 * [new tag]             2.4.3      -> 2.4.3 
 * [new tag]             2.4.4      -> 2.4.4 
 * [new tag]             2.4.5      -> 2.4.5 
 * [new tag]             2.4.6      -> 2.4.6 
 * [new tag]             2.4.7      -> 2.4.7 
 * [new tag]             2.4.8      -> 2.4.8 
 * [new tag]             2.4.9      -> 2.4.9 
 * [new tag]             2.5.0      -> 2.5.0 
 * [new tag]             2.5.1      -> 2.5.1 
 * [new tag]             2.5.10     -> 2.5.10 
 * [new tag]             2.5.11     -> 2.5.11 
 * [new tag]             2.5.12     -> 2.5.12 
 * [new tag]             2.5.2      -> 2.5.2 
 * [new tag]             2.5.3      -> 2.5.3 
 * [new tag]             2.5.4      -> 2.5.4 
 * [new tag]             2.5.5      -> 2.5.5 
 * [new tag]             2.5.6      -> 2.5.6 
 * [new tag]             2.5.7      -> 2.5.7 
 * [new tag]             2.5.8      -> 2.5.8 
 * [new tag]             2.5.9      -> 2.5.9 
 * [new tag]             2.6.0      -> 2.6.0 
 * [new tag]             2.6.1      -> 2.6.1 
 * [new tag]             2.6.2      -> 2.6.2 
 * [new tag]             2.7.0      -> 2.7.0 
 * [new tag]             2.7.1      -> 2.7.1 
 * [new tag]             2.7.2      -> 2.7.2 
 * [new tag]             2.7.3      -> 2.7.3 
 * [new tag]             2.7.4      -> 2.7.4 
 * [new tag]             2.7.5      -> 2.7.5 
 * [new tag]             2.7.6      -> 2.7.6 
 * [new tag]             2.7.7      -> 2.7.7 
 * [new tag]             3.0.0      -> 3.0.0 
 * [new tag]             3.0.1      -> 3.0.1 
 * [new tag]             3.0.10     -> 3.0.10 
 * [new tag]             3.0.11     -> 3.0.11 
 * [new tag]             3.0.2      -> 3.0.2 
 * [new tag]             3.0.3      -> 3.0.3 
 * [new tag]             3.0.4      -> 3.0.4 
 * [new tag]             3.0.5      -> 3.0.5 
 * [new tag]             3.0.6      -> 3.0.6 
 * [new tag]             3.0.7      -> 3.0.7 
 * [new tag]             3.0.8      -> 3.0.8 
 * [new tag]             3.0.9      -> 3.0.9 
 * [new tag]             3.1.0      -> 3.1.0 
 * [new tag]             3.1.1      -> 3.1.1 
 * [new tag]             3.1.10     -> 3.1.10 
 * [new tag]             3.1.11     -> 3.1.11 
 * [new tag]             3.1.12     -> 3.1.12 
 * [new tag]             3.1.2      -> 3.1.2 
 * [new tag]             3.1.3      -> 3.1.3 
 * [new tag]             3.1.4      -> 3.1.4 
 * [new tag]             3.1.5      -> 3.1.5 
 * [new tag]             3.1.6      -> 3.1.6 
 * [new tag]             3.1.7      -> 3.1.7 
 * [new tag]             3.1.8      -> 3.1.8 
 * [new tag]             3.1.9      -> 3.1.9 
 * [new tag]             3.2.0      -> 3.2.0 
 * [new tag]             3.2.1      -> 3.2.1 
 * [new tag]             3.2.10     -> 3.2.10 
 * [new tag]             3.2.11     -> 3.2.11 
 * [new tag]             3.2.12     -> 3.2.12 
 * [new tag]             3.2.13     -> 3.2.13 
 * [new tag]             3.2.14     -> 3.2.14 
 * [new tag]             3.2.15     -> 3.2.15 
 * [new tag]             3.2.16     -> 3.2.16 
 * [new tag]             3.2.17     -> 3.2.17 
 * [new tag]             3.2.2      -> 3.2.2 
 * [new tag]             3.2.3      -> 3.2.3 
 * [new tag]             3.2.4      -> 3.2.4 
 * [new tag]             3.2.5      -> 3.2.5 
 * [new tag]             3.2.6      -> 3.2.6 
 * [new tag]             3.2.7      -> 3.2.7 
 * [new tag]             3.2.8      -> 3.2.8 
 * [new tag]             3.2.9      -> 3.2.9 
 * [new tag]             3.3.0      -> 3.3.0 
 * [new tag]             3.3.1      -> 3.3.1 
 * [new tag]             3.3.10     -> 3.3.10 
 * [new tag]             3.3.11     -> 3.3.11 
 * [new tag]             3.3.12     -> 3.3.12 
 * [new tag]             3.3.13     -> 3.3.13 
 * [new tag]             3.3.14     -> 3.3.14 
 * [new tag]             3.3.15     -> 3.3.15 
 * [new tag]             3.3.16     -> 3.3.16 
 * [new tag]             3.3.2      -> 3.3.2 
 * [new tag]             3.3.3      -> 3.3.3 
 * [new tag]             3.3.4      -> 3.3.4 
 * [new tag]             3.3.5      -> 3.3.5 
 * [new tag]             3.3.6      -> 3.3.6 
 * [new tag]             3.3.7      -> 3.3.7 
 * [new tag]             3.3.8      -> 3.3.8 
 * [new tag]             3.3.9      -> 3.3.9 
 * [new tag]             3.4.0      -> 3.4.0 
 * [new tag]             3.4.1      -> 3.4.1 
 * [new tag]             3.4.10     -> 3.4.10 
 * [new tag]             3.4.11     -> 3.4.11 
 * [new tag]             3.4.2      -> 3.4.2 
 * [new tag]             3.4.3      -> 3.4.3 
 * [new tag]             3.4.4      -> 3.4.4 
 * [new tag]             3.4.5      -> 3.4.5 
 * [new tag]             3.4.6      -> 3.4.6 
 * [new tag]             3.4.7      -> 3.4.7 
 * [new tag]             3.4.8      -> 3.4.8 
 * [new tag]             3.4.9      -> 3.4.9 
 * [new tag]             3.5.0      -> 3.5.0 
 * [new tag]             3.5.1      -> 3.5.1 
 * [new tag]             3.5.10     -> 3.5.10 
 * [new tag]             3.5.2      -> 3.5.2 
 * [new tag]             3.5.3      -> 3.5.3 
 * [new tag]             3.5.4      -> 3.5.4 
 * [new tag]             3.5.5      -> 3.5.5 
 * [new tag]             3.5.6      -> 3.5.6 
 * [new tag]             3.5.7      -> 3.5.7 
 * [new tag]             3.5.8      -> 3.5.8 
 * [new tag]             3.5.9      -> 3.5.9 
 * [new tag]             3.6.0      -> 3.6.0 
 * [new tag]             3.6.1      -> 3.6.1 
 * [new tag]             3.6.2      -> 3.6.2 
HEAD is now at 8de3e9371 Merge pull request #13893 from Homebrew/dependabot/github_actions/codecov/codecov-action-3.1.1 
==> Tapping homebrew/core 
remote: Enumerating objects: 1273105, done. 
remote: Counting objects: 100% (273/273), done. 
remote: Compressing objects: 100% (118/118), done. 
remote: Total 1273105 (delta 157), reused 261 (delta 155), pack-reused 1272832 
Receiving objects: 100% (1273105/1273105), 514.74 MiB | 23.52 MiB/s, done. 
Resolving deltas: 100% (878060/878060), done. 
From https://github.com/Homebrew/homebrew-core 
 * [new branch]              master     -> origin/master 
HEAD is now at c1b0e95c006 mlkit: update 4.7.1 bottle. 
==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:fc45ee6eddf4c7a17f4373dde7b1bc8a58255ea61e6847d3bf895225b28d072a 
######################################################################## 100.0% 
==> Pouring portable-ruby-2.6.8_1.x86_64_linux.bottle.tar.gz 
Warning: /home/ec2-user/.linuxbrew/bin is not in your PATH. 
  Instructions on how to configure your shell for Homebrew 
  can be found in the ‘Next steps’ section below. 
==> Installation successful! 
 
==> Homebrew has enabled anonymous aggregate formulae and cask analytics. 
Read the analytics documentation (and how to opt-out) here: 
  https://docs.brew.sh/Analytics 
No analytics data has been sent yet (nor will any be during this install run). 
 
==> Homebrew is run entirely by unpaid volunteers. Please consider donating: 
  https://github.com/Homebrew/brew#donations 
 
==> Next steps: 
– Run these two commands in your terminal to add Homebrew to your PATH: 
    echo ‘eval “$(/home/ec2-user/.linuxbrew/bin/brew shellenv)”‘ >> /home/ec2-user/.bash_profile 
    eval “$(/home/ec2-user/.linuxbrew/bin/brew shellenv)” 
– Install Homebrew’s dependencies if you have sudo access: 
    sudo yum groupinstall ‘Development Tools’ 
  For more information, see: 
    https://docs.brew.sh/Homebrew-on-Linux 
– We recommend that you install GCC: 
    brew install gcc 
– Run brew help to get started 
– Further documentation: 
    https://docs.brew.sh 
 
$  

 

 

 

 

brewのパスを通す

インストールしただけではまだ brew のパスは通っていません。

 

■brewのパスは通っていない

$ brew help
bash: brew: command not found

 

brew のパスを通します。

brew のパスは先ほどのインストール時の「==> Next steps: 」を参考にコマンドを実行します。

 

 

 

■パスを通すコマンド

==> Next steps:  
– Run these two commands in your terminal to add Homebrew to your PATH:  
    echo ‘eval “$(/home/ec2-user/.linuxbrew/bin/brew shellenv)”‘ >> /home/ec2-user/.bash_profile  
    eval “$(/home/ec2-user/.linuxbrew/bin/brew shellenv)” 

 

 

 

■コマンドを実行する

$ echo ‘eval “$(/home/ec2-user/.linuxbrew/bin/brew shellenv)”‘ >> /home/ec2-user/.bash_profile
$ eval “$(/home/ec2-user/.linuxbrew/bin/brew shellenv)”

 

 

 

■brewのパスが通ったことを確認する

$ brew help 
Example usage: 
  brew search TEXT|/REGEX/ 
  brew info [FORMULA|CASK…] 
  brew install FORMULA|CASK… 
  brew update 
  brew upgrade [FORMULA|CASK…] 
  brew uninstall FORMULA|CASK… 
  brew list [FORMULA|CASK…] 
 
Troubleshooting: 
  brew config 
  brew doctor 
  brew install –verbose –debug FORMULA|CASK 
 
Contributing: 
  brew create URL [–no-fetch] 
  brew edit [FORMULA|CASK…] 
 
Further help: 
  brew commands 
  brew help [COMMAND] 
  man brew 
  https://docs.brew.sh 

 

 

 

 

gh と jq をインストールする

brew をインストールしたら brew を使って gh と jq をインストールします。

 

■gh と jq をインストールする

$ brew install gh jq 
==> Downloading https://ghcr.io/v2/homebrew/core/linux-headers/5.15/manifests/5.15.57-1 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/linux-headers/5.15/blobs/sha256:8692682830cbb1fb74bb61190b 
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:8692682830cbb1fb74bb61 
######################################################################## 100.0% 
Warning: Building glibc from source as the bottle needs: 
– HOMEBREW_CELLAR: /home/linuxbrew/.linuxbrew/Cellar (yours is /home/ec2-user/.linuxbrew/Cellar) 
– HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew (yours is /home/ec2-user/.linuxbrew) 
==> Downloading https://github.com/Homebrew/glibc-bootstrap/releases/download/1.0.0/bootstrap-binutils-2.38 
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/524462031 
######################################################################## 100.0% 
==> Downloading https://github.com/Homebrew/glibc-bootstrap/releases/download/1.0.0/bootstrap-bison-3.8.2.t 
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/524462031 
######################################################################## 100.0% 
==> Downloading https://github.com/Homebrew/glibc-bootstrap/releases/download/1.0.0/bootstrap-gawk-5.1.1.ta 
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/524462031 
######################################################################## 100.0% 
==> Downloading https://github.com/Homebrew/glibc-bootstrap/releases/download/1.0.0/bootstrap-gcc-9.5.0.tar 
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/524462031 
######################################################################## 100.0% 
==> Downloading https://github.com/Homebrew/glibc-bootstrap/releases/download/1.0.0/bootstrap-make-4.3.tar. 
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/524462031 
######################################################################## 100.0% 
==> Downloading https://github.com/Homebrew/glibc-bootstrap/releases/download/1.0.0/bootstrap-python3-3.9.1 
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/524462031 
######################################################################## 100.0% 
==> Downloading https://github.com/Homebrew/glibc-bootstrap/releases/download/1.0.0/bootstrap-sed-4.8.tar.g 
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/524462031 
######################################################################## 100.0% 
==> Downloading https://ftp.gnu.org/gnu/glibc/glibc-2.35.tar.gz 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/gmp/manifests/6.2.1_1 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/gmp/blobs/sha256:786ae29f0c0b06ea86e42bd9c6ac2c49bd5757da0 
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:786ae29f0c0b06ea86e42b 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/isl/manifests/0.25 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/isl/blobs/sha256:c0244c95ed9cc89b826868de83bec3150fcc120ad 
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:c0244c95ed9cc89b826868 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/mpfr/manifests/4.1.0 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/mpfr/blobs/sha256:4c5f1cfd038e8fbd640795e34e5e23c11244be3e 
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:4c5f1cfd038e8fbd640795 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/libmpc/manifests/1.2.1 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/libmpc/blobs/sha256:d74eb5f1377d8fa72fad88baca1bd5f00c29d4 
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:d74eb5f1377d8fa72fad88 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/lz4/manifests/1.9.4 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/lz4/blobs/sha256:1757fefc3840e11c4822e4c2a95aa62aca44a4eac 
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:1757fefc3840e11c4822e4 
######################################################################## 100.0% 
Warning: Building xz from source as the bottle needs: 
– HOMEBREW_CELLAR: /home/linuxbrew/.linuxbrew/Cellar (yours is /home/ec2-user/.linuxbrew/Cellar) 
– HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew (yours is /home/ec2-user/.linuxbrew) 
==> Downloading https://downloads.sourceforge.net/project/lzmautils/xz-5.2.6.tar.gz 
==> Downloading from https://jaist.dl.sourceforge.net/project/lzmautils/xz-5.2.6.tar.gz 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/zlib/manifests/1.2.12_1 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/zlib/blobs/sha256:c8e13538da9684a2cd591d241ea9a2ca6d6761b1 
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:c8e13538da9684a2cd591d 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/zstd/manifests/1.5.2-3 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/zstd/blobs/sha256:006b5ab6a4616a8b6f59953cb9efb546d312e3ba 
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:006b5ab6a4616a8b6f5995 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/binutils/manifests/2.39_1 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/binutils/blobs/sha256:efa7497e2ea56d9b68ce41363cdc1a41cad0 
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:efa7497e2ea56d9b68ce41 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/gcc/manifests/12.2.0-1 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/gcc/blobs/sha256:c7f773f9af560766b2d971d815a8d224c267088c0 
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:c7f773f9af560766b2d971 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/gh/manifests/2.15.0 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/gh/blobs/sha256:cd23b61a033d029ae6b9ea1feafd04fda17b771364 
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:cd23b61a033d029ae6b9ea 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/oniguruma/manifests/6.9.8 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/oniguruma/blobs/sha256:e3e431432a920a795798426fe7a32b55369 
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:e3e431432a920a79579842 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/jq/manifests/1.6-1 
######################################################################## 100.0% 
==> Downloading https://ghcr.io/v2/homebrew/core/jq/blobs/sha256:2beea2c2c372ccf1081e9a5233fc30204708032542 
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:2beea2c2c372ccf1081e9a 
######################################################################## 100.0% 
==> Installing dependencies for gh: linux-headers@5.15, glibc, gmp, isl, mpfr, libmpc, lz4, xz, zlib, zstd, binutils and gcc@12 
==> Installing gh dependency: linux-headers@5.15 
==> Pouring linux-headers@5.15–5.15.57.x86_64_linux.bottle.1.tar.gz 
🍺  /home/ec2-user/.linuxbrew/Cellar/linux-headers@5.15/5.15.57: 963 files, 5.5MB 
==> Installing gh dependency: glibc 
==> ../configure –disable-crypt –disable-debug –disable-dependency-tracking –disable-silent-rules –pre 
==> make all 
==> make install 
==> /home/ec2-user/.linuxbrew/Cellar/glibc/2.35_1/sbin/ldconfig 
==> Installing locale data for en_US.UTF-8 
==> /home/ec2-user/.linuxbrew/Cellar/glibc/2.35_1/bin/localedef -i en_US -f UTF-8 en_US.UTF-8 
🍺  /home/ec2-user/.linuxbrew/Cellar/glibc/2.35_1: 1,436 files, 133.3MB, built in 10 minutes 24 seconds 
==> Installing gh dependency: gmp 
==> Pouring gmp–6.2.1_1.x86_64_linux.bottle.tar.gz 
🍺  /home/ec2-user/.linuxbrew/Cellar/gmp/6.2.1_1: 23 files, 3.9MB 
==> Installing gh dependency: isl 
==> Pouring isl–0.25.x86_64_linux.bottle.tar.gz 
🍺  /home/ec2-user/.linuxbrew/Cellar/isl/0.25: 74 files, 9.2MB 
==> Installing gh dependency: mpfr 
==> Pouring mpfr–4.1.0.x86_64_linux.bottle.tar.gz 
🍺  /home/ec2-user/.linuxbrew/Cellar/mpfr/4.1.0: 31 files, 7.8MB 
==> Installing gh dependency: libmpc 
==> Pouring libmpc–1.2.1.x86_64_linux.bottle.tar.gz 
🍺  /home/ec2-user/.linuxbrew/Cellar/libmpc/1.2.1: 13 files, 526.5KB 
==> Installing gh dependency: lz4 
==> Pouring lz4–1.9.4.x86_64_linux.bottle.tar.gz 
🍺  /home/ec2-user/.linuxbrew/Cellar/lz4/1.9.4: 22 files, 660KB 
==> Installing gh dependency: xz 
==> ./configure –prefix=/home/ec2-user/.linuxbrew/Cellar/xz/5.2.6 
Last 15 lines from /home/ec2-user/.cache/Homebrew/Logs/xz/01.configure: 
 
Initializing Automake: 
checking for a BSD-compatible install… /usr/bin/install -c 
checking whether build environment is sane… yes 
checking for a race-free mkdir -p… /usr/bin/mkdir -p 
checking for gawk… gawk 
checking whether make sets $(MAKE)… yes 
checking whether make supports nested variables… yes 
checking whether ln -s works… yes 
checking whether make supports the include directive… yes (GNU style) 
checking for gcc… gcc 
checking whether the C compiler works… no 
configure: error: in `/tmp/xz-20220920-3349-3pecb1/xz-5.2.6′: 
configure: error: C compiler cannot create executables 
See `config.log’ for more details 
 
READ THIS: https://docs.brew.sh/Troubleshooting 
 
$  

 

 

 

configure: error: in `/tmp/xz-xxxxx-3349-3pecb1/xz-5.2.6′: のエラーが表示された場合

上記のように「configure: error: in `/tmp/xz-20220920-3349-3pecb1/xz-5.2.6′:」のエラーが表示された場合は以下の対応をします。

 

 

 

■brew の Update を試す

$ brew update
Already up-to-date.

 

 

 

■binutils をインストールする

$ brew install binutils 
==> Downloading https://ghcr.io/v2/homebrew/core/zlib/manifests/1.2.12_1 
Already downloaded: /home/ec2-user/.cache/Homebrew/downloads/eb8a0a66a57927afa448fbd3ed7d26ba733902bc46538499b191b224fa4b90bd–zlib-1.2.12_1.bottle_manifest.json 
==> Downloading https://ghcr.io/v2/homebrew/core/zlib/blobs/sha256:c8e13538da9684a2cd591d241ea9a2ca6d6761b1 
Already downloaded: /home/ec2-user/.cache/Homebrew/downloads/da3369060a06b18eca8b27f2884116528c29a5d8b2252d91f5d38c3b013b73c6–zlib–1.2.12_1.x86_64_linux.bottle.tar.gz 
==> Downloading https://ghcr.io/v2/homebrew/core/binutils/manifests/2.39_1 
Already downloaded: /home/ec2-user/.cache/Homebrew/downloads/0e62125ed5cacf720aff507ece31b188bbc9b9f80c5a860eb9f7efb65d759f5b–binutils-2.39_1.bottle_manifest.json 
==> Downloading https://ghcr.io/v2/homebrew/core/binutils/blobs/sha256:efa7497e2ea56d9b68ce41363cdc1a41cad0 
Already downloaded: /home/ec2-user/.cache/Homebrew/downloads/6b48e70fcf2d6cac042ea157418e4443cb64c6600ae8588375267caa97496480–binutils–2.39_1.x86_64_linux.bottle.tar.gz 
==> Installing dependencies for binutils: zlib 
==> Installing binutils dependency: zlib 
==> Pouring zlib–1.2.12_1.x86_64_linux.bottle.tar.gz 
🍺  /home/ec2-user/.linuxbrew/Cellar/zlib/1.2.12_1: 12 files, 439KB 
==> Installing binutils 
==> Pouring binutils–2.39_1.x86_64_linux.bottle.tar.gz 
==> Caveats 
binutils is keg-only, which means it was not symlinked into /home/ec2-user/.linuxbrew, 
because it shadows the host toolchain. 
 
If you need to have binutils first in your PATH, run: 
  echo ‘export PATH=”/home/ec2-user/.linuxbrew/opt/binutils/bin:$PATH”‘ >> /home/ec2-user/.bash_profile 
 
For compilers to find binutils you may need to set: 
  export LDFLAGS=”-L/home/ec2-user/.linuxbrew/opt/binutils/lib” 
  export CPPFLAGS=”-I/home/ec2-user/.linuxbrew/opt/binutils/include” 
 
==> Summary 
🍺  /home/ec2-user/.linuxbrew/Cellar/binutils/2.39_1: 4,687 files, 370.4MB 
==> Running `brew cleanup binutils`… 
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP. 
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`). 
==> No outdated dependents to upgrade! 
==> Checking for dependents of upgraded formulae… 
Disable this behaviour by setting HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK. 
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`). 
==> Reinstalling 1 dependent with broken linkage from source: 
binutils 
==> Caveats 
==> binutils 
binutils is keg-only, which means it was not symlinked into /home/ec2-user/.linuxbrew, 
because it shadows the host toolchain. 
 
$  

 

 

 

 

改めて xz と gh と jq をインストールする

 

 

■xz をインストールする

$ brew install xz 
Warning: xz 5.2.6 is already installed and up-to-date.  ← すでにインストール済み
To reinstall 5.2.6, run: 
  brew reinstall xz 
$ brew install gh 

 

 

 

■gh をインストールする

$ brew install gh 
==> Downloading https://ghcr.io/v2/homebrew/core/gh/manifests/2.15.0 
Already downloaded: /home/ec2-user/.cache/Homebrew/downloads/038ed100a25e1eca83afbc05bb9410eb1a1a851eba65901715bdef381f2cb177–gh-2.15.0.bottle_manifest.json 
==> Downloading https://ghcr.io/v2/homebrew/core/gh/blobs/sha256:cd23b61a033d029ae6b9ea1feafd04fda17b771364 
Already downloaded: /home/ec2-user/.cache/Homebrew/downloads/485f6f2b6b31cc34efa60546e58ea1e477ea7fb341cb24936eb324b53dcea22d–gh–2.15.0.x86_64_linux.bottle.tar.gz 
==> Pouring gh–2.15.0.x86_64_linux.bottle.tar.gz 
==> Caveats 
Bash completion has been installed to: 
  /home/ec2-user/.linuxbrew/etc/bash_completion.d 
==> Summary 
🍺  /home/ec2-user/.linuxbrew/Cellar/gh/2.15.0: 140 files, 33.5MB 
==> Running `brew cleanup gh`… 
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP. 
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`). 
$  

 

 

 

■jq のインストールをする

$ brew install jq 
==> Downloading https://ghcr.io/v2/homebrew/core/oniguruma/manifests/6.9.8 
Already downloaded: /home/ec2-user/.cache/Homebrew/downloads/fccf013b32eda50ffdfbb2748b9f01c7d5a845d5ba02bfeed201b6a30028800c–oniguruma-6.9.8.bottle_manifest.json 
==> Downloading https://ghcr.io/v2/homebrew/core/oniguruma/blobs/sha256:e3e431432a920a795798426fe7a32b55369 
Already downloaded: /home/ec2-user/.cache/Homebrew/downloads/97d49e2009b61b82fc234e6d4e3f4bf120cebf2c2d22ea78b4b0060eebc57279–oniguruma–6.9.8.x86_64_linux.bottle.tar.gz 
==> Downloading https://ghcr.io/v2/homebrew/core/jq/manifests/1.6-1 
Already downloaded: /home/ec2-user/.cache/Homebrew/downloads/fc2724606b6ebef1ba0db7d7ae84cfca1df8cfed9e58e3a8714413b3676935f7–jq-1.6-1.bottle_manifest.json 
==> Downloading https://ghcr.io/v2/homebrew/core/jq/blobs/sha256:2beea2c2c372ccf1081e9a5233fc30204708032542 
Already downloaded: /home/ec2-user/.cache/Homebrew/downloads/69dcd46d6c37a41049d43bbc5ee7dcbf3558b8f0990555fd89f5ba5d5010d9d7–jq–1.6.x86_64_linux.bottle.1.tar.gz 
==> Installing dependencies for jq: oniguruma 
==> Installing jq dependency: oniguruma 
==> Pouring oniguruma–6.9.8.x86_64_linux.bottle.tar.gz 
🍺  /home/ec2-user/.linuxbrew/Cellar/oniguruma/6.9.8: 15 files, 1.6MB 
==> Installing jq 
==> Pouring jq–1.6.x86_64_linux.bottle.1.tar.gz 
🍺  /home/ec2-user/.linuxbrew/Cellar/jq/1.6: 19 files, 1.3MB 
==> Running `brew cleanup jq`… 
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP. 
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`). 
$  

 

 

 

 

GitHub CLI の認証をする

gh コマンドのインストールが完了したら GitHub CLI の認証をします。

 

 

■gh auth login コマンドを実行する

$ gh auth login 
? What account do you want to log into? GitHub.com 
? What is your preferred protocol for Git operations? HTTPS 
? Authenticate Git with your GitHub credentials? Yes 
? How would you like to authenticate GitHub CLI? Login with a web browser 
 
! First copy your one-time code: xxxx-xxxx 
Press Enter to open github.com in your browser…  
! Failed opening a web browser at https://github.com/login/device 
  exec: “xdg-open,x-www-browser,www-browser,wslview”: executable file not found in $PATH 
  Please try entering the URL in your browser manually 
✓ Authentication complete. 
– gh config set -h github.com git_protocol https 
✓ Configured git protocol 
✓ Logged in as xxxxxxxx
$  

 

 

いくつかの質問に答えると下図のように認証の画面が起動します。

 

【GitHubActions】GitHubActionsの実行履歴(flow)をまとめて削除する手順

 

 

 

 

【GitHubActions】GitHubActionsの実行履歴(flow)をまとめて削除する手順

 

 

 

 

【GitHubActions】GitHubActionsの実行履歴(flow)をまとめて削除する手順

 

 

 

 

 

【GitHubActions】GitHubActionsの実行履歴(flow)をまとめて削除する手順

 

 

 

 

gh コマンドでフローを削除する

ここまで来たら gh コマンドでフローをまとめて削除してみます。

 

まずは gh コマンドの動確をします。

 

■フローのリストを表示する

$ gh run list 
STATUS  NAME          WORKFLOW        BRANCH       EVENT         ID          ELAPSED  AGE 
✓       demo_create  TerraformApply  demo_create  pull_request  3087753702  45s      7h 
✓       demo_create  TerraformPlan   demo_create  pull_request  3087746002  1m39s    7h 
✓       demo_create  TerraformApply  demo_create  pull_request  3087739415  37s      7h 
✓       demo_create  TerraformPlan   demo_create  pull_request  3087732872  41s      7h 
✓       demo_create  TerraformApply  demo_create  pull_request  3087700175  41s      7h 
✓       demo_create  TerraformPlan   demo_create  pull_request  3087692595  38s      7h 
X        demo_create  TerraformApply  demo_create   pull_request  3087531659  40s      8h 
✓       demo_create  TerraformPlan   demo_create  pull_request  3087525913  43s      8h 
X        demo_role    TerraformApply  demo_role    pull_request  3087514469  20s      8h 
X        demo_role    TerraformPlan   demo_role    pull_request  3087512653  25s      8h 
✓       demo_create  TerraformApply  demo_create  pull_request  3087422709  46s      8h 
✓       demo_create  TerraformPlan   demo_create  pull_request  3087419976  38s      8h 
✓       demo_create  TerraformApply  demo_create  pull_request  3087406388  48s      8h 
✓       demo_create  TerraformPlan   demo_create  pull_request  3087402716  41s      8h 
X        demo_create  TerraformApply  demo_create  pull_request  3087395076  43s      8h 
✓       demo_create  TerraformPlan   demo_create  pull_request  3087391241  34s      8h 
X        demo_create  TerraformPlan   demo_create  pull_request  3087072880  34s      10h 
X        demo_create  TerraformApply  demo_create  pull_request  3087071360  32s      10h 
X        demo_create  TerraformPlan   demo_create  pull_request  3087066223  34s      10h 
X        demo_create  TerraformPlan   demo_create  pull_request  3087056382  21s      10h 
$  

 

 

 

■特定のフローを表示する

$ repo=”[アカウント名]/[リポジトリ名]”; gh api repos/$repo/actions/workflows                                   

  “total_count”: 2, 
  “workflows”: [ 
    { 
      “id”: 34732429, 
      “node_id”: “W_kwDOH_L6as4CEfmN”, 
      “name”: “TerraformApply”, 
      “path”: “.github/workflows/terraform_apply.yml”, 
      “state”: “active”, 
      “created_at”: “2022-09-xxxxxxxxxxx”, 
      “updated_at”: “2022-09-xxxxxxxxxxx”, 
      “url”: “https://api.github.com/repos/xxxxxx/xxxxxxxxx/actions/workflows/34732429”, 
      “html_url”: “https://github.com/xxxxxx/xxxxxxxxxx/blob/main/.github/workflows/terraform_apply.yml”, 
      “badge_url”: “https://github.com/xxxxxx/xxxxxxxxxx/workflows/TerraformApply/badge.svg” 
    }, 
    { 
      “id”: 34732183, 
      “node_id”: “W_kwDOH_L6as4CEfiX”, 
      “name”: “TerraformPlan”, 
      “path”: “.github/workflows/terraform_plan.yml”, 
      “state”: “active”, 
      “created_at”: “2022-09-xxxxxxxxxxxx”, 
      “updated_at”: “2022-09-xxxxxxxxxxxx”, 
      “url”: “https://api.github.com/repos/xxxxxx/xxxxxxxxxx/actions/workflows/34732183”, 
      “html_url”: “https://github.com/xxxxxx/xxxxxxxxxx/blob/main/.github/workflows/terraform_plan.yml”, 
      “badge_url”: “https://github.com/xxxxxx/xxxxxxxxxx/workflows/TerraformPlan/badge.svg” 
    } 
  ] 

$  

 

 

 

 

 

■削除する

$ repo=”[アカウント名]/[リポジトリ名”; gh api repos/$repo/actions/workflows | jq -r “.workflows[].id” | xargs -I{} gh api repos/$repo/actions/workflows/{}/runs | jq -r ‘.workflow_runs[].id’ | xargs -P4 -I{} gh api repos/$repo/actions/runs/{} -X DELETE

 

 

 

 

1回のコマンドで50個くらいのフローしか削除されないようです。

何度か繰り返したら0になりました。

【GitHubActions】GitHubActionsの実行履歴(flow)をまとめて削除する手順

 

 

 

 

参考サイト

https://qiita.com/tippy/items/79ca3f7b7bcac1d92136

 

よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

この記事を書いた人

コメント

コメントする

AlphaOmega Captcha Medica  –  What Do You See?
     
 

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください