Skip to content
This repository was archived by the owner on Nov 22, 2023. It is now read-only.

Commit e5e5c12

Browse files
Merge pull request #71 from the-psc/rbh-ways-of-working-generating-infra-token
Add PAT generation instructions...
2 parents c936e2b + 1873693 commit e5e5c12

File tree

8 files changed

+97
-2
lines changed

8 files changed

+97
-2
lines changed

.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "chrome",
9+
"request": "launch",
10+
"name": "Launch Chrome against localhost",
11+
"url": "http://localhost:8080",
12+
"webRoot": "${workspaceFolder}"
13+
}
14+
]
15+
}

package-lock.json

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/ways-of-working/index.html.md.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Team ways of working
33
weight: 20
44
parent: /ways-of-working
5-
last_reviewed_on: 2022-04-06
5+
last_reviewed_on: 2023-11-20
66
review_in: 3 months
77
---
88

@@ -29,6 +29,7 @@ The ways of working for this service are recorded and shared here:-
2929
|[How to manage ephemeris data] (manage-ephemeris/manage-ephemeris.html)
3030
|[How to use the API] (use-the-api/use-the-api.html)
3131
|[How to onboard new organisations and users] (onboarding-new-user/onboarding-process.html)
32+
|[How to generate the GitHub Personal Access Token for Infrastructure] (infra-token/infra-token.html)
3233

3334

3435
<%= partial 'partials/_links' %>
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: How to generate the GitHub Personal Access Token for Infrastructure
3+
weight: 20
4+
parent: /ways-of-working
5+
hide_in_navigation: true
6+
last_reviewed_on: 2023-11-20
7+
review_in: 12 months
8+
---
9+
10+
# How to generate the GitHub Personal Access Token for Infrastructure
11+
12+
<%= partial 'partials/_links' %>
13+
14+
Personal access tokens (PATs) are a secure way to grant third-party applications access to your GitHub account. They are an alternative to using your GitHub password, which can be more secure as they can be limited to specific scopes and can be revoked if they are compromised.
15+
16+
<div class="govuk-warning-text">
17+
<span class="govuk-warning-text__icon" aria-hidden="true">!</span>
18+
<strong class="govuk-warning-text__text">
19+
<span class="govuk-warning-text__assistive">Warning</span>
20+
Classic PATs are the older version of PATs and are still supported by GitHub. They have been deprecated in favor of fine-grained PATs, which offer more granular control over permissions. However, classic PATs are still a viable option for many users and used here.
21+
</strong>
22+
</div>
23+
24+
25+
In this document, we will describe how to generate a classic PAT in GitHub and add it as a secret to the three UKSA repositories.
26+
27+
## Generating a Classic Personal Access Token
28+
29+
1. __Navigate to your GitHub settings:__ Click on your profile picture in the top right corner of any GitHub page and select "Settings" from the dropdown menu.
30+
31+
2. __Access Developer Settings:__ In the left sidebar, click on "Developer settings".
32+
33+
3. __Generate a new token:__ Under the "Personal access tokens" section, click on "Generate new token".
34+
![GitHub Action Image](pat-token-1.png)
35+
36+
4. __Provide a descriptive name:__ In the "Note" field, give your token a descriptive name so you can easily identify it later, e.g. "Terraform PAT".
37+
38+
5. __Set expiration:__ If you want your token to expire after a certain period, select "Expiration" and choose the desired expiration time. We expire after 30 days and regenerate.
39+
40+
6. __Select permissions:__ Choose the permissions you want to grant to your token. We use the the token to access repositories, so select the "repo" scope.
41+
![GitHub Action Image](pat-token-2.png)
42+
43+
7. __Generate the token:__ Once you have selected the desired permissions, click on "Generate token".
44+
45+
8. __Copy and save the token:__ Your newly generated token will be displayed on the screen. Copy and save this token securely, as it will be needed later.
46+
![GitHub Action Image](pat-token-3.png)
47+
48+
## Adding the Token as a Secret to Repositories
49+
50+
<div class="govuk-warning-text">
51+
<span class="govuk-warning-text__icon" aria-hidden="true">!</span>
52+
<strong class="govuk-warning-text__text">
53+
<span class="govuk-warning-text__assistive">Warning</span>
54+
This will be done over three repositories.
55+
</strong>
56+
</div>
57+
58+
1. __Navigate to the repository settings:__ Go to the page of the repository where you want to add the token as a secret.
59+
60+
2. __Access settings:__ Click on "Settings" in the top right corner of the repository page.
61+
62+
3. __Open Secrets section:__ In the left sidebar, click on "Secrets and Variables" and select "Actions".
63+
64+
4. __Find the secret for the respective repo:__ Either `INFRA_REPO_TOKEN` (for sst-beta and sst-beta-python-backend) or `TF_GITHUB_TOKEN` (for sst-beta-infra)
65+
66+
5. __Paste the token:__ In the "Value" field, paste the personal access token you generated earlier.
67+
68+
6. __Save the secret:__ Click on "Update secret" to save the token as a secret for the repository.
69+
70+
## Repeat for Additional Repositories
71+
Repeat the process of adding the token as a secret for each repository.
72+
73+
* [Front-end](https://github.com/UKSpaceAgency/sst-beta/)
74+
* [Back-end](https://github.com/UKSpaceAgency/sst-beta-python-backend/)
75+
* [Infra](https://github.com/UKSpaceAgency/sst-beta-infra/)
76+
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)