Skip to content

github-modules/github-buildpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Heroku Buildpack for GitHub Authentication

This is a Heroku buildpack that enables authenticated GitHub operations within a Heroku dyno.

It detects a GITHUB_AUTH_TOKEN environment variable and creates a .netrc file with a GitHub entry.

It is the soul sister of the npm Buildpack.

See the blog post: npm and GitHub automation with Heroku

Setup

First, create a new GitHub access token at github.com/settings/tokens/new.

Then save this token in your Heroku app's config:

heroku config:set GITHUB_AUTH_TOKEN=YOUR_TOKEN_HERE

Then configure your app to use this buildpack:

heroku buildpacks:add --index 1 zeke/github

The next time you push your app to Heroku, this buildpack will create a .netrc file containing your GitHub token in the base directory of the app:

heroku run bash
cat .netrc
machine github.com login YOUR_TOKEN_HERE password x-oauth-basic

Now you can perform authenticated git operations on the dyno. Note that if you want to git commit, you'll need to specify the git user and email:

git clone https://github.com/you/some-private-repo
cd some-private-repo
git config user.email "zeke@sikelianos.com"
git config user.name "Zeke Sikelianos"
touch some/file
git commit -am "git commit from a dyno!"
git push origin master

Using the latest source code

The zeke/github buildpack from the Heroku Buildpack Registry represents the latest stable version of the buildpack. If you'd like to use the source code from this Github repository, you can set your buildpack to the Github URL:

heroku buildpacks:add --index 1 https://github.com/github-modules/github-buildpack

License

MIT

Notes

This buildpack was inspired by @timshadel/heroku-buildpack-github-netrc, but the two differ in one significant way: the @timshadel buildpack allows authenticated requests to be made only at build time (i.e. when your app is being deployed), whereas this buildpack allows authenticated requests at build time and/or run time (when your app is actually running).

Releases

No releases published

Packages

No packages published

Languages