Skip to content

Commit

Permalink
Move PR message validation to a separate workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorcast-db committed Jul 16, 2024
1 parent f970829 commit f0466bd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/message.yml
Original file line number Diff line number Diff line change
@@ -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
19 changes: 0 additions & 19 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,3 @@ 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

0 comments on commit f0466bd

Please sign in to comment.