Skip to content

Commit

Permalink
[Internal] Move PR message validation to a separate workflow (#983)
Browse files Browse the repository at this point in the history
## Changes
Move PR message validation to a separate workflow

## Tests
Edit this PR message
  • Loading branch information
hectorcast-db committed Jul 15, 2024
1 parent 00b8067 commit 6253976
Show file tree
Hide file tree
Showing 2 changed files with 26 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
20 changes: 1 addition & 19 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6253976

Please sign in to comment.