If for any reason, your workflow needs to access another GitHub repository different than its source, for example:
Pulling application code from CodeBuild, or
Pulling manifests from a separate repo than the application code.
In these cases, the CI/CD workflow will require a Personal Access Token with the correct permissions set as a secret in the workflow source.
To generate a personal access token (PAT)
Sign in as the CI GitHub user (stored in GitHub)
Access
Settings
via the user picture dropdown in the upper right cornerFrom the left navigation menu, access
<> Developer settings
(all the way at the bottom at time of writing)From the left navigation menu in
Developer settings
, access Personal Access TokenIf presented with a dropdown, select
Tokens (classic)
You may now generate a new PAT with the
Generate new token
button above the list of PATs already in existenceIn the popup:
Notate the purpose of the token
Choose its expiration timeframe
Ensure that the token has the correct permissions by selecting the checkbox next to
repo
...
d. Click the Generate token
green button at the bottom
Note |
---|
Make sure you copy the value of the PAT, you will not be able to retrieve it again once you leave this page. |
Setting the token secret
GitHub Actions
In the repo that is running the CI/CD workflow, navigate to
Settings
with the horizontal navigation menuFrom the left navigation menu, go to Security > Secrets > Actions
Create a
New repository secret
with the green button at the topFill in the name and value of your token
Once saved, you’ll be able to retrieve the value with
secrets.NAME_OF_SECRET
CodeBuild
...
Info |
---|
The AWS Platform Guide now lives at thoughtbot.com Visit Accessing another GitHub repository to access this page's content |