Skip to content

Commit 1ad66ee

Browse files
Add ruletype for Renovate GitHub Action
Co-Authored-By: Philippe Moore <mesembria@users.noreply.github.com>
1 parent 1dc6e7e commit 1ad66ee

File tree

4 files changed

+92
-0
lines changed

4 files changed

+92
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
tests:
2+
- name: "Should have Renovate enabled"
3+
def: {}
4+
params: {}
5+
expect: "pass"
6+
git:
7+
repo_base: github_action_with_renovate
8+
- name: "Should not have Renovate enabled"
9+
def: {}
10+
params: {}
11+
expect: "fail"
12+
git:
13+
repo_base: github_action_without_renovate
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Renovate
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
# Run every 15 minutes
6+
- cron: '0/15 * * * *'
7+
jobs:
8+
renovate:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4.2.2
13+
- name: Self-hosted Renovate
14+
uses: renovatebot/github-action@v41.0.6
15+
with:
16+
token: ${{ secrets.RENOVATE_TOKEN }}
17+
configurationFile: renovate/renovate-config.json
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Just Checkout
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
# Run every 15 minutes
6+
- cron: '0/15 * * * *'
7+
jobs:
8+
renovate:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4.2.2
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
version: v1
3+
release_phase: alpha
4+
type: rule-type
5+
name: renovate_github_action
6+
display_name: Enable Renovate for automated dependency updates
7+
short_failure_message: Renovate is not configured via a GitHub action
8+
severity:
9+
value: medium
10+
context: {}
11+
description: |
12+
Verifies that Renovate is configured via a GitHub action for the repository.
13+
guidance: |
14+
Ensure that Renovate is configured and enabled for the repository.
15+
16+
Renovate enables automated dependency updates for repositories.
17+
It is recommended that repositories have some form of automated
18+
dependency updates enabled to ensure that vulnerabilities are not
19+
introduced into the codebase.
20+
21+
For more information, see the [GitHub Action Renovate](https://github.com/renovatebot/github-action) documentation.
22+
def:
23+
in_entity: repository
24+
rule_schema:
25+
type: object
26+
properties: {}
27+
ingest:
28+
type: git
29+
git: {}
30+
eval:
31+
type: rego
32+
rego:
33+
type: deny-by-default
34+
def: |
35+
package minder
36+
37+
import rego.v1
38+
39+
actions := github_workflow.ls_actions("./.github/workflows")
40+
41+
default message := "Renovate GitHub action is not configured"
42+
default allow := false
43+
allow if {
44+
# check that there is a renovate action
45+
"renovatebot/github-action" in actions
46+
}
47+
# Defines the configuration for alerting on the rule
48+
alert:
49+
type: security_advisory
50+
security_advisory: {}

0 commit comments

Comments
 (0)