ハマログ

株式会社イーツー・インフォの社員ブログ

GitHub ActionsのArtifactを削除したい

GitHub ActionsのArtifactの上限よくわからなかったんだけど、無料で利用している場合、、おそらく2GBっぽい。 上限に達すると以下のエラーとなり、アップロードができなくなります。
Cannot upload artifacts. You may have exceeded your spending limit for storing artifacts with Actions or Packages.  
Artifactは90日で自動削除されるのですが、ビルド頻度によっては削除されるのを待っていられないため、古いArtifactを自動的に削除する設定をいれてみました。

手順

gha-remove-artifactsを利用しました。
https://github.com/c-hive/gha-remove-artifacts
name: Java CI with Maven

on:
  push:
    branches: [ development ]

jobs:
  remove-old-artifacts:
    runs-on: ubuntu-latest
    timeout-minutes: 10

    steps:
    - name: Remove old artifacts
      uses: c-hive/gha-remove-artifacts@v1
      with:
        age: '1 weeks'
        # Optional inputs
        # skip-tags: true
        # skip-recent: 5

  build:
    runs-on: ubuntu-latest
    (略)
削除できました
注意
c-hive/gha-remove-artifactsは公式製品ではなくオープンソースなので、その旨理解の上、事前に動作確認してから導入してください。
gitgithubGitHub Actions

  kaneko tomo   2020年11月12日


関連記事

AWSのロードバランサーでリダイレクト設定

リダイレクト設定 一時的にサイトを止めたい、まだ公開前のパスにアクセスさせたくな…

最適化のタイミングとバランス

Premature optimization is the root of al…

GitHub Actions + Maven + Javaで、独自のライブラリを利用する

GitHub ActionsでビルドしているJavaで、Mavenのセントラルリ…


← 前の投稿

次の投稿 →