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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Renovate Bot: Automated Dependency Updates
|
| 2 |
+
|
| 3 |
+
## What is Renovate?
|
| 4 |
+
|
| 5 |
+
[Renovate](https://github.com/renovatebot/renovate) is an open-source dependency update tool that automatically creates pull requests to keep your project dependencies up-to-date. It's maintained by Mend.io and is free for public and private repositories.
|
| 6 |
+
|
| 7 |
+
## Why Use Renovate Over Manual Updates?
|
| 8 |
+
|
| 9 |
+
| Manual Updates | Renovate |
|
| 10 |
+
|----------------|----------|
|
| 11 |
+
| Easy to forget | Runs on schedule automatically |
|
| 12 |
+
| Time-consuming to check each dependency | Monitors 90+ package managers |
|
| 13 |
+
| Risk of missing security patches | Creates PRs immediately when updates available |
|
| 14 |
+
| No visibility into what's outdated | Dependency Dashboard shows all pending updates |
|
| 15 |
+
|
| 16 |
+
## Key Features
|
| 17 |
+
|
| 18 |
+
### 1. Multi-Platform Support
|
| 19 |
+
- GitHub, GitLab, Bitbucket, Azure DevOps, Gitea
|
| 20 |
+
- Unlike Dependabot (GitHub-only), Renovate works everywhere
|
| 21 |
+
|
| 22 |
+
### 2. Extensive Package Manager Support
|
| 23 |
+
- npm, yarn, pnpm
|
| 24 |
+
- Docker images
|
| 25 |
+
- GitHub Actions
|
| 26 |
+
- Kubernetes manifests
|
| 27 |
+
- Terraform
|
| 28 |
+
- **Custom regex patterns** (our use case for n8n in Dockerfile)
|
| 29 |
+
|
| 30 |
+
### 3. Flexible Configuration
|
| 31 |
+
```json
|
| 32 |
+
{
|
| 33 |
+
"schedule": ["every weekend"], // When to check
|
| 34 |
+
"automerge": true, // Auto-merge safe updates
|
| 35 |
+
"packageRules": [ // Fine-grained control
|
| 36 |
+
{
|
| 37 |
+
"matchUpdateTypes": ["major"],
|
| 38 |
+
"automerge": false // Require review for breaking changes
|
| 39 |
+
}
|
| 40 |
+
]
|
| 41 |
+
}
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
### 4. Grouping & Scheduling
|
| 45 |
+
- Group related updates into single PRs
|
| 46 |
+
- Schedule updates for low-traffic times
|
| 47 |
+
- Reduce PR noise
|
| 48 |
+
|
| 49 |
+
## Our Implementation (n8n-workflow)
|
| 50 |
+
|
| 51 |
+
### Problem Solved
|
| 52 |
+
n8n is installed via `npm install -g n8n` in our Dockerfile. Standard package managers can't detect this, but Renovate's **regex manager** can.
|
| 53 |
+
|
| 54 |
+
### Configuration (`renovate.json`)
|
| 55 |
+
```json
|
| 56 |
+
{
|
| 57 |
+
"customManagers": [
|
| 58 |
+
{
|
| 59 |
+
"customType": "regex",
|
| 60 |
+
"fileMatch": ["^Dockerfile$"],
|
| 61 |
+
"matchStrings": ["ARG N8N_VERSION=(?<currentValue>.*?)\\n"],
|
| 62 |
+
"depNameTemplate": "n8n",
|
| 63 |
+
"datasourceTemplate": "npm"
|
| 64 |
+
}
|
| 65 |
+
]
|
| 66 |
+
}
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
### How It Works
|
| 70 |
+
```
|
| 71 |
+
┌─────────────────────────────────────────────────────────────┐
|
| 72 |
+
│ Renovate (every weekend) │
|
| 73 |
+
│ 1. Reads Dockerfile │
|
| 74 |
+
│ 2. Extracts: ARG N8N_VERSION=2.3.4 │
|
| 75 |
+
│ 3. Checks npm registry for latest n8n version │
|
| 76 |
+
│ 4. If newer version exists → Creates PR │
|
| 77 |
+
└─────────────────────────────────────────────────────────────┘
|
| 78 |
+
│
|
| 79 |
+
▼
|
| 80 |
+
┌─────────────────────────────────────────────────────────────┐
|
| 81 |
+
│ GitHub Actions (renovate-auto-merge.yml) │
|
| 82 |
+
│ 1. Detects PR from renovate[bot] │
|
| 83 |
+
│ 2. Auto-approves the PR │
|
| 84 |
+
│ 3. Enables auto-merge (squash) │
|
| 85 |
+
└─────────────────────────────────────────────────────────────┘
|
| 86 |
+
│
|
| 87 |
+
▼
|
| 88 |
+
┌─────────────────────────────────────────────────────────────┐
|
| 89 |
+
│ Existing Deploy Workflow │
|
| 90 |
+
│ 1. Triggered on push to main │
|
| 91 |
+
│ 2. Deploys to Hugging Face Spaces │
|
| 92 |
+
│ 3. n8n updated in production │
|
| 93 |
+
└─────────────────────────────────────────────────────────────┘
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
## Applying to Other Projects
|
| 97 |
+
|
| 98 |
+
### Use Case 1: Docker Base Images
|
| 99 |
+
```json
|
| 100 |
+
{
|
| 101 |
+
"packageRules": [
|
| 102 |
+
{
|
| 103 |
+
"matchDatasources": ["docker"],
|
| 104 |
+
"matchPackageNames": ["node"],
|
| 105 |
+
"allowedVersions": "/^20\\./" // Only Node 20.x updates
|
| 106 |
+
}
|
| 107 |
+
]
|
| 108 |
+
}
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
### Use Case 2: GitHub Actions
|
| 112 |
+
Renovate automatically detects and updates actions in `.github/workflows/*.yml`:
|
| 113 |
+
```yaml
|
| 114 |
+
# Before: uses: actions/checkout@v3
|
| 115 |
+
# After: uses: actions/checkout@v4
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
### Use Case 3: Custom Version Files
|
| 119 |
+
For any version string in any file:
|
| 120 |
+
```json
|
| 121 |
+
{
|
| 122 |
+
"customManagers": [
|
| 123 |
+
{
|
| 124 |
+
"customType": "regex",
|
| 125 |
+
"fileMatch": ["^VERSION$", "^config\\.yaml$"],
|
| 126 |
+
"matchStrings": ["version:\\s*(?<currentValue>\\S+)"],
|
| 127 |
+
"depNameTemplate": "my-package",
|
| 128 |
+
"datasourceTemplate": "npm"
|
| 129 |
+
}
|
| 130 |
+
]
|
| 131 |
+
}
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
### Use Case 4: Monorepo with Multiple Apps
|
| 135 |
+
```json
|
| 136 |
+
{
|
| 137 |
+
"packageRules": [
|
| 138 |
+
{
|
| 139 |
+
"matchFileNames": ["apps/frontend/**"],
|
| 140 |
+
"groupName": "frontend dependencies"
|
| 141 |
+
},
|
| 142 |
+
{
|
| 143 |
+
"matchFileNames": ["apps/backend/**"],
|
| 144 |
+
"groupName": "backend dependencies"
|
| 145 |
+
}
|
| 146 |
+
]
|
| 147 |
+
}
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
## Auto-Merge Workflow (Required)
|
| 151 |
+
|
| 152 |
+
Renovate's `automerge: true` doesn't always work without branch protection. Add this workflow:
|
| 153 |
+
|
| 154 |
+
```yaml
|
| 155 |
+
# .github/workflows/renovate-auto-merge.yml
|
| 156 |
+
name: Renovate Auto-Merge
|
| 157 |
+
|
| 158 |
+
on:
|
| 159 |
+
pull_request_target:
|
| 160 |
+
types: [opened, synchronize, reopened]
|
| 161 |
+
|
| 162 |
+
permissions:
|
| 163 |
+
contents: write
|
| 164 |
+
pull-requests: write
|
| 165 |
+
|
| 166 |
+
jobs:
|
| 167 |
+
auto-merge:
|
| 168 |
+
runs-on: ubuntu-latest
|
| 169 |
+
if: github.actor == 'renovate[bot]'
|
| 170 |
+
steps:
|
| 171 |
+
- name: Auto-approve Renovate PR
|
| 172 |
+
run: gh pr review --approve "$PR_URL"
|
| 173 |
+
env:
|
| 174 |
+
PR_URL: ${{ github.event.pull_request.html_url }}
|
| 175 |
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 176 |
+
|
| 177 |
+
- name: Enable auto-merge
|
| 178 |
+
run: gh pr merge --auto --squash "$PR_URL"
|
| 179 |
+
env:
|
| 180 |
+
PR_URL: ${{ github.event.pull_request.html_url }}
|
| 181 |
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 182 |
+
```
|
| 183 |
+
|
| 184 |
+
## Renovate vs Dependabot
|
| 185 |
+
|
| 186 |
+
| Feature | Renovate | Dependabot |
|
| 187 |
+
|---------|----------|------------|
|
| 188 |
+
| Platform | Multi-platform | GitHub only |
|
| 189 |
+
| Package managers | 90+ | 14 |
|
| 190 |
+
| Custom regex | ✅ Yes | ❌ No |
|
| 191 |
+
| Grouping | ✅ Advanced | ⚠️ Limited |
|
| 192 |
+
| Scheduling | ✅ Flexible | ⚠️ Basic |
|
| 193 |
+
| Dashboard | ✅ Yes | ❌ No |
|
| 194 |
+
| Self-hosted option | ✅ Yes | ❌ No |
|
| 195 |
+
|
| 196 |
+
## Getting Started
|
| 197 |
+
|
| 198 |
+
1. **Install Renovate GitHub App**: https://github.com/apps/renovate
|
| 199 |
+
2. **Grant repository access**
|
| 200 |
+
3. **Merge the onboarding PR** (creates `renovate.json`)
|
| 201 |
+
4. **Add auto-merge workflow** (see above)
|
| 202 |
+
5. **Monitor the Dependency Dashboard issue**
|
| 203 |
+
|
| 204 |
+
## References
|
| 205 |
+
|
| 206 |
+
- [Renovate Documentation](https://docs.renovatebot.com/)
|
| 207 |
+
- [Renovate Presets](https://docs.renovatebot.com/presets-default/)
|
| 208 |
+
- [Regex Manager](https://docs.renovatebot.com/modules/manager/regex/)
|
| 209 |
+
- [GitHub App](https://github.com/apps/renovate)
|
.github/workflows/renovate-auto-merge.yml
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Renovate Auto-Merge
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request_target:
|
| 5 |
+
types: [opened, synchronize, reopened]
|
| 6 |
+
|
| 7 |
+
permissions:
|
| 8 |
+
contents: write
|
| 9 |
+
pull-requests: write
|
| 10 |
+
|
| 11 |
+
jobs:
|
| 12 |
+
auto-merge:
|
| 13 |
+
runs-on: ubuntu-latest
|
| 14 |
+
if: github.actor == 'renovate[bot]'
|
| 15 |
+
|
| 16 |
+
steps:
|
| 17 |
+
- name: Auto-approve Renovate PR
|
| 18 |
+
run: gh pr review --approve "$PR_URL"
|
| 19 |
+
env:
|
| 20 |
+
PR_URL: ${{ github.event.pull_request.html_url }}
|
| 21 |
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 22 |
+
|
| 23 |
+
- name: Enable auto-merge for Renovate PR
|
| 24 |
+
run: gh pr merge --auto --squash "$PR_URL"
|
| 25 |
+
env:
|
| 26 |
+
PR_URL: ${{ github.event.pull_request.html_url }}
|
| 27 |
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|