forked from OpenHands/software-agent-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (52 loc) · 2.03 KB
/
Copy pathcancel-eval.yml
File metadata and controls
63 lines (52 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
name: Cancel Eval
run-name: Cancel Eval (${{ inputs.run_id }})
on:
workflow_dispatch:
inputs:
run_id:
description: Workflow run ID to cancel
required: true
type: string
reason:
description: Reason for cancellation
required: false
type: string
env:
EVAL_REPO: OpenHands/evaluation
EVAL_WORKFLOW: kill-eval-job.yml
permissions:
contents: read
jobs:
cancel-eval:
runs-on: ubuntu-latest
steps:
- name: Cancel evaluation job
env:
DISPATCH_TOKEN: ${{ secrets.OPENHANDS_BOT_GITHUB_PAT_EVAL_DISPATCH }}
RUN_ID: ${{ github.event.inputs.run_id }}
REASON: ${{ github.event.inputs.reason }}
run: |-
set -euo pipefail
if [ -z "$DISPATCH_TOKEN" ]; then
echo "Missing dispatch token" >&2
exit 1
fi
echo "Canceling evaluation workflow run: $RUN_ID"
# Dispatch kill workflow in evaluation repo
PAYLOAD=$(jq -n \
--arg ref "main" \
--arg run_id "$RUN_ID" \
--arg reason "$REASON" \
'{ref: $ref, inputs: {run_id: $run_id, reason: $reason}}')
RESPONSE=$(curl -sS -o /tmp/dispatch.out -w "%{http_code}" -X POST \
-H "Authorization: token $DISPATCH_TOKEN" \
-H "Accept: application/vnd.github+json" \
-d "$PAYLOAD" \
"https://api.github.com/repos/${EVAL_REPO}/actions/workflows/${EVAL_WORKFLOW}/dispatches")
if [ "$RESPONSE" != "204" ]; then
echo "Dispatch failed (status $RESPONSE):" >&2
cat /tmp/dispatch.out >&2
exit 1
fi
echo "Cancellation dispatched successfully for run: $RUN_ID"