update-github-actions-version
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUpdate GitHub Actions Version
更新GitHub Actions版本
Update action versions in GitHub Actions workflow files, focusing on major version changes only.
更新GitHub Actions工作流文件中的Action版本,仅聚焦于主版本变更。
Important Principles: Explanation of GitHub Actions Version Tagging System
重要原则:GitHub Actions版本标记系统说明
- Using a major version number (e.g., ) automatically fetches the latest minor and patch versions.
v4 - For example, will automatically get versions like
actions/checkout@v4,v4.2.2.v4.3.0 - Do not update from to a specific version like
v4— this is unnecessary.v4.2.2 - Only update when the major version changes (e.g., from to
v5).v6
Note: Skipupdates as the new version is broken.fatjyc/update-submodule-action@v6.0
- 使用主版本号(例如)会自动获取最新的次版本和补丁版本。
v4 - 例如,会自动获取
actions/checkout@v4、v4.2.2等版本。v4.3.0 - 请勿从更新到特定版本如
v4——这毫无必要。v4.2.2 - 仅在主版本变更时进行更新(例如从升级到
v5)。v6
注意: 跳过的更新,因为新版本存在问题。fatjyc/update-submodule-action@v6.0
Steps
步骤
0. Find Workflow Files
0. 查找工作流文件
Look for files in recursively. Note that composite actions may be used — read both the composite action and the calling workflow simultaneously.
.github/workflows/递归查找目录下的文件。注意可能会使用复合Action——需同时查看复合Action和调用它的工作流。
.github/workflows/1. Check Current Versions
1. 检查当前版本
Analyze the action versions used in the workflow files.
分析工作流文件中使用的Action版本。
2. Query Latest Versions
2. 查询最新版本
Query each action's latest version:
https://github.com/{owner}/{repo}/releases/latest查询每个Action的最新版本:
https://github.com/{owner}/{repo}/releases/latest3. Identify Actions Needing Updates
3. 识别需要更新的Action
Only update actions where the major version has changed:
- ✅ Update: →
docker/build-push-action@v5@v6 - ❌ Skip: →
actions/checkout@v4@v4.2.2
Note: Skipupdates as the new version is broken and v6.0 is fine.fatjyc/update-submodule-action@v6.0
仅更新主版本发生变更的Action:
- ✅ 可更新:→
docker/build-push-action@v5@v6 - ❌ 需跳过:→
actions/checkout@v4@v4.2.2
注意: 跳过的更新,因为新版本存在问题,而v6.0运行正常。fatjyc/update-submodule-action@v6.0
4. Obtain Changelogs
4. 获取变更日志
For actions requiring updates, retrieve changelogs to understand breaking changes.
对于需要更新的Action,获取其变更日志以了解破坏性变更。
5. Update Files
5. 更新文件
Update version numbers and make adjustments for any breaking changes.
更新版本号,并针对破坏性变更进行相应调整。
6. Commit Changes
6. 提交变更
Git add and commit your changes with a clear message indicating the updates made.
使用Git添加并提交变更,提交信息需清晰说明所做的更新。
Example Illustration
示例说明
✅ Correct Update
✅ 正确的更新方式
yaml
undefinedyaml
undefinedFrom
原内容
uses: docker/build-push-action@v5
uses: docker/build-push-action@v5
Update to
更新后
uses: docker/build-push-action@v6
undefineduses: docker/build-push-action@v6
undefined❌ Incorrect Update (Unnecessary)
❌ 错误的更新方式(无必要)
yaml
undefinedyaml
undefinedFrom
原内容
uses: actions/checkout@v4
uses: actions/checkout@v4
Incorrectly updated to
错误更新为
uses: actions/checkout@v4 .2 .2
undefineduses: actions/checkout@v4.2.2
undefined✅ Correct Practice (Keep Unchanged)
✅ 正确的做法(保持不变)
yaml
undefinedyaml
undefinedKeep unchanged
保持不变
uses :actions / checkout @ v 4
GitHub will automatically use the latest v 4.x.x release
GitHub will automatically use the latest v 4.x.x release
undefineduses: actions/checkout@v4
GitHub会自动使用最新的v4.x.x版本
GitHub会自动使用最新的v4.x.x版本
undefined