88 workflow_run :
99 workflows : ["Merge Conditions"]
1010 types : [completed]
11+ # PR trigger for testing (remove after validation)
12+ pull_request :
13+ branches : [main]
14+ paths :
15+ - " scripts/autocurrency/agent-fix.py"
16+ - " .github/workflows/agent-currency-fix.yml"
17+ - " docker/vllm/Dockerfile"
1118
1219permissions :
1320 contents : read
2330jobs :
2431 fix-agent :
2532 if : >-
26- github.event.workflow_run.conclusion == 'failure' &&
27- startsWith(github.event.workflow_run.head_branch, 'auto-update/')
33+ github.event_name == 'workflow_dispatch' ||
34+ github.event_name == 'pull_request' || (
35+ github.event.workflow_run.conclusion == 'failure' &&
36+ startsWith(github.event.workflow_run.head_branch, 'auto-update/')
37+ )
2838 runs-on :
2939 - codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}
3040 fleet:default-runner
3141 buildspec-override:true
3242 env :
33- HEAD_BRANCH : ${{ github.event.workflow_run.head_branch }}
34- RUN_ID : ${{ github.event.workflow_run.id }}
35- RUN_URL : ${{ github.event.workflow_run.html_url }}
43+ HEAD_BRANCH : ${{ github.event.workflow_run.head_branch || github.head_ref }}
44+ RUN_ID : ${{ github.event.workflow_run.id || '' }}
45+ RUN_URL : ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
3646 steps :
3747 - name : Validate branch name
3848 run : |
49+ # Skip validation for pull_request testing
50+ if [ "${{ github.event_name }}" = "pull_request" ]; then
51+ echo "Skipping branch validation for PR testing"
52+ exit 0
53+ fi
3954 if [[ ! "$HEAD_BRANCH" =~ ^auto-update/[a-z]+-[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
4055 echo "::error::Branch '${HEAD_BRANCH}' does not match expected pattern."
4156 exit 1
@@ -51,13 +66,27 @@ jobs:
5166 fi
5267 gh --version
5368
69+ # For pull_request testing: wait for PR CI to complete before checking
70+ - name : Wait for CI to complete
71+ if : github.event_name == 'pull_request'
72+ run : |
73+ echo "Waiting 3 minutes for PR CI workflows to complete..."
74+ sleep 180
75+
5476 - name : Find failed tracked workflows
5577 id : failures
5678 env :
5779 GH_TOKEN : ${{ github.token }}
5880 run : |
5981 TRACKED="PR - vLLM EC2|PR - vLLM SageMaker|PR - SGLang EC2|PR - SGLang SageMaker"
60- SHA=$(gh api "/repos/${{ github.repository }}/actions/runs/${RUN_ID}" --jq '.head_sha')
82+
83+ # Get HEAD SHA depending on event type
84+ if [ -n "$RUN_ID" ]; then
85+ SHA=$(gh api "/repos/${{ github.repository }}/actions/runs/${RUN_ID}" --jq '.head_sha')
86+ else
87+ SHA="${{ github.event.pull_request.head.sha || github.sha }}"
88+ fi
89+ echo "SHA: $SHA"
6190
6291 FAILED_RUN_IDS=$(gh api "/repos/${{ github.repository }}/actions/runs?head_sha=${SHA}&status=completed&per_page=50" \
6392 --jq "[.workflow_runs[] | select(.conclusion == \"failure\" and (.name | test(\"${TRACKED}\")))] | .[].id" \
@@ -93,16 +122,19 @@ jobs:
93122 if : steps.failures.outputs.has_failures == 'true'
94123 uses : actions/checkout@v5
95124 with :
96- ref : main
125+ ref : ${{ github.event_name == 'pull_request' && github.head_ref || ' main' }}
97126 fetch-depth : 0
98127 token : ${{ steps.app-token.outputs.token }}
99128
100129 - name : Prepare workspace
101130 if : steps.failures.outputs.has_failures == 'true'
102131 run : |
103132 cp scripts/autocurrency/agent-fix.py /tmp/agent-fix.py
104- git fetch origin "$HEAD_BRANCH"
105- git checkout "origin/$HEAD_BRANCH" -B pr-branch
133+ # For pull_request testing, we're already on the right branch
134+ if [ "${{ github.event_name }}" != "pull_request" ]; then
135+ git fetch origin "$HEAD_BRANCH"
136+ git checkout "origin/$HEAD_BRANCH" -B pr-branch
137+ fi
106138
107139 - name : Count previous attempts
108140 if : steps.failures.outputs.has_failures == 'true'
0 commit comments