├── .editorconfig ├── .github ├── semantic.yml └── workflows │ └── build.yml ├── .pre-commit-config.yaml ├── .pre-commit-hooks.yaml ├── .python-version ├── LICENSE ├── README.md ├── package.json ├── renovate.json └── requirements.txt /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true -------------------------------------------------------------------------------- /.github/semantic.yml: -------------------------------------------------------------------------------- 1 | # Semantic Commit bot: https://github.com/zeke/semantic-pull-requests 2 | 3 | # Always validate the PR title, and ignore the commits 4 | titleOnly: true 5 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | push: 8 | branches: 9 | - main 10 | 11 | jobs: 12 | test: 13 | runs-on: ubuntu-latest 14 | 15 | timeout-minutes: 10 16 | 17 | steps: 18 | - name: Checkout repository 19 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 20 | 21 | - name: Set up Python 22 | uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 23 | with: 24 | python-version-file: .python-version 25 | cache: pip 26 | 27 | - name: Install dependencies 28 | run: pip install -r requirements.txt 29 | 30 | - name: Run pre-commit 31 | run: >- 32 | pre-commit try-repo --all-files 33 | --ref="${GITHUB_SHA}" 34 | "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" 35 | 36 | release: 37 | if: ${{ github.ref == 'refs/heads/main' }} 38 | needs: [test] 39 | runs-on: ubuntu-latest 40 | permissions: 41 | contents: write 42 | 43 | timeout-minutes: 10 44 | 45 | steps: 46 | - name: Checkout repository 47 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 48 | 49 | - name: Get Renovate version 50 | id: get-renovate-version 51 | uses: mikefarah/yq@b534aa9ee5d38001fba3cd8fe254a037e4847b37 # v4.45.4 52 | with: 53 | cmd: >- 54 | yq eval 55 | '.[]|select(.id=="renovate-config-validator")|.additional_dependencies[0]|split("@").[1]' 56 | .pre-commit-hooks.yaml 57 | 58 | - name: Create release 59 | run: | 60 | if ! gh release view "${TAG}" >/dev/null; then 61 | gh release create "${TAG}" \ 62 | --notes "See https://github.com/renovatebot/renovate/releases/tag/${TAG} for more changes" \ 63 | --target "${TARGET}" \ 64 | --title "${TAG}" 65 | else 66 | echo 'release already exists' 67 | fi 68 | env: 69 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 70 | TAG: ${{ steps.get-renovate-version.outputs.result }} 71 | TARGET: ${{ github.sha }} 72 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/renovatebot/pre-commit-hooks 3 | rev: 40.36.8 4 | hooks: 5 | - id: renovate-config-validator 6 | -------------------------------------------------------------------------------- /.pre-commit-hooks.yaml: -------------------------------------------------------------------------------- 1 | - id: renovate-config-validator 2 | name: renovate-config-validator 3 | description: Validate Renovate config 4 | language: node 5 | language_version: lts 6 | additional_dependencies: [renovate@40.36.8] 7 | entry: renovate-config-validator 8 | files: '(^|/).?renovate(?:rc)?(?:\.json5?)?$' 9 | -------------------------------------------------------------------------------- /.python-version: -------------------------------------------------------------------------------- 1 | 3.13.3 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Maxime Brunet 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Renovate pre-commit hooks 2 | 3 | A [pre-commit](https://pre-commit.com/) hook to run [`renovate-config-validator`](https://docs.renovatebot.com/config-validation/#config-validation) when you [reconfigure Renovate via PR](https://docs.renovatebot.com/getting-started/installing-onboarding/#reconfigure-via-pr). 4 | 5 | Even though it is a Node-based hook, it works [without any system-level dependencies](https://pre-commit.com/#node). 6 | 7 | ## Usage 8 | 9 | For general usage: 10 | 11 | ```yaml 12 | repos: 13 | - repo: https://github.com/renovatebot/pre-commit-hooks 14 | rev: 40.36.8 15 | hooks: 16 | - id: renovate-config-validator 17 | ``` 18 | 19 | Or for a tighter configuration, 20 | opt into [strict mode](https://docs.renovatebot.com/config-validation/#strict-mode): 21 | 22 | ```yaml 23 | repos: 24 | - repo: https://github.com/renovatebot/pre-commit-hooks 25 | rev: 40.36.8 26 | hooks: 27 | - id: renovate-config-validator 28 | args: [--strict] 29 | ``` 30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy_package", 3 | "version": "0.0.0" 4 | } -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "github>renovatebot/.github" 5 | ], 6 | "assignees": [ 7 | "maxbrunet", 8 | "rarkins", 9 | "viceice" 10 | ], 11 | "automergeType": "pr", 12 | "prCreation": "immediate", 13 | "packageRules": [ 14 | { 15 | "matchPackageNames": [ 16 | "renovate" 17 | ], 18 | "automerge": true, 19 | "separateMinorPatch": false 20 | } 21 | ], 22 | "customManagers": [ 23 | { 24 | "customType": "regex", 25 | "description": "Update Renovate", 26 | "managerFilePatterns": [ 27 | "/^\\.pre-commit-(?:config|hooks)\\.yaml$/", 28 | "/^README\\.md$/" 29 | ], 30 | "matchStrings": [ 31 | "additional_dependencies: \\[renovate@(?.*?)\\]", 32 | "rev: (?.*?)\\s" 33 | ], 34 | "depNameTemplate": "renovate", 35 | "datasourceTemplate": "npm" 36 | } 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pre-commit==4.2.0 2 | --------------------------------------------------------------------------------