You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[plan] Fix push_to_pull_request_branch conclusion handler to run git ops in target repo directory #28374
Fix actions/setup/js/push_to_pull_request_branch.cjs (conclusion handler) to run all git operations (fetch, checkout, apply, push) in the target repo's checkout directory instead of the workspace root.
Context
Issue #21306: The conclusion handler already resolves the target repo slug but then runs git fetch, git checkout, git apply, and git push with no cwd, so they all run in the job's default working directory (workspace root) instead of the subdirectory where the target repo is checked out.
Approach
Add require('./find_repo_checkout.cjs') at the top of the file
After resolving itemRepo (the target repo slug) and before any git commands:
If itemRepo differs from process.env.GITHUB_REPOSITORY, call findRepoCheckout(itemRepo, process.env.GITHUB_WORKSPACE, { allowedRepos }). If not found, return { success: false, error: "Repository 'org/repo' not found in workspace..." }.
Set repoCwd = checkoutResult.path
Pass { cwd: repoCwd, env: { ...process.env, ...gitAuthEnv } } to every exec.exec call for git (fetch, checkout, apply, push)
Prefer explicit cwd per exec call over process.chdir to avoid global state side effects
Files to Modify
actions/setup/js/push_to_pull_request_branch.cjs — main push/apply git block
Acceptance Criteria
findRepoCheckout is imported and called when target repo differs from GITHUB_REPOSITORY
All git commands receive { cwd: repoCwd } option
getGitAuthEnv is still applied for fetch/push operations
Clear error returned if target repo not found in workspace
Activity
fix: pass repoCwd to all git ops in push_to_pull_request_branch concl…