Skip to content

Commit 6072f66

Browse files
chore: add renovate bot (#30)
1 parent 8803e70 commit 6072f66

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed

.github/renovate.json5

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
$schema: "https://docs.renovatebot.com/renovate-schema.json",
3+
extends: [
4+
"config:base",
5+
":disableRateLimiting",
6+
":dependencyDashboard",
7+
":semanticCommits",
8+
":automergeDigest",
9+
":automergeBranch",
10+
],
11+
dependencyDashboardTitle: "Renovate Dashboard 🤖",
12+
suppressNotifications: ["prIgnoreNotification"],
13+
rebaseWhen: "conflicted",
14+
commitBodyTable: true,
15+
cargo: {
16+
commitMessageTopic: "Rust crate {{depName}}",
17+
},
18+
packageRules: [
19+
{
20+
description: "Auto merge non-major updates",
21+
matchUpdateTypes: ["minor", "patch"],
22+
automerge: true,
23+
automergeType: "pr",
24+
},
25+
{
26+
description: "Group Rust dev dependencies",
27+
matchManagers: ["cargo"],
28+
matchDepTypes: ["dev-dependencies"],
29+
groupName: "Rust dev dependencies",
30+
groupSlug: "rust-dev",
31+
},
32+
],
33+
ignorePaths: [],
34+
}

.github/workflows/renovate.yaml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
name: Renovate
3+
on:
4+
# checkov:skip=CKV_GHA_7: "Workflow dispatch inputs are required for manual debugging and configuration"
5+
workflow_dispatch:
6+
inputs:
7+
dryRun:
8+
description: Dry Run
9+
default: "false"
10+
required: false
11+
logLevel:
12+
description: Log Level
13+
default: "debug"
14+
required: false
15+
version:
16+
description: Renovate version
17+
default: latest
18+
required: false
19+
schedule:
20+
# Run every week on sunday and wednesday at 00:00 UTC
21+
- cron: "0 0 * * 0,3"
22+
push:
23+
branches: ["main"]
24+
paths:
25+
- .github/renovate.json5
26+
- .github/renovate/**.json5
27+
28+
permissions:
29+
contents: read
30+
pull-requests: write
31+
issues: write
32+
33+
concurrency:
34+
group: ${{ github.workflow }}-${{ github.run_number || github.ref }}
35+
cancel-in-progress: true
36+
37+
# Retrieve BOT_USER_ID via `curl -s "https://api.github.com/users/${BOT_USERNAME}%5Bbot%5D" | jq .id`
38+
env:
39+
WORKFLOW_DRY_RUN: false
40+
WORKFLOW_LOG_LEVEL: debug
41+
WORKFLOW_VERSION: latest # 37.59.8
42+
RENOVATE_PLATFORM: github
43+
RENOVATE_PLATFORM_COMMIT: true
44+
RENOVATE_ONBOARDING_CONFIG_FILE_NAME: .github/renovate.json5
45+
RENOVATE_AUTODISCOVER: true
46+
RENOVATE_AUTODISCOVER_FILTER: "${{ github.repository }}"
47+
RENOVATE_GIT_AUTHOR: "${{ secrets.BOT_USERNAME }} <${{ secrets.BOT_USER_ID }}+${{ secrets.BOT_USERNAME }}[bot]@users.noreply.github.com>"
48+
49+
jobs:
50+
renovate:
51+
name: Renovate
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Generate Token
55+
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
56+
id: app-token
57+
with:
58+
app-id: "${{ secrets.BOT_APP_ID }}"
59+
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
60+
61+
- name: Checkout
62+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
63+
with:
64+
token: "${{ steps.app-token.outputs.token }}"
65+
66+
- name: Override default config from dispatch variables
67+
run: |
68+
echo "RENOVATE_DRY_RUN=${{ github.event.inputs.dryRun || env.WORKFLOW_DRY_RUN }}" >> "${GITHUB_ENV}"
69+
echo "LOG_LEVEL=${{ github.event.inputs.logLevel || env.WORKFLOW_LOG_LEVEL }}" >> "${GITHUB_ENV}"
70+
71+
- name: Delete old dashboard
72+
run: |
73+
ISSUE_NUMBER=$(gh issue list -S 'Renovate Dashboard 🤖' --json number -q '.[0].number')
74+
if [ "$ISSUE_NUMBER" != "null" ] && [ -n "$ISSUE_NUMBER" ]; then
75+
gh issue close "$ISSUE_NUMBER"
76+
else
77+
echo "No issue found to close."
78+
fi
79+
env:
80+
GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}"
81+
82+
- name: Renovate
83+
uses: renovatebot/github-action@248bf5a619694187930adc80b9343c37761c173f # v43.0.1
84+
with:
85+
configurationFile: "${{ env.RENOVATE_ONBOARDING_CONFIG_FILE_NAME }}"
86+
token: "${{ steps.app-token.outputs.token }}"
87+
renovate-version: "${{ github.event.inputs.version || env.WORKFLOW_VERSION }}"

0 commit comments

Comments
 (0)