ハマログ

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

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日


関連記事

WordPressがメンテナンスモードになり続けた場合の対処法

こんにちは、金子です。 はじめに コーポレートサイトのWordpressでプラグ…

作成したAMIを別のAWSアカウントで利用する

あるAWSアカウントで運用しているEC2インスタンスを別のAWSアカウントに引っ…

Amazon Linux 2023のdnf update –securityはyum update –securityと異なる挙動になる

新しいサーバーをAmazon Linux 2023で構築して本番運用を開始しまし…


← 前の投稿

次の投稿 →