actions-updater

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub Actions Version Updater

GitHub Actions 版本更新工具

Update GitHub Actions in workflow files to their latest released versions. This replaces Dependabot's
package-ecosystem: "github-actions"
functionality.
将工作流文件中的GitHub Actions更新至其最新发布版本。此工具可替代Dependabot的
package-ecosystem: "github-actions"
功能。

Process

操作流程

Step 1: Check for Updates

步骤1:检查更新

Run the bundled script to parse all
uses:
lines and query each action's latest release:
uv run actions-updater/scripts/check_updates.py
With no arguments, the script scans
.github/workflows/*.yml
and
*.yaml
. To check specific files:
uv run actions-updater/scripts/check_updates.py path/to/workflow.yaml
The script parses workflow YAML, recursively extracts all
uses: owner/repo@version
entries, queries
gh release view --repo owner/repo
for each, and outputs a comparison table showing the current and latest major versions. It skips local actions (
./...
) and Docker actions (
docker://...
).
运行内置脚本解析所有
uses:
行,并查询每个Action的最新发布版本:
uv run actions-updater/scripts/check_updates.py
若不带参数,脚本会扫描
.github/workflows/*.yml
*.yaml
文件。若要检查特定文件:
uv run actions-updater/scripts/check_updates.py path/to/workflow.yaml
该脚本会解析工作流YAML文件,递归提取所有
uses: owner/repo@version
条目,为每个条目调用
gh release view --repo owner/repo
进行查询,并输出对比表格,显示当前版本和最新主版本。它会跳过本地Actions(
./...
)和Docker Actions(
docker://...
)。

Step 2: Update Workflow Files

步骤2:更新工作流文件

For each action with an available update, edit the workflow file using the Edit tool.
Version format rules:
  • If the current pin is a major version tag (e.g.,
    @v3
    ), extract the major version from the latest release tag and update to that (e.g.,
    v4.2.1
    becomes
    @v4
    )
  • If the current pin is an exact version (e.g.,
    @v3.1.0
    ), update to the full latest release tag
  • If the current pin is a SHA, flag it for the user but do not auto-update
对于每个有可用更新的Action,使用编辑工具修改工作流文件。
版本格式规则:
  • 如果当前固定的是主版本标签(例如
    @v3
    ),从最新发布标签中提取主版本并更新(例如
    v4.2.1
    会更新为
    @v4
  • 如果当前固定的是精确版本(例如
    @v3.1.0
    ),更新为完整的最新发布标签
  • 如果当前固定的是SHA值,标记出来供用户查看,但不会自动更新

Step 3: Summarize

步骤3:总结

Present a table of all updates applied, showing the action, old version, and new version.
展示所有已应用更新的表格,包含Action名称、旧版本和新版本。

Scripts

脚本

scripts/check_updates.py

scripts/check_updates.py

Check all workflow actions for available updates. Requires authenticated
gh
CLI.
uv run scripts/check_updates.py                      # scans .github/workflows/
uv run scripts/check_updates.py path/to/ci.yaml      # specific file(s)
检查所有工作流Actions的可用更新。需要已认证的
gh
CLI。
uv run scripts/check_updates.py                      # 扫描.github/workflows/目录
uv run scripts/check_updates.py path/to/ci.yaml      # 特定文件