Skip to content

Add PAT as a secret

This section shows you how to set up the PAT you just created as a secret in the application repository.

Step 1: Add the secret

Change APP_REPO to the name of your application repository and paste the PAT when asked to paste your secret.

export APP_REPO="oslokommune/pirates-apps"
gh secret set --repo "$APP_REPO" PAT_ON_MACHINE_USER_FOR_IAC_DISPATCH
Example output
? Paste your secret ***
✓ Set Actions secret PAT_ON_MACHINE_USER_FOR_IAC_DISPATCH for oslokommune/pirates-apps

Go to your application repository and navigate to Settings > Secrets and variables > Actions > Repository secrets. Click on New repository secret.

Name

PAT_ON_MACHINE_USER_FOR_IAC_DISPATCH

Value

The value of the personal access token you created previously (for example github_pat_R2eH8G6iO3qV7jK1bW0zN4pL)

Click on Add secret.

Why is this a repository secret?

You don't need to use an environment for this secret because it's the same value for all environments.

Step 2: Verify

Try to run the _gp_too-tikki_pirates-dev_build_and_push_image.yml workflow. It should now run without any errors. This means the workflow has successfully sent an event to your infrastructure repository.

Next step

Bump the image tag in Terraform.