diff --git a/.codegen/changelog_config.yml b/.codegen/changelog_config.yml index dc1405693..a35312305 100644 --- a/.codegen/changelog_config.yml +++ b/.codegen/changelog_config.yml @@ -4,7 +4,7 @@ change_types: - message: Bug Fixes tag: "[Fix]" - message: Documentation - tag: "[Docs]" + tag: "[Doc]" - message: Internal Changes tag: "[Internal]" # Default for messages without a tag diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index e01593d13..e534ac5ed 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -40,23 +40,23 @@ jobs: commit-message: runs-on: ubuntu-latest - + if: ${{ github.event_name == 'pull_request' }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Validate Tag run: | - MSG=$(git log --format=%B -n 1 ${{github.event.after}}) - TAG=$(echo MSG | sed 's/\[\(.*\)\].*/\1/') + TAG=$(echo ${{ github.event.pull_request.title }} | sed -ne 's/\[\(.*\)\].*/\1/p') echo "Found tag {$TAG}" - LINE=$(cat .codegen/changelog_config.yml | grep "tag: \"\[$(echo $TAG)\]\"") - VALID=$([ -z "$TAG" ] && echo "False" || echo "True") - echo "::set-env name=VALID_TAG::${TAG}" - - - name: Valid Tag - if: ${{VALID}} != "true" - uses: actions/github-script@v3 - with: - script: | - core.setFailed('Invalid tag name') \ No newline at end of file + # The status code for grep will be 1 if no match, and 0 if a match. + # Store in variable to hide the actual grep result from the console output. + MATCH=$(cat .codegen/changelog_config.yml | grep "tag: \"\[$(echo $TAG)\]\"") + + - name: Log failure + if: failure() + run: | + echo "Invalid or missing tag in commit message" + exit 1 \ No newline at end of file