{"id":19581170,"url":"https://github.com/google-github-actions/run-vertexai-notebook","last_synced_at":"2025-04-27T09:33:00.263Z","repository":{"id":37792195,"uuid":"501339908","full_name":"google-github-actions/run-vertexai-notebook","owner":"google-github-actions","description":"A GitHub Action for running a Google Cloud Vertex AI notebook.","archived":false,"fork":false,"pushed_at":"2024-10-30T00:11:27.000Z","size":47,"stargazers_count":20,"open_issues_count":1,"forks_count":9,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-10-30T02:44:04.309Z","etag":null,"topics":["actions","artificial-intelligence","gcp","github-actions","google-cloud","google-cloud-platform","machine-learning","ml-notebooks","vertex-ai"],"latest_commit_sha":null,"homepage":"https://cloud.google.com/vertex-ai","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google-github-actions.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-08T17:01:44.000Z","updated_at":"2024-10-30T00:11:19.000Z","dependencies_parsed_at":"2023-01-04T21:31:27.148Z","dependency_job_id":"1e1a3e7b-eb71-43f8-acb1-e94155b80248","html_url":"https://github.com/google-github-actions/run-vertexai-notebook","commit_stats":{"total_commits":23,"total_committers":5,"mean_commits":4.6,"dds":0.6956521739130435,"last_synced_commit":"0cde94af43963508b52276a6232afaed1bd05fa8"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-github-actions%2Frun-vertexai-notebook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-github-actions%2Frun-vertexai-notebook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-github-actions%2Frun-vertexai-notebook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-github-actions%2Frun-vertexai-notebook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google-github-actions","download_url":"https://codeload.github.com/google-github-actions/run-vertexai-notebook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224067250,"owners_count":17250140,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","artificial-intelligence","gcp","github-actions","google-cloud","google-cloud-platform","machine-learning","ml-notebooks","vertex-ai"],"created_at":"2024-11-11T07:33:19.383Z","updated_at":"2024-11-11T07:33:20.536Z","avatar_url":"https://github.com/google-github-actions.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# `run-vertexai-notebook` GitHub Action\n\nGitHub composite action to trigger asynchronous execution of a Jupyter Notebook via [Google Cloud Vertex AI][vertex-ai].\n\nThe typical SDLC for a Jupyter Notebook includes source control of the notebook file without it's output cells. It is a best practice that notebooks should be stored this way to prevent commiting potentially sensitive data. A downside of this practice is that code reviewers will not be able to see the output while reviewing and may not be able to accurately gauge the impact of a change.\n\nThe main purpose of this action is to provide a secure way to execute a notebook, store the output (outside of source control), and serve it to a reviewer with proper access controls.\n\nThis action relies on the notebook execution functionality of Google Cloud's Vertex AI to execute the notebook and store the executed notebook with output cells in Google Cloud Storage. Access to the output is controled by Google Cloud Storage ACLs.\n\n**NOTE:** *Notebooks executed by this action will fall under the [notebook executor requirements][nbexecution] defined by Vertex AI.*\n\nThis action will provision cloud resources with associated costs so it is recommended that you control the usage of this action by:\n\n* Limiting the triggers of this action: e.g. on pull request with a specific label\n\n* Limiting the set of notebooks that it executes for via the `allowlist` parameter\n\n* Managing the size of the Vertex AI infrastructure via the `vertex_machine_type` parameter\n\n**This is not an officially supported Google product, and it is not covered by a\nGoogle Cloud support contract. To report bugs or request features in a Google\nCloud product, please contact [Google Cloud\nsupport](https://cloud.google.com/support).**\n\n# Prerequisites\n\nThis action requires Google Cloud credentials to execute gcloud commands. See [setup-gcloud][setup-gcloud] for details.\n\n# Setup\n\n1.  Create a new Google Cloud Project (or select an existing project) and\n    [enable the Vertex AI APIs][vertex-api].\n\n1.  Create or reuse a GitHub repository for the example workflow:\n\n    1.  [Create a repository][newrepo].\n\n    1.  Move into the repository directory:\n\n        ```\n        $ cd \u003crepo\u003e\n        ```\n\n    1.  Copy the example into the repository:\n\n        ```\n        $ cp -r \u003cpath_to\u003e/notebook-review-action/examples/notebook-review/ .\n        ```\n\n1.  [Create a GCS bucket][bucket] if one does not already exist.\n\n1.  [Create a Google Cloud service account][create-sa] if one does not already exist.\n\n1.  Add the following [Cloud IAM roles][roles] to your service account:\n\n    - `roles/aiplatform.user` - allows running jobs in Vertex AI\n    - `roles/storage.objectWriter` - allows writing notebook files to object storage\n\n    **Note:** *These permissions are overly broad to favor a quick start. They do not represent best practices around the Principle of Least Privilege. To properly restrict access, you should create a custom IAM role with the most\n    restrictive permissions.*\n\n1.  [Setup authenticaion to Google Cloud][auth] using workload identity federation with the above service account.\n\n# Usage\n\n```yaml\n jobs:\n   notebook-review:\n    name: Notebook Review\n    needs: changes\n    runs-on: ubuntu-latest\n\n    steps:\n    - id: 'auth'\n      name: 'Authenticate to Google Cloud'\n      uses: 'google-github-actions/auth@v0'\n      with:\n        workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'\n        service_account: 'my-service-account@my-project.iam.gserviceaccount.com'\n\n    - id: notebook-review\n      uses: google-github-actions/run-vertexai-notebook@v0\n        with:\n          gcs_source_bucket: '${{ env.GCS_SOURCE }}'\n          gcs_output_bucket: '${{ env.GCS_OUTPUT }}'\n          allowlist: '${{ needs.changes.outputs.notebooks_files }}'\n```\n\n### Running `R` notebooks\n\nR requires a different base container and kernel\n\n```yaml\n    - id: notebook-review\n      uses: google-github-actions/run-vertexai-notebook@v0\n        with:\n          gcs_source_bucket: '${{ env.GCS_SOURCE }}'\n          gcs_output_bucket: '${{ env.GCS_OUTPUT }}'\n          allowlist: '${{ needs.changes.outputs.notebooks_files }}'\n          vertex_container_name: 'gcr.io/deeplearning-platform-release/r-cpu.4-1:latest' # R base container\n          kernel_name: 'ir' # The stock R kernel\n```\n\nSee a more complete example in [examples](examples/.github/workflows/notebook-review.yml).\n\n# Inputs\n\n-   `gcs_source_bucket` - (Required) Google Cloud Storage bucket to store\n    notebooks to be run by Vertex AI. e.g. mygcp-bucket-0001/nbr/source. This\n    bucket was created during setup above.\n\n-   `gcs_output_bucket` - (Required) Google Cloud Storage bucket to store the\n    results of the notebooks executed by Vertex AI. e.g.\n    mygcp-bucket-0001/nbr/output. This bucket was created during setup above.\n\n    **Note:** It is recommended that the source and output values share the\n    same bucket and utilize a path structure to seperate source from output.\n\n-   region: (Optional) Google Cloud region to execute Vertex AI jobs in.\n    Defaults to `us-central1`.\n\n-   `vertex_machine_type` - (Optional) Machine type to use for Vertex AI job\n    execution. Defaults to a `n1-standard-4` machine shape.\n\n-   `allowlist` - (Required) List of notebooks to execute. Comma separated list\n    of files to run on Vertex AI. e.g.\n    mynotebook.ipynb,somedir/another_notebook.pynb. It is expected that this is\n    the output from an action like [dorny/paths-filter][path-filter].\n\n-   `add_comment` - (Optional) By default the action will attempt to write a\n    comment to the open PR or issue that triggered this action. This flag allows\n    workflows that are triggered on direct push to a branch to disable this behavior.\n\n-   `kernel_name` - (Optional) Kernel to use as the environment for the notebook\n    when it executes. Defaults to `python3`.\n\n-   `vertex_container_name` - (Optional) The base container to use for the notebook\n    execution job. Defaults to `gcr.io/deeplearning-platform-release/base-cu110:latest`\n\n[bucket]: https://cloud.google.com/storage/docs/creating-buckets\n[auth]: https://github.com/google-github-actions/auth\n[sdk]: https://cloud.google.com/sdk\n[roles]: https://cloud.google.com/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource\n[vertex-api]: https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com\n[vertex-ai]: https://cloud.google.com/vertex-ai\n[newrepo]: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-new-repository\n[nbexecution]: https://cloud.google.com/vertex-ai/docs/workbench/managed/executor#requirements\n[path-filter]: https://github.com/dorny/paths-filter\n[create-sa]: https://cloud.google.com/iam/docs/creating-managing-service-accounts\n[setup-gcloud]: https://github.com/google-github-actions/setup-gcloud\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-github-actions%2Frun-vertexai-notebook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle-github-actions%2Frun-vertexai-notebook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-github-actions%2Frun-vertexai-notebook/lists"}