Skip to content

Commit 5f0967b

Browse files
adjust release conditions
1 parent 2051791 commit 5f0967b

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,28 @@ on:
1414
default: false
1515

1616
jobs:
17+
guard:
18+
name: Require green main.yml for this commit
19+
runs-on: ubuntu-latest
20+
permissions:
21+
actions: read
22+
steps:
23+
- name: Check latest main.yml conclusion
24+
env:
25+
GH_TOKEN: ${{ github.token }}
26+
run: |
27+
conclusion=$(gh api \
28+
"repos/${{ github.repository }}/actions/workflows/main.yml/runs?head_sha=${{ github.sha }}&status=completed" \
29+
--jq '.workflow_runs[0].conclusion // "missing"')
30+
echo "main.yml conclusion for ${{ github.sha }}: $conclusion"
31+
if [ "$conclusion" != "success" ]; then
32+
echo "::error::main.yml is not green for ${{ github.sha }} (got: $conclusion). Run publish from a commit on main whose CI passed."
33+
exit 1
34+
fi
35+
1736
publish:
1837
name: Publish to Maven Central
38+
needs: guard
1939
runs-on: ubuntu-latest
2040
environment:
2141
name: maven-central

0 commit comments

Comments
 (0)