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 GitHub environment you created earlier.

Step 1: Add the 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 workflow. It should now run without any errors. This means the workflow has successfully sent an event to your infrastructure repository.