Skip to content

Commit

Permalink
Switch examples from Personal Token to Service Account token
Browse files Browse the repository at this point in the history
Using a personal token is inadvisable as it's tied to a user identity. Now that we have Service Account tokens, we can switch all documentation to those.
  • Loading branch information
Piccirello committed Jun 13, 2023
1 parent c58305d commit 4cf5d14
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
env:
NODE_ENV: development
DOPPLER_TOKEN: ${{ secrets.TEST_DOPPLER_TOKEN }}
personal-token-test:
service-account-token-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -26,6 +26,6 @@ jobs:
- run: npm run test
env:
NODE_ENV: development
DOPPLER_TOKEN: ${{ secrets.TEST_DOPPLER_PERSONAL_TOKEN }}
DOPPLER_PROJECT: github-actions-secrets-fetch-test
DOPPLER_CONFIG: prd
DOPPLER_TOKEN: ${{ secrets.TEST_DOPPLER_SA_TOKEN }}
DOPPLER_PROJECT: secrets-fetch-action
DOPPLER_CONFIG: test
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This action enables you to fetch Doppler secrets for use in your GitHub Actions.
The action can be configured in two ways:

* Service Token (recommended)
* Personal Token with Project and Config
* Service Account Token with Project and Config

### Service Token

Expand All @@ -26,15 +26,15 @@ Then supply the Service Token using the `doppler-token` input:
doppler-token: ${{ secrets.DOPPLER_TOKEN }}
```

### Personal Token
### Service Account Token

A Doppler Personal Token provides read/write access to every Project and Config accessible for that account and should only be used when necessary. The `doppler-project` and `doppler-config` inputs must be provided when using a Personal Token:
A Doppler Service Account Token allows for a configurable set of permissions to services in your workplace. The `doppler-project` and `doppler-config` inputs must be provided when using a Service Account Token:

```yaml
- uses: dopplerhq/[email protected]
id: doppler
with:
doppler-token: ${{ secrets.PERSONAL_DOPPLER_TOKEN }}
doppler-token: ${{ secrets.DOPPLER_TOKEN }}
doppler-project: auth-api
doppler-config: ci-cd
```
Expand Down
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ const DOPPLER_META = ["DOPPLER_PROJECT", "DOPPLER_CONFIG", "DOPPLER_ENVIRONMENT"
const DOPPLER_TOKEN = core.getInput("doppler-token", { required: true });
core.setSecret(DOPPLER_TOKEN);

const IS_PERSONAL_TOKEN = DOPPLER_TOKEN.startsWith("dp.pt.");
const DOPPLER_PROJECT = IS_PERSONAL_TOKEN ? core.getInput("doppler-project") : null;
const DOPPLER_CONFIG = IS_PERSONAL_TOKEN ? core.getInput("doppler-config") : null;
if (IS_PERSONAL_TOKEN && !(DOPPLER_PROJECT && DOPPLER_CONFIG)) {
core.setFailed("doppler-project and doppler-config inputs are required when using a Personal token");
const IS_SA_TOKEN = DOPPLER_TOKEN.startsWith("dp.sa.");
const DOPPLER_PROJECT = IS_SA_TOKEN ? core.getInput("doppler-project") : null;
const DOPPLER_CONFIG = IS_SA_TOKEN ? core.getInput("doppler-config") : null;
if (IS_SA_TOKEN && !(DOPPLER_PROJECT && DOPPLER_CONFIG)) {
core.setFailed("doppler-project and doppler-config inputs are required when using a Service Account token");
process.exit();
}

Expand Down

0 comments on commit 4cf5d14

Please sign in to comment.