Skip to content

Commit ec5d715

Browse files
authored
ci(pre-commit): Enable pre-commit CI and renovate (#130)
* ci(pre-commit): Enable pre-commit CI and renovate * fix pre-commit * pre-commit autoupdate
1 parent f8669c9 commit ec5d715

File tree

5 files changed

+31
-26
lines changed

5 files changed

+31
-26
lines changed

.devcontainer/devcontainer.json

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
{
2-
"build": {
3-
// instructs devcontainers to use a Dockerfile
4-
// rather than a pre-defined image
5-
"dockerfile": "Dockerfile"
6-
},
7-
"customizations": {
8-
"vscode": {
9-
"extensions": [
10-
"ms-azuretools.vscode-docker", // docker support
11-
"BazelBuild.vscode-bazel" // bazel support
12-
]
13-
}
14-
},
15-
// sets up pre-commit hooks
16-
"postStartCommand": "pre-commit install"
17-
}
18-
2+
"build": {
3+
// instructs devcontainers to use a Dockerfile
4+
// rather than a pre-defined image
5+
"dockerfile": "Dockerfile"
6+
},
7+
"customizations": {
8+
"vscode": {
9+
"extensions": [
10+
"ms-azuretools.vscode-docker", // docker support
11+
"BazelBuild.vscode-bazel" // bazel support
12+
]
13+
}
14+
},
15+
// sets up pre-commit hooks
16+
"postStartCommand": "pre-commit install"
17+
}

.github/workflows/ci.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ on:
1111
workflow_dispatch:
1212

1313
concurrency:
14-
# Cancel previous actions from the same PR or branch except 'main' branch.
15-
# See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info.
16-
group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'main' && format('::{0}', github.run_id) || ''}}
17-
cancel-in-progress: ${{ github.ref_name != 'main' }}
14+
# Cancel previous actions from the same PR or branch except 'main' branch.
15+
# See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info.
16+
group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'main' && format('::{0}', github.run_id) || ''}}
17+
cancel-in-progress: ${{ github.ref_name != 'main' }}
1818

1919
jobs:
2020
test:
@@ -29,10 +29,15 @@ jobs:
2929
[
3030
{"folder": ".", "bzlmodEnabled": false}
3131
]
32+
pre-commit:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: pre-commit/[email protected]
3237
# For branch protection settings, this job provides a "stable" name that can be used to gate PR merges
3338
# on "all matrix jobs were successful".
3439
conclusion:
35-
needs: test
40+
needs: [test, pre-commit]
3641
runs-on: ubuntu-latest
3742
if: always()
3843
steps:

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ default_language_version:
1414
repos:
1515
# Check formatting and lint for starlark code
1616
- repo: https://github.com/keith/pre-commit-buildifier
17-
rev: 6.1.0.1
17+
rev: 7.3.1.1
1818
hooks:
1919
- id: buildifier
2020
- id: buildifier-lint
2121
# Enforce that commit messages allow for later changelog generation
2222
- repo: https://github.com/commitizen-tools/commitizen
23-
rev: v2.18.0
23+
rev: v4.1.0
2424
hooks:
2525
# Requires that commitizen is already installed
2626
- id: commitizen
2727
stages: [commit-msg]
2828
- repo: https://github.com/pre-commit/mirrors-prettier
29-
rev: "v2.4.0"
29+
rev: v3.1.0
3030
hooks:
3131
- id: prettier

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Optional: if you write tools for your rules to call, you should avoid toolchain
2828
For example, https://github.com/aspect-build/rules_py actions rely on a couple of binaries written in Rust, but we don't want users to be forced to
2929
fetch a working Rust toolchain. Instead we want to ship pre-built binaries on our GH releases, and the ruleset fetches these as toolchains.
3030
See https://blog.aspect.build/releasing-bazel-rulesets-rust for information on how to do this.
31-
Note that users who *do* want to build tools from source should still be able to do so, they just need to register a different toolchain earlier.
31+
Note that users who _do_ want to build tools from source should still be able to do so, they just need to register a different toolchain earlier.
3232

3333
---- SNIP ----
3434

renovate.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
33
"extends": [
44
":dependencyDashboard",
5+
":enablePreCommit",
56
":semanticPrefixFixDepsChoreOthers",
67
"group:monorepos",
78
"group:recommended",

0 commit comments

Comments
 (0)