commit 2484d9ca71f1289c721846103d9fe5d1fc76fdde Author: Maxime Brunet Date: Tue Jan 25 14:49:24 2022 -0800 feat: Initial commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..53b061a8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true \ No newline at end of file diff --git a/.github/semantic.yml b/.github/semantic.yml new file mode 100644 index 00000000..bb5b6756 --- /dev/null +++ b/.github/semantic.yml @@ -0,0 +1,4 @@ +# Semantic Commit bot: https://github.com/zeke/semantic-pull-requests + +# Always validate the PR title, and ignore the commits +titleOnly: true diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 00000000..22fd180c --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,56 @@ +name: tag + +on: + push: + branches: + - main + +jobs: + tag: + runs-on: ubuntu-latest + permissions: + contents: write + + timeout-minutes: 10 + + steps: + - name: Checkout repository + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.4.0 + with: + fetch-depth: 0 # all tags + + - name: Get Renovate version + id: get-renovate-version + uses: mikefarah/yq@a0ba20866929f62c3fe4f520f34a5f820d27fd37 # renovate: tag=v4.17.2 + with: + cmd: >- + yq eval + '.[]|select(.id=="renovate-config-validator")|.additional_dependencies[0]|split("@").[1]' + .pre-commit-hooks.yaml + + - name: Create tag + run: | + TAG=${{ steps.get-renovate-version.outputs.result }} + if ! git show-ref --tags "${TAG}" --quiet; then + git tag "${TAG}" && git push origin "${TAG}" + fi + + test: + needs: [tag] + runs-on: ubuntu-latest + + timeout-minutes: 10 + + steps: + - name: Checkout repository + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.4.0 + with: + fetch-depth: 2 + + - name: Set up Python + uses: actions/setup-python@f38219332975fe8f9c04cca981d674bf22aea1d3 # renovate: tag=v2.3.1 + + - name: Run pre-commit + uses: pre-commit/action@9b88afc9cd57fd75b655d5c71bd38146d07135fe # renovate: tag=v2.0.3 + with: + extra_args: --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..cba52714 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: + - repo: https://github.com/maxbrunet/renovate-pre-commit-hooks + rev: 31.56.0 + hooks: + - id: renovate-config-validator diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 00000000..8ac217a6 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,7 @@ +- id: renovate-config-validator + name: renovate-config-validator + description: Validate Renovate config + language: node + additional_dependencies: [renovate@31.56.0] + entry: renovate-config-validator + files: '(^|/).?renovate(?:rc)?(?:\.json5?)?$' diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..35177f20 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Maxime Brunet + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..c4510998 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# Renovate pre-commit hooks + +A [pre-commit](https://pre-commit.com/) hook to run `renovate-config-validator` when you [reconfigure Renovate via PR](https://docs.renovatebot.com/getting-started/installing-onboarding/#reconfigure-via-pr). + +Even though it is a Node-based hook, it works [without any system-level dependencies](https://pre-commit.com/#node). + +## Usage + +```yaml +repos: + - repo: github.com/maxbrunet/renovate-pre-commit-hooks + rev: 31.56.0 + hooks: + - id: renovate-config-validator +``` diff --git a/package.json b/package.json new file mode 100644 index 00000000..8db61ee6 --- /dev/null +++ b/package.json @@ -0,0 +1,4 @@ +{ + "name": "dummy_package", + "version": "0.0.0" +} \ No newline at end of file diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..5d4d4871 --- /dev/null +++ b/renovate.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["github>renovatebot/.github"], + "assignees": ["maxbrunet"], + "automergeType": "pr", + "prCreation": "immediate", + "regexManagers": [ + { + "description": "Update Renovate", + "fileMatch": [ + "^\\.pre-commit-(?:config|hooks)\\.yaml$", + "^README\\.md$" + ], + "matchStrings": [ + "additional_dependencies: \\[renovate@(?.*?)\\]", + "rev: (?.*?)\\s" + ], + "depNameTemplate": "renovate", + "datasourceTemplate": "npm" + } + ] +}