Skip to content

Commit

Permalink
Add renovate
Browse files Browse the repository at this point in the history
  • Loading branch information
paddyroddy committed Oct 10, 2023
0 parents commit 48fda0b
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Linting

on:
push:
branches:
- main
- "renovate/**"
pull_request:

jobs:
linting:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4

- name: Cache pre-commit
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Set up python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install dependencies
run: |-
python -m pip install pre-commit
pre-commit install
- name: Run pre-commit
run: pre-commit run --all-files --color always --verbose
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=lf]
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
hooks:
- id: prettier
- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 37.12.1
hooks:
- id: renovate-config-validator
args: [renovate/default-config.json]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
19 changes: 19 additions & 0 deletions .renovaterc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
"schedule:weekdays",
":automergeAll",
":automergeBranch",
":disableDependencyDashboard",
":enablePreCommit"
],
"commitMessageAction": "Renovate:",
"packageRules": [
{
"description": "Shorten commit titles",
"commitMessageTopic": "{{depName}}",
"matchManagers": ["github-actions", "pre-commit"]
}
]
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# .github

Default files for all repositories
47 changes: 47 additions & 0 deletions renovate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Renovate

To enable `Renovate` in a given repository, one must install and enable the
[GitHub application](https://github.com/apps/renovate).
One must then make a `.renovaterc.json` file in the repository, of the following
form.
Note, the two `/` is intentional.

```json
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>UCL-ARC/.github//renovate/default-config.json"]
}
```

## Automerging

To benefit from the automerging capabilities of the default config it is
_highly_ recommended having `required` status checks that run on anything that
`Renovate` updates.
In `GitHub Actions` this can be performed with the following at the top of the
relevant workflows, which will run `Renovate` on pull requests or branches.

```yaml
on:
push:
branches:
- main
- "renovate/**"
pull_request:
```
The following `GitHub` settings are required.

- `Allow auto-merge`

The following branch rules to the base branch are also recommended.

- `Require status checks to pass before merging`
- `Require branches to be up to date before merging`
- List all status checks that should be mandatory here

If the repository requires pull requests, then one must also configure the
following.

- `Allow specified actors to bypass required pull requests`
- Add `renovate` here
21 changes: 21 additions & 0 deletions renovate/default-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
"schedule:weekdays",
":automergeBranch",
":automergeDigest",
":automergeMinor",
":automergePatch",
":disableDependencyDashboard",
":enablePreCommit"
],
"commitMessageAction": "Renovate:",
"packageRules": [
{
"description": "Shorten commit titles",
"commitMessageTopic": "{{depName}}",
"matchManagers": ["bundler", "github-actions", "pre-commit"]
}
]
}

0 comments on commit 48fda0b

Please sign in to comment.