Skip to content

Commit 7155809

Browse files
committed
CI: Extract commit message
1 parent 415ef56 commit 7155809

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

.github/workflows/wheels.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,26 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18+
job_metadata:
19+
runs-on: ubuntu-latest
20+
outputs:
21+
commit_message: ${{ steps.get_commit_message.outputs.commit_message }}
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v3
25+
with:
26+
fetch-depth: 2
27+
- name: Print head git commit message
28+
id: get_commit_message
29+
run: |
30+
if [[ -z "$COMMIT_MSG" ]]; then
31+
COMMIT_MSG=$(git show -s --format=%s $REF)
32+
fi
33+
echo commit_message=$COMMIT_MSG | tee -a $GITHUB_OUTPUT
34+
env:
35+
COMMIT_MSG: ${{ github.event.head_commit.message }}
36+
REF: ${{ github.event.pull_request.head.sha }}
37+
1838
build-sdist:
1939
name: Build sdist
2040
runs-on: ubuntu-latest
@@ -29,8 +49,9 @@ jobs:
2949

3050
build-wheel:
3151
name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }}
52+
needs: [job_metadata]
3253
runs-on: ${{ matrix.buildplat[0] }}
33-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[build wheels]')
54+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') || contains(needs.job_metadata.outputs.commit_message, '[build wheels]')
3455
strategy:
3556
fail-fast: false
3657
matrix:

0 commit comments

Comments
 (0)