debug git actions #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: [push] | |
jobs: | |
commit_message_validation: | |
name: validate git commit messages | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: '${{ github.event.pull_request.base.ref }}' | |
- name: Execute message validation | |
run: | | |
# Checkout branch | |
git checkout -q ${{ github.event.pull_request.head.ref }} | |
# Set variables | |
BASE_BRANCH=${{ github.event.pull_request.base.ref }} | |
msg_regex='MAT-[0-9]+\s.*' | |
# This list permits some commits | |
commit_static_permit_list="(^Merge pull request \#)|(^Merge branch)|(^Revert \")" | |
# Initialize invalidCommit as false, will be set to true by any invalid commits | |
invalidCommit=false | |
CURRENT_BRANCH=$(git branch | grep ^\* | cut -d "*" -f 2 | cut -d " " -f 2) | |
# Find hash of commit most common ancestor, e.g. where branch began | |
echo $BASE_BRANCH | |
echo $CURRENT_BRANCH | |
BRANCH_MERGE_BASE=$(git merge-base ${BASE_BRANCH} ${CURRENT_BRANCH}) | |
# Find all commits since common ancestor | |
BRANCH_COMMITS=$(git rev-list ${BRANCH_MERGE_BASE}..HEAD) | |
exit 0 |