简体   繁体   中英

[GitHub Actions]: Create Artifact Container failed: Artifact storage quota has been hit. Unable to upload any new artifacts

I have a GitHub workflow that creates APKs for my Flutter app. This worked fine until recently, I seem to have exhausted some kind of quota. Now when the workflow runs I get this error:

Create Artifact Container failed: Artifact storage quota has been hit. Unable to upload any new artifacts

I assumed that deleting all artifacts would free up the space again so I used another workflow to achieve this:

name: 'Delete old artifacts'

on:
  push:
    branches:
      - master
      - develop
  pull_request:
    branches:
      - master
      - develop

jobs:
  delete-artifacts:
    runs-on: ubuntu-latest
    steps:
      - uses: kolpav/purge-artifacts-action@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          expire-in: 0days

The new workflow seems to be working, I no longer see the old files in the GitHub UI. However, I still get the error when trying to run the APK workflow. Any ideas how to fix this error?


Update :

My GitHub says I have used up my included services (free version). Is there a way to undo that? Simply deleting the artifacts does not seem to be enough. 在此处输入图像描述

There is no way to undo. The quota is monthly, so you just have to wait for quota reset.

Github Actions (runner time) and Github Storage (artifacts) should have separate quotas.

For Github Actions, I know they are free for public repositories, so you could change your repository visibility, at least temporarily if you need it. As for Github Storage, I'm not sure if the same trick works, never tested.

Let me know and I can update the answer.

You can actually delete old artifacts to bypass this. Just go to your actions, click on a previous build and check if there are stored artifacts at the bottom of the page. There is a recycle bin icon you can click to delete it.

人工制品

You can also specify when Github deletes old artifacts automatically for you. You go into Settings -> Actions -> General and find "Artifact and log retention".

工件和日志保留

Note it might take some time for Github to update the completed quota.

I managed to stop this error by adding a new step on my deploy script:

  - name: Delete Old Artifacts
    uses: actions/github-script@v6
    id: artifact
    with:
      script: |
        const res = await github.rest.actions.listArtifactsForRepo({
          owner: context.repo.owner,
          repo: context.repo.repo,
        })

        res.data.artifacts
          .forEach(({ id }) => {
            github.rest.actions.deleteArtifact({
              owner: context.repo.owner,
              repo: context.repo.repo,
              artifact_id: id,
            })
          })

Place it right above the upload step and it will delete all previous artifacts of the repo.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM