diff --git a/.github/workflows/message.yml b/.github/workflows/message.yml new file mode 100644 index 00000000..89f60eaf --- /dev/null +++ b/.github/workflows/message.yml @@ -0,0 +1,25 @@ +name: Validate Commit Message + +on: + pull_request: + types: [opened, synchronize, edited] + +jobs: + + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Validate Tag + run: | + TAG=$(echo ${{ github.event.pull_request.title }} | sed -ne 's/\[\(.*\)\].*/\1/p') + if grep -q "tag: \"\[$TAG\]\"" .codegen/changelog_config.yml; then + echo "Valid tag found: [$TAG]" + else + echo "Invalid or missing tag in commit message: [$TAG]" + exit 1 + fi \ No newline at end of file diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 4a245395..08daadc8 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -75,22 +75,4 @@ jobs: run: | # Exit with status code 1 if there are differences (i.e. unformatted files) git diff --exit-code - - commit-message: - runs-on: ubuntu-latest - if: ${{ github.event_name == 'pull_request' }} - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Validate Tag - run: | - TAG=$(echo ${{ github.event.pull_request.title }} | sed -ne 's/\[\(.*\)\].*/\1/p') - if grep -q "tag: \"\[$TAG\]\"" .codegen/changelog_config.yml; then - echo "Valid tag found: [$TAG]" - else - echo "Invalid or missing tag in commit message: [$TAG]" - exit 1 - fi \ No newline at end of file + \ No newline at end of file