chore: [DRAFT] [Test] Add pre merge action to check commit format #3
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: "Check commit message" | |
on: | |
pull_request: | |
merge_group: | |
jobs: | |
check_commit_message: | |
if: ${{ github.event_name == 'merge_group' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Get commit message | |
id: commit_message | |
run: | | |
COMMIT_MESSAGE=$(git log -1 --pretty=%B) | |
echo "Commit message: $COMMIT_MESSAGE" | |
shell: bash | |
- name: Use the commit message in subsequent steps | |
run: | | |
echo "Commit message in subsequent steps: ${{ steps.commit_message.outputs.COMMIT_MESSAGE }}" | |
- name: Check if commit message is "mirland" | |
id: check_commit | |
run: | | |
if [[ "$COMMIT_MESSAGE" != *"mirland"* ]]; then | |
echo "Commit message is 'mirland'." | |
exit 1 | |
else | |
echo "Error: Commit message is not 'mirland'." | |
echo "::set-output name=status::failure" | |
exit 1 | |
fi | |
shell: bash |