Repository navigation
fix(repo-maintenance): Quality Gate 必須チェックの fallback ワークフローを配布対象に追加 #721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # Quality Gate Fallback | ||
| # | ||
| # Required Status Check "Quality Gate" を必ず報告するための fallback ワークフロー。 | ||
| # | ||
| # 必要な背景: | ||
| # - setup-team-protection.sh はブランチ保護に "Quality Gate" を必須チェックとして登録する | ||
| # - ci.yml の Quality Gate ジョブが paths フィルタでスキップされた場合や、 | ||
| # ci.yml 自体が存在しない / 走らない場合、PR は永遠に | ||
| # "Expected — Waiting for status to be reported" のまま blocked になる | ||
| # - この fallback は ci.yml の実行可否をチェックし、走っていなければ Pass を emit する | ||
| # | ||
| # 動作: | ||
| # - ci.yml が走っている / 成功している場合 → 何もしない (本体の Quality Gate が優先) | ||
| # - ci.yml が走っていない場合 → Pass で Quality Gate を emit | ||
| # | ||
| # 使い方: | ||
| # .github/workflows/quality-gate-fallback.yml にコピーして配置 | ||
| # setup-team-protection.sh で "Quality Gate" を必須チェックに設定する場合は必須 | ||
| # | ||
| # 既知の制限: | ||
| # - GITHUB_TOKEN で push されたコミット (claude[bot] / dependabot[bot] が | ||
| # GITHUB_TOKEN で押した場合など) では `pull_request` イベントが発火しないため、 | ||
| # この fallback も実行されない。その場合は別途 PAT 経由の push か | ||
| # workflow_dispatch / repository_dispatch での再トリガーが必要。 | ||
| # | ||
| name: CI Fallback | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main, master, pre-production, production] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }}-fallback | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| quality-gate: | ||
| name: Quality Gate | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 2 | ||
| steps: | ||
| - name: Check if CI workflow ran | ||
| id: check | ||
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 | ||
| with: | ||
| script: | | ||
| const { data: runs } = await github.rest.actions.listWorkflowRunsForRepo({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| head_sha: context.sha, | ||
| per_page: 20, | ||
| }); | ||
|
|
||
| const ciRun = runs.workflow_runs.find( | ||
| r => r.name === 'CI' && r.id !== context.runId | ||
| ); | ||
|
|
||
| if (ciRun && ciRun.status !== 'completed') { | ||
| core.info(`CI workflow is running (${ciRun.html_url}), this fallback is not needed.`); | ||
| core.setOutput('ci_running', 'true'); | ||
| } else if (ciRun && ciRun.conclusion === 'success') { | ||
| core.info(`CI workflow already succeeded (${ciRun.html_url}).`); | ||
| core.setOutput('ci_running', 'true'); | ||
| } else { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This logic marks Useful? React with 👍 / 👎. |
||
| core.info('CI workflow did not run for this commit. Providing fallback Quality Gate.'); | ||
| core.setOutput('ci_running', 'false'); | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| - name: Pass (CI skipped) | ||
| if: steps.check.outputs.ci_running == 'false' | ||
| run: echo "Quality Gate passed (CI skipped — no code changes detected or workflow disabled)." | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: keito4/config
Length of output: 96
🏁 Script executed:
Repository: keito4/config
Length of output: 1008
🏁 Script executed:
Repository: keito4/config
Length of output: 2593
🏁 Script executed:
Repository: keito4/config
Length of output: 39
🏁 Script executed:
Repository: keito4/config
Length of output: 2308
🏁 Script executed:
Repository: keito4/config
Length of output: 5022
🏁 Script executed:
Repository: keito4/config
Length of output: 1259
🏁 Script executed:
Repository: keito4/config
Length of output: 39
Hardcoding
maincreates inconsistency with multi-branch protection logic.The Quality Gate check only inspects
branches/main, but the script'sPROTECT_BRANCHESlogic supportsmain,pre-production, andproductionfor Next.js projects. When Quality Gate is registered as required onpre-productionorproduction, the hardcoded check misses them, incorrectly determining no fallback is needed and allowing the PR to block on "Expected — Waiting for status to be reported."Dynamic branch detection is needed to align with the protection scope.
🤖 Prompt for AI Agents