From 17c7e8598d4f863e5795257f32515f030a0567bd Mon Sep 17 00:00:00 2001
From: Brendan <2bndy5@gmail.com>
Date: Fri, 5 Sep 2025 16:27:13 -0700
Subject: [PATCH 1/8] add: check PR title for correctness
- include spell check config in this repo
- fixed a misspelling
- introduce c-spell pre-commit hook
- include conventional-commit config
---
.github/committed.toml | 20 +++++++++++++++++
.github/workflows/pre-commit.yml | 32 ++++++++++++++++++++++++++++
.github/workflows/snyk-container.yml | 2 +-
.pre-commit-config.yaml | 4 ++++
cspell.config.yml | 25 ++++++++++++++++++++++
profile/README.md | 3 ++-
6 files changed, 84 insertions(+), 2 deletions(-)
create mode 100644 .github/committed.toml
create mode 100644 cspell.config.yml
diff --git a/.github/committed.toml b/.github/committed.toml
new file mode 100644
index 0000000..ae10d05
--- /dev/null
+++ b/.github/committed.toml
@@ -0,0 +1,20 @@
+# https://github.com/crate-ci/committed/blob/master/docs/reference.md
+style = "conventional"
+subject_capitalized = false
+allowed_types = [
+ "fix",
+ "feat",
+ "build",
+ "chore",
+ "docs",
+ "style",
+ "refactor",
+ "remove",
+ "deprecate",
+ "security",
+ "add",
+ "perf",
+ "test",
+]
+subject_length = 0 # unlimited
+line_length = 0 # unlimited
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index 9ad2bd6..06eced8 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -14,6 +14,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5
+ with:
+ persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 #v5
id: python-setup
with:
@@ -27,3 +29,33 @@ jobs:
path: '~/.cache/pre-commit'
key: pre-commit-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
- run: pipx run pre-commit run --show-diff-on-failure --color=always --all-files
+
+ check-pr-title:
+ name: Check PR title
+ if: github.event_name == 'pull_request'
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ steps:
+ # checkout only needed for config files
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ with:
+ persist-credentials: false
+ - run: rustup update --no-self-update
+ - name: Install cargo-binstall
+ uses: cargo-bins/cargo-binstall@2bb61346d075e720d4c3da92f23b6d612d5a7543 # v1.15.3
+ - name: Install committed
+ run: cargo binstall -y committed
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
+ - name: conventional-commit
+ run: >-
+ echo "${{ github.event.pull_request.title }}"
+ | committed --config .github/committed.toml --commit-file -
+ - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
+ with:
+ node-version: latest
+ - name: spell check
+ run: >-
+ echo "${{ github.event.pull_request.title }}"
+ | npx cspell-cli lint stdin
diff --git a/.github/workflows/snyk-container.yml b/.github/workflows/snyk-container.yml
index c93fa87..27f4987 100644
--- a/.github/workflows/snyk-container.yml
+++ b/.github/workflows/snyk-container.yml
@@ -14,7 +14,7 @@ jobs:
env:
# In order to use the Snyk Action you will need to have a Snyk API token.
# More details in https://github.com/snyk/actions#getting-your-snyk-token
- # or you can signup for free at https://snyk.io/login
+ # or you can sign up for free at https://snyk.io/login
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: xianpengshen/clang-tools:all
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 286aa9d..2f06f64 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -8,3 +8,7 @@ repos:
- id: check-yaml
- id: mixed-line-ending
args: ["--fix=lf"]
+ - repo: https://github.com/streetsidesoftware/cspell-cli
+ rev: v9.2.0
+ hooks:
+ - id: cspell
diff --git a/cspell.config.yml b/cspell.config.yml
new file mode 100644
index 0000000..1c32ea5
--- /dev/null
+++ b/cspell.config.yml
@@ -0,0 +1,25 @@
+version: "0.2"
+language: en
+words:
+ - Abril
+ - autobuild
+ - autolabeler
+ - binstall
+ - Fatface
+ - htmlcov
+ - mkdocs
+ - peaceiris
+ - pipx
+ - pypi
+ - rustup
+ - sarif
+ - setuptools
+ - testpypi
+ - venv
+ - xianpengshen
+ignorePaths:
+ - .env/**
+ - .venv/**
+ - env/**
+ - venv/**
+ - .gitignore
diff --git a/profile/README.md b/profile/README.md
index 5554172..3944ff2 100644
--- a/profile/README.md
+++ b/profile/README.md
@@ -1,3 +1,5 @@
+
+
@@ -6,7 +8,6 @@
## Cpp Linter
-
**Automated linting for your C/C++ code**
### Get Started
From 60c3c32ac5936ba3f87cf5362ff05be32136b9b7 Mon Sep 17 00:00:00 2001
From: Brendan <2bndy5@gmail.com>
Date: Fri, 5 Sep 2025 17:38:25 -0700
Subject: [PATCH 2/8] update SHA for pinned actions
---
.github/workflows/pre-commit.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index 06eced8..48c43b2 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -13,10 +13,10 @@ jobs:
run-pre-commit:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 #v5
+ - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
id: python-setup
with:
python-version: '3.x'
@@ -24,7 +24,7 @@ jobs:
if: inputs.commands
run: ${{ inputs.commands }}
- name: Cache pre-commit environments
- uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 #v4
+ uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: '~/.cache/pre-commit'
key: pre-commit-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
From 33dba5b8c8440f69f3b20c25f4608a566785d6c5 Mon Sep 17 00:00:00 2001
From: Brendan <2bndy5@gmail.com>
Date: Fri, 5 Sep 2025 22:45:53 -0700
Subject: [PATCH 3/8] fix path to committed.toml config
---
.github/workflows/pre-commit.yml | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index 48c43b2..87de1ae 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -38,9 +38,18 @@ jobs:
contents: read
steps:
# checkout only needed for config files
- - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ - name: Checkout ${{ github.repository }} repo
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ with:
+ persist-credentials: false
+ path: project-repo
+ - name: Checkout cpp-linter/.github (org) repo
+ # needed for certain config and script files
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
+ repository: cpp-linter/.github
+ path: org-repo
- run: rustup update --no-self-update
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@2bb61346d075e720d4c3da92f23b6d612d5a7543 # v1.15.3
@@ -51,11 +60,12 @@ jobs:
- name: conventional-commit
run: >-
echo "${{ github.event.pull_request.title }}"
- | committed --config .github/committed.toml --commit-file -
+ | committed --config ${{ github.workspace }}/org-repo/.github/committed.toml --commit-file -
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: latest
- name: spell check
+ working-directory: project-repo
run: >-
echo "${{ github.event.pull_request.title }}"
| npx cspell-cli lint stdin
From 9d74a1269c2cf60926bfe93422c416eeb9fdd3fa Mon Sep 17 00:00:00 2001
From: Brendan <2bndy5@gmail.com>
Date: Fri, 5 Sep 2025 23:05:21 -0700
Subject: [PATCH 4/8] pin pre-commit hooks to SHA
Careful review should be paid when using
`pre-commit autoupdate` (which only uses tags).
---
.pre-commit-config.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 2f06f64..f4973db 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v6.0.0
+ rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
@@ -9,6 +9,6 @@ repos:
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/streetsidesoftware/cspell-cli
- rev: v9.2.0
+ rev: 3749de0c02b93bbbe0eae9d7d72da1ecf3c7a2e0 # v9.2.0
hooks:
- id: cspell
From d4d03c121056ffe03a642aea492179e5a9863170 Mon Sep 17 00:00:00 2001
From: Brendan <2bndy5@gmail.com>
Date: Fri, 5 Sep 2025 23:21:04 -0700
Subject: [PATCH 5/8] clarify comments
---
.github/workflows/pre-commit.yml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index 87de1ae..602ff53 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -34,17 +34,19 @@ jobs:
name: Check PR title
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
+ # The calling workflow must grant these permissions.
permissions:
contents: read
steps:
- # checkout only needed for config files
- name: Checkout ${{ github.repository }} repo
+ # needed for cspell.config.yml (project-specific)
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
+ repository: ${{ github.repository }}
path: project-repo
- name: Checkout cpp-linter/.github (org) repo
- # needed for certain config and script files
+ # needed for committed.toml config (org-specific)
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
From f16abb5aeeaadae8c48bcc63a17595451a424165 Mon Sep 17 00:00:00 2001
From: Brendan <2bndy5@gmail.com>
Date: Sat, 6 Sep 2025 00:51:47 -0700
Subject: [PATCH 6/8] checkout repos with same ref as the calling workflow's
ref
have to use org-repo main branch for committed config
---
.github/workflows/pre-commit.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index 602ff53..96c863f 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -44,6 +44,7 @@ jobs:
with:
persist-credentials: false
repository: ${{ github.repository }}
+ ref: ${{ github.sha }}
path: project-repo
- name: Checkout cpp-linter/.github (org) repo
# needed for committed.toml config (org-specific)
From a40d6266f0b210952d9b8b593a944025acbfe9a5 Mon Sep 17 00:00:00 2001
From: Brendan <2bndy5@gmail.com>
Date: Sat, 6 Sep 2025 01:42:03 -0700
Subject: [PATCH 7/8] revert to pre-commit hooks' tags
---
.pre-commit-config.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index f4973db..2f06f64 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0
+ rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
@@ -9,6 +9,6 @@ repos:
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/streetsidesoftware/cspell-cli
- rev: 3749de0c02b93bbbe0eae9d7d72da1ecf3c7a2e0 # v9.2.0
+ rev: v9.2.0
hooks:
- id: cspell
From 219f541747a1652a92656c630e9af39470822ec8 Mon Sep 17 00:00:00 2001
From: Brendan <2bndy5@gmail.com>
Date: Sat, 6 Sep 2025 12:17:28 -0700
Subject: [PATCH 8/8] remove cspell pre-commit hook
considering if there's no other need for node.js installed
---
.pre-commit-config.yaml | 4 ----
1 file changed, 4 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 2f06f64..286aa9d 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -8,7 +8,3 @@ repos:
- id: check-yaml
- id: mixed-line-ending
args: ["--fix=lf"]
- - repo: https://github.com/streetsidesoftware/cspell-cli
- rev: v9.2.0
- hooks:
- - id: cspell