Skip to content

Commit 724d561

Browse files
authored
add: check PR title for correctness (#49)
- include spell check config in this repo - fixed a misspelling - include conventional-commit config
1 parent 87bc257 commit 724d561

File tree

5 files changed

+96
-5
lines changed

5 files changed

+96
-5
lines changed

.github/committed.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# https://github.com/crate-ci/committed/blob/master/docs/reference.md
2+
style = "conventional"
3+
subject_capitalized = false
4+
allowed_types = [
5+
"fix",
6+
"feat",
7+
"build",
8+
"chore",
9+
"docs",
10+
"style",
11+
"refactor",
12+
"remove",
13+
"deprecate",
14+
"security",
15+
"add",
16+
"perf",
17+
"test",
18+
]
19+
subject_length = 0 # unlimited
20+
line_length = 0 # unlimited

.github/workflows/pre-commit.yml

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,62 @@ jobs:
1313
run-pre-commit:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5
17-
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 #v5
16+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
17+
with:
18+
persist-credentials: false
19+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
1820
id: python-setup
1921
with:
2022
python-version: '3.x'
2123
- name: Run commands
2224
if: inputs.commands
2325
run: ${{ inputs.commands }}
2426
- name: Cache pre-commit environments
25-
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 #v4
27+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
2628
with:
2729
path: '~/.cache/pre-commit'
2830
key: pre-commit-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
2931
- run: pipx run pre-commit run --show-diff-on-failure --color=always --all-files
32+
33+
check-pr-title:
34+
name: Check PR title
35+
if: github.event_name == 'pull_request'
36+
runs-on: ubuntu-latest
37+
# The calling workflow must grant these permissions.
38+
permissions:
39+
contents: read
40+
steps:
41+
- name: Checkout ${{ github.repository }} repo
42+
# needed for cspell.config.yml (project-specific)
43+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
44+
with:
45+
persist-credentials: false
46+
repository: ${{ github.repository }}
47+
ref: ${{ github.sha }}
48+
path: project-repo
49+
- name: Checkout cpp-linter/.github (org) repo
50+
# needed for committed.toml config (org-specific)
51+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
52+
with:
53+
persist-credentials: false
54+
repository: cpp-linter/.github
55+
path: org-repo
56+
- run: rustup update --no-self-update
57+
- name: Install cargo-binstall
58+
uses: cargo-bins/cargo-binstall@2bb61346d075e720d4c3da92f23b6d612d5a7543 # v1.15.3
59+
- name: Install committed
60+
run: cargo binstall -y committed
61+
env:
62+
GITHUB_TOKEN: ${{ github.token }}
63+
- name: conventional-commit
64+
run: >-
65+
echo "${{ github.event.pull_request.title }}"
66+
| committed --config ${{ github.workspace }}/org-repo/.github/committed.toml --commit-file -
67+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
68+
with:
69+
node-version: latest
70+
- name: spell check
71+
working-directory: project-repo
72+
run: >-
73+
echo "${{ github.event.pull_request.title }}"
74+
| npx cspell-cli lint stdin

.github/workflows/snyk-container.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
env:
1515
# In order to use the Snyk Action you will need to have a Snyk API token.
1616
# More details in https://github.com/snyk/actions#getting-your-snyk-token
17-
# or you can signup for free at https://snyk.io/login
17+
# or you can sign up for free at https://snyk.io/login
1818
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
1919
with:
2020
image: xianpengshen/clang-tools:all

cspell.config.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: "0.2"
2+
language: en
3+
words:
4+
- Abril
5+
- autobuild
6+
- autolabeler
7+
- binstall
8+
- Fatface
9+
- htmlcov
10+
- mkdocs
11+
- peaceiris
12+
- pipx
13+
- pypi
14+
- rustup
15+
- sarif
16+
- setuptools
17+
- testpypi
18+
- venv
19+
- xianpengshen
20+
ignorePaths:
21+
- .env/**
22+
- .venv/**
23+
- env/**
24+
- venv/**
25+
- .gitignore

profile/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<!-- markdownlint-disable MD036 MD041 MD033 -->
2+
13
<p align="center">
24
<img src="/assets/readme-banner-small.png" width="512" height="141" alt="cpp-linter_brand_logo" />
35
</p>
@@ -6,7 +8,6 @@
68

79
## Cpp Linter
810

9-
<!-- markdownlint-disable MD036 -->
1011
**Automated linting for your C/C++ code**
1112

1213
### Get Started

0 commit comments

Comments
 (0)