Skip to content

Commit e28b7c4

Browse files
authored
Update check-status.yaml
1 parent bfaabb6 commit e28b7c4

File tree

1 file changed

+12
-39
lines changed

1 file changed

+12
-39
lines changed

.github/workflows/check-status.yaml

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,19 @@ on:
1212
workflow_dispatch:
1313

1414
jobs:
15-
# ... other jobs here
1615

17-
wait-for-external-status:
16+
wait-for-status:
1817
runs-on: ubuntu-latest
19-
needs: [build, test] # list all your previous jobs
20-
if: always() # run even if previous jobs failed (adjust as needed)
18+
needs: [build] # Adjust as needed
19+
if: always() # Optionally run even if previous jobs failed
2120
steps:
22-
- name: Wait for external status "ci/prow/e2e"
23-
env:
24-
DESIRED_CONTEXT: "ci/prow/e2e"
25-
MAX_RETRIES: 30
26-
RETRY_DELAY: 10
27-
COMMIT_SHA: ${{ github.sha }}
28-
REPO: ${{ github.repository }}
29-
TOKEN: ${{ secrets.GITHUB_TOKEN }}
30-
run: |
31-
i=0
32-
statusFound=false
33-
while [ $i -lt $MAX_RETRIES ]; do
34-
echo "Checking statuses for commit $COMMIT_SHA (attempt $((i+1))/$MAX_RETRIES)..."
35-
RESPONSE=$(curl -s -H "Accept: application/vnd.github.v3+json" \
36-
-H "Authorization: token $TOKEN" \
37-
"https://api.github.com/repos/$REPO/commits/$COMMIT_SHA/statuses")
38-
# Use jq to look for our desired context and get its state
39-
STATE=$(echo "$RESPONSE" | jq -r --arg context "$DESIRED_CONTEXT" '.[] | select(.context==$context) | .state' )
40-
if [ -n "$STATE" ] && [ "$STATE" != "pending" ]; then
41-
echo "Found status context '$DESIRED_CONTEXT' with state: $STATE"
42-
statusFound=true
43-
break
44-
else
45-
echo "Status context '$DESIRED_CONTEXT' not found or still pending. Waiting..."
46-
fi
47-
i=$((i+1))
48-
sleep $RETRY_DELAY
49-
done
21+
- name: Wait for external status
22+
uses: developerproductivity/data-ingestion/osci@v1
23+
with:
24+
desired_context: "ci/prow/e2e"
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
max_retries: 30
27+
retry_delay: 10
5028

51-
if [ "$statusFound" = false ]; then
52-
echo "Timeout waiting for status context '$DESIRED_CONTEXT'"
53-
exit 1
54-
fi
55-
56-
- name: Proceed with final steps
57-
run: echo "All statuses are now complete. Continuing with the workflow..."
29+
- name: Display final status
30+
run: echo "External status final state: ${{ steps.wait-for-status.outputs.final_state }}"

0 commit comments

Comments
 (0)