Skip to content

Commit

Permalink
Merge pull request #22 from highb/setup-conventional-commits-lint-def…
Browse files Browse the repository at this point in the history
…ault-behavior-if-no-github

fix: Default version if no GH, update linter to ensure conventional commit
  • Loading branch information
highb authored Dec 11, 2023
2 parents 542e475 + d56566d commit 28f3e02
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .cz.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "v$version"
version_scheme = "semver"
version = "1.0.0"
update_changelog_on_bump = true
17 changes: 17 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ on:
branches:
- main
pull_request:
branches:
- main

permissions:
pull-requests: read
contents: read

jobs:
shellcheck:
Expand Down Expand Up @@ -34,3 +40,14 @@ jobs:
- name: Run shfmt
run: scripts/shfmt.bash

commit:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Check out
uses: actions/checkout@v3
with:
token: "${{ secrets.GITHUB_TOKEN }}"
fetch-depth: 0
- name: Lint commits
uses: highb/commitizen-check-action@main
15 changes: 10 additions & 5 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,16 @@ sort_versions() {
}

list_github_tags() {
git ls-remote --tags --refs "$GH_REPO" |
grep -oE 'refs/tags/v[0-9]+.[0-9]+.[0-9]+$' |
cut -d/ -f3- |
sed 's/^v//' |
sort -V
if [ -n "${GITHUB_API_TOKEN:-}" ]; then
git ls-remote --tags --refs "$GH_REPO" |
grep -oE 'refs/tags/v[0-9]+.[0-9]+.[0-9]+$' |
cut -d/ -f3- |
sed 's/^v//' |
sort -V
else
# If we can't use the GitHub API, we'll just hardcode the latest version
echo "14.2.2"
fi
}

list_all_versions() {
Expand Down

0 comments on commit 28f3e02

Please sign in to comment.