Skip to content

Commit eea4e1c

Browse files
committed
Add documentation
1 parent 5f042fb commit eea4e1c

File tree

2 files changed

+98
-5
lines changed

2 files changed

+98
-5
lines changed

README.md

Lines changed: 97 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,83 @@ The action to load secrets from [1Password Connect](https://1password.com/secret
44

55
Specify right from your workflow YAML which secrets from 1Password should be loaded into your job, and the action will make them available as environment variables for the next steps.
66

7+
## Prerequisites
8+
- [1Password Connect](https://support.1password.com/secrets-automation/#step-2-deploy-a-1password-connect-server) deployed in your infrastructure
9+
710
## Usage
811

12+
There are two ways that secrets can be loaded:
13+
- [use the secrets from the action's ouput](#use-secrets-from-the-actions-output)
14+
- [export secrets as environment variables](#export-secrets-as-environment-variables)
15+
16+
### Use secrets from the action's output
17+
18+
```yml
19+
on: push
20+
jobs:
21+
hello-world:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
- name: Load secret
27+
id: op-load-secret
28+
uses: 1password/load-secrets-action@v1
29+
env:
30+
OP_CONNECT_HOST: <Your Connect instance URL>
31+
OP_CONNECT_TOKEN: ${{ secrets.OP_CONNECT_TOKEN }}
32+
SECRET: op://app-cicd/hello-world/secret
33+
34+
- name: Print masked secret
35+
run: echo "Secret: ${{ steps.op-load-secret.outputs.SECRET }}"
36+
# Prints: Secret: ***
37+
```
38+
39+
<details>
40+
<summary><b>Longer usage example</b></summary>
41+
42+
```yml
43+
on: push
44+
name: Deploy app
45+
46+
jobs:
47+
test:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v2
51+
52+
- name: Configure 1Password Connect
53+
uses: 1password/load-secrets-action/configure@v1
54+
with:
55+
# Persist the 1Password Connect URL for next steps. You can also persist
56+
# the Connect token using input `connect-token`, but keep in mind that
57+
# every single step in the job would then be able to access the token.
58+
connect-host: https://1password.acme.com
59+
60+
- name: Load Docker credentials
61+
id: load-docker-credentials
62+
uses: 1password/load-secrets-action@v1
63+
env:
64+
OP_CONNECT_TOKEN: ${{ secrets.OP_CONNECT_TOKEN }}
65+
DOCKERHUB_USERNAME: op://app-cicd/docker/username
66+
DOCKERHUB_TOKEN: op://app-cicd/docker/token
67+
68+
- name: Login to Docker Hub
69+
uses: docker/login-action@v1
70+
with:
71+
username: ${{ steps.load-docker-credentials.outputs.DOCKERHUB_USERNAME }}
72+
password: ${{ steps.load-docker-credentials.outputs.DOCKERHUB_TOKEN }}
73+
74+
- name: Build and push Docker image
75+
uses: docker/build-push-action@v2
76+
with:
77+
push: true
78+
tags: acme/app:latest
79+
```
80+
</details>
81+
82+
### Export secrets as environment variables
83+
984
```yml
1085
on: push
1186
jobs:
@@ -16,6 +91,9 @@ jobs:
1691

1792
- name: Load secret
1893
uses: 1password/load-secrets-action@v1
94+
with:
95+
# Export loaded secrets as environment variables
96+
export-env: true
1997
env:
2098
OP_CONNECT_HOST: <Your Connect instance URL>
2199
OP_CONNECT_TOKEN: ${{ secrets.OP_CONNECT_TOKEN }}
@@ -48,6 +126,9 @@ jobs:
48126

49127
- name: Load Docker credentials
50128
uses: 1password/load-secrets-action@v1
129+
with:
130+
# Export loaded secrets as environment variables
131+
export-env: true
51132
env:
52133
OP_CONNECT_TOKEN: ${{ secrets.OP_CONNECT_TOKEN }}
53134
DOCKERHUB_USERNAME: op://app-cicd/docker/username
@@ -71,6 +152,8 @@ jobs:
71152
- name: Load AWS credentials
72153
uses: 1password/load-secrets-action@v1
73154
with:
155+
# Export loaded secrets as environment variables
156+
export-env: true
74157
# Remove local copies of the Docker credentials, which are not needed anymore
75158
unset-previous: true
76159
env:
@@ -89,6 +172,7 @@ jobs:
89172
90173
| Name | Default | Description |
91174
|---|---|---|
175+
| `export-env` | `false` | Export the loaded secrets as environment variables |
92176
| `unset-previous` | `false` | Whether to unset environment variables populated by 1Password in earlier job steps |
93177

94178
## Secrets Reference Syntax
@@ -107,12 +191,9 @@ So for example, the reference URI `op://app-cicd/aws/secret-access-key` would be
107191

108192
## Masking
109193

110-
Similar to regular GitHub repository secrets, secret fields from 1Password will automatically be masked from the GitHub Actions logs too.
111-
A 1Password field is considered 'secret' when it's marked as concealed (which shows as `•••••••` in the 1Password GUI) or when it's a secure note.
194+
Similar to regular GitHub repository secrets, fields from 1Password will automatically be masked from the GitHub Actions logs too.
112195
So if one of these values accidentally gets printed, it'll get replaced with `***`.
113196

114-
This means that a username or port field for example will not get masked.
115-
116197
## 1Password Connect Configuration
117198

118199
To use the action, you need to have a [1Password Connect](https://support.1password.com/secrets-automation/#step-1-set-up-a-secrets-automation-workflow) instance deployed somewhere.
@@ -150,3 +231,15 @@ jobs:
150231
## Supported Runners
151232

152233
You can run the action on Linux and macOS runners. Windows is currently not supported.
234+
235+
## Security
236+
237+
1Password requests you practice responsible disclosure if you discover a vulnerability.
238+
239+
Please file requests via BugCrowd.
240+
241+
For information about security practices, please visit our Security homepage.
242+
243+
## Getting help
244+
245+
If you find yourself stuck, visit our Support Page for help.

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ inputs:
99
description: Whether to unset environment variables populated by 1Password in earlier job steps
1010
default: false
1111
export-env:
12-
description: Export the secrets as environment variables
12+
description: Export the loaded secrets as environment variables
1313
default: false
1414
runs:
1515
using: 'docker'

0 commit comments

Comments
 (0)