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

JSON 5 #26

Merged
merged 2 commits into from
Apr 6, 2024
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
File renamed without changes.
31 changes: 22 additions & 9 deletions .github/workflows/renovate-config-validator.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,41 @@
name: Validate Renovate Config
name: "Validate Renovate Config"

on:
push
push:

jobs:
config:
strategy:
fail-fast: false
matrix:
include:

- name: Own Config
config-files: .github/renovate.json
- name: "Own Config"
config-files: .github/renovate.json5

- name: Shared Config
config-files: default.json # group.json is not possible yet
- name: "Shared Config"
config-files: default.json

name: 🔍 ${{ matrix.name }}
- name: "Shared Config (Actual)"
config-files: default.json5

# Not possible yet: "Configuration Error: Invalid configuration option: all".
#- name: "Group Presets"
# config-files: group.json5

name: "🔍 ${{ matrix.name }}"
timeout-minutes: 2
permissions:
# actions/checkout
contents: read
runs-on: ubuntu-latest
steps:

- name: Checkout ${{ github.ref }} branch in ${{ github.repository }} repository.
- name: "Checkout ${{ github.ref }} branch in ${{ github.repository }} repository."
uses: actions/checkout@v4

- name: Run renovate-config-validator on shared config.
- name: "Run renovate-config-validator on shared config."
shell: bash
run: >
npx
--yes
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
Configuration files for renovatebot installed in [repositories](https://github.com/TWiStErRob?tab=repositories).

## Naming
Note: this repository is called `renovate-config` so it'll be [picked up automatically by Renovate](https://docs.renovatebot.com/config-presets/#organization-level-presets).
* This repository is called `renovate-config` so it'll be [picked up automatically by Renovate](https://docs.renovatebot.com/config-presets/#organization-level-presets).
* The shared config preset is called `default.json` as that's the [only supported name](https://docs.renovatebot.com/config-presets/).
* `default.json5` is the actual preset referenced from `default.json`, so that I can use JSON5 features.

# Installation
1. Add repository to [Renovate GitHub app installation](https://github.com/settings/installations/24636554).
2. Wait for "Configure Renovate" onboarding PR.
3. It should automatically pick up [local>TWiStErRob/renovate-config](default.json)
4. Move `/renovate.json` to `/.github/renovate.json`.
5. Commit and push to `renovate/configure` branch.
6. Review, configure as necessary and merge PR.
4. Commit and push to `renovate/configure` branch.
5. Review, configure as necessary and merge PR.

# Development
IntelliJ IDEA has json-schema validation and auto-complete support, so it the recommended editor.
Expand Down
9 changes: 5 additions & 4 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require('fs');
const configFilePath = "P:\\projects\\workspace\\net.twisterrob.gradle\\.github\\renovate.json";
const JSON5 = require('json5');
const configFilePath = "P:\\projects\\contrib\\github-twisterrob-renovate\\.github\\renovate.json5";
const configFileText = fs.readFileSync(configFilePath, "utf8");
module.exports = {
// https://docs.renovatebot.com/self-hosted-configuration/#dryrun
Expand Down Expand Up @@ -27,7 +28,7 @@ module.exports = {
// Command line: last parameter in form of user/repo
// https://docs.renovatebot.com/self-hosted-configuration/#repositories
"repositories": [
{"repository": "TWiStErRob/net.twisterrob.gradle"},
{ "repository": "TWiStErRob/renovate-config" },
],

// Reduce noise:
Expand All @@ -54,6 +55,6 @@ module.exports = {
// rather than from the loaded JSON. REPORT this sounds like a bug.
"force": {
// This loads a local file instead.
...JSON.parse(configFileText)
}
...JSON5.parse(configFileText),
},
};
63 changes: 2 additions & 61 deletions default.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"onboardingConfigFileName": ".github/renovate.json",
"extends": [
"config:recommended",
":disableRateLimiting",
"github>TWiStErRob/renovate-config:group/all"
],
"semanticCommits": "disabled",
"configMigration": true,
"commitMessageExtra": "from {{{currentValue}}} to {{{newValue}}}{{#if isMajor}} (major v{{{newMajor}}}){{else}}{{/if}}",
"labels": ["in:dependencies"],
"separateMajorMinor": true,
"separateMultipleMajor": true,
"separateMinorPatch": true,
"minimumReleaseAge": "8 hours",
"internalChecksFilter": "strict",
"ignorePaths": [
"do-not-ignore-anything"
],
"packageRules": [
{
"description": "Auto-merge all small changes, except for unstable versions.",
"matchUpdateTypes": ["minor", "patch"],
"matchCurrentVersion": "!/^0/",
"automerge": true
},
{
"description": "Auto-merge all updates of specific dependencies, their 0.x versions are stable and well-controlled.",
"matchUpdateTypes": ["minor", "patch"],
"matchCurrentVersion": "/^0/",
"matchPackageNames": [
"org.gradle.toolchains.foojay-resolver-convention"
],
"automerge": true
},
{
"description": "Auto-merge all digest updates, TODO why?",
"matchUpdateTypes": ["digest"],
"automerge": true
},
{
"description": "Wait for npm dependencies, they often have small patch releases in quick succession.",
"matchDatasources": ["npm"],
"minimumReleaseAge": "3 days"
},
{
"description": "Merge my packages as soon as possible.",
"matchPackagePrefixes": ["net.twisterrob"],
"minimumReleaseAge": "0 minutes"
},
{
"description": "Pin my reusable workflows, semver might not be true.",
"matchDepTypes": ["action"],
"matchPackageNames": [
"TWiStErRob/github-workflows"
],
"pinDigests": true
}
],
"gradle-wrapper": {
"description": "Update Gradle wrapper to non-stable versions",
"ignoreUnstable": false
}
"local>TWiStErRob/renovate-config:default.json5"
]
}
65 changes: 65 additions & 0 deletions default.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"onboardingConfigFileName": ".github/renovate.json5",
"extends": [
"config:recommended",
":disableRateLimiting",
"local>TWiStErRob/renovate-config:group.json5/all"
],
"semanticCommits": "disabled",
"configMigration": true,
"commitMessageExtra": "from {{{currentValue}}} to {{{newValue}}}{{#if isMajor}} (major v{{{newMajor}}}){{else}}{{/if}}",
"labels": ["in:dependencies"],
"separateMajorMinor": true,
"separateMultipleMajor": true,
"separateMinorPatch": true,
"minimumReleaseAge": "8 hours",
"internalChecksFilter": "strict",
"ignorePaths": [
"do-not-ignore-anything"
],
"packageRules": [
{
"description": "Auto-merge all small changes, except for unstable versions.",
"matchUpdateTypes": ["minor", "patch"],
"matchCurrentVersion": "!/^0/",
"automerge": true
},
{
"description": "Auto-merge all updates of specific dependencies, their 0.x versions are stable and well-controlled.",
"matchUpdateTypes": ["minor", "patch"],
"matchCurrentVersion": "/^0/",
"matchPackageNames": [
"org.gradle.toolchains.foojay-resolver-convention"
],
"automerge": true
},
{
"description": "Auto-merge all digest updates, TODO why?",
"matchUpdateTypes": ["digest"],
"automerge": true
},
{
"description": "Wait for npm dependencies, they often have small patch releases in quick succession.",
"matchDatasources": ["npm"],
"minimumReleaseAge": "3 days"
},
{
"description": "Merge my packages as soon as possible.",
"matchPackagePrefixes": ["net.twisterrob"],
"minimumReleaseAge": "0 minutes"
},
{
"description": "Pin my reusable workflows, semver might not be true.",
"matchDepTypes": ["action"],
"matchPackageNames": [
"TWiStErRob/github-workflows"
],
"pinDigests": true
}
],
"gradle-wrapper": {
"description": "Update Gradle wrapper to non-stable versions",
"ignoreUnstable": false
}
}
30 changes: 15 additions & 15 deletions group.json → group.json5
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
"extends": [
"group:monorepos",
"group:recommended",
"github>TWiStErRob/renovate-config:group/twisterrob-gradle",
"github>TWiStErRob/renovate-config:group/github-artifacts",
"github>TWiStErRob/renovate-config:group/github-pages",
"github>TWiStErRob/renovate-config:group/kotlin",
"github>TWiStErRob/renovate-config:group/ktor",
"github>TWiStErRob/renovate-config:group/detekt",
"github>TWiStErRob/renovate-config:group/agp",
"github>TWiStErRob/renovate-config:group/agp-lint",
"github>TWiStErRob/renovate-config:group/androidx",
"github>TWiStErRob/renovate-config:group/androidx-test",
"github>TWiStErRob/renovate-config:group/mockito",
"github>TWiStErRob/renovate-config:group/neo4j",
"github>TWiStErRob/renovate-config:group/log4j2",
"github>TWiStErRob/renovate-config:group/jackson",
"github>TWiStErRob/renovate-config:group/notion"
"local>TWiStErRob/renovate-config:group.json5/twisterrob-gradle",
"local>TWiStErRob/renovate-config:group.json5/github-artifacts",
"local>TWiStErRob/renovate-config:group.json5/github-pages",
"local>TWiStErRob/renovate-config:group.json5/kotlin",
"local>TWiStErRob/renovate-config:group.json5/ktor",
"local>TWiStErRob/renovate-config:group.json5/detekt",
"local>TWiStErRob/renovate-config:group.json5/agp",
"local>TWiStErRob/renovate-config:group.json5/agp-lint",
"local>TWiStErRob/renovate-config:group.json5/androidx",
"local>TWiStErRob/renovate-config:group.json5/androidx-test",
"local>TWiStErRob/renovate-config:group.json5/mockito",
"local>TWiStErRob/renovate-config:group.json5/neo4j",
"local>TWiStErRob/renovate-config:group.json5/log4j2",
"local>TWiStErRob/renovate-config:group.json5/jackson",
"local>TWiStErRob/renovate-config:group.json5/notion"
]
},
"twisterrob-gradle": {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"renovate": "renovate"
},
"devDependencies": {
"json5": "2.2.3",
"renovate": "37.0.0"
},
"jshintConfig": {
Expand Down