Skip to content

ci: npm dependabot PRでCIを確実にスキップするラベルベース判定を追加#369

Closed
ROhta wants to merge 1 commit into
mainfrom
worktree-dependabot-skip-ci
Closed

ci: npm dependabot PRでCIを確実にスキップするラベルベース判定を追加#369
ROhta wants to merge 1 commit into
mainfrom
worktree-dependabot-skip-ci

Conversation

@ROhta

@ROhta ROhta commented May 23, 2026

Copy link
Copy Markdown
Owner

期待する挙動・状態

  • npm dependabot のPR (タイトル先頭 [skip ci]) で Dependency Check workflow を確実にスキップ
  • github-actions dependabot のPR (タイトル先頭 check ci status) は従来通り CI 実行

必要な依存関係

  • なし(ワークフロー設定のみ)

確認済み項目

見てほしいところ

  • PRのLabelsの設定は適切か
  • ラベル skip-ci を skip 判定のキーにする設計でよいか(代替案: dependencies ラベルや actor 判定など)
  • Dependency Review は npm 依存の脆弱性スキャンが目的だが、 npm dependabot PR で skip するトレードオフを許容するか

背景

GitHub Actions の [skip ci]push および pull_request イベントで動作するとされているが、 公式ドキュメントは どの pull_request types で効くか を明示していない。 特にコミット push を伴わない review_requested / ready_for_review / reopened などの特殊 types ではコミュニティで挙動が不安定と報告されている。

このリポジトリの dependency-review.yml は trigger types を [review_requested, reopened, ready_for_review] に限定しており、 該当 types で何らかの操作(手動レビュアー指定など)が発生した場合に [skip ci] が効かない可能性がある。

変更内容

ファイル 変更
.github/dependabot.yml npm エコシステムの labelsskip-ci を追加
.github/workflows/dependency-review.yml Dependency-Review / Build-Check 各ジョブに if: !contains(github.event.pull_request.labels.*.name, 'skip-ci') を追加

検証で判明した既存挙動

  • Deploy pages (push: main) : npm [skip ci] PR のマージコミットに対する workflow runs を確認したところ実行されていない → GitHub の自動 [skip ci]既に正常スキップ済み(本PRでは触らない)
  • Dependency Check (pull_request) : 過去 30 件の workflow runs において npm dependabot PR で起動した形跡なし(trigger types が opened を含まないため通常は発火しない)

つまり今回の修正は観測された不具合への直接修正ではなく defense-in-depth の保険。

関連

  • 外部ツール (CodeQL / DeepScan / Snyk) は GitHub Actions の [skip ci] の管轄外。 これらを止めたい場合は各サービス側の設定が必要。

GitHubの`[skip ci]`はコミットpushを伴わないpull_requestイベント
(review_requested, ready_for_review, reopened)では公式に挙動が明示
されておらず、何らかの操作でDependency Checkが起動した場合に効か
ない可能性がある。

ラベルベースのジョブレベルif条件で確実にスキップする保険を追加。

- dependabot.yml: npmエコシステムに`skip-ci`ラベルを自動付与
- dependency-review.yml: 各ジョブで`skip-ci`ラベル時にスキップ

github-actions dependabot (check ci statusプレフィックス) は
`skip-ci`ラベルを付けないため影響なし。CIは従来通り実行される。
Copilot AI review requested due to automatic review settings May 23, 2026 01:52
@ROhta

ROhta commented May 23, 2026

Copy link
Copy Markdown
Owner Author

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

npm Dependabot の PR で [skip ci] が pull_request の特定 types(review_requested / reopened / ready_for_review)で効かない可能性に備え、ラベルベースで Dependency Check ワークフローを確実にスキップできるようにする変更です。

Changes:

  • npm dependabot の PR に skip-ci ラベルが付与されるよう Dependabot 設定を更新
  • Dependency Check workflow の各ジョブに skip-ci ラベル有無によるスキップ条件を追加

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/dependency-review.yml PR ラベルに応じて Dependency-Review / Build-Check ジョブをスキップする条件を追加
.github/dependabot.yml npm ecosystem の Dependabot PR に skip-ci ラベルを付与する設定を追加
Comments suppressed due to low confidence (1)

.github/workflows/dependency-review.yml:22

  • 課題: skip-ci ラベルが付与されると、Dependabot 以外の PR でもこのジョブが無条件に skipped になり、ビルド検証を意図せず回避できてしまいます。

対策案: skip-ci に加えて PR 作成者が Dependabot であること(例: github.event.pull_request.user.logindependabot[bot])や、PR タイトルの prefix([skip ci])なども併せて判定し、一般の PR ではラベルだけでスキップできないようにしてください。

  Build-Check:
    if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
    runs-on: ubuntu-latest

Comment on lines 8 to 10
Dependency-Review:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
runs-on: ubuntu-latest
@ROhta ROhta added the enhance-2 新機能 後方互換性を切らない変更・機能追加 label May 23, 2026
@ROhta

ROhta commented May 23, 2026

Copy link
Copy Markdown
Owner Author

方針変更: dependabot のPRでもCIを全て走らせたいため、本修正は破棄します。代わりに [skip ci] プレフィックス自体を削除する別PRを作成します。

@ROhta ROhta closed this May 23, 2026
ROhta added a commit that referenced this pull request May 23, 2026
## 期待する挙動・状態

- npm dependabot のPR でも、 すべての CI / 外部ツールを通常通り実行する
- コミットメッセージは dependabot デフォルト (例: \`Bump xxx from 1.0.0 to 1.1.0\`)

## 必要な依存関係

- なし

## 確認済み項目

- [x] github-actions エコシステムの \`check ci status\` プレフィックスは維持 (CI実行の意図のため)
- [x] \`labels: [\"dependencies\"]\` は維持 (両エコシステム共通)
- [x] PR #369 (label-based skip-ci 判定) は破棄済み

## 見てほしいところ

- [ ] PRのLabelsの設定は適切か
- [ ] github-actions の \`check ci status\` プレフィックスも統一(削除)するか、 現状維持か
- [ ] dependabot がデフォルトのコミットメッセージで動作することを次回 dependabot 起動時 (npm: daily
10:00 JST) に確認

## 背景

`[skip ci]` プレフィックスでCIをスキップする方針から、 **dependabot のPRでもCIを全て走らせる** 方針に転換。
理由:

- GitHub Actions の `[skip ci]` は `pull_request` の特殊 types
(`review_requested` / `ready_for_review` / `reopened`)
における挙動が公式に明示されておらず信頼性に欠ける
- 外部ツール (CodeQL / DeepScan / Snyk) は GitHub Actions の管轄外で `[skip ci]`
の影響を受けない
- 部分的にしかスキップできないなら、 一貫してすべて実行する方が混乱がない

## 変更内容

| ファイル | 変更 |
|---|---|
| `.github/dependabot.yml` | npm エコシステムの `commit-message` セクション (prefix
`[skip ci]` + include scope) を削除 |

github-actions エコシステムは既存のコミット履歴 (`check ci status(deps): bump ...`)
との連続性のため変更なし。
@ROhta
ROhta deleted the worktree-dependabot-skip-ci branch July 5, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhance-2 新機能 後方互換性を切らない変更・機能追加

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants