Skip to content

Commit 5355310

Browse files
committed
Add linting to the CI with protolint for API projects
This uses an action that will add comments to the PR diff with any linting issues found. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent e1943d5 commit 5355310

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
## New Features
1212

13-
<!-- Here goes the main new features and examples or instructions on how to use them -->
13+
* cookiecutter: Add linting to the CI with `protolint` for API projects.
1414

1515
## Bug Fixes
1616

cookiecutter/{{cookiecutter.github_repo_name}}/.github/workflows/ci.yaml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,30 @@ env:
2323
# but sadly `env` can't be used either in `runs-on`.
2424

2525
jobs:
26+
{% if cookiecutter.type == "api" -%}
27+
protolint:
28+
runs-on: ubuntu-20.04
29+
30+
steps:
31+
- name: Fetch sources
32+
uses: actions/checkout@v3
33+
with:
34+
submodules: true
35+
36+
- name: Run protolint
37+
# Only use hashes here, as we are passing the github token, we want to
38+
# make sure updates are done conciously to avoid security issues if the
39+
# action repo gets hacked
40+
uses: yoheimuta/action-protolint@e94cc01b1ad085ed9427098442f66f2519c723eb # v1.0.0
41+
with:
42+
fail_on_error: true
43+
filter_mode: nofilter
44+
github_token: {{'${{ secrets.github_token }}'}}
45+
protolint_flags: proto/
46+
protolint_version: "0.45.0"
47+
reporter: github-check
48+
49+
{% endif -%}
2650
nox:
2751
name: Test with nox
2852
strategy:
@@ -121,7 +145,7 @@ jobs:
121145

122146
publish-docs:
123147
name: Publish documentation website to GitHub pages
124-
needs: ["nox", "build"]
148+
needs: ["nox", "build"{{', "protolint"' if cookiecutter.type == "api"}}]
125149
if: github.event_name == 'push'
126150
runs-on: ubuntu-20.04
127151
permissions:

0 commit comments

Comments
 (0)