Skip to content

Commit 75d7c91

Browse files
committed
Add success/failure indicators in forks
1 parent e2406c2 commit 75d7c91

1 file changed

Lines changed: 37 additions & 13 deletions

File tree

.github/workflows/competition.yml

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,41 @@ jobs:
1515
runs-on: ubuntu-latest
1616

1717
steps:
18-
- name: Send Dispatch to Central Repo
18+
- name: Trigger Central Evaluation and Wait
19+
env:
20+
# The GitHub CLI uses this token to auth with the central repo
21+
GH_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
1922
run: |
20-
# Notice the URL now ends with /competition.yaml/dispatches
21-
curl -X POST https://api.github.com/repos/utiasDSL/lsy_drone_racing/actions/workflows/competition.yaml/dispatches \
22-
-H "Accept: application/vnd.github.v3+json" \
23-
-H "Authorization: Bearer ${{ secrets.DISPATCH_TOKEN }}" \
24-
-d '{
25-
"ref": "competition",
26-
"inputs": {
27-
"repository": "${{ github.repository }}",
28-
"sha": "${{ github.sha }}",
29-
"actor": "${{ github.actor }}"
30-
}
31-
}'
23+
echo "🚀 Dispatching evaluation to central repository..."
24+
25+
# 1. Trigger the workflow with inputs
26+
gh workflow run competition.yaml \
27+
--repo utiasDSL/lsy_drone_racing \
28+
--ref competition \
29+
-f repository="${{ github.repository }}" \
30+
-f sha="${{ github.sha }}" \
31+
-f actor="${{ github.actor }}"
32+
33+
echo "⏳ Waiting 10 seconds for GitHub to queue the run..."
34+
sleep 10
35+
36+
# 2. Fetch the ID of the run that was just created
37+
RUN_ID=$(gh run list \
38+
--repo utiasDSL/lsy_drone_racing \
39+
--workflow "competition.yaml" \
40+
--json databaseId \
41+
--jq '.[0].databaseId')
42+
43+
if [ -z "$RUN_ID" ]; then
44+
echo "❌ Could not find the central workflow run. Check your DISPATCH_TOKEN permissions."
45+
exit 1
46+
fi
47+
48+
echo "✅ Evaluation started! Watching Run ID: $RUN_ID"
49+
echo "🔗 You can view the live central logs here: https://github.com/utiasDSL/lsy_drone_racing/actions/runs/$RUN_ID"
50+
51+
# 3. Watch the run until it finishes.
52+
# The --exit-status flag ensures that if the central evaluation fails, this student job fails too!
53+
gh run watch $RUN_ID \
54+
--repo utiasDSL/lsy_drone_racing \
55+
--exit-status

0 commit comments

Comments
 (0)