Skip to content

Commit 18cbb7b

Browse files
nadiamoeNadia Santalla
authored andcommitted
ci/renovate: use shared renovate presets and actions
1 parent 1fd23e7 commit 18cbb7b

File tree

3 files changed

+27
-87
lines changed

3 files changed

+27
-87
lines changed

.github/renovate.json5

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,9 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
33
"extends": [
4-
"config:best-practices",
5-
":semanticCommitsDisabled"
6-
],
7-
8-
"branchPrefix": "grafanarenovatebot/",
9-
"commitMessagePrefix": "Chore: ",
10-
// Used when renovate runs as a github app.
11-
// https://docs.renovatebot.com/configuration-options/#platformcommit
12-
// Setting platformCommit to "enabled", as required by Grafana policy, seems to make renovate think all PRs are modified,
13-
// as the dynamic author configured by github does not match the author set in `gitAuthor`. It is recommended to
14-
// leave it unset: https://github.com/renovatebot/renovate/discussions/29106.
15-
"platformCommit": "enabled",
16-
"dependencyDashboard": false,
17-
"forkProcessing": "disabled",
18-
"rebaseWhen": "behind-base-branch",
19-
"prHourlyLimit": 0,
20-
"prConcurrentLimit": 10,
21-
"branchConcurrentLimit": 10,
22-
23-
"enabledManagers": ["custom.regex", "gomod"],
24-
25-
"labels": ["dependencies"],
26-
27-
"gomod": {
28-
"enabled": true
29-
},
30-
31-
"postUpdateOptions": [
32-
"gomodTidyE"
33-
],
34-
35-
"customManagers": [
36-
{
37-
// Update renovate version in GHA workflow file.
38-
"customType": "regex",
39-
"depNameTemplate": "ghcr.io/renovatebot/renovate",
40-
"datasourceTemplate": "docker",
41-
"fileMatch": [
42-
"^\\.github/workflows/.*\\.ya?ml$",
43-
],
44-
"matchStrings": [
45-
"renovate-version: (?<currentValue>[^@\\s]+)(?:@(?<currentDigest>\\S+))?",
46-
"RENOVATE_IMAGE=ghcr.io/renovatebot/renovate:(?<currentValue>[^@\\s]+)(?:@(?<currentDigest>\\S+))?"
47-
],
48-
},
4+
"github>grafana/sm-renovate//presets/grafana.json5",
5+
"github>grafana/sm-renovate//presets/synthetic-monitoring.json5",
6+
"github>grafana/sm-renovate//presets/go.json5",
497
],
8+
"commitMessagePrefix": "",
509
}

.github/workflows/renovate-validate.yaml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,23 @@ name: Validate renovate config
22
on:
33
pull_request:
44
paths:
5-
- "**renovate*.*"
5+
# When renovate config changes:
6+
- "renovate.*"
7+
- ".renovate.*"
8+
- ".github/renovate.*"
9+
# Also when renovate version changes:
10+
- ".github/workflows/renovate*"
11+
612
jobs:
7-
validate:
13+
renovate:
14+
permissions:
15+
# Needed for logging into vault.
16+
contents: read
17+
id-token: write
818
runs-on: ubuntu-latest
919
timeout-minutes: 5
1020
steps:
1121
- name: Checkout Code
12-
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
13-
- name: Validate renovate config
14-
run: |-
15-
# Renovate updates the line below. Please keep its formatting as it is.
16-
export RENOVATE_IMAGE=ghcr.io/renovatebot/renovate:39.38.0@sha256:5a53ef5d0488e54ad36194453f012cce7926660d46076e424053d445d4ff0225
17-
docker run -i --rm -v $(realpath .):/repo -w /repo --entrypoint renovate-config-validator "$RENOVATE_IMAGE" --strict
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
- name: Self-hosted renovate
24+
uses: grafana/sm-renovate/actions/renovate-validate@main

.github/workflows/renovate.yaml

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,20 @@
1-
name: Renovate
1+
name: Self-hosted Renovate
22

33
on:
44
schedule:
5-
- cron: "18 */4 * * *"
5+
- cron: "29 */4 * * *"
66
workflow_dispatch:
77

88
jobs:
99
renovate:
1010
permissions:
11-
contents: read # needed to read the contents of the repository
12-
id-token: write # needed to create a GitHub App token
11+
# Needed for logging into vault.
12+
contents: read
13+
id-token: write
1314
runs-on: ubuntu-latest
1415
timeout-minutes: 5
1516
steps:
1617
- name: Checkout Code
17-
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
18-
- name: retrieve secrets
19-
id: get-secrets
20-
uses: grafana/shared-workflows/actions/get-vault-secrets@332fb1cf3349234b5b1940f3f2797410e6ccd5d2
21-
with:
22-
common_secrets: |
23-
GRAFANA_RENOVATE_APP_ID=grafana-renovate-app:app-id
24-
GRAFANA_RENOVATE_PRIVATE_KEY=grafana-renovate-app:private-key
25-
26-
- name: create GitHub app token
27-
id: app-token
28-
# Beware that the token generated here has elevated permissions wrt to
29-
# the ones set in the action. In particular, it will be able to write
30-
# to the repository (e.g. create branches) and create pull requests.
31-
uses: actions/create-github-app-token@v1
32-
with:
33-
app-id: ${{ env.GRAFANA_RENOVATE_APP_ID }}
34-
private-key: ${{ env.GRAFANA_RENOVATE_PRIVATE_KEY }}
35-
owner: ${{ github.repository_owner }}
36-
37-
- name: Self-hosted Renovate
38-
uses: renovatebot/github-action@dd4d265eb8646cd04fc5f86ff8bc8d496d75a251 # v40.2.8
39-
with:
40-
renovate-version: 39.38.0@sha256:5a53ef5d0488e54ad36194453f012cce7926660d46076e424053d445d4ff0225
41-
configurationFile: .github/renovate-app.json
42-
token: "${{ steps.app-token.outputs.token }}"
43-
env:
44-
LOG_LEVEL: debug
45-
RENOVATE_PLATFORM: github
46-
RENOVATE_REPOSITORIES: ${{ github.repository }}
18+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
- name: Self-hosted renovate
20+
uses: grafana/sm-renovate/actions/renovate@main

0 commit comments

Comments
 (0)