From ab9876057697e84276ecc1091b205f5389aecad2 Mon Sep 17 00:00:00 2001 From: Brandon High <759848+highb@users.noreply.github.com> Date: Mon, 11 Dec 2023 13:36:08 -0800 Subject: [PATCH] fix: Default version if no GH, update linter to ensure conventional commit --- .github/workflows/lint.yml | 13 +++++++++++++ lib/utils.bash | 15 ++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6e438d6..7e5a935 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,6 +5,12 @@ on: branches: - main pull_request: + branches: + - main + +permissions: + pull-requests: read + contents: read jobs: shellcheck: @@ -34,3 +40,10 @@ jobs: - name: Run shfmt run: scripts/shfmt.bash + pr-title: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/lib/utils.bash b/lib/utils.bash index 1ff4b12..9a3f4bb 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -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() {