another test #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: React on each commit expect with prefix | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Getting the sources" | |
uses: actions/checkout@v4 | |
- name: Check for prefix in commit messages | |
id: check_prefix | |
run: | | |
set -e # Enable exit on error | |
trap 'echo "An error occurred. Handling it."; exit 0' ERR | |
PREFIX="prefix" | |
git log --format=%B -n 1 $GITHUB_SHA | grep -q "^$PREFIX" | |
echo "prefix_found=0" >> $GITHUB_OUTPUT | |
if git log --format=%B -n 1 $GITHUB_SHA | grep -q "^$PREFIX"; then | |
echo "prefix_found=1" >> $GITHUB_OUTPUT | |
else | |
echo "prefix_found=0" >> $GITHUB_OUTPUT | |
fi | |
- name: Build and Test | |
if: steps.check_prefix.outputs.prefix_found == '1' | |
run: | | |
echo "work!" |