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

Add redirect to GitHub repo and add authorization #6

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jschenke488
Copy link

No description provided.

@vercel
Copy link

vercel bot commented Jun 12, 2023

Someone is attempting to deploy a commit to a Personal Account owned by @Contextualist on Vercel.

@Contextualist first needs to authorize it.

@jschenke488
Copy link
Author

I don't know if I did the environment variables correctly for Vercel, but authorization works locally

Copy link
Owner

@Contextualist Contextualist left a comment

Choose a reason for hiding this comment

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

Thanks for contributing! Recently I did notice GitHub’s increasing throttle to unauthorized API requests, so this config would be quite helpful.


@app.route('/')
def redir():
return redirect("https://github.com/Contextualist/glare")
Copy link
Owner

Choose a reason for hiding this comment

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

Nice to have😉, but let's move it to vercel.json: { "src": "/", "status": 301, "headers": { "Location": "https://github.com/Contextualist/glare" } }

@@ -47,7 +58,7 @@ def get_release(user, repo_ver, name_re):
return redirect(matched[0])

def api_req(url):
resp = httpx.get(url)
resp = httpx.get(url, headers={'Authorization': config['GITHUB_AUTHORIZATION']}) if ast.literal_eval(config['GITHUB_IS_AUTHORIZED']) == True else httpx.get(url)
Copy link
Owner

Choose a reason for hiding this comment

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

I might want to simplify things a bit: if GITHUB_TOKEN is set and is non-empty, add the auth header.

Comment on lines +9 to +12
"env": {
"GITHUB_AUTHORIZATION": "Bearer YOUR-TOKEN",
"GITHUB_IS_AUTHORIZED": "False"
}
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe just use .env file as the default only way of managing the environment variables, so that it's less confusing to users.

@vercel
Copy link

vercel bot commented Jun 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
glare ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2023 8:19am

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.

2 participants