From 62e97d99adcdfee6fd255897d729e3be5a4e7b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3bert=20Papp=20=28TWiStErRob=29?= Date: Sat, 6 Apr 2024 09:45:01 +0100 Subject: [PATCH 1/2] Migrate to JSON5 --- .github/{renovate.json => renovate.json5} | 0 .../workflows/renovate-config-validator.yaml | 31 +++++++++++++------ README.md | 9 +++--- config.js | 9 +++--- default.json => default.json5 | 4 +-- group.json => group.json5 | 30 +++++++++--------- package.json | 1 + 7 files changed, 50 insertions(+), 34 deletions(-) rename .github/{renovate.json => renovate.json5} (100%) rename default.json => default.json5 (94%) rename group.json => group.json5 (90%) diff --git a/.github/renovate.json b/.github/renovate.json5 similarity index 100% rename from .github/renovate.json rename to .github/renovate.json5 diff --git a/.github/workflows/renovate-config-validator.yaml b/.github/workflows/renovate-config-validator.yaml index e4b1c72..ee419e2 100644 --- a/.github/workflows/renovate-config-validator.yaml +++ b/.github/workflows/renovate-config-validator.yaml @@ -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 diff --git a/README.md b/README.md index 48afd9d..cf93f28 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/config.js b/config.js index f9a0139..4cdd021 100644 --- a/config.js +++ b/config.js @@ -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 @@ -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: @@ -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), + }, }; diff --git a/default.json b/default.json5 similarity index 94% rename from default.json rename to default.json5 index 1e53c08..55c3430 100644 --- a/default.json +++ b/default.json5 @@ -1,10 +1,10 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "onboardingConfigFileName": ".github/renovate.json", + "onboardingConfigFileName": ".github/renovate.json5", "extends": [ "config:recommended", ":disableRateLimiting", - "github>TWiStErRob/renovate-config:group/all" + "local>TWiStErRob/renovate-config:group.json5/all" ], "semanticCommits": "disabled", "configMigration": true, diff --git a/group.json b/group.json5 similarity index 90% rename from group.json rename to group.json5 index d1d65d0..06adb41 100644 --- a/group.json +++ b/group.json5 @@ -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": { diff --git a/package.json b/package.json index 043838f..239f8d7 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "renovate": "renovate" }, "devDependencies": { + "json5": "2.2.3", "renovate": "37.0.0" }, "jshintConfig": { From c8d1f271959ab9be4ed8e3ac7bf6b94a1dcfae72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3bert=20Papp=20=28TWiStErRob=29?= Date: Sat, 6 Apr 2024 09:45:37 +0100 Subject: [PATCH 2/2] Add new entry point for JSON to JSON5 upgrade. --- default.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 default.json diff --git a/default.json b/default.json new file mode 100644 index 0000000..640da8a --- /dev/null +++ b/default.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "local>TWiStErRob/renovate-config:default.json5" + ] +}