# 上传工件失败：上传工件'dist'时请求超时120秒

- **ID:** `cicd/github-actions-artifact-upload-timeout`
- **领域:** cicd
- **类别:** network_error
- **错误码:** `UPLOAD_TIMEOUT`
- **验证级别:** ai_generated
- **修复率:** 78%

## 根因

工件上传到GitHub Actions存储超时，原因是大文件大小、网络连接缓慢或高峰时段服务器端限流。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| actions/upload-artifact@v3 | active | — | — |
| actions/upload-artifact@v4 | active | — | — |
| GitHub Actions hosted runner | active | — | — |

## 解决方案

1. ```
   Split artifact into smaller chunks using multiple upload steps: `tar -czf dist-part1.tar.gz dist/ && actions/upload-artifact@v4 with name: dist-part1` and repeat
   ```
2. ```
   Reduce artifact size by excluding unnecessary files: `actions/upload-artifact@v4 with path: dist/ --exclude '*.map'` and add .gitignore patterns
   ```
3. ```
   Use self-hosted runner with faster network or upload via custom script using GitHub API with chunked upload
   ```

## 无效尝试

- **** — Transient network issues may resolve, but if file size or throttling is the cause, retries fail repeatedly. (55% 失败率)
- **** — actions/upload-artifact does not support custom timeout; timeout is hardcoded on GitHub's side. (95% 失败率)
- **** — Upload step already compresses; manual compression adds overhead and may not reduce size enough. (40% 失败率)
