From 8c20a9caae56418b44d88ea3831a49e829430ed7 Mon Sep 17 00:00:00 2001 From: Rachael Sewell Date: Fri, 6 Jan 2023 10:57:36 -0800 Subject: [PATCH] remove LFS from codebase (#33777) --- .devcontainer/devcontainer.json | 3 +-- .../release-issue.md | 2 +- .github/workflows/azure-preview-env-deploy.yml | 5 ----- .github/workflows/azure-staging-build-deploy.yml | 4 ---- .github/workflows/browser-test.yml | 5 ----- .github/workflows/main-preview-docker-cache.yml | 4 ---- .github/workflows/repo-sync.yml | 5 ++++- .github/workflows/test.yml | 14 -------------- CONTRIBUTING.md | 8 +++----- contributing/development.md | 4 +--- lib/search/config.js | 4 ---- script/copy-to-test-repo.sh | 2 +- script/search/parse-page-sections-into-records.js | 13 +------------ 13 files changed, 12 insertions(+), 61 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ce21a1ea27b6..4a9cd18743e1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,7 +17,6 @@ // Install features. Type 'feature' in the VS Code command palette for a full list. "features": { - "git-lfs": "latest", "sshd": "latest" }, @@ -42,7 +41,7 @@ }, // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "git lfs pull && npm ci", + "postCreateCommand": "npm ci", // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "node" diff --git a/.github/actions-scripts/enterprise-server-issue-templates/release-issue.md b/.github/actions-scripts/enterprise-server-issue-templates/release-issue.md index 26a082c69257..eb53adb7fd0b 100644 --- a/.github/actions-scripts/enterprise-server-issue-templates/release-issue.md +++ b/.github/actions-scripts/enterprise-server-issue-templates/release-issue.md @@ -101,7 +101,7 @@ This file should be automatically updated, but you can also run `script/update-e ### 🚢 🛳️ 🚢 Shipping the release branch -- [ ] The megabranch creator should push the search index LFS objects for the public `github/docs` repo. The LFS objects were already pushed for the internal repo after the `sync-english-index-for-` was added to the megabranch. To push the LFS objects to the public repo: +- [ ] Sync the search indices for the new release: 1. First navigate to the [sync search indices workflow](https://github.com/github/docs-internal/actions/workflows/sync-search-indices.yml). 2. Then, to run the workflow with parameters, click on `Run workflow` button. 3. A modal will pop up where you will set the following inputs: diff --git a/.github/workflows/azure-preview-env-deploy.yml b/.github/workflows/azure-preview-env-deploy.yml index f31140f99ad7..5ae79b8a5cdf 100644 --- a/.github/workflows/azure-preview-env-deploy.yml +++ b/.github/workflows/azure-preview-env-deploy.yml @@ -91,7 +91,6 @@ jobs: with: ref: 'main' persist-credentials: 'false' - lfs: 'true' - if: ${{ env.IS_INTERNAL_BUILD == 'true' }} name: Check out PR code @@ -100,10 +99,6 @@ jobs: ref: ${{ env.COMMIT_REF }} # To prevent issues with cloning early access content later persist-credentials: 'false' - lfs: 'true' - - - name: Check out LFS objects - run: git lfs checkout - name: Get preview app info env: diff --git a/.github/workflows/azure-staging-build-deploy.yml b/.github/workflows/azure-staging-build-deploy.yml index 24fc3c696426..cb93698b8e6b 100644 --- a/.github/workflows/azure-staging-build-deploy.yml +++ b/.github/workflows/azure-staging-build-deploy.yml @@ -65,10 +65,6 @@ jobs: ref: ${{ env.COMMIT_REF }} # To prevent issues with cloning early access content later persist-credentials: 'false' - lfs: 'true' - - - name: Check out LFS objects - run: git lfs checkout - name: 'Set env vars' run: | diff --git a/.github/workflows/browser-test.yml b/.github/workflows/browser-test.yml index 3befdbd5d673..fcb89286ca72 100644 --- a/.github/workflows/browser-test.yml +++ b/.github/workflows/browser-test.yml @@ -50,11 +50,6 @@ jobs: - name: Checkout uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - lfs: true - - - name: Checkout LFS objects - run: git lfs checkout - name: Setup Node uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 diff --git a/.github/workflows/main-preview-docker-cache.yml b/.github/workflows/main-preview-docker-cache.yml index 2f74edacd0d1..ec2bd3fb0255 100644 --- a/.github/workflows/main-preview-docker-cache.yml +++ b/.github/workflows/main-preview-docker-cache.yml @@ -49,10 +49,6 @@ jobs: with: # To prevent issues with cloning early access content later persist-credentials: 'false' - lfs: 'true' - - - name: Check out LFS objects - run: git lfs checkout - if: ${{ env.ENABLE_EARLY_ACCESS }} name: Clone docs-early-access diff --git a/.github/workflows/repo-sync.yml b/.github/workflows/repo-sync.yml index 68203018b1c7..f50afa22edaf 100644 --- a/.github/workflows/repo-sync.yml +++ b/.github/workflows/repo-sync.yml @@ -100,7 +100,10 @@ jobs: - name: Check out repo uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - # Set up npm and run npm ci to run husky to get githooks for LFS + # Set up npm and run npm ci to get custom husky githooks error + # messages if they exist. We could also remove these two steps + # because currently we have no hooks with customer error messages. + # See pull #32064 where they were removed. - name: Setup node uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2f6f3b897b09..73a7116f104b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -66,15 +66,6 @@ jobs: # Even if if doesn't do anything - name: Check out repo uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - # Not all test suites need the LFS files. So instead, we opt to - # NOT clone them initially and instead, include them manually - # only for the test groups that we know need the files. - lfs: ${{ matrix.test-group == 'content' }} - # Enables cloning the Early Access repo later with the relevant PAT - # persist-credentials: 'false' - # ->> Do we really need this? actions/checkout doesn't use it for the nested example: - # https://github.com/actions/checkout#checkout-multiple-repos-nested - name: Setup node uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 @@ -172,11 +163,6 @@ jobs: token: ${{ secrets.DOCUBOT_REPO_PAT }} path: translations/ko-kr - # This is necessary when LFS files where cloned but does nothing - # if actions/checkout was run with `lfs:false`. - - name: Checkout LFS objects - run: git lfs checkout - - name: Gather files changed env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ec99f2668476..0c8372313f2f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,9 +48,7 @@ For more information about using a codespace for working on GitHub documentation #### Make changes locally -1. [Install Git LFS](https://docs.github.com/en/github/managing-large-files/versioning-large-files/installing-git-large-file-storage). - -2. Fork the repository. +1. Fork the repository. - Using GitHub Desktop: - [Getting started with GitHub Desktop](https://docs.github.com/en/desktop/installing-and-configuring-github-desktop/getting-started-with-github-desktop) will guide you through setting up Desktop. - Once Desktop is set up, you can use it to [fork the repo](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/cloning-and-forking-repositories-from-github-desktop)! @@ -58,9 +56,9 @@ For more information about using a codespace for working on GitHub documentation - Using the command line: - [Fork the repo](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#fork-an-example-repository) so that you can make your changes without affecting the original project until you're ready to merge them. -3. Install or update to **Node.js v16**. For more information, see [the development guide](contributing/development.md). +2. Install or update to **Node.js v16**. For more information, see [the development guide](contributing/development.md). -4. Create a working branch and start with your changes! +3. Create a working branch and start with your changes! ### Commit your update diff --git a/contributing/development.md b/contributing/development.md index b95c9ed627e5..ee88816545ce 100644 --- a/contributing/development.md +++ b/contributing/development.md @@ -10,9 +10,7 @@ It runs on macOS, Windows, and Linux environments. You'll need Node.js version 16 to run the site. To install Node.js, [download the "LTS" installer from nodejs.org](https://nodejs.org). If you're using [`nodenv`](https://github.com/nodenv/nodenv), read the [`nodenv` docs](https://github.com/nodenv/nodenv#readme) for instructions on switching Node.js versions. -You'll want to [install Git LFS](https://docs.github.com/en/github/managing-large-files/versioning-large-files/installing-git-large-file-storage). - -Once you've installed Node.js (which includes the popular `npm` package manager) and Git LFS, open Terminal and run the following: +Once you've installed Node.js (which includes the popular `npm` package manager), open Terminal and run the following: ```sh git clone https://github.com/github/docs diff --git a/lib/search/config.js b/lib/search/config.js index ce43059f8cd1..21ec77955be7 100644 --- a/lib/search/config.js +++ b/lib/search/config.js @@ -1,9 +1,5 @@ export const namePrefix = 'github-docs' -export const maxContentLength = 5000 export default { - // to reduce the size of our enormous search index, we limit the - // content and record size for translated articles - maxContentLength, namePrefix, } diff --git a/script/copy-to-test-repo.sh b/script/copy-to-test-repo.sh index 66fbfbf38d3d..cb605bdf53cc 100755 --- a/script/copy-to-test-repo.sh +++ b/script/copy-to-test-repo.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copies certain directories over to docs-internal-test and pushes. Useful for debugging actions -# Doesn't copy over git lfs files (.json.br), content/, and data/ directories +# Doesn't copy over content/ and data/ directories echo "Make sure to run this script in the root path of docs-internal!" diff --git a/script/search/parse-page-sections-into-records.js b/script/search/parse-page-sections-into-records.js index 9dd09a4a2edb..55061785bc3c 100644 --- a/script/search/parse-page-sections-into-records.js +++ b/script/search/parse-page-sections-into-records.js @@ -1,8 +1,6 @@ #!/usr/bin/env node import { render } from 'cheerio-to-text' -import { maxContentLength } from '../../lib/search/config.js' - // This module takes cheerio page object and divides it into sections // using H1,H2 heading elements as section delimiters. The text // that follows each heading becomes the content of the search record. @@ -10,7 +8,7 @@ import { maxContentLength } from '../../lib/search/config.js' const ignoredHeadingSlugs = ['in-this-article', 'further-reading', 'prerequisites'] export default function parsePageSectionsIntoRecords(page) { - const { href, $, languageCode } = page + const { href, $ } = page const title = $('h1').first().text().trim() const breadcrumbsArray = $('[data-search=breadcrumbs] nav.breadcrumbs a') .map((i, el) => { @@ -81,15 +79,6 @@ export default function parsePageSectionsIntoRecords(page) { console.warn(`${objectID} has no body and no intro.`) } - // These below lines can be deleted (along with the `maxContentLength` - // config) once we've stopped generating Lunr indexes on disk that - // we store as Git LFS. - if (!process.env.ELASTICSEARCH_URL) { - if (languageCode !== 'en' && body.length > maxContentLength) { - body = body.slice(0, maxContentLength) - } - } - const content = intro && !body.includes(intro.trim()) ? `${intro.trim()}\n${body.trim()}`.trim() : body.trim()