• Will Chen's avatar
    Add workflow to cancel CI runs after PR merge (#2315) · 909a00b0
    Will Chen 提交于
    #skip-bb
    
    ## Summary
    This PR adds a new GitHub Actions workflow that automatically cancels
    in-progress and queued CI workflow runs when a pull request is merged.
    This helps reduce unnecessary CI resource consumption and prevents stale
    workflow runs from completing after their changes have already been
    integrated.
    
    ## Changes
    - Added `.github/workflows/cancel-ci-after-merge.yml` workflow that:
      - Triggers when a pull request is closed (merged)
      - Finds the CI workflow in the repository
    - Queries for all in-progress and queued CI runs on the merged PR's
    branch
      - Cancels each identified workflow run with error handling and logging
      - Includes comprehensive console logging for debugging and monitoring
    
    ## Implementation Details
    - The workflow uses `actions/github-script@v7` to interact with the
    GitHub Actions API
    - It specifically targets the "CI" workflow by name
    - Handles both "in_progress" and "queued" statuses to catch all active
    runs
    - Includes try-catch error handling to gracefully handle cancellation
    failures
    - Requires `actions: write` permission to cancel workflow runs
    - Only executes when `github.event.pull_request.merged == true` to avoid
    running on rejected PRs
    
    
    <!-- This is an auto-generated description by cubic. -->
    ---
    ## Summary by cubic
    Automatically cancel active CI runs for the merged PR’s head commit.
    Frees up runners and prevents stale builds from finishing.
    
    - **New Features**
    - Adds .github/workflows/cancel-ci-after-merge.yml triggered on PR
    closed, gated to merged PRs.
    - Targets the CI workflow via file path ci.yml and lists runs for the PR
    head SHA.
    - Cancels active runs (in_progress, queued, pending, waiting) with
    try/catch error handling and de-duplicates by run ID.
    - Supports fork and non-fork PRs; uses actions/github-script@v7 with
    actions: write permissions and clear console logs.
    
    <sup>Written for commit 4d631b3ccb9d127c4781b185b9d6eac90d2fd710.
    Summary will update on new commits.</sup>
    
    <!-- End of auto-generated description by cubic. -->
    
    ---------
    Co-authored-by: 's avatarClaude <noreply@anthropic.com>
    909a00b0
名称
最后提交
最后更新
.claude 正在载入提交数据...
.cursor/rules 正在载入提交数据...
.devcontainer 正在载入提交数据...
.github 正在载入提交数据...
.husky 正在载入提交数据...
assets 正在载入提交数据...
docs 正在载入提交数据...
drizzle 正在载入提交数据...
e2e-tests 正在载入提交数据...
makers 正在载入提交数据...
packages/@dyad-sh 正在载入提交数据...
scaffold 正在载入提交数据...
scripts 正在载入提交数据...
shared 正在载入提交数据...
src 正在载入提交数据...
testing 正在载入提交数据...
tools 正在载入提交数据...
worker 正在载入提交数据...
workers/tsc 正在载入提交数据...
.cursorignore 正在载入提交数据...
.env.example 正在载入提交数据...
.eslintrc.json 正在载入提交数据...
.gitattributes 正在载入提交数据...
.gitignore 正在载入提交数据...
.oxlintrc.json 正在载入提交数据...
.prettierignore 正在载入提交数据...
.prettierrc 正在载入提交数据...
AGENTS.md 正在载入提交数据...
CLA.md 正在载入提交数据...
CLAUDE.md 正在载入提交数据...
CONTRIBUTING.md 正在载入提交数据...
LICENSE 正在载入提交数据...
README.md 正在载入提交数据...
SECURITY.md 正在载入提交数据...
biome.json 正在载入提交数据...
components.json 正在载入提交数据...
drizzle.config.ts 正在载入提交数据...
forge.config.ts 正在载入提交数据...
forge.env.d.ts 正在载入提交数据...
index.html 正在载入提交数据...
lint-staged.config.js 正在载入提交数据...
merge.config.ts 正在载入提交数据...
package-lock.json 正在载入提交数据...
package.json 正在载入提交数据...
playwright.config.ts 正在载入提交数据...
tsconfig.app.json 正在载入提交数据...
tsconfig.json 正在载入提交数据...
tsconfig.node.json 正在载入提交数据...
vite.main.config.mts 正在载入提交数据...
vite.preload.config.mts 正在载入提交数据...
vite.renderer.config.mts 正在载入提交数据...
vite.worker.config.mts 正在载入提交数据...
vitest.config.ts 正在载入提交数据...