Skip to content

Commit 14a8a40

Browse files
committed
add check for queued or in-progress main build
1 parent 17770f9 commit 14a8a40

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

.github/workflows/release-build.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,22 @@ jobs:
2929
uses: actions/checkout@v4
3030

3131
- name: Check main build status
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3234
run: |
3335
WORKFLOW_ID=$(gh api repos/${{ github.repository }}/actions/workflows --jq '.workflows[] | select(.name=="Python Instrumentation Main Build") | .id')
34-
STATUS=$(gh api repos/${{ github.repository }}/actions/workflows/$WORKFLOW_ID/runs --jq '.workflow_runs[] | select(.head_branch=="${{ github.ref_name }}") | .conclusion' | head -1)
35-
if [ "$STATUS" != "success" ]; then
36-
echo "Latest main build on branch ${{ github.ref_name }} status: $STATUS"
36+
LATEST_RUN=$(gh api repos/${{ github.repository }}/actions/workflows/$WORKFLOW_ID/runs --jq '.workflow_runs[] | select(.head_branch=="${{ github.ref_name }}") | {conclusion, status}' | head -1)
37+
STATUS=$(echo "$LATEST_RUN" | jq -r '.status')
38+
CONCLUSION=$(echo "$LATEST_RUN" | jq -r '.conclusion')
39+
40+
if [ "$STATUS" = "in_progress" ] || [ "$STATUS" = "queued" ]; then
41+
echo "Main build is still running (status: $STATUS). Cannot proceed with release."
42+
exit 1
43+
elif [ "$CONCLUSION" != "success" ]; then
44+
echo "Latest main build on branch ${{ github.ref_name }} conclusion: $CONCLUSION"
3745
exit 1
3846
fi
39-
env:
40-
GH_TOKEN: ${{ github.token }}
47+
echo "Main build succeeded, proceeding with release"
4148
4249
- name: Build Wheel and Image Files
4350
uses: ./.github/actions/artifacts_build

0 commit comments

Comments
 (0)