Skip to content

fix: 読み取りトークンでのマージ方式取得を修正 - #28

Merged
kazeburo merged 2 commits into
mainfrom
codex/fix-tagpr-merge-method
Oct 8, 2026
Merged

kazeburo merged 2 commits into
mainfrom
codex/fix-tagpr-merge-method

Conversation

@kazeburo

@kazeburo kazeburo commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

User description

修正内容

Dependabot の tagpr 更新がテストを通過しても、No merge method is enabled で停止していました。読み取り専用 GITHUB_TOKEN で取得した REST のリポジトリ情報では allow_* 設定が省略されるため、未取得を無効と判定していました。

マージ方式を GraphQL の mergeCommitAllowed / squashMergeAllowed / rebaseMergeAllowed で取得します。設定を取得できない場合と、すべて無効な場合を区別します。権限追加はありません。マージ処理は引き続き既存Appと検証済みSHAを使用します。

検証

  • ローカル: 27ケース成功、GitHubトークンを必要とする実接続テスト1件はスキップ
  • CIに、読み取り専用 GITHUB_TOKEN で実際にマージ方式を取得するテストを追加(マージAPIはモックのままで、実際のPRは変更しません)
  • RESTレスポンスに設定項目がないケース、squash/rebaseのみ有効なケース、設定未取得、全方式無効を検証

失敗した実行: https://github.com/monitoring-forge/github-common/actions/runs/37790685455/job/113356948389

マージ後は対象Dependabot PRのテストを再実行すると、最新の自動マージワークフローで判定されます。他リポジトリには通常のリリース・同期PR経由で反映します。


PR Type

Bug fix, Tests


Description

  • Query merge settings through read-only GraphQL access.

  • Distinguish missing settings from disabled methods.

  • Test merge selection and live token access.


Diagram Walkthrough

flowchart LR
  A["Successful Dependabot test run"]
  B["Query GraphQL merge settings"]
  C["Validate settings and select method"]
  D["Merge tested SHA"]
  A --> B
  B --> C
  C --> D
Loading

File Walkthrough

Relevant files
Bug fix
dependabot-auto-merge.yml
Select enabled merge methods using GraphQL settings           

.github/workflows/dependabot-auto-merge.yml

  • Replace REST merge settings with GraphQL fields accessible to
    read-only tokens.
  • Reject missing settings separately from explicitly disabled methods.
  • Preserve merge, squash, then rebase preference.
+16/-3   
Configuration changes
test.yml
Enable conditional live merge settings verification           

.github/workflows/test.yml

  • Provide a token for the live settings test only on default-branch
    pushes.
+2/-0     
Tests
dependabot-auto-merge.test.cjs
Cover GraphQL merge selection and token access                     

tests/dependabot-auto-merge.test.cjs

  • Mock GraphQL settings while leaving REST repository settings empty.
  • Cover squash, rebase, missing settings, and disabled methods.
  • Conditionally verify GraphQL access with a live token while mocking
    merges.
+35/-3   

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

(Review updated until commit b239db3)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

Comment thread .github/workflows/test.yml Outdated
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit b239db3

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

No code suggestions found for the PR.

@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

@kazeburo
kazeburo merged commit 64cb400 into main Oct 8, 2026
4 checks passed
@kazeburo
kazeburo deleted the codex/fix-tagpr-merge-method branch October 8, 2026 14:33
@github-actions github-actions Bot mentioned this pull request Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant