-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathnotebook-review.yml
More file actions
86 lines (75 loc) · 3.04 KB
/
notebook-review.yml
File metadata and controls
86 lines (75 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: 'Run Vertex AI Notebook'
on:
pull_request:
types:
- 'labeled'
branches:
- 'main'
permissions:
pull-requests: 'write'
issues: 'write'
contents: 'write'
id-token: 'write'
env:
GCS_SOURCE: 'mybucket/ghnbr/source' # TODO: Update to a bucket with proper ACLs
GCS_OUTPUT: 'mybucket/ghnbr/output' # TODO: Update to a bucket with proper ACLs
jobs:
# JOB to run change detection and build the allowlist
changes:
if: |-
${{ github.event.label.name == 'notebook-review' }}
runs-on: 'ubuntu-latest'
# Set job outputs to values from filter step
outputs:
notebooks: '${{ steps.filter.outputs.notebooks }}'
notebooks_files: '${{ steps.filter.outputs.notebooks_files }}'
steps:
# For pull requests it's not necessary to checkout the code
- uses: 'dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36' # ratchet:dorny/paths-filter@v3.0.2
id: 'filter'
with:
list-files: 'shell'
filters: |-
notebooks:
- 'somedir/**.ipynb'
# JOB to initiate the notebook review process
notebook-review:
name: 'Notebook Review'
needs: 'changes'
if: |-
${{ needs.changes.outputs.notebooks == 'true' }}
runs-on: 'ubuntu-latest'
steps:
- id: 'checkout'
uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8' # ratchet:actions/checkout@v5
# Configure Workload Identity Federation and generate an access token.
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093' # ratchet:google-github-actions/auth@v3.0.0
with:
workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'
# Alternative option - authentication via credentials json
# - id: 'auth'
# uses: 'google-github-actions/auth@b258a9f230b36c9fa86dfaa43d1906bd76399edb'
# with:
# credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- id: 'notebook-review'
uses: 'google-github-actions/run-vertexai-notebook@e71afc3f2ef954ad746ea4eaf1e0e16a742e0daa' # ratchet:google-github-actions/run-vertexai-notebook@v1
with:
gcs_source_bucket: '${{ env.GCS_SOURCE }}'
gcs_output_bucket: '${{ env.GCS_OUTPUT }}'
allowlist: '${{ needs.changes.outputs.notebooks_files }}'