Skip to content

feat: enable auto-merge for dependency update PRs#22

Merged
toshi0806 merged 11 commits into
mainfrom
add-auto-merge-dependency-update
Mar 13, 2026
Merged

feat: enable auto-merge for dependency update PRs#22
toshi0806 merged 11 commits into
mainfrom
add-auto-merge-dependency-update

Conversation

@toshi0806
Copy link
Copy Markdown
Member

Summary

  • dependency-update ワークフローに auto-merge ステップを追加
  • テストとフォーマットチェックが両方成功した場合のみ、PRの auto-merge を有効化
  • peter-evans/create-pull-request の出力からPR番号を取得して gh pr merge --auto --merge を実行

前提条件(設定済み)

  • 各リポジトリで allow_auto_merge を有効化済み
  • 各リポジトリの branch protection に ci / Code Quality を required status check として追加済み

対象リポジトリ

  • tenbin_dns, tdig, tenbin_ex, tenbin_cache, elixir_dnstap

Test plan

  • ワークフローの YAML 構文が正しいことを確認
  • 次回の週次実行(月曜)で auto-merge が動作することを確認
  • テスト失敗時にはPRが残ることを確認

Add an auto-merge step to the dependency-update workflow that
automatically merges the PR when both tests and format checks pass.
Copilot AI review requested due to automatic review settings March 13, 2026 02:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the reusable dependency update workflow to automatically enable auto-merge for the generated dependency-update PR when the workflow’s test and format steps succeed.

Changes:

  • Adds a step id to the PR-creation step so downstream steps can use its outputs.
  • Adds a GitHub CLI step to enable PR auto-merge when tests and formatting pass.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +131 to +135
- name: Enable auto-merge
if: >-
steps.create_pr.outputs.pull-request-number &&
steps.test_run.outcome == 'success' &&
steps.format_check.outcome == 'success'
Comment on lines +131 to +135
- name: Enable auto-merge
if: >-
steps.create_pr.outputs.pull-request-number &&
steps.test_run.outcome == 'success' &&
steps.format_check.outcome == 'success'
Comment on lines +131 to +135
- name: Enable auto-merge
if: >-
steps.create_pr.outputs.pull-request-number &&
steps.test_run.outcome == 'success' &&
steps.format_check.outcome == 'success'
- Add auto-merge input parameter (default: true) for opt-in control
- Add continue-on-error to prevent workflow failure when auto-merge
  is not available on the repository
- Update PR body to reflect auto-merge status instead of misleading
  manual review instructions
@toshi0806
Copy link
Copy Markdown
Member Author

Copilot レビュー対応

3件の指摘に対応しました (b68efff)

1. auto-merge 未対応リポジトリでの失敗防止

  • continue-on-error: true を追加。auto-merge が有効でないリポジトリでもワークフローが失敗しない

2. opt-in 制御

  • auto-merge input パラメータを追加 (default: true)
  • 呼び出し側で auto-merge: false を指定すれば無効化可能

3. PR本文の矛盾解消

  • 「レビューしてマージしてください」のチェックリストを削除
  • auto-merge の状態 (enabled/disabled) を表示するように変更

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds optional auto-merge support to the reusable dependency update workflow so dependency bump PRs can be automatically queued for merging when tests and formatting succeed.

Changes:

  • Introduces a new auto-merge workflow input to control whether auto-merge is attempted.
  • Adds a post-PR-creation step that runs gh pr merge --auto --merge when tests/format pass.
  • Updates the PR body to include an auto-merge status line.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread .github/workflows/dependency-update.yml Outdated
type: number
auto-merge:
description: 'Enable auto-merge when tests and format pass'
default: true
Comment thread .github/workflows/dependency-update.yml Outdated
- [ ] All tests pass
- [ ] No breaking changes in dependencies
- [ ] Security advisories addressed (if any)
- Auto-merge: ${{ inputs.auto-merge && steps.test_run.outcome == 'success' && steps.format_check.outcome == 'success' && 'enabled' || 'disabled (manual review required)' }}
- Change auto-merge default to false (opt-in) to prevent unexpected
  behavior in downstream repos upgrading to this version
- Change PR body text from 'enabled' to 'requested' to reflect that
  auto-merge may not succeed
- Add warning step when auto-merge fails to alert about missing
  repo settings
- Update usage comment with auto-merge example
@toshi0806
Copy link
Copy Markdown
Member Author

Copilot レビュー対応 (2回目)

2件の指摘に対応しました (035e452)

1. auto-merge デフォルトを false に変更 (opt-in 化)

  • default: truedefault: false に変更
  • 下流リポジトリでバージョンアップ時に予期せず自動マージが始まることを防止
  • 有効化するには呼び出し側で auto-merge: true を明示的に指定する必要がある

2. PR本文と実際の状態の不整合を解消

  • PR本文の表示を enabledrequested に変更(リクエストしたが成功保証なし)
  • auto-merge 失敗時に ::warning:: で警告メッセージを出力するステップを追加
  • リポジトリ設定の不足を明確に通知

呼び出し側の対応(マージ後に必要)

各リポジトリの dependency-update.ymlauto-merge: true を追加する必要があります:

jobs:
  dependency-update:
    uses: smkwlab/.github/.github/workflows/dependency-update.yml@v1
    with:
      auto-merge: true
    secrets: inherit

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the reusable “Dependency Update” GitHub Actions workflow to optionally request GitHub auto-merge for dependency update PRs when the workflow’s test and format steps succeed.

Changes:

  • Adds a new auto-merge workflow_call input (default false) and documents its usage.
  • Captures the PR number from peter-evans/create-pull-request and conditionally runs gh pr merge --auto to enable auto-merge.
  • Updates the generated PR body to include an “Auto-merge” status line.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread .github/workflows/dependency-update.yml Outdated
- [ ] All tests pass
- [ ] No breaking changes in dependencies
- [ ] Security advisories addressed (if any)
- Auto-merge: ${{ inputs.auto-merge && steps.test_run.outcome == 'success' && steps.format_check.outcome == 'success' && 'requested' || 'disabled (manual review required)' }}
Comment thread .github/workflows/dependency-update.yml Outdated
Comment on lines +142 to +145
run: |
echo "Enabling auto-merge for PR #${{ steps.create_pr.outputs.pull-request-number }}"
gh pr merge ${{ steps.create_pr.outputs.pull-request-number }} \
--auto --merge


- Distinguish three auto-merge states in PR body: disabled, skipped
  (checks failed), and requested
- Add merge-method input parameter (merge/squash/rebase) to support
  repos with different merge policies
@toshi0806
Copy link
Copy Markdown
Member Author

Copilot レビュー対応 (3回目)

2件の指摘に対応しました (ff12bce)

1. Auto-merge 状態メッセージの改善

PR本文の Auto-merge 表示を3つの状態に分類:

  • disabled — auto-merge input が false
  • skipped (checks failed) — auto-merge 有効だがテスト/フォーマット失敗
  • requested — auto-merge リクエスト済み

2. マージ方式の設定可能化

  • merge-method input パラメータを追加 (default: merge)
  • merge, squash, rebase から選択可能
  • squash-only リポジトリでも動作するように対応

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds optional auto-merge support to the reusable dependency update workflow so dependency bump PRs can be merged automatically when checks pass.

Changes:

  • Introduces auto-merge and merge-method inputs to control auto-merge behavior.
  • Captures the created PR number and runs gh pr merge --auto when tests/format succeed.
  • Updates the generated PR body to include auto-merge status.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread .github/workflows/dependency-update.yml Outdated
Comment on lines +31 to +40
auto-merge:
description: 'Enable auto-merge when tests and format pass (requires allow_auto_merge repo setting)'
default: false
required: false
type: boolean
merge-method:
description: 'Merge method for auto-merge (merge, squash, or rebase)'
default: 'merge'
required: false
type: string
Comment on lines +147 to +151
run: |
echo "Enabling auto-merge for PR #${{ steps.create_pr.outputs.pull-request-number }}"
gh pr merge ${{ steps.create_pr.outputs.pull-request-number }} \
--auto --${{ inputs.merge-method }}

Comment thread .github/workflows/dependency-update.yml Outdated
run: |
echo "Enabling auto-merge for PR #${{ steps.create_pr.outputs.pull-request-number }}"
gh pr merge ${{ steps.create_pr.outputs.pull-request-number }} \
--auto --${{ inputs.merge-method }}
…-branch #22

- Rename auto-merge/merge-method to auto_merge/merge_method to avoid
  hyphen being interpreted as subtraction in GitHub Actions expressions
- Add merge method validation step to whitelist merge/squash/rebase
  and prevent shell injection
- Add --delete-branch flag to gh pr merge to clean up branches after
  auto-merge
@toshi0806
Copy link
Copy Markdown
Member Author

Copilot レビュー対応 (4回目)

3件の指摘に対応しました (7b411c9)

1. ハイフン付きinput名のリネーム

  • auto-mergeauto_mergemerge-methodmerge_method に変更
  • GitHub Actions の式でハイフンが減算演算子と解釈される問題を解消

2. merge method のバリデーション追加

  • validate_merge ステップを追加し、merge/squash/rebase のみ許可
  • 不正な値によるシェルインジェクションを防止
  • バリデーション済みの値を auto_merge ステップで使用

3. --delete-branch フラグの追加

  • gh pr merge--delete-branch を追加
  • auto-merge 後のブランチクリーンアップを保証

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds optional auto-merge support to the reusable dependency update workflow so dependency-update PRs can be automatically merged once tests/format succeed.

Changes:

  • Introduces auto_merge and merge_method inputs for the reusable workflow.
  • Adds merge-method validation and a gh pr merge --auto step to request auto-merge after successful checks.
  • Updates the created PR body to include an “Auto-merge” status line.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +31 to +40
auto_merge:
description: 'Enable auto-merge when tests and format pass (requires allow_auto_merge repo setting)'
default: false
required: false
type: boolean
merge_method:
description: 'Merge method for auto-merge (merge, squash, or rebase)'
default: 'merge'
required: false
type: string
Comment thread .github/workflows/dependency-update.yml Outdated
required: false
type: number
auto_merge:
description: 'Enable auto-merge when tests and format pass (requires allow_auto_merge repo setting)'
Comment thread .github/workflows/dependency-update.yml Outdated
- [ ] All tests pass
- [ ] No breaking changes in dependencies
- [ ] Security advisories addressed (if any)
- Auto-merge: ${{ !inputs.auto_merge && 'disabled' || (steps.test_run.outcome != 'success' || steps.format_check.outcome != 'success') && 'skipped (checks failed)' || 'requested' }}
Comment thread .github/workflows/dependency-update.yml Outdated
- name: Warn if auto-merge failed
if: steps.auto_merge.outcome == 'failure'
run: |
echo "::warning::Auto-merge could not be enabled. Check that 'Allow auto-merge' is enabled in repository settings."
- Add comment explaining why auto_merge/merge_method use snake_case
  (hyphens interpreted as subtraction in if: expressions)
- Fix description to reference actual UI setting name "Allow
  auto-merge" in repo Settings > General
- Change PR body auto-merge status to "pending" instead of
  "requested" to avoid implying success before the step runs
- Add PR comment step to confirm actual auto-merge result (success
  or failure with detailed error output and troubleshooting guide)
- Use env vars instead of direct expression interpolation in shell
  commands for safer execution
@toshi0806
Copy link
Copy Markdown
Member Author

Copilot レビュー対応 (5回目)

4件の指摘に対応しました (0adb13d)

1. snake_case の命名理由を明記

  • ワークフロー内にコメントを追加し、既存の kebab-case input との不統一の理由を説明
  • if: 式でハイフンが減算演算子と解釈されるため snake_case を使用

2. description の表現を修正

  • allow_auto_merge repo setting"Allow auto-merge" in repo Settings > General に変更
  • 実際のGitHub UI設定名と一致させた

3. PR本文の auto-merge 表示を改善

  • requestedpending (will be confirmed by workflow) に変更
  • 実際の auto-merge 結果は後続ステップでPRコメントとして追記

4. 詳細なエラーフィードバック

  • 成功時: PRコメントで確認メッセージ
  • 失敗時: PRコメントで考えられる原因一覧 + gh pr merge のエラー出力を表示
  • env変数経由でシェルコマンドに値を渡すよう改善

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds optional auto-merge support to the reusable dependency update workflow so dependency PRs can be automatically merged when formatting and tests pass.

Changes:

  • Adds auto_merge and merge_method inputs for controlling auto-merge behavior.
  • Captures PR creation output and attempts to enable auto-merge via gh pr merge --auto when checks pass.
  • Updates the generated PR body to include auto-merge status.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread .github/workflows/dependency-update.yml Outdated
Comment on lines +31 to +34
# NOTE: snake_case is intentional for auto_merge and merge_method.
# Hyphens in input names are interpreted as subtraction in GitHub Actions
# `if:` expressions (e.g., inputs.auto-merge → inputs.auto minus merge).
auto_merge:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ steps.create_pr.outputs.pull-request-number }}
MERGE_METHOD: ${{ steps.validate_merge.outputs.method }}
run: |
Comment thread .github/workflows/dependency-update.yml Outdated
Comment on lines +185 to +193
- \"Allow auto-merge\" is not enabled in repository Settings > General
- The merge method (${MERGE_METHOD:-merge}) is not allowed by repository settings
- Insufficient token permissions
- Branch protection rules are blocking auto-merge

**Error output:**
\`\`\`
${ERROR_OUTPUT}
\`\`\`
Comment thread .github/workflows/dependency-update.yml Outdated
Comment on lines +171 to +187
- name: Update PR on auto-merge result
if: steps.auto_merge.outcome == 'success' || steps.auto_merge.outcome == 'failure'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ steps.create_pr.outputs.pull-request-number }}
run: |
if [ "${{ steps.auto_merge.outcome }}" = "success" ]; then
gh pr comment "${PR_NUMBER}" --body "Auto-merge has been enabled successfully."
else
ERROR_OUTPUT=$(cat /tmp/auto-merge-output.txt 2>/dev/null || echo "unknown error")
gh pr comment "${PR_NUMBER}" --body "$(cat <<EOFCOMMENT
⚠️ Auto-merge could not be enabled.

**Possible causes:**
- \"Allow auto-merge\" is not enabled in repository Settings > General
- The merge method (${MERGE_METHOD:-merge}) is not allowed by repository settings
- Insufficient token permissions
- Clarify snake_case comment: explain that kebab-case inputs are safe
  in with:/interpolation contexts, only if: expressions need snake_case
- Add set -o pipefail so gh pr merge failures are not masked by tee
- Replace unquoted heredoc with string concatenation to avoid
  backslash escaping issues in PR comments
- Add MERGE_METHOD env var to the result reporting step
@toshi0806
Copy link
Copy Markdown
Member Author

Copilot レビュー対応 (6回目)

4件の指摘に対応しました (f5a6d21)

1. snake_case コメントの矛盾を解消

  • 既存の kebab-case input (otp-version 等) は with: / ${{ }} 文字列補間で使用されるため安全
  • auto_merge / merge_methodif: 式で使用されるため snake_case が必要
  • この区別をコメントに明記

2. pipefail の追加

  • set -o pipefail を追加し、gh pr merge の失敗が tee で隠されないように修正

3. heredoc エスケープの修正

  • unquoted heredoc 内のバックスラッシュエスケープが文字列にそのまま残る問題を修正
  • 文字列連結方式に変更し、Markdown が正しくレンダリングされるように修正

4. MERGE_METHOD env var の追加

  • "Update PR on auto-merge result" ステップの env に MERGE_METHOD を追加
  • 失敗メッセージで正しいマージ方式が表示されるように修正

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the reusable dependency update workflow by adding optional auto-merge support for the dependency update PRs it creates.

Changes:

  • Add new workflow_call inputs auto_merge and merge_method (snake_case) to control auto-merge behavior.
  • Capture the created PR number and, when enabled and checks pass, attempt to enable GitHub auto-merge via gh pr merge --auto.
  • Update the example usage snippet and PR body to include auto-merge status information.
Comments suppressed due to low confidence (1)

.github/workflows/dependency-update.yml:126

  • Auto-merge may never complete in repositories that rely on PR-required status checks: this workflow creates/updates the PR using secrets.GITHUB_TOKEN, and GitHub does not trigger other workflows from events caused by GITHUB_TOKEN (e.g., the branch push/PR creation). In that case, gh pr merge --auto will remain pending because the required checks never run on the PR. Consider accepting an optional caller-provided PAT (via workflow_call.secrets) and using it for checkout/create-pull-request and GH_TOKEN, or explicitly documenting that auto-merge requires a non-GITHUB_TOKEN token in the calling workflow.
    - name: Create Pull Request
      id: create_pr
      if: steps.check_changes.outputs.changes == 'true'
      uses: peter-evans/create-pull-request@v7
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        commit-message: "chore: update dependencies"
        title: "chore: weekly dependency update"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread .github/workflows/dependency-update.yml Outdated
- [ ] All tests pass
- [ ] No breaking changes in dependencies
- [ ] Security advisories addressed (if any)
- Auto-merge: ${{ !inputs.auto_merge && 'disabled' || (steps.test_run.outcome != 'success' || steps.format_check.outcome != 'success') && 'skipped (checks failed)' || 'pending (will be confirmed by workflow)' }}
- name: Enable auto-merge
id: auto_merge
if: steps.validate_merge.outcome == 'success'
continue-on-error: true
…-error #22

- Move auto-merge status calculation from inline expression to
  dedicated step for readability and maintainability
- Add comment explaining why continue-on-error is intentional:
  PR creation is the primary goal, auto-merge failure is reported
  via PR comment rather than failing the workflow
@toshi0806
Copy link
Copy Markdown
Member Author

Copilot レビュー対応 (7回目)

2件の指摘に対応しました (f4c7cc9)

1. Auto-merge ステータスの式を分離

  • 複雑な &&/|| チェーンを専用ステップ Determine auto-merge status に抽出
  • PR本文では steps.auto_merge_status.outputs.label を参照するだけに簡素化

2. continue-on-error の意図を明記

  • コメントを追加: PR作成が主目的であり、auto-merge の失敗はPRコメントで通知するためワークフロー全体は失敗させない設計意図を明記

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds optional auto-merge support to the reusable dependency update workflow so dependency update PRs can be automatically merged when checks pass.

Changes:

  • Add new workflow_call inputs auto_merge and merge_method to control whether/How dependency update PRs auto-merge.
  • Add steps to validate the merge method, enable GitHub auto-merge via gh pr merge --auto, and comment on the PR with the result.
  • Update the PR body to include an “Auto-merge” status line.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread .github/workflows/dependency-update.yml Outdated
Comment on lines +157 to +160
inputs.auto_merge &&
steps.create_pr.outputs.pull-request-number &&
steps.test_run.outcome == 'success' &&
steps.format_check.outcome == 'success'


- Change steps.create_pr.outputs.pull-request-number to
  steps.create_pr.outputs['pull-request-number'] in all references
- Hyphens in output names are parsed as subtraction in if: expressions
@toshi0806
Copy link
Copy Markdown
Member Author

Copilot レビュー対応 (8回目)

1件の指摘に対応しました (a037175)

1. ハイフン付き output 名のブラケット記法

  • steps.create_pr.outputs.pull-request-number を全箇所で steps.create_pr.outputs['pull-request-number'] に変更
  • if: 式でハイフンが減算演算子として解釈される問題を解消
  • env:${{ }} コンテキストでも統一のためブラケット記法に変更

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds optional auto-merge support to the reusable dependency update workflow so dependency bump PRs can be automatically merged once tests and formatting pass.

Changes:

  • Introduces auto_merge and merge_method inputs for enabling/configuring auto-merge.
  • Adds steps to validate merge method, enable auto-merge via gh, and comment on the PR with the outcome.
  • Updates the PR body to include an “Auto-merge” status line.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +119 to +129
- name: Determine auto-merge status
id: auto_merge_status
if: steps.check_changes.outputs.changes == 'true'
run: |
if [ "${{ inputs.auto_merge }}" != "true" ]; then
echo "label=disabled" >> "$GITHUB_OUTPUT"
elif [ "${{ steps.test_run.outcome }}" != "success" ] || [ "${{ steps.format_check.outcome }}" != "success" ]; then
echo "label=skipped (checks failed)" >> "$GITHUB_OUTPUT"
else
echo "label=pending (will be confirmed by workflow)" >> "$GITHUB_OUTPUT"
fi
Comment thread .github/workflows/dependency-update.yml Outdated
Comment on lines +154 to +160
- name: Validate merge method
id: validate_merge
if: >-
inputs.auto_merge &&
steps.create_pr.outputs['pull-request-number'] &&
steps.test_run.outcome == 'success' &&
steps.format_check.outcome == 'success'
- Move validate_merge step before create_pr so invalid merge_method
  is detected before PR is created
- Add "skipped (invalid merge method)" status to auto_merge_status
- Enable auto-merge step now checks validate_merge.outcome along
  with PR number and test results
@toshi0806
Copy link
Copy Markdown
Member Author

Copilot レビュー対応 (9回目)

2件の指摘に対応しました (c0b08fd)

1. merge_method バリデーションをPR作成前に移動

ステップの実行順序を変更:

  1. Validate merge method — auto_merge が true なら即バリデーション(PR作成前)
  2. Determine auto-merge status — バリデーション結果を含めてステータス決定
  3. Create Pull Request — 正確なステータスをPR本文に記載
  4. Enable auto-merge — 全条件を満たした場合のみ実行

2. 無効な merge_method のステータス表示

  • auto_merge_statusskipped (invalid merge method) ケースを追加
  • 無効な merge_method でも PR 本文は正確な状態を表示

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds optional auto-merge support to the reusable dependency update workflow so that dependency bump PRs can be merged automatically when checks pass.

Changes:

  • Introduces auto_merge and merge_method workflow-call inputs to control auto-merge behavior.
  • Adds steps to validate merge method, surface auto-merge status in the PR body, and enable auto-merge via gh pr merge --auto.
  • Posts a PR comment indicating whether auto-merge was enabled successfully (or why it failed).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +119 to +130
- name: Validate merge method
id: validate_merge
if: inputs.auto_merge
run: |
case "${{ inputs.merge_method }}" in
merge|squash|rebase)
echo "method=${{ inputs.merge_method }}" >> "$GITHUB_OUTPUT"
;;
*)
echo "::error::Invalid merge method: ${{ inputs.merge_method }}. Must be merge, squash, or rebase."
exit 1
;;
Comment thread .github/workflows/dependency-update.yml Outdated
Comment on lines +32 to +35
# These inputs are used in `if:` expressions where hyphens are parsed
# as the subtraction operator (e.g., inputs.auto-merge → inputs.auto minus merge).
# The existing kebab-case inputs (otp-version, etc.) are only used in
# `with:` / `${{ }}` string interpolation contexts where hyphens are safe.


- Add continue-on-error to validate_merge so invalid merge_method
  does not block PR creation
- Simplify snake_case NOTE to avoid misleading claims about where
  kebab-case inputs are used
@toshi0806
Copy link
Copy Markdown
Member Author

Copilot レビュー対応 (10回目)

2件の指摘に対応しました (06699da)

1. validate_merge に continue-on-error 追加

  • 無効な merge_method でもジョブが停止せず、PR作成は続行される
  • auto_merge_status が "skipped (invalid merge method)" を正しく表示
  • Enable auto-merge ステップは validate_merge.outcome == 'success' をチェックするのでスキップされる

2. snake_case NOTE を簡素化

  • kebab-case input の使用箇所に関する不正確な記述を削除
  • if: 式でハイフンが減算演算子になるという理由のみを簡潔に記載

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds opt-in auto-merge support to the reusable dependency update workflow so that dependency update PRs can be automatically merged when tests/format checks succeed.

Changes:

  • Introduces auto_merge (boolean) and merge_method (string) inputs for the reusable workflow.
  • Adds validation and status reporting for auto-merge, surfacing the result in the PR body and via a PR comment on failure.
  • Enables auto-merge via gh pr merge --auto when preconditions are met.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the reusable dependency-update workflow to optionally enable GitHub auto-merge for the generated dependency update PR when checks pass.

Changes:

  • Adds auto_merge and merge_method workflow-call inputs to control auto-merge behavior.
  • Implements merge-method validation and conditional gh pr merge --auto execution.
  • Updates the created PR body to include auto-merge status and posts a follow-up PR comment on auto-merge failure.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +31 to +33
# NOTE: snake_case is intentional for auto_merge and merge_method
# because they are used in `if:` expressions where hyphens would be
# parsed as the subtraction operator.
@toshi0806 toshi0806 merged commit e1566db into main Mar 13, 2026
9 checks passed
@toshi0806 toshi0806 deleted the add-auto-merge-dependency-update branch March 13, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants