diff --git a/.github/spelling/README.md b/.github/actions/spelling/README.md similarity index 100% rename from .github/spelling/README.md rename to .github/actions/spelling/README.md diff --git a/.github/spelling/advice.md b/.github/actions/spelling/advice.md similarity index 100% rename from .github/spelling/advice.md rename to .github/actions/spelling/advice.md diff --git a/.github/spelling/allow.txt b/.github/actions/spelling/allow.txt similarity index 99% rename from .github/spelling/allow.txt rename to .github/actions/spelling/allow.txt index 400b4ba2..6954e9c0 100644 --- a/.github/spelling/allow.txt +++ b/.github/actions/spelling/allow.txt @@ -1136,3 +1136,4 @@ ytd yticks zakarid zaxis +Thallam \ No newline at end of file diff --git a/.github/spelling/block-delimiters.list b/.github/actions/spelling/block-delimiters.list similarity index 100% rename from .github/spelling/block-delimiters.list rename to .github/actions/spelling/block-delimiters.list diff --git a/.github/spelling/candidate.patterns b/.github/actions/spelling/candidate.patterns similarity index 100% rename from .github/spelling/candidate.patterns rename to .github/actions/spelling/candidate.patterns diff --git a/.github/spelling/excludes.txt b/.github/actions/spelling/excludes.txt similarity index 99% rename from .github/spelling/excludes.txt rename to .github/actions/spelling/excludes.txt index 89e48681..37c50762 100644 --- a/.github/spelling/excludes.txt +++ b/.github/actions/spelling/excludes.txt @@ -113,4 +113,4 @@ ignore$ ^\Qworkshops/ai-agents/ai_agents_for_engineers.ipynb\E$ ^\Qowlbot.py\E$ ^\Q.github/workflows/issue_assigner/assign_issue.py\E$ -^\Qnoxfile.py\E$ +^\Qnoxfile.py\E$ \ No newline at end of file diff --git a/.github/spelling/expect.txt b/.github/actions/spelling/expect.txt similarity index 100% rename from .github/spelling/expect.txt rename to .github/actions/spelling/expect.txt diff --git a/.github/spelling/line_forbidden.patterns b/.github/actions/spelling/line_forbidden.patterns similarity index 100% rename from .github/spelling/line_forbidden.patterns rename to .github/actions/spelling/line_forbidden.patterns diff --git a/.github/spelling/patterns.txt b/.github/actions/spelling/patterns.txt similarity index 100% rename from .github/spelling/patterns.txt rename to .github/actions/spelling/patterns.txt diff --git a/.github/spelling/reject.txt b/.github/actions/spelling/reject.txt similarity index 100% rename from .github/spelling/reject.txt rename to .github/actions/spelling/reject.txt diff --git a/.github/workflows/spelling.yaml b/.github/workflows/spelling.yaml index 7b3fa47d..ec0f2d77 100644 --- a/.github/workflows/spelling.yaml +++ b/.github/workflows/spelling.yaml @@ -155,4 +155,4 @@ jobs: not-upper-or-lower-pattern: "[^A-ZÁÉÍÓÚÑÇÜa-záéíóúñçü]" punctuation-pattern: "'" only_check_changed_files: true - longest_word: "10" + longest_word: "10" \ No newline at end of file diff --git a/.github/workflows/update_notebook_links.py b/.github/workflows/update_notebook_links.py deleted file mode 100644 index 26551268..00000000 --- a/.github/workflows/update_notebook_links.py +++ /dev/null @@ -1,110 +0,0 @@ -"""Check links in notebooks for accuracy.""" - -import os -import sys -import urllib.parse - -import nbformat - -LINK_PREFIXES = { - "colab_link": "https://colab.research.google.com/github/GoogleCloudPlatform/generative-ai/blob/main/", - "colab_enterprise_link": "https://console.cloud.google.com/vertex-ai/colab/import/", - "github_link": "https://github.com/GoogleCloudPlatform/generative-ai/blob/main/", - "workbench_link": "https://console.cloud.google.com/vertex-ai/workbench/deploy-notebook?download_url=", - "bigquery_studio_link": "https://console.cloud.google.com/bigquery/import?url=", - "linkedin_link": "https://www.linkedin.com/sharing/share-offsite/?url=", - "bluesky_link": "https://bsky.app/intent/compose?text=", - "twitter_link": "https://twitter.com/intent/tweet?url=", - "reddit_link": "https://reddit.com/submit?url=", - "facebook_link": "https://www.facebook.com/sharer/sharer.php?u=", -} - -GITHUB_URL_PREFIX = LINK_PREFIXES["github_link"] -RAW_URL_PREFIX = ( - "https://raw.githubusercontent.com/GoogleCloudPlatform/generative-ai/main/" -) - - -def fix_markdown_links( - cell_source: str, relative_notebook_path: str -) -> tuple[str, bool]: - """Fixes links in a markdown cell and returns the updated source.""" - new_lines = [] - changes_made = False - - encoded_url = urllib.parse.quote(f"{GITHUB_URL_PREFIX}{relative_notebook_path}") - - for line in cell_source.splitlines(): - for key, prefix in LINK_PREFIXES.items(): - if prefix not in line or "**NOTE:**" in line: - continue - - start_index = line.find(prefix) + len(prefix) - end_index = line.find(".ipynb", start_index) + len(".ipynb") - correct_link = "" - - if key in {"colab_link", "github_link"}: - correct_link = relative_notebook_path - elif key == "colab_enterprise_link": - correct_link = urllib.parse.quote( - f"{RAW_URL_PREFIX}{relative_notebook_path}", - safe=":", - ) - elif key == "workbench_link": - correct_link = f"{RAW_URL_PREFIX}{relative_notebook_path}" - elif key == "bigquery_studio_link": - correct_link = f"{GITHUB_URL_PREFIX}{relative_notebook_path}" - elif key in { - "linkedin_link", - "bluesky_link", - "twitter_link", - "reddit_link", - "facebook_link", - }: - correct_link = encoded_url - - if correct_link.lower() not in line.lower(): - print(f"Incorrect link in {relative_notebook_path}: {line}\n") - print(f"Should be: {correct_link}\n") - line = line.replace(line[start_index:end_index], correct_link) - changes_made = True - - new_lines.append(line) - - return "\n".join(new_lines), changes_made - - -def fix_links_in_notebook(notebook_path: str) -> int: - """Fixes specific types of links in a Jupyter notebook.""" - with open(notebook_path, encoding="utf-8") as f: - notebook = nbformat.read(f, as_version=4) - - relative_notebook_path = os.path.relpath(notebook_path, start=os.getcwd()).lower() - - for cell in notebook.cells: - if cell.cell_type == "markdown" and "