From 88a9aa533991c3ff278640632a31ba1bcd535b2d Mon Sep 17 00:00:00 2001 From: Andreas Holm <60451789+holm10@users.noreply.github.com> Date: Fri, 10 Jan 2025 09:23:21 -0800 Subject: [PATCH] Accesses readarray for macOS using bash --- .github/workflows/wheeltest.yml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wheeltest.yml b/.github/workflows/wheeltest.yml index d56c5979..d3b7b264 100644 --- a/.github/workflows/wheeltest.yml +++ b/.github/workflows/wheeltest.yml @@ -18,7 +18,8 @@ jobs: - name: Checks out repo uses: actions/checkout@v4 - - name: Set tags env variables. + - name: Set UBUNTU tags env variables. + if: matrix.os == 'ubuntu-latest' run: | # Set "checking" variable to false by default. echo "has_tags=false" >> $GITHUB_ENV @@ -34,6 +35,30 @@ jobs: echo "spec_tags=${commit_message[1]}" >> $GITHUB_ENV fi + - name: Set macOS tags env variables. + if: (matrix.os == 'macos-13') || (matrix.os == 'macos-14') + run: | + + # Get updated bash to access readarray + brew install bash + # Switch to bash for readarray + $(brew --prefix bash)/bin/bash + # Set "checking" variable to false by default. + echo "has_tags=false" >> $GITHUB_ENV + # Get your last commit message, not the merge commit. + text=$(git log -1 --no-merges --pretty=%B) + # Read the commit message into an array split by "#". + readarray -d "#" -t commit_message <<< "$text" + # Sanity check. + echo "the tags are: ${commit_message[1]}" + # Add tags and overwrite "checking" variable to true if there are tags. + if [[ "${commit_message[1]}" == *"@"* ]]; then + echo "has_tags=true" >> $GITHUB_ENV + echo "spec_tags=${commit_message[1]}" >> $GITHUB_ENV + fi + # Switch back to zsh + /bin/zsh + - name: Set up macOS-specific paths and libraries if: (matrix.os == 'macos-13') || (matrix.os == 'macos-14') run: |