diff --git a/.github/workflows/Abc.yml b/.github/workflows/Abc.yml index 104679c..eec0160 100644 --- a/.github/workflows/Abc.yml +++ b/.github/workflows/Abc.yml @@ -1,7 +1,8 @@ name: build and test Backend -on: [push] - +on: + pull_request: + types: [opened, edited, synchronize, reopened] jobs: compliance: @@ -14,9 +15,19 @@ jobs: produce-artifacts: runs-on: ubuntu-latest + steps: - - - name: GitHub-Kontext anzeigen - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" + - name: Show the PR Title + run: echo "The title is ${{ github.event.pull_request.title }}" + - name: Check title prefix + env: + PR_TITLE: ${{ github.event.pull_request.title }} + run: | + # The regex checks for line start (^), followed by keywords, and an optional description format + if [[ "$PR_TITLE" =~ ^(feat|fix|docs)(\(.*\))?: ]]; then + echo "Success: PR title starts with a valid prefix." + else + echo "Error: PR title must start with 'feat:', 'fix:', or 'docs:'." + echo "Current title: $PR_TITLE" + exit 1 + fi