Skip to content

Commit 198c0a0

Browse files
authored
project: respect PR labels (#961)
1 parent 2c4dc6a commit 198c0a0

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

.github/workflows/build.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,31 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
jobs:
14+
check-labels:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
skip: ${{ steps.check.outputs.skip }}
18+
19+
steps:
20+
- name: Check PR labels
21+
id: check
22+
run: |
23+
labels=$(jq -r '.pull_request.labels | map(.name) | join(",")' $GITHUB_EVENT_PATH)
24+
if [[ "$labels" == *"[no ci]"* ]]; then
25+
echo "skip=true" >> $GITHUB_OUTPUT
26+
else
27+
echo "skip=false" >> $GITHUB_OUTPUT
28+
fi
29+
if [[ "$labels" == *"don't test"* ]]; then
30+
echo "skip_tests=true" >> $GITHUB_OUTPUT
31+
else
32+
echo "skip_tests=false" >> $GITHUB_OUTPUT
33+
fi
34+
1435
build:
36+
needs: check-labels
37+
if: needs.check-labels.outputs.skip == 'false'
38+
1539
strategy:
1640
matrix:
1741
profile: [ 'jdk17', 'jdk17-aarch64' ]
@@ -49,4 +73,9 @@ jobs:
4973
- name: Build and test with Maven
5074
env:
5175
SKIP_DOCKER_TESTS: "true"
52-
run: ./mvnw -s .github/settings.xml -B clean install -Pgha -Pdocker -Pit -P${{ matrix.profile }}
76+
run: |
77+
if [[ "${{ needs.check-labels.outputs.skip_tests }}" == "true" ]]; then
78+
./mvnw -s .github/settings.xml -B clean install -Pgha -Pdocker -P${{ matrix.profile }} -DskipTests
79+
else
80+
./mvnw -s .github/settings.xml -B clean install -Pgha -Pdocker -Pit -P${{ matrix.profile }}
81+
fi

0 commit comments

Comments
 (0)