Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Renovate workflow to keep actions, workflows, and tool dependencies up to date #946

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/renovate-config.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
$schema: "https://docs.renovatebot.com/renovate-schema.json",
branchPrefix: "grafanarenovatebot/",
customManagers: [
{
customType: "regex",
fileMatch: [
"(?:^|/)\\.github/(?:workflows|actions)/.+\\.ya?ml$",
"(?:^|/)action\\.ya?ml$",
],
matchStrings: [
"# renovate: datasource=(?<datasource>[a-z-.]+?) depName=(?<depName>[^\\s]+?)(?: (?:lookupName|packageName)=(?<packageName>[^\\s]+?))?(?: versioning=(?<versioning>[^\\s]+?))?(?: extractVersion=(?<extractVersion>[^\\s]+?))?\\s+[A-Za-z0-9_-]+?[_-](?:VERSION|version)\\s*:\\s*[\"']?(?<currentValue>[^@]+)(?:@(?<currentDigest>sha256:[a-f0-9]+))?[\"']?",
],
},
],
dependencyDashboard: false,
enabledManagers: ["custom.regex", "github-actions", "gomod", "npm"],
forkProcessing: "enabled",
globalExtends: [":pinDependencies", "config:best-practices"],
onboarding: false,
osvVulnerabilityAlerts: true,
packageRules: [
{
labels: ["update-major"],
matchUpdateTypes: ["major"],
},
{
labels: ["update-minor"],
matchUpdateTypes: ["minor"],
},
{
labels: ["update-patch"],
matchUpdateTypes: ["patch"],
},
{
labels: ["update-digest"],
matchUpdateTypes: ["digest"],
},
{
// Run the custom matcher on early Monday mornings (UTC)
schedule: "* 0-4 * * 1",
matchPackageNames: ["ghcr.io/renovatebot/renovate"],
},
],
platformCommit: "enabled",
rebaseWhen: "behind-base-branch",
requireConfig: "optional",
vulnerabilityAlerts: {
enabled: true,
},
}
74 changes: 74 additions & 0 deletions .github/workflows/renovate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Renovate
on:
schedule:
- cron: 13 */4 * * *

pull_request:
paths:
- .github/renovate-config.json5
- .github/workflows/renovate.yml
types:
- edited
- opened
- ready_for_review
- synchronize

push:
branches:
- main
paths:
- .github/renovate-config.json5
- .github/workflows/renovate.yml

workflow_dispatch:
inputs:
dry-run:
description: "Run Renovate in dry-run mode"
required: false
default: false
type: boolean

jobs:
renovate:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
sparse-checkout: |
.github/renovate-config.json5
actions/get-vault-secrets

- uses: grafana/shared-workflows/actions/get-vault-secrets@97c6f45f01d4bca8a3b1acfe397113ce88858a81 # get-vault-secrets-v1.0.1
with:
common_secrets: |
GRAFANA_RENOVATE_APP_ID=grafana-renovate-app:app-id
GRAFANA_RENOVATE_PRIVATE_KEY=grafana-renovate-app:private-key

- id: generate-token
uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1
with:
app-id: ${{ env.GRAFANA_RENOVATE_APP_ID }}
private-key: ${{ env.GRAFANA_RENOVATE_PRIVATE_KEY }}

- uses: renovatebot/github-action@f24426972367551f3391720e34317783a92fd32b # v41.0.8
with:
configurationFile: .github/renovate-config.json5
# renovate: datasource=docker depName=ghcr.io/renovatebot/renovate
renovate-version: 39.91.0@sha256:60d04619493d43fe67d728121dfef56b893bf90695219d352e772e881403d158
token: ${{ steps.generate-token.outputs.token }}
env:
LOG_LEVEL: ${{ github.event_name == 'pull_request' && 'debug' || 'info' }}
# On pull requests, use the branch HEAD ref, so you can change things and see the results in the PR workflow run.
# By default, Renovate will clone the main/default branch.
RENOVATE_BASE_BRANCHES: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || null }}
# Dry run if the event is pull_request, or workflow_dispatch AND the dry-run input is true
RENOVATE_DRY_RUN: ${{ (github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry-run == 'true')) && 'full' || null }}
RENOVATE_PLATFORM: github
RENOVATE_REPOSITORIES: ${{ github.repository }}
RENOVATE_USERNAME: GrafanaRenovateBot
Loading