简体   繁体   English

[GitHub 操作]:创建工件容器失败:已达到工件存储配额。 无法上传任何新工件

[英][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.我有一个 GitHub 工作流程,可以为我的 Flutter 应用程序创建 APK。 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.新的工作流程似乎正在运行,我不再在 GitHub UI 中看到旧文件。 However, I still get the error when trying to run the APK workflow.但是,我在尝试运行 APK 工作流程时仍然遇到错误。 Any ideas how to fix this error?任何想法如何解决这个错误?


Update :更新

My GitHub says I have used up my included services (free version).我的 GitHub 说我已经用完了包含的服务(免费版)。 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. Github Actions (runner time) 和 Github Storage (artifacts) 应该有单独的配额。

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.对于 Github 操作,我知道它们对公共存储库是免费的,因此您可以更改存储库的可见性,至少在需要时可以暂时更改。 As for Github Storage, I'm not sure if the same trick works, never tested.至于 Github 存储,我不确定同样的技巧是否有效,从未测试过。

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.只需 go 到您的操作,单击以前的构建并检查页面底部是否有存储的工件。 There is a recycle bin icon you can click to delete it.有一个回收站图标,您可以单击以将其删除。

人工制品

You can also specify when Github deletes old artifacts automatically for you.您还可以指定 Github 何时自动为您删除旧工件。 You go into Settings -> Actions -> General and find "Artifact and log retention".您将 go 进入设置 -> 操作 -> 常规并找到“工件和日志保留”。

工件和日志保留

Note it might take some time for Github to update the completed quota.请注意,Github 可能需要一些时间来更新已完成的配额。

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.将它放在上传步骤的正上方,它将删除存储库中所有以前的工件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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