Skip to content

fix(github): Guard against missing release #567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 10, 2025
Merged

Conversation

mydea
Copy link
Member

@mydea mydea commented Nov 22, 2024

Fixes #503 (comment)

Note: We already have a test covering that getLatestRelease() accepts undefined.

@mydea mydea self-assigned this Nov 22, 2024
repo: this.githubConfig.repo,
})
).data;
} catch {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blanket catch here may mask other potential issues such as authentication or temporary server unavailability. I feel like we should filter these.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what would you filter here? To me it sounds reasonable to fall back to assume it is the latest release if something goes wrong here 🤔 But if you want to exclude something specific, we can of course do that, open for concrete suggestions (not really easy to test/try this...)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not assume lack of a release on a 401 or 500 response. I'd even say unless we get a 200 with an explicit null in it, we should not assume anything?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you mean we should fail the whole release if we do not get a 200 here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes as otherwise you create an incomplete release or worse, mark a hotfix release as latest accidentally.

If you think this behavior should be optional, we should revise the flow and make this an explicit user choice or make a breaking release.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finally got around to give this another go. I adjusted it to only "swallow" 404 errors, which occur when no release exists. all other errors are rethrown!

Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://github.com/getsentry/craft/pull/567/files#r1899608188

In it's current form this patch creates inconsistent behavior on server related issues.

@mydea mydea force-pushed the fn/fix-github-no-releases branch from 35eef2a to ac2964b Compare January 10, 2025 09:37
@mydea mydea requested a review from BYK January 10, 2025 09:37
mydea added a commit that referenced this pull request Jan 10, 2025
Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Co-authored-by: Burak Yigit Kaya <[email protected]>
@mydea mydea merged commit cf6e2d4 into master Jan 10, 2025
11 checks passed
@mydea mydea deleted the fn/fix-github-no-releases branch January 10, 2025 10:16
mydea added a commit that referenced this pull request Jan 10, 2025
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