Skip to content

Commit 5fa1b12

Browse files
committed
explicitly sort workflows by time
1 parent 812750c commit 5fa1b12

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/workflows/release-build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ 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=="NodeJS Instrumentation Main Build") | .id')
34-
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)
36+
LATEST_RUN=$(gh api repos/${{ github.repository }}/actions/workflows/$WORKFLOW_ID/runs --jq '[.workflow_runs[] | select(.head_branch=="${{ github.ref_name }}")] | sort_by(.created_at) | reverse | .[0] | {conclusion, status}')
3537
STATUS=$(echo "$LATEST_RUN" | jq -r '.status')
3638
CONCLUSION=$(echo "$LATEST_RUN" | jq -r '.conclusion')
3739
@@ -43,8 +45,6 @@ jobs:
4345
exit 1
4446
fi
4547
echo "Main build succeeded, proceeding with release"
46-
env:
47-
GH_TOKEN: ${{ github.token }}
4848
4949
- name: Build Tarball and Image Files
5050
uses: ./.github/actions/artifacts_build

0 commit comments

Comments
 (0)