Skip to content

Using a Personal Access Token to grant access to private dependencies

Brandon Sturgeon edited this page Jun 9, 2022 · 2 revisions

Personal Access Tokens are a simpler option for granting access to a private dependency.

(Prefer a more robust and flexible solution? Check out a different method using SSH Keypairs)


Using GitHub Actions

There are three steps:

  • Create a Personal Access Token
  • Add your PAT to your project's Secrets
  • Update the Workflow file

Create a Personal Access Token

On GitHub, go to your account settings: At the bottom of the menu, go to "Developer Settings", then "Personal access tokens":

image image

"Generate New Token": image


For your token's name, try to name it something that you'll remember grants GLuaTest access to your dependency.

As for the expiration date, it's better if you select a definite expiration date, but it'll be fine if you set it to unlimited. In our opinion, the best solution is to choose an expiration date that's 1-3 years away.

Click the "repo" checkbox to give this token access to private repositories that you have access to. image

Then, generate the token.

Once it's generated, be sure to copy the token (you can only see it once!).

Add your PAT to Your Project's Secrets

Go to Your Projects repository settings, then navigate to Secrets -> Actions:

image

New repository secret:

image

Be sure to name it something that reminds you it's for GLuaTest. Paste your Personal Access Token into the Value input, then click "Add secret"

image

Update the Workflow

You need to share your Personal Access Token with GLuaTest.

Add the github-token: key to the with block of your GLuaTest step:

name: GLuaTest Runner

on:
  pull_request:

jobs:
  run-tests:
    uses: CFC-Servers/GLuaTest/.github/workflows/run_tests.yml@main
    with:
        github-token: "${{ secrets.GLUATEST_TOKEN }}"

All done! When GLuaTest runs, it will be able to clone your project's private dependencies.