diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 0000000..b8d2bca --- /dev/null +++ b/.github/workflows/linting.yml @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a883c45 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 diff --git a/.renovaterc.json b/.renovaterc.json new file mode 100644 index 0000000..5c0e418 --- /dev/null +++ b/.renovaterc.json @@ -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": ["pre-commit"] + } + ] +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a803570..933f0c7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# Contributing Guidlines +# Contributing Guidelines First off, thanks for taking the time to contribute! ⭐ diff --git a/renovate/README.md b/renovate/README.md new file mode 100644 index 0000000..4b1288c --- /dev/null +++ b/renovate/README.md @@ -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>paddyroddy/.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 diff --git a/renovate/default-config.json b/renovate/default-config.json new file mode 100644 index 0000000..e13cf95 --- /dev/null +++ b/renovate/default-config.json @@ -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"] + } + ] +}