fix: Handle remote prune failures gracefully (#4295)
Wrap the git remote prune command in a try-catch block to prevent the action from failing if the prune operation fails. Instead, log a warning message and allow the action to continue. Fixes edge cases where the prune command may fail on self-hosted runners but shouldn't block the pull request creation workflow.
This commit is contained in:
7
dist/index.js
vendored
7
dist/index.js
vendored
@@ -458,7 +458,12 @@ function createPullRequest(inputs) {
|
||||
// deleted after being merged or closed. Without this the push using
|
||||
// '--force-with-lease' fails due to "stale info."
|
||||
// https://github.com/peter-evans/create-pull-request/issues/633
|
||||
yield git.exec(['remote', 'prune', branchRemoteName]);
|
||||
try {
|
||||
yield git.exec(['remote', 'prune', branchRemoteName]);
|
||||
}
|
||||
catch (error) {
|
||||
core.warning(`Failed to prune remote '${branchRemoteName}': ${error.message}`);
|
||||
}
|
||||
}
|
||||
core.endGroup();
|
||||
// Apply the branch suffix if set
|
||||
|
||||
Reference in New Issue
Block a user