Skip to content

Use push_token for git operations to trigger CI on bot PRs#275

Merged
leggetter merged 2 commits intomainfrom
claude/debug-ci-bot-prs-NeOgH
Mar 23, 2026
Merged

Use push_token for git operations to trigger CI on bot PRs#275
leggetter merged 2 commits intomainfrom
claude/debug-ci-bot-prs-NeOgH

Conversation

@leggetter
Copy link
Collaborator

Summary

Replace the workflow dispatch approach for triggering CI checks with a token-based solution. When a push_token is provided, use it for git push and PR creation operations so GitHub recognizes events from a real user and automatically triggers pull_request workflows.

Key Changes

  • New push_token input: Added optional input parameter that accepts a PAT or GitHub App token for git operations. Falls back to github_token if not provided.
  • Git remote authentication: Configure git remote URL with the push token so push operations are authenticated as the token owner, triggering GitHub workflows normally.
  • PR creation with push_token: Use the push token when creating PRs via the GitHub API, ensuring the PR creation event triggers pull_request workflows.
  • Removed workflow dispatch calls: Deleted the manual workflow_dispatch API calls that previously attempted to trigger the test workflow. This approach is no longer needed when using a proper token.
  • Removed actions: write permission: No longer required since we're not dispatching workflows manually.
  • Updated documentation: Clarified the new approach in README with setup instructions for the optional AUTO_IMPLEMENT_PUSH_TOKEN secret.

Implementation Details

  • The push_token defaults to github_token if not explicitly set, maintaining backward compatibility
  • When push_token is set, both git operations and PR creation use it, ensuring consistent authentication
  • The solution respects GitHub's restriction on GITHUB_TOKEN not triggering pull_request workflows by using a real user token instead
  • Documentation now recommends a classic PAT with repo scope or fine-grained token with contents: write + pull-requests: write

https://claude.ai/code/session_01PHFVduUenioa8nn4NMCabe

claude added 2 commits March 23, 2026 17:30
…er on bot PRs

PRs created with GITHUB_TOKEN don't trigger pull_request workflows (GitHub
restriction). The previous workflow_dispatch workaround ran tests but results
didn't appear as PR checks. Add an optional push_token input (PAT or GitHub
App token) used for git push and PR creation — GitHub sees events from a real
user and triggers all pull_request workflows normally. Remove the
workflow_dispatch workaround and actions:write permission since they're no
longer needed.

https://claude.ai/code/session_01PHFVduUenioa8nn4NMCabe
…, document all token types

Rename secret to include GITHUB in the name for consistency. Document that
push_token accepts personal PATs (classic or fine-grained) and GitHub App
installation tokens.

https://claude.ai/code/session_01PHFVduUenioa8nn4NMCabe
@leggetter leggetter merged commit 65b64e4 into main Mar 23, 2026
11 of 12 checks passed
@leggetter leggetter deleted the claude/debug-ci-bot-prs-NeOgH branch March 23, 2026 18:03
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