setup-renovate-for-tuist

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Setup Renovate for Tuist

为Tuist配置Renovate

Renovate automates dependency update PRs for your Tuist iOS project. This skill creates the correct
renovate.json
based on your project's integration style and package format.
Renovate可自动为你的Tuist iOS项目创建依赖更新PR。本技能会根据项目的集成方式和包格式生成正确的
renovate.json
文件。

Preflight Checklist

前置检查清单

Before starting:
  • Confirm the project uses Tuist (look for
    Tuist.swift
    or
    Tuist/
    directory)
  • Identify the integration style (see below)
  • Check whether Tuist registry is enabled
  • Confirm the project is hosted on GitHub (Renovate GitHub App or self-hosted)
开始之前:
  • 确认项目使用Tuist(查找
    Tuist.swift
    文件或
    Tuist/
    目录)
  • 确定项目的集成方式(见下文)
  • 检查Tuist注册表是否已启用
  • 确认项目托管在GitHub上(使用Renovate GitHub App或自托管部署)

Step 1 — Detect Integration Style

步骤1 — 检测集成方式

Check where packages are declared:
Tuist/Package.swift-based — look for non-empty
dependencies
array:
swift
// Tuist/Package.swift
let package = Package(
    dependencies: [
        .package(url: "https://github.com/firebase/firebase-ios-sdk", from: "11.8.1")
    ]
)
Project.swift-based — search for
Project.swift
files anywhere in the project that contain a non-empty
packages:
array:
bash
grep -rl "packages:" --include="Project.swift" .
swift
// (location varies per project)
let project = Project(
    packages: [
        .remote(url: "https://github.com/firebase/firebase-ios-sdk", requirement: .upToNextMajor(from: "11.8.1"))
    ]
)
A project uses one style only. If
Tuist/Package.swift
has non-empty dependencies → Tuist/Package.swift-based. If any
Project.swift
file has a non-empty
packages:
array → Project.swift-based.
检查包的声明位置:
基于Tuist/Package.swift — 查找非空的
dependencies
数组:
swift
// Tuist/Package.swift
let package = Package(
    dependencies: [
        .package(url: "https://github.com/firebase/firebase-ios-sdk", from: "11.8.1")
    ]
)
基于Project.swift — 在项目中搜索包含非空
packages:
数组的
Project.swift
文件:
bash
grep -rl "packages:" --include="Project.swift" .
swift
// (位置因项目而异)
let project = Project(
    packages: [
        .remote(url: "https://github.com/firebase/firebase-ios-sdk", requirement: .upToNextMajor(from: "11.8.1"))
    ]
)
一个项目只会使用一种集成方式。如果
Tuist/Package.swift
包含非空的dependencies数组,则为基于Tuist/Package.swift的方式;如果任意
Project.swift
文件包含非空的
packages:
数组,则为基于Project.swift的方式。

Step 2 — Detect Package Format

步骤2 — 检测包格式

Within the detected files, check whether packages use URL format or registry format:
FormatExample
URL-based
.package(url: "https://github.com/firebase/firebase-ios-sdk", from: "11.8.1")
Registry-based
.package(id: "firebase.firebase-ios-sdk", from: "11.8.1")
URL-based (Project.swift)
.remote(url: "https://github.com/...", requirement: .upToNextMajor(from: "1.0.0"))
Also note any packages using
requirement: .branch("...")
— these cannot be tracked by Renovate and should be left out (see Branch Dependencies below).
在检测到的文件中,检查包使用的是URL格式还是注册表格式
格式示例
URL型
.package(url: "https://github.com/firebase/firebase-ios-sdk", from: "11.8.1")
注册表型
.package(id: "firebase.firebase-ios-sdk", from: "11.8.1")
URL型(Project.swift)
.remote(url: "https://github.com/...", requirement: .upToNextMajor(from: "1.0.0"))
同时注意使用
requirement: .branch("...")
的包——Renovate无法追踪这类包,应将其排除(见下文的分支依赖部分)。

Step 3 — Check for mise.toml

步骤3 — 检查mise.toml文件

Check if
mise.toml
exists in the project root. If yes, Renovate can also update tool versions (tuist, swiftlint, etc.) automatically.
检查项目根目录是否存在
mise.toml
文件。如果存在,Renovate还可以自动更新工具版本(如tuist、swiftlint等)。

Step 4 — Ask for Schedule Preference

步骤4 — 询问调度偏好

Ask the user: "When would you like Renovate to check for updates? (e.g. 'every Monday morning', 'weekly on Friday', 'daily')"
Use the answer to set the
schedule
field in
renovate.json
. Renovate uses natural language scheduling:
User preferenceRenovate schedule value
Monday morning
"before 9am on monday"
Friday afternoon
"after 2pm on friday"
Weekly (any)
"once a week"
Daily
"every day"
If using a self-hosted GitHub Actions workflow, also convert the chosen schedule to a matching cron expression.
询问用户:"你希望Renovate在何时检查更新?(例如:'每周一早上'、'每周五'、'每天')"
根据回答设置
renovate.json
中的
schedule
字段。Renovate支持自然语言调度:
用户偏好Renovate调度值
周一早上
"before 9am on monday"
周五下午
"after 2pm on friday"
每周(任意时间)
"once a week"
每天
"every day"
如果使用自托管的GitHub Actions工作流,还需将选定的调度转换为匹配的cron表达式。

Step 5 — Create renovate.json

步骤5 — 生成renovate.json

Create
renovate.json
in the project root based on the detected configuration.

根据检测到的配置,在项目根目录创建
renovate.json
文件。

Case A: Tuist/Package.swift + URL-based packages (most common)

情况A:基于Tuist/Package.swift + URL型包(最常见)

The Renovate Swift manager natively handles
Package.swift
files. The default pattern
/(^|/)Package\.swift/
already matches
Tuist/Package.swift
.
json
{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": ["config:recommended"],
  "packageRules": [
    {
      "matchManagers": ["swift"],
      "groupName": "Swift dependencies",
      "schedule": ["<schedule>"]
    }
  ]
}

Renovate的Swift管理器原生支持
Package.swift
文件。默认匹配模式
/(^|/)Package\.swift/
已包含
Tuist/Package.swift
json
{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": ["config:recommended"],
  "packageRules": [
    {
      "matchManagers": ["swift"],
      "groupName": "Swift dependencies",
      "schedule": ["<schedule>"]
    }
  ]
}

Case B: Tuist/Package.swift + Registry-based packages (id: format)

情况B:基于Tuist/Package.swift + 注册表型包(id:格式)

Renovate's Swift manager only understands
url:
-based packages. For
id:
-based registry packages, use
customManagers
with a regex that:
  • Handles both
    from:
    and
    exact:
    requirements
  • Matches multiline declarations (packages formatted across multiple lines will be silently missed otherwise)
  • Transforms dot notation to slash notation for GitHub lookups (
    firebase.firebase-ios-sdk
    firebase/firebase-ios-sdk
    )
  • Uses triple braces
    {{{ }}}
    in
    packageNameTemplate
    to prevent HTML-escaping the
    /
Use two managers (releases + tags) as fallback since some packages only publish tags, not releases:
json
{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": ["config:recommended"],
  "enabledManagers": ["custom.regex"],
  "customManagers": [
    {
      "customType": "regex",
      "managerFilePatterns": ["/Tuist/Package\\.swift/"],
      "matchStrings": [
        "\\.package\\(id:\\s*\"(?<depName>[\\w\\-.]+?)\"[\\s\\S]*?(?:from|exact):\\s*\"(?<currentValue>[^\"]+)\"\\)"
      ],
      "datasourceTemplate": "github-releases",
      "packageNameTemplate": "{{{replace '\\.' '/' depName}}}"
    },
    {
      "customType": "regex",
      "managerFilePatterns": ["/Tuist/Package\\.swift/"],
      "matchStrings": [
        "\\.package\\(id:\\s*\"(?<depName>[\\w\\-.]+?)\"[\\s\\S]*?(?:from|exact):\\s*\"(?<currentValue>[^\"]+)\"\\)"
      ],
      "datasourceTemplate": "github-tags",
      "packageNameTemplate": "{{{replace '\\.' '/' depName}}}"
    }
  ],
  "packageRules": [
    {
      "matchManagers": ["custom.regex"],
      "groupName": "Swift dependencies",
      "schedule": ["<schedule>"]
    }
  ]
}
Note on dotted repo names: If a repo name had dots replaced with underscores (e.g.,
groue.GRDB_swift
), the
packageNameTemplate
replacement
groue/GRDB_swift
won't match the real GitHub repo
groue/GRDB.swift
. For these packages, add an explicit
packageRules
override:
json
{
  "matchPackageNames": ["groue.GRDB_swift"],
  "packageName": "groue/GRDB.swift"
}

Renovate的Swift管理器仅支持
url:
型包。对于
id:
型的注册表包,需使用
customManagers
配合正则表达式,实现:
  • 处理
    from:
    exact:
    两种依赖声明
  • 匹配多行声明(否则跨多行的包声明会被遗漏)
  • 将点符号转换为斜杠符号以适配GitHub查找(
    firebase.firebase-ios-sdk
    firebase/firebase-ios-sdk
  • packageNameTemplate
    中使用三重括号
    {{{ }}}
    避免
    /
    被HTML转义
使用两个管理器(发布版+标签版)作为备选,因为部分包仅发布标签而不发布正式版本:
json
{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": ["config:recommended"],
  "enabledManagers": ["custom.regex"],
  "customManagers": [
    {
      "customType": "regex",
      "managerFilePatterns": ["/Tuist/Package\\.swift/"],
      "matchStrings": [
        "\\.package\\(id:\\s*\"(?<depName>[\\w\\-.]+?)\"[\\s\\S]*?(?:from|exact):\\s*\"(?<currentValue>[^\"]+)\"\\)"
      ],
      "datasourceTemplate": "github-releases",
      "packageNameTemplate": "{{{replace '\\.' '/' depName}}}"
    },
    {
      "customType": "regex",
      "managerFilePatterns": ["/Tuist/Package\\.swift/"],
      "matchStrings": [
        "\\.package\\(id:\\s*\"(?<depName>[\\w\\-.]+?)\"[\\s\\S]*?(?:from|exact):\\s*\"(?<currentValue>[^\"]+)\"\\)"
      ],
      "datasourceTemplate": "github-tags",
      "packageNameTemplate": "{{{replace '\\.' '/' depName}}}"
    }
  ],
  "packageRules": [
    {
      "matchManagers": ["custom.regex"],
      "groupName": "Swift dependencies",
      "schedule": ["<schedule>"]
    }
  ]
}
关于带点的仓库名称说明:如果仓库名称中的点被替换为下划线(例如
groue.GRDB_swift
),
packageNameTemplate
的替换规则会生成
groue/GRDB_swift
,但实际GitHub仓库是
groue/GRDB.swift
。对于这类包,需添加显式的
packageRules
覆盖:
json
{
  "matchPackageNames": ["groue.GRDB_swift"],
  "packageName": "groue/GRDB.swift"
}

Case C: Project.swift-based + URL-based packages

情况C:基于Project.swift + URL型包

Project.swift uses
.remote(url:)
which is a Tuist-specific syntax, not standard SPM. Renovate's Swift manager won't parse this. The regex must:
  • Handle multiline declarations
  • Handle optional
    https://
    prefix and
    .git
    suffix
  • Cover all requirement types:
    .upToNextMajor
    ,
    .upToNextMinor
    ,
    .exact
Use two managers (releases + tags) as fallback:
json
{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": ["config:recommended"],
  "enabledManagers": ["custom.regex"],
  "customManagers": [
    {
      "customType": "regex",
      "managerFilePatterns": ["/(^|/)Project\\.swift$/"],
      "matchStrings": [
        "\\.remote\\(url:\\s*\"(?:https?:\\/\\/)?github\\.com\\/(?<depName>[\\w\\-_]+\\/[\\w\\-_.]+?)(?:\\.git)?\"[\\s\\S]*?requirement:\\s*\\.(?:upToNextMajor|upToNextMinor)\\(from:\\s*\"(?<currentValue>[^\"]+)\"\\)"
      ],
      "datasourceTemplate": "github-releases"
    },
    {
      "customType": "regex",
      "managerFilePatterns": ["/(^|/)Project\\.swift$/"],
      "matchStrings": [
        "\\.remote\\(url:\\s*\"(?:https?:\\/\\/)?github\\.com\\/(?<depName>[\\w\\-_]+\\/[\\w\\-_.]+?)(?:\\.git)?\"[\\s\\S]*?requirement:\\s*\\.(?:upToNextMajor|upToNextMinor)\\(from:\\s*\"(?<currentValue>[^\"]+)\"\\)"
      ],
      "datasourceTemplate": "github-tags"
    },
    {
      "customType": "regex",
      "managerFilePatterns": ["/(^|/)Project\\.swift$/"],
      "matchStrings": [
        "\\.remote\\(url:\\s*\"(?:https?:\\/\\/)?github\\.com\\/(?<depName>[\\w\\-_]+\\/[\\w\\-_.]+?)(?:\\.git)?\"[\\s\\S]*?requirement:\\s*\\.exact\\(\"(?<currentValue>[^\"]+)\"\\)"
      ],
      "datasourceTemplate": "github-releases"
    },
    {
      "customType": "regex",
      "managerFilePatterns": ["/(^|/)Project\\.swift$/"],
      "matchStrings": [
        "\\.remote\\(url:\\s*\"(?:https?:\\/\\/)?github\\.com\\/(?<depName>[\\w\\-_]+\\/[\\w\\-_.]+?)(?:\\.git)?\"[\\s\\S]*?requirement:\\s*\\.exact\\(\"(?<currentValue>[^\"]+)\"\\)"
      ],
      "datasourceTemplate": "github-tags"
    }
  ],
  "packageRules": [
    {
      "matchManagers": ["custom.regex"],
      "groupName": "Swift dependencies",
      "schedule": ["<schedule>"]
    }
  ]
}

Project.swift使用
.remote(url:)
语法,这是Tuist特有的,而非标准SPM语法。Renovate的Swift管理器无法解析该语法。正则表达式需满足:
  • 处理多行声明
  • 处理可选的
    https://
    前缀和
    .git
    后缀
  • 支持所有依赖类型:
    .upToNextMajor
    .upToNextMinor
    .exact
使用两个管理器(发布版+标签版)作为备选:
json
{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": ["config:recommended"],
  "enabledManagers": ["custom.regex"],
  "customManagers": [
    {
      "customType": "regex",
      "managerFilePatterns": ["/(^|/)Project\\.swift$/"],
      "matchStrings": [
        "\\.remote\\(url:\\s*\"(?:https?:\\/\\/)?github\\.com\\/(?<depName>[\\w\\-_]+\\/[\\w\\-_.]+?)(?:\\.git)?\"[\\s\\S]*?requirement:\\s*\\.(?:upToNextMajor|upToNextMinor)\\(from:\\s*\"(?<currentValue>[^\"]+)\"\\)"
      ],
      "datasourceTemplate": "github-releases"
    },
    {
      "customType": "regex",
      "managerFilePatterns": ["/(^|/)Project\\.swift$/"],
      "matchStrings": [
        "\\.remote\\(url:\\s*\"(?:https?:\\/\\/)?github\\.com\\/(?<depName>[\\w\\-_]+\\/[\\w\\-_.]+?)(?:\\.git)?\"[\\s\\S]*?requirement:\\s*\\.(?:upToNextMajor|upToNextMinor)\\(from:\\s*\"(?<currentValue>[^\"]+)\"\\)"
      ],
      "datasourceTemplate": "github-tags"
    },
    {
      "customType": "regex",
      "managerFilePatterns": ["/(^|/)Project\\.swift$/"],
      "matchStrings": [
        "\\.remote\\(url:\\s*\"(?:https?:\\/\\/)?github\\.com\\/(?<depName>[\\w\\-_]+\\/[\\w\\-_.]+?)(?:\\.git)?\"[\\s\\S]*?requirement:\\s*\\.exact\\(\"(?<currentValue>[^\"]+)\"\\)"
      ],
      "datasourceTemplate": "github-releases"
    },
    {
      "customType": "regex",
      "managerFilePatterns": ["/(^|/)Project\\.swift$/"],
      "matchStrings": [
        "\\.remote\\(url:\\s*\"(?:https?:\\/\\/)?github\\.com\\/(?<depName>[\\w\\-_]+\\/[\\w\\-_.]+?)(?:\\.git)?\"[\\s\\S]*?requirement:\\s*\\.exact\\(\"(?<currentValue>[^\"]+)\"\\)"
      ],
      "datasourceTemplate": "github-tags"
    }
  ],
  "packageRules": [
    {
      "matchManagers": ["custom.regex"],
      "groupName": "Swift dependencies",
      "schedule": ["<schedule>"]
    }
  ]
}

Case D: Mixed (URL + registry packages)

情况D:混合模式(URL型 + 注册表型包)

Combine the
customManagers
entries from Case B and Case C. Set
enabledManagers
to include only the managers you use:
json
{
  "enabledManagers": ["custom.regex"]
}

合并情况B和情况C中的
customManagers
配置。将
enabledManagers
设置为仅包含你使用的管理器:
json
{
  "enabledManagers": ["custom.regex"]
}

Branch Dependencies

分支依赖

Packages declared with
requirement: .branch("...")
use mutable Git refs — there is no semantic version for Renovate to track. Do not add regex patterns for these. If Renovate picks them up accidentally, disable them explicitly:
json
{
  "matchDatasources": ["git-refs"],
  "enabled": false
}

使用
requirement: .branch("...")
声明的包使用可变的Git引用——Renovate无法追踪这类包的语义版本。不要为这类包添加正则匹配规则。如果Renovate意外识别了它们,可显式禁用:
json
{
  "matchDatasources": ["git-refs"],
  "enabled": false
}

Adding mise.toml support (optional)

可选:添加mise.toml支持

If
mise.toml
exists, add
mise
to
enabledManagers
:
json
{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": ["config:recommended"],
  "enabledManagers": ["mise", "custom.regex"],
  "packageRules": [
    {
      "matchManagers": ["mise"],
      "groupName": "Dev tools",
      "schedule": ["<schedule>"]
    }
  ]
}
The
mise
manager reads
mise.toml
and updates tool versions like
tuist
,
swiftlint
, etc.

如果
mise.toml
文件存在,在
enabledManagers
中添加
mise
json
{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": ["config:recommended"],
  "enabledManagers": ["mise", "custom.regex"],
  "packageRules": [
    {
      "matchManagers": ["mise"],
      "groupName": "Dev tools",
      "schedule": ["<schedule>"]
    }
  ]
}
mise
管理器会读取
mise.toml
文件并更新工具版本,如
tuist
swiftlint
等。

Recommended packageRules additions (optional)

可选:推荐添加的packageRules配置

Consider adding these to control merge behaviour:
json
{
  "packageRules": [
    {
      "matchUpdateTypes": ["patch"],
      "automerge": true,
      "automergeType": "branch"
    },
    {
      "matchUpdateTypes": ["minor"],
      "automerge": false
    },
    {
      "matchUpdateTypes": ["major"],
      "automerge": false
    }
  ]
}
And these top-level options to prevent PR floods:
json
{
  "prConcurrentLimit": 3,
  "prHourlyLimit": 2
}
可考虑添加以下配置来控制合并行为:
json
{
  "packageRules": [
    {
      "matchUpdateTypes": ["patch"],
      "automerge": true,
      "automergeType": "branch"
    },
    {
      "matchUpdateTypes": ["minor"],
      "automerge": false
    },
    {
      "matchUpdateTypes": ["major"],
      "automerge": false
    }
  ]
}
还可添加以下顶级配置项来避免PR泛滥:
json
{
  "prConcurrentLimit": 3,
  "prHourlyLimit": 2
}

Step 6 — Dry-run Verification

步骤6 — 预运行验证

Run a local dry-run to confirm the
renovate.json
detects the expected packages before merging.
Check if Renovate is installed:
bash
renovate --version
  • If installed → proceed to run the dry-run below.
  • If not installed → ask the user: "Renovate is not installed. Can I install it with
    npm install -g renovate
    ?"
    Only install if the user confirms.
Run the dry-run:
bash
RENOVATE_TOKEN=<github-pat> renovate --dry-run=full <org>/<repo>
A GitHub PAT with
repo
scope is required. Ask the user to provide it if not already available in the environment.
What to check in the output:
  • Each expected package appears as a detected dependency with its current version
  • No
    matched 0 files
    warnings for your
    managerFilePatterns
  • Registry packages show the correct transformed
    depName
    (e.g.
    firebase/firebase-ios-sdk
    , not
    firebase.firebase-ios-sdk
    )
If a package is missing:
  • Paste the actual Swift declaration (including surrounding lines) into regex101.com using the JavaScript flavor
  • Test the failing
    matchStrings
    pattern directly
  • Common culprits: multiline declaration not matched by
    [\s\S]*?
    , unhandled requirement type (e.g.
    .upToNextMinor
    ,
    .exact
    )
在合并之前,运行本地预运行来确认
renovate.json
能检测到预期的包。
检查Renovate是否已安装:
bash
renovate --version
  • 如果已安装 → 继续运行下方的预运行命令。
  • 如果未安装 → 询问用户:"Renovate未安装。是否使用
    npm install -g renovate
    进行安装?"
    仅在用户确认后进行安装。
运行预运行:
bash
RENOVATE_TOKEN=<github-pat> renovate --dry-run=full <org>/<repo>
需要一个带有
repo
权限的GitHub PAT。如果环境中没有,可请求用户提供。
输出检查要点:
  • 每个预期的包都作为已检测到的依赖项显示,并包含当前版本
  • 没有针对
    managerFilePatterns
    matched 0 files
    警告
  • 注册表型包显示正确转换后的
    depName
    (例如
    firebase/firebase-ios-sdk
    ,而非
    firebase.firebase-ios-sdk
如果某个包未被检测到:
  • 将实际的Swift声明(包括周围代码行)粘贴到regex101.com,选择JavaScript正则风格
  • 直接测试对应的
    matchStrings
    模式
  • 常见问题:多行声明未被
    [\s\S]*?
    匹配、未处理的依赖类型(例如
    .upToNextMinor
    .exact

Step 7 — Enable Renovate

步骤7 — 启用Renovate

Choose one of the two approaches:
选择以下两种方式之一:

Option A: Renovate GitHub App (recommended)

方式A:Renovate GitHub App(推荐)

  1. Install the Renovate GitHub App on the repository.
  2. Merge the
    renovate.json
    — Renovate will auto-create an onboarding PR, then begin raising dependency update PRs.
No additional files needed.
  1. 在仓库上安装Renovate GitHub App
  2. 合并
    renovate.json
    文件——Renovate会自动创建一个初始化PR,之后开始生成依赖更新PR。
无需额外文件。

Option B: Self-hosted via GitHub Actions

方式B:通过GitHub Actions自托管

1. Check for an existing Renovate workflow:
bash
ls .github/workflows/
Search for any workflow file that already references Renovate:
bash
grep -rl "renovate" .github/workflows/
  • If a Renovate workflow already exists — show its contents to the user and ask whether to update the schedule/token or leave it as-is. Do not create a new file.
  • If no Renovate workflow exists — create
    .github/workflows/renovate.yml
    :
yaml
name: Renovate

on:
  schedule:
    - cron: '<cron expression matching chosen schedule>'
  workflow_dispatch:

permissions:
  contents: write
  pull-requests: write

jobs:
  renovate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: renovatebot/github-action@v40
        with:
          configurationFile: renovate.json
          token: ${{ secrets.RENOVATE_TOKEN }}
2. Set
RENOVATE_TOKEN
in GitHub repository secrets (a PAT with
repo
scope) if not already set.
1. 检查是否存在现有的Renovate工作流:
bash
ls .github/workflows/
搜索任何已包含Renovate的工作流文件:
bash
grep -rl "renovate" .github/workflows/
  • 如果已存在Renovate工作流 — 向用户展示其内容,并询问是否更新调度/令牌或保持原样。不要创建新文件。
  • 如果不存在Renovate工作流 — 创建
    .github/workflows/renovate.yml
yaml
name: Renovate

on:
  schedule:
    - cron: '<cron expression matching chosen schedule>'
  workflow_dispatch:

permissions:
  contents: write
  pull-requests: write

jobs:
  renovate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: renovatebot/github-action@v40
        with:
          configurationFile: renovate.json
          token: ${{ secrets.RENOVATE_TOKEN }}
2. 如果尚未设置,在GitHub仓库密钥中配置
RENOVATE_TOKEN
(带有
repo
权限的PAT)。

Step 8 — Verify

步骤8 — 验证

After merging:
  • Renovate creates a Configure Renovate PR (if using GitHub App) — merge it
  • Renovate opens PRs for outdated packages on the configured schedule
  • Check
    https://app.renovatebot.com/dashboard
    for run logs
合并后:
  • Renovate会创建一个配置Renovate的PR(如果使用GitHub App)——合并该PR
  • Renovate会按照配置的调度为过时的包创建PR
  • 访问
    https://app.renovatebot.com/dashboard
    查看运行日志

Common Issues

常见问题

IssueFix
No PRs createdConfirm
renovate.json
is valid JSON; check app dashboard for errors
customManagers
not matching
Test the regex against your actual Swift file at regex101.com (use JavaScript flavor)
Multiline declarations not detectedEnsure
[\\s\\S]*?
is used instead of
.+?
in
matchStrings
Registry package PRs have wrong versionOverride
packageName
in
packageRules
to point to the correct GitHub repo
Renovate opens too many PRs at onceAdd
"prConcurrentLimit": 3
to
renovate.json
Package updates break buildAdd
"automerge": false
(it's the default — confirm it's not set to
true
)
Renovate scan is very slowAdd
"enabledManagers": ["custom.regex"]
to skip irrelevant built-in managers
问题解决方法
未创建任何PR确认
renovate.json
是有效的JSON;查看App仪表盘的错误信息
customManagers
未匹配到内容
在regex101.com(使用JavaScript风格)中,用实际的Swift文件测试正则表达式
多行声明未被检测到确保
matchStrings
中使用
[\\s\\S]*?
而非
.+?
注册表型包的PR版本错误
packageRules
中覆盖
packageName
,指向正确的GitHub仓库
Renovate同时创建过多PR
renovate.json
中添加
"prConcurrentLimit": 3
包更新导致构建失败添加
"automerge": false
(默认即为该值——确认未设置为
true
Renovate扫描速度极慢添加
"enabledManagers": ["custom.regex"]
以跳过无关的内置管理器

Done Checklist

完成检查清单

  • renovate.json
    created in project root with correct config for detected style
  • JSON is valid (no syntax errors)
  • customManagers
    regex tested against actual Swift file content (including multiline examples)
  • Branch dependencies excluded or disabled
  • renovate --dry-run
    confirms all expected packages are detected
  • Renovate GitHub App installed OR
    .github/workflows/renovate.yml
    created
  • RENOVATE_TOKEN
    secret set (self-hosted only)
  • 已在项目根目录创建符合检测到的配置的
    renovate.json
    文件
  • JSON文件语法有效(无语法错误)
  • 已针对实际Swift文件内容(包括多行示例)测试
    customManagers
    的正则表达式
  • 已排除或禁用分支依赖
  • renovate --dry-run
    确认所有预期的包都被检测到
  • 已安装Renovate GitHub App 或 创建了
    .github/workflows/renovate.yml
    文件
  • 已设置
    RENOVATE_TOKEN
    密钥(仅自托管方式需要)