Fix non-existent branch issues on closed PRs edge case#433
Merged
GrantBirki merged 3 commits intomainfrom Nov 26, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a branch existence check to handle edge cases where deployments are attempted on pull requests with deleted branches (e.g., after merge/close). The fix prevents deployments from failing with unclear errors by proactively checking if the branch exists and providing helpful error messages with alternative deployment options.
Key changes:
- Adds branch existence validation before proceeding with deployments
- Implements conditional logic to skip the check for stable branches, SHA deployments, and forks
- Provides clear, actionable error messages when branches are missing
Reviewed changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/functions/prechecks.js | Adds branch existence check with conditional logic to skip for stable branches, SHA deployments, and forks; includes error handling for 404 and unexpected errors |
| dist/index.js | Bundled distribution file reflecting the source changes |
| tests/functions/prechecks.test.js | Comprehensive test coverage for all code paths including success, 404 errors, unexpected errors, and skip conditions |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

resolves: #424