Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ on:
branches: [main]
pull_request:
branches: [main]
types: [opened, synchronize, reopened, labeled]
merge_group:
workflow_dispatch:
inputs:
ok-to-test:
description: Run e2e tests
type: boolean
default: false

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-${{ github.event.action == 'labeled' }}
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

jobs:
build:
if: github.event.action != 'labeled'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -27,7 +31,6 @@ jobs:
run: make build

verify:
if: github.event.action != 'labeled'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -40,7 +43,6 @@ jobs:
run: make verify

test:
if: github.event.action != 'labeled'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -53,7 +55,6 @@ jobs:
run: make test

test-integration:
if: github.event.action != 'labeled'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -66,7 +67,8 @@ jobs:
run: make test-integration

test-e2e:
if: github.event_name == 'push' || github.event_name == 'merge_group' || contains(github.event.pull_request.labels.*.name, 'ok-to-test')
if: >-
github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'workflow_dispatch' && inputs.ok-to-test) || contains(github.event.pull_request.labels.*.name, 'ok-to-test')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/retest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Retest

on:
issue_comment:
types: [created]

jobs:
retest:
if: >-
github.event.issue.pull_request && contains(github.event.comment.body, '/retest')
runs-on: ubuntu-latest
permissions:
actions: write
pull-requests: read
steps:
- name: Check permission
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PERMISSION=$(gh api "repos/${{ github.repository }}/collaborators/${{ github.event.comment.user.login }}/permission" -q .permission)
if [[ "$PERMISSION" != "admin" && "$PERMISSION" != "write" ]]; then
echo "User ${{ github.event.comment.user.login }} does not have write permission (permission=$PERMISSION)"
exit 1
fi

- name: Trigger CI
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER=${{ github.event.issue.number }}
HEAD_SHA=$(gh pr view "$PR_NUMBER" --json headRefOid -q .headRefOid)
RUN_ID=$(gh run list --workflow=ci.yaml --commit="$HEAD_SHA" --limit=1 --json databaseId -q '.[0].databaseId')

if [ -n "$RUN_ID" ]; then
CONCLUSION=$(gh run view "$RUN_ID" --json conclusion -q .conclusion)
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: When CI is still in-progress, conclusion is empty, so this falls through to dispatch a brand-new parallel CI run. Consider checking for an in-progress run (e.g., status == "in_progress" or empty conclusion) and either skipping the dispatch or informing the user that CI is already running.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/retest.yaml, line 34:

<comment>When CI is still in-progress, `conclusion` is empty, so this falls through to dispatch a brand-new parallel CI run. Consider checking for an in-progress run (e.g., `status == "in_progress"` or empty conclusion) and either skipping the dispatch or informing the user that CI is already running.</comment>

<file context>
@@ -13,16 +13,32 @@ jobs:
-          if [ "$CONCLUSION" = "failure" ]; then
-            gh run rerun "$RUN_ID" --failed
+          if [ -n "$RUN_ID" ]; then
+            CONCLUSION=$(gh run view "$RUN_ID" --json conclusion -q .conclusion)
+            if [ "$CONCLUSION" = "failure" ]; then
+              gh run rerun "$RUN_ID" --failed
</file context>
Suggested change
CONCLUSION=$(gh run view "$RUN_ID" --json conclusion -q .conclusion)
CONCLUSION=$(gh run view "$RUN_ID" --json conclusion -q .conclusion)
STATUS=$(gh run view "$RUN_ID" --json status -q .status)
if [ "$STATUS" = "in_progress" ] || [ "$STATUS" = "queued" ] || [ "$STATUS" = "waiting" ]; then
echo "CI run $RUN_ID is still $STATUS — skipping retest"
exit 0
fi
Fix with Cubic

if [ "$CONCLUSION" = "failure" ]; then
gh run rerun "$RUN_ID" --failed
exit 0
elif [ -z "$CONCLUSION" ]; then
echo "CI is already in progress (run $RUN_ID)"
exit 0
fi
fi

HEAD_REF=$(gh pr view "$PR_NUMBER" --json headRefName -q .headRefName)
OK_TO_TEST=$(gh pr view "$PR_NUMBER" --json labels -q '[.labels[].name] | any(. == "ok-to-test")')
gh workflow run ci.yaml --ref "$HEAD_REF" -f "ok-to-test=$OK_TO_TEST"
Loading