Skip to content

Commit

Permalink
feat: add message sanitization in commit module
Browse files Browse the repository at this point in the history
Remove code blocks from the message and strip leading/trailing whitespace to ensure clean commit messages.
This will prevent unnecessary code block formatting from being included in the commit messages.
  • Loading branch information
liblaf committed Jan 17, 2024
1 parent 6fe5fb4 commit 62b3f56
Show file tree
Hide file tree
Showing 6 changed files with 277 additions and 274 deletions.
24 changes: 5 additions & 19 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ name: CI
on:
push:

permissions:
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

Expand Down Expand Up @@ -113,6 +110,8 @@ jobs:

upload:
name: Upload Release Assets
permissions:
contents: write
needs:
- build-pkg
- build-exe
Expand All @@ -123,26 +122,13 @@ jobs:
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Delete Existing Release
run: gh release --repo="${{ github.repository }}" delete dev --cleanup-tag
env:
GH_TOKEN: ${{ github.token }}
continue-on-error: true
- name: Upload Release Assets
run: gh release --repo="${{ github.repository }}" create dev artifacts/**/* --generate-notes --prerelease
- name: Create GitHub Release
run: gh release --repo="${{ github.repository }}" create dev artifacts/* --generate-notes --prerelease
env:
GH_TOKEN: ${{ github.token }}

check:
name: Check
needs:
- test
- build-pkg
- build-exe
if: always()
runs-on: ubuntu-latest
steps:
- name: Check
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
12 changes: 7 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ on:
branches:
- main

permissions:
contents: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Create GitHub Release
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
outputs:
created: ${{ steps.release.outputs.releases_created }}
Expand Down Expand Up @@ -130,6 +129,8 @@ jobs:

upload:
name: Upload Release Assets
permissions:
contents: write
needs:
- release
- build-pkg
Expand All @@ -141,7 +142,8 @@ jobs:
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Upload Release Assets
run: gh release --repo="${{ github.repository }}" upload "${{ needs.release.outputs.tag }}" artifacts/**/* --clobber
run: gh release --repo="${{ github.repository }}" upload "${{ needs.release.outputs.tag }}" artifacts/* --clobber
env:
GH_TOKEN: ${{ github.token }}
3 changes: 3 additions & 0 deletions ai_commit_cli/commit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def check(message: str) -> bool:


def sanitize(message: str) -> str:
message = message.removeprefix("```")
message = message.removesuffix("```")
message = message.strip()
lines: Sequence[str] = [sanitize_line(line) for line in message.splitlines()]
return "\n".join(lines)

Expand Down
33 changes: 0 additions & 33 deletions cspell.config.yaml

This file was deleted.

36 changes: 36 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"words": [
"choco",
"cython",
"dmypy",
"gomod",
"httpx",
"ipynb",
"liblaf",
"mkdocs",
"nointeraction",
"nuitka",
"pybuilder",
"pycache",
"pyflow",
"pyinstaller",
"pypa",
"pypackages",
"pytype",
"tiktoken",
"typer"
],
"ignorePaths": ["*-lock.*", "*.lock", "cspell.json"],
"dictionaries": [
"bash",
"cpp",
"cpp-legacy",
"cpp-refined",
"dotnet",
"makefile",
"npm",
"python",
"python-common"
],
"allowCompoundWords": true
}
Loading

0 comments on commit 62b3f56

Please sign in to comment.