From f3c2d63d6676bcff77ceabf4e65e053d2691064b Mon Sep 17 00:00:00 2001 From: "Eshan Roy (Eshanized)" <148610067+eshanized@users.noreply.github.com> Date: Tue, 30 Apr 2024 15:19:17 +0530 Subject: [PATCH] Create commitizen.yml --- .github/workflows/commitizen.yml | 55 ++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/commitizen.yml diff --git a/.github/workflows/commitizen.yml b/.github/workflows/commitizen.yml new file mode 100644 index 0000000..820c59a --- /dev/null +++ b/.github/workflows/commitizen.yml @@ -0,0 +1,55 @@ +name: Check Commitizen + +on: + push: + branches: + - '*' + pull_request: + types: [opened, synchronize] + +jobs: + check-commitizen: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/$DEFAULT_BRANCH' || github.event_name == 'pull_request' + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Install commitizen + run: | + sudo apt-get update + sudo apt-get install -y python3-pip + pip3 install --user commitizen + + - name: Run commitizen check + run: | + cz check --message "$MESSAGE" >/tmp/cz_check || true + grep "successful" /tmp/cz_check + + tag-to-release: + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Install commitizen + run: | + sudo apt-get update + sudo apt-get install -y git python3-pip + pip3 install --user commitizen + + - name: Clone repository + run: git clone ${{ github.repository }} + + - name: Move to project directory + run: cd $(basename ${{ github.repository }}) + + - name: Determine changelog + run: | + CHANGELOG=$(cz changelog ${{ github.ref }} --dry-run | sed /^Invalid/d) + echo "::set-env name=CHANGELOG::$CHANGELOG" + + - name: Create release + run: | + release-cli create --name ${{ github.ref }} --description "${{ env.CHANGELOG }}" --tag-name ${{ github.ref }}