In netlify.toml how to access Github API Access Token of Git Gateway

In netlify.toml how to access Github API Access Token of Git Gateway

How to call
GET /.netlify/git/github/contents/ in netlify.toml?

Hi @ankitpandeypagefreez . There is no API call or other action that you can take to make us show you or send you the value of that token. Like many auth tokens in many services including ours, the field is “write-only” and thereafter not visible to anyone - you included.

This protects you in case someone gains access to your account. So if you need to know that token - you’ll need to have generated it at GitHub, saved a copy, and pasted a copy here.

Put another way, we intentionally restrict your git access during build to protect you from attackers who may gain access to our build systems - they have no ability to connect to git with elevated permissions as a protection. This article describes a bit more of the why: [Support Guide] How do I access private repositories in the build environment?

1 Like

@fool

Thank you for your answer.

What I want here:
How to call below commands in netlify.toml
I am interested in syntax.
(Git Gateway | Netlify Docs)

GET /.netlify/git/github/contents/
GET /repos/:owner/:name/pulls/

(throwing error when called same in bash)

Actually I created a dynamic build systems based on major branch names ie. dev1, dev2, staging, prod(all are branch name and same using in build command in netlify.toml)

I need base branch name of a pull request in deploy-preview(I do not have same in env of netlify)

TOML is not meant to write functions. Could you better describe what exactly it is that you’re trying to do?