Skip to content

Commit 3d4d6cd

Browse files
authored
Pin auth to v0 and show full permissions block in examples (#226)
1 parent 3a873dc commit 3d4d6cd

File tree

1 file changed

+69
-43
lines changed

1 file changed

+69
-43
lines changed

README.md

Lines changed: 69 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,30 @@ Cloud Function. See the Authorization section below for more information.
3030
## Usage
3131

3232
```yaml
33-
steps:
34-
- uses: actions/checkout@v2
35-
- id: auth
36-
uses: google-github-actions/auth@v0.4.0
37-
with:
38-
workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
39-
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'
40-
- id: deploy
41-
uses: google-github-actions/deploy-cloud-functions@v0.6.0
42-
with:
43-
name: my-function
44-
runtime: nodejs10
45-
46-
# Example of using the output
47-
- id: test
48-
run: curl "${{ steps.deploy.outputs.url }}"
33+
jobs:
34+
job_id:
35+
permissions:
36+
contents: 'read'
37+
id-token: 'write'
38+
39+
steps:
40+
- uses: actions/checkout@v2
41+
42+
- id: auth
43+
uses: google-github-actions/auth@v0
44+
with:
45+
workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
46+
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'
47+
48+
- id: deploy
49+
uses: google-github-actions/deploy-cloud-functions@v0.7.0
50+
with:
51+
name: my-function
52+
runtime: nodejs10
53+
54+
# Example of using the output
55+
- id: test
56+
run: curl "${{ steps.deploy.outputs.url }}"
4957
```
5058
5159
## Inputs
@@ -206,32 +214,46 @@ See [usage](https://github.com/google-github-actions/auth#usage) for more detail
206214
#### Authenticating via Workload Identity Federation
207215

208216
```yaml
209-
- uses: actions/checkout@v2
210-
- id: auth
211-
uses: google-github-actions/auth@v0.4.0
212-
with:
213-
workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
214-
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'
215-
- id: deploy
216-
uses: google-github-actions/deploy-cloud-functions@v0.6.0
217-
with:
218-
name: my-function
219-
runtime: nodejs10
217+
jobs:
218+
job_id:
219+
permissions:
220+
contents: 'read'
221+
id-token: 'write'
222+
223+
steps:
224+
- uses: actions/checkout@v2
225+
226+
- id: auth
227+
uses: google-github-actions/auth@v0
228+
with:
229+
workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
230+
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'
231+
232+
- id: deploy
233+
uses: google-github-actions/deploy-cloud-functions@v0.7.0
234+
with:
235+
name: my-function
236+
runtime: nodejs10
220237
```
221238

222239
#### Authenticating via Service Account Key JSON
223240

224241
```yaml
225-
- uses: actions/checkout@v2
226-
- id: auth
227-
uses: google-github-actions/auth@v0.4.0
228-
with:
229-
credentials_json: ${{ secrets.gcp_credentials }}
230-
- id: deploy
231-
uses: google-github-actions/deploy-cloud-functions@v0.6.0
232-
with:
233-
name: my-function
234-
runtime: nodejs10
242+
jobs:
243+
job_id:
244+
steps:
245+
- uses: actions/checkout@v2
246+
247+
- id: auth
248+
uses: google-github-actions/auth@v0
249+
with:
250+
credentials_json: ${{ secrets.gcp_credentials }}
251+
252+
- id: deploy
253+
uses: google-github-actions/deploy-cloud-functions@v0.7.0
254+
with:
255+
name: my-function
256+
runtime: nodejs10
235257
```
236258

237259
### Via Application Default Credentials
@@ -242,12 +264,16 @@ authenticate requests as the service account attached to the instance. **This
242264
only works using a custom runner hosted on GCP.**
243265

244266
```yaml
245-
- uses: actions/checkout@v2
246-
- id: Deploy
247-
uses: google-github-actions/deploy-cloud-functions@v0.6.0
248-
with:
249-
name: my-function
250-
runtime: nodejs10
267+
jobs:
268+
job_id:
269+
steps:
270+
- uses: actions/checkout@v2
271+
272+
- id: Deploy
273+
uses: google-github-actions/deploy-cloud-functions@v0.7.0
274+
with:
275+
name: my-function
276+
runtime: nodejs10
251277
```
252278

253279
The action will automatically detect and use the Application Default

0 commit comments

Comments
 (0)