From d2e4b58ab62ca6dad440b656aed86ab37f5f0471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ya=C4=9F=C4=B1z=20Zengin?= Date: Sun, 21 Jul 2024 22:27:43 +0300 Subject: [PATCH] pmt: Create separate workflow for automatic commit review --- .github/workflows/check_commits.yml | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/check_commits.yml diff --git a/.github/workflows/check_commits.yml b/.github/workflows/check_commits.yml new file mode 100644 index 0000000..f812ab1 --- /dev/null +++ b/.github/workflows/check_commits.yml @@ -0,0 +1,35 @@ +name: Check commit + +on: [push] + +jobs: + check-commit: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Detect commit type + id: check-commit-type + run: | + echo "BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV + COMM_MSG=$(git log -1 --pretty=%B) + if [ "${GITHUB_EVENT_NAME}" == "push" ]; then + if [[ "${COMM_MSG}" == *"initial"* ]]; then + echo "build_and_release=true" >> $GITHUB_ENV + else + echo "build_and_release=false" >> $GITHUB_ENV + fi + elif [ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]; then + echo "build_and_release=true" >> $GITHUB_ENV + fi + + - name: Run release workflow + id: run-rel-workflow + if: env.build_and_release == 'true' + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: 'build.yml' + token: ${{ secrets.PMT_WORKFLOW_GTOKEN }} + ref: ${{ env.BRANCH }}