Skip to content

fix: auto-merge README-sync PR via GitHub App (master is protected)#166

Merged
da2gl merged 3 commits into
masterfrom
fix/readme-deps-pr-flow
Jun 8, 2026
Merged

fix: auto-merge README-sync PR via GitHub App (master is protected)#166
da2gl merged 3 commits into
masterfrom
fix/readme-deps-pr-flow

Conversation

@da2gl

@da2gl da2gl commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Problem

The merged update-readme-deps workflow pushes the regenerated README directly to master, which branch protection rejects:

remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: - Changes must be made through a pull request.

master also requires an approving review, and GITHUB_TOKEN cannot satisfy that (a bot cannot approve its own PR, and token-based approvals don't count).

Fix

The workflow now uses two identities:

  1. github-actions[bot] (default GITHUB_TOKEN) — regenerates the README, pushes a branch, and opens the PR.
  2. GitHub App (appodeal-dependabot, via APP_ID / APP_PRIVATE_KEY secrets) — approves and squash-merges the PR.

A second identity is mandatory: the PR author can't approve its own PR. The source branch is deleted on merge.

cron / push / manual
  → regenerate README → no diff? stop
  → github-actions[bot] opens PR
  → App token minted → App approves + squash-merges + deletes branch
master updated, zero-touch

Required setup (before this works)

  • Repo secrets: APP_ID, APP_PRIVATE_KEY
  • appodeal-dependabot installed on the repo with Pull requests: write + Contents: write
  • If the master ruleset requires CODEOWNERS approval specifically, add the App to CODEOWNERS

Note

This PR itself needs a one-time human approval to merge (chicken-and-egg). Once merged, subsequent README-sync PRs are approved and merged automatically.

🤖 Generated with Claude Code

da2gl and others added 2 commits June 2, 2026 12:28
Direct push from the workflow is rejected by branch protection
(GH006: changes must be made through a pull request). The job now pushes
a branch, opens a PR, and squash-merges it automatically.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
github-actions[bot] opens the README-sync PR, then a GitHub App
(APP_ID / APP_PRIVATE_KEY secrets) approves and squash-merges it — a second
identity is required because a PR author cannot approve its own PR and
GITHUB_TOKEN approvals do not satisfy branch protection. The source branch
is deleted on merge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@da2gl da2gl enabled auto-merge June 8, 2026 10:35
@da2gl da2gl requested a review from Copilot June 8, 2026 10:35
@da2gl da2gl changed the title fix: README deps workflow uses PR instead of direct push fix: auto-merge README-sync PR via GitHub App (master is protected) Jun 8, 2026

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

Updates the update-readme-deps GitHub Actions workflow to handle protected master by moving README regeneration commits into an auto-managed pull request flow, using a GitHub App identity to provide the required approval/merge capabilities.

Changes:

  • Grants workflow pull-requests: write permission to open PRs.
  • Replaces direct pushes to master with: create branch → commit README → open PR.
  • Mints a GitHub App token to approve and (squash) merge the PR and delete the branch.

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

Comment thread .github/workflows/update-readme-deps.yml Outdated
Comment thread .github/workflows/update-readme-deps.yml
Include github.run_attempt in the branch name; github.run_id alone stays
constant across re-runs of the same run, so a retry would collide with the
already-pushed branch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@da2gl da2gl requested a review from Copilot June 8, 2026 10:41
@da2gl da2gl disabled auto-merge June 8, 2026 10:41

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@da2gl da2gl merged commit 953fa50 into master Jun 8, 2026
1 check passed
@da2gl da2gl deleted the fix/readme-deps-pr-flow branch June 8, 2026 10:43
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.

3 participants