Skip to content
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

🕵️ Investigation: Use a GitHub API that doesn't error with 404 when not found #5

Open
JoshuaKGoldberg opened this issue Aug 26, 2022 · 2 comments
Labels
status: needs investigation Further research required...?

Comments

@JoshuaKGoldberg
Copy link
Owner

Overview

Right now, if the extension is used on a GitHub issue page for a repository that doesn't have a .github/replies.yml, the API call to https://api.github.com/repos/${userOrOrganization}/${repository} fails with a 404. That failure shows up in the dev tools console. Annoying.

It'd be nice to find a GitHub API that doesn't cause these 404s when the file isn't found. Maybe a GraphQL one has such a feature?

@estevezluis
Copy link
Contributor

estevezluis commented Apr 10, 2023

I see that this issue isn't accepting prs however, in attempt to solve issue #43 (didn't understand the out of scope part), I found an API that lets you search through the git tree.

Take a look at my commit

There's two way to use this API.

  1. Without recursive parameter. This would require a second API call after finding '.github' tree/dir
  2. With recursive parameter. If git repo contains a large amount of files this will be slow.

@JoshuaKGoldberg
Copy link
Owner Author

Aha that's a nice investigation! Thank you for putting this together! 🙏

  • Upside: I like very much that it shouldn't give a 404 when the file doesn't exist.
  • Downside: that extra API call, as you mentioned. It means the extension will run slower and less reliably.

Let's investigate alternate ways to get this working that take up just one network request still. (aside: I just filed #149 to tackle after this issue)

A couple of options that popped up while searching for alternatives:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs investigation Further research required...?
Projects
None yet
Development

No branches or pull requests

2 participants