Skip to content

Commit 345ec99

Browse files
ChengYanJinclaude
andcommitted
Add Renovate workflow for Docker base image updates
Keep Docker base images up to date automatically to prevent CVE from outdated base layers. Runs on weekdays at 8am UTC. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent eb37951 commit 345ec99

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

.github/workflows/renovate.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Renovate
2+
on:
3+
schedule:
4+
- cron: "0 8 * * 1-5" # Weekdays at 8am UTC
5+
workflow_dispatch: # Allow manual trigger
6+
7+
jobs:
8+
renovate:
9+
runs-on: ubuntu-latest
10+
permissions: {}
11+
steps:
12+
- name: Generate app token
13+
id: app-token
14+
uses: actions/create-github-app-token@v3
15+
with:
16+
app-id: ${{ vars.ACTIONS_APP_ID }}
17+
private-key: ${{ secrets.ACTIONS_APP_PRIVATE_KEY }}
18+
owner: ${{ github.repository_owner }}
19+
20+
- name: Checkout
21+
uses: actions/checkout@v6
22+
with:
23+
token: ${{ steps.app-token.outputs.token }}
24+
25+
- name: Run Renovate
26+
uses: renovatebot/github-action@v46.1.9
27+
with:
28+
configurationFile: renovate.json
29+
token: ${{ steps.app-token.outputs.token }}
30+
env:
31+
RENOVATE_REPOSITORIES: ${{ github.repository }}
32+
33+
- name: Auto-approve Renovate PRs
34+
env:
35+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
36+
run: |
37+
gh pr list --repo ${{ github.repository }} --state open --json number,headRefName --jq '.[] | select(.headRefName | startswith("improvement/renovate-")) | .number' | while read -r pr; do
38+
if ! gh pr view "$pr" --repo ${{ github.repository }} --json comments --jq '.comments[].body' | grep -q '^/approve$'; then
39+
gh pr comment "$pr" --repo ${{ github.repository }} --body '/approve'
40+
echo "Approved PR #$pr"
41+
else
42+
echo "PR #$pr already approved, skipping"
43+
fi
44+
done

renovate.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["config:recommended"],
4+
"enabledManagers": ["dockerfile"],
5+
"branchPrefix": "improvement/renovate-",
6+
"packageRules": [
7+
{
8+
"matchManagers": ["dockerfile"],
9+
"matchUpdateTypes": ["minor", "patch"],
10+
"addLabels": ["dependencies", "docker", "renovate"]
11+
},
12+
{
13+
"matchManagers": ["dockerfile"],
14+
"matchUpdateTypes": ["major"],
15+
"addLabels": ["dependencies", "docker", "major", "renovate"]
16+
}
17+
]
18+
}

0 commit comments

Comments
 (0)