You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

删除所有工件与工作流后仍触发GitHub Actions存储配额告警

GitHub Actions 工件存储配额耗尽问题排查与解决

问题描述

执行GitHub Actions工作流时触发以下错误:

Failed to CreateArtifact: Artifact storage quota has been hit. Unable to upload any new artifacts. Usage is recalculated every 6-12 hours.

已执行的操作:

  • 手动删除仓库Actions中的所有工件
  • 删除所有工作流运行记录
  • 将组织升级至GitHub Teams并将Actions支出预算提高至4美元
  • 等待数日并多次重试,但问题未解决
  • 添加自动清理脚本c-hive/gha-remove-artifacts@v1
  • 将工件保留期设置为3天(距离上次部署已超过3天)

当前工作流配置:

name: Build and deploy Node.js app to Azure Web App - <your-app-name>

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: read

    steps:
      - uses: actions/checkout@v4

      - name: Set up Node.js version
        uses: actions/setup-node@v3
        with:
          node-version: '22.x'

      - name: npm install, build, and test
        run: |
          npm install
          npm run build --if-present
          npm run test --if-present

      - name: Zip artifact for deployment
        run: zip release.zip ./* -r

      - name: Upload artifact for deployment job
        uses: actions/upload-artifact@v4
        with:
          name: node-app
          path: release.zip

  deploy:
    runs-on: ubuntu-latest
    needs: build
    environment:
      name: 'Production'
      url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
    permissions:
      id-token: write
      contents: read

    steps:
      - name: Download artifact from build job
        uses: actions/download-artifact@v4
        with:
          name: node-app

      - name: Unzip artifact for deployment
        run: unzip release.zip

      - name: Login to Azure
        uses: azure/login@v2
        with:
          client-id: ${{ secrets.AZURE_CLIENT_ID }}
          tenant-id: ${{ secrets.AZURE_TENANT_ID }}
          subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

      - name: Deploy to Azure Web App
        id: deploy-to-webapp
        uses: azure/webapps-deploy@v3
        with:
          app-name: '<your-app-name>'
          slot-name: 'Production'
          package: .

目前可通过跳过工件压缩与解压步骤完成部署,但存储配额问题未解决。


排查与解决步骤

  1. 检查组织级存储使用明细
    组织的GitHub Actions存储是所有仓库共享的,不要只看单个仓库的情况。进入组织账单页面,查看存储使用的具体分布,确认是否有其他仓库占用了大量配额。

  2. 使用GitHub CLI强制清理所有工件
    手动删除和常规清理脚本可能遗漏部分未关联的工件,用GitHub CLI执行彻底清理:

    # 替换{owner}和{repo}为你的实际信息
    gh api repos/{owner}/{repo}/actions/artifacts --jq '.artifacts[] | .id' | xargs -I {} gh api repos/{owner}/{repo}/actions/artifacts/{} -X DELETE
    
  3. 确认保留期设置的优先级
    仓库级的保留期可能被组织级设置覆盖,进入组织Settings → Actions → General,检查全局的Artifact and log retention设置,确保没有强制更长的保留期。同时确认仓库级的3天设置已正确保存。

  4. 等待配额重新计算的完整周期
    升级计划或提高预算后,系统重新计算配额的周期可能延长至24小时,而非提示的6-12小时,耐心等待后再重试。

  5. 优化工作流,彻底避免工件上传
    既然已经可以跳过工件步骤完成部署,直接合并构建与部署流程,完全省去工件环节,从根源上避免存储占用:

    name: Build and deploy Node.js app to Azure Web App - <your-app-name>
    
    on:
      push:
        branches:
          - main
      workflow_dispatch:
    
    jobs:
      build-and-deploy:
        runs-on: ubuntu-latest
        permissions:
          id-token: write
          contents: read
        environment:
          name: 'Production'
          url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
    
        steps:
          - uses: actions/checkout@v4
    
          - name: Set up Node.js version
            uses: actions/setup-node@v3
            with:
              node-version: '22.x'
    
          - name: npm install, build, and test
            run: |
              npm install
              npm run build --if-present
              npm run test --if-present
    
          - name: Login to Azure
            uses: azure/login@v2
            with:
              client-id: ${{ secrets.AZURE_CLIENT_ID }}
              tenant-id: ${{ secrets.AZURE_TENANT_ID }}
              subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
    
          - name: Deploy to Azure Web App
            id: deploy-to-webapp
            uses: azure/webapps-deploy@v3
            with:
              app-name: '<your-app-name>'
              slot-name: 'Production'
              package: .
    
  6. 提交GitHub支持工单
    如果以上操作都无效,说明可能存在系统缓存或计算错误,直接联系GitHub支持,提供组织/仓库信息、已执行的操作记录,请求重新核算存储配额。


内容的提问来源于stack exchange,提问作者Alex

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 21:24:51