1
0
mirror of synced 2025-12-19 18:10:59 -05:00

remove LFS from codebase (#33777)

This commit is contained in:
Rachael Sewell
2023-01-06 10:57:36 -08:00
committed by GitHub
parent fbfc550011
commit 8c20a9caae
13 changed files with 12 additions and 61 deletions

View File

@@ -17,7 +17,6 @@
// Install features. Type 'feature' in the VS Code command palette for a full list. // Install features. Type 'feature' in the VS Code command palette for a full list.
"features": { "features": {
"git-lfs": "latest",
"sshd": "latest" "sshd": "latest"
}, },
@@ -42,7 +41,7 @@
}, },
// Use 'postCreateCommand' to run commands after the container is created. // 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. // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node" "remoteUser": "node"

View File

@@ -101,7 +101,7 @@ This file should be automatically updated, but you can also run `script/update-e
### 🚢 🛳️ 🚢 Shipping the release branch ### 🚢 🛳️ 🚢 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-<PLAN@RELEASE>` 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). 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. 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: 3. A modal will pop up where you will set the following inputs:

View File

@@ -91,7 +91,6 @@ jobs:
with: with:
ref: 'main' ref: 'main'
persist-credentials: 'false' persist-credentials: 'false'
lfs: 'true'
- if: ${{ env.IS_INTERNAL_BUILD == 'true' }} - if: ${{ env.IS_INTERNAL_BUILD == 'true' }}
name: Check out PR code name: Check out PR code
@@ -100,10 +99,6 @@ jobs:
ref: ${{ env.COMMIT_REF }} ref: ${{ env.COMMIT_REF }}
# To prevent issues with cloning early access content later # To prevent issues with cloning early access content later
persist-credentials: 'false' persist-credentials: 'false'
lfs: 'true'
- name: Check out LFS objects
run: git lfs checkout
- name: Get preview app info - name: Get preview app info
env: env:

View File

@@ -65,10 +65,6 @@ jobs:
ref: ${{ env.COMMIT_REF }} ref: ${{ env.COMMIT_REF }}
# To prevent issues with cloning early access content later # To prevent issues with cloning early access content later
persist-credentials: 'false' persist-credentials: 'false'
lfs: 'true'
- name: Check out LFS objects
run: git lfs checkout
- name: 'Set env vars' - name: 'Set env vars'
run: | run: |

View File

@@ -50,11 +50,6 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
lfs: true
- name: Checkout LFS objects
run: git lfs checkout
- name: Setup Node - name: Setup Node
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516

View File

@@ -49,10 +49,6 @@ jobs:
with: with:
# To prevent issues with cloning early access content later # To prevent issues with cloning early access content later
persist-credentials: 'false' persist-credentials: 'false'
lfs: 'true'
- name: Check out LFS objects
run: git lfs checkout
- if: ${{ env.ENABLE_EARLY_ACCESS }} - if: ${{ env.ENABLE_EARLY_ACCESS }}
name: Clone docs-early-access name: Clone docs-early-access

View File

@@ -100,7 +100,10 @@ jobs:
- name: Check out repo - name: Check out repo
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 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 - name: Setup node
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with: with:

View File

@@ -66,15 +66,6 @@ jobs:
# Even if if doesn't do anything # Even if if doesn't do anything
- name: Check out repo - name: Check out repo
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 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 - name: Setup node
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
@@ -172,11 +163,6 @@ jobs:
token: ${{ secrets.DOCUBOT_REPO_PAT }} token: ${{ secrets.DOCUBOT_REPO_PAT }}
path: translations/ko-kr 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 - name: Gather files changed
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -48,9 +48,7 @@ For more information about using a codespace for working on GitHub documentation
#### Make changes locally #### Make changes locally
1. [Install Git LFS](https://docs.github.com/en/github/managing-large-files/versioning-large-files/installing-git-large-file-storage). 1. Fork the repository.
2. Fork the repository.
- Using GitHub Desktop: - 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. - [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)! - 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: - 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. - [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 ### Commit your update

View File

@@ -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 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), open Terminal and run the following:
Once you've installed Node.js (which includes the popular `npm` package manager) and Git LFS, open Terminal and run the following:
```sh ```sh
git clone https://github.com/github/docs git clone https://github.com/github/docs

View File

@@ -1,9 +1,5 @@
export const namePrefix = 'github-docs' export const namePrefix = 'github-docs'
export const maxContentLength = 5000
export default { export default {
// to reduce the size of our enormous search index, we limit the
// content and record size for translated articles
maxContentLength,
namePrefix, namePrefix,
} }

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Copies certain directories over to docs-internal-test and pushes. Useful for debugging actions # 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!" echo "Make sure to run this script in the root path of docs-internal!"

View File

@@ -1,8 +1,6 @@
#!/usr/bin/env node #!/usr/bin/env node
import { render } from 'cheerio-to-text' import { render } from 'cheerio-to-text'
import { maxContentLength } from '../../lib/search/config.js'
// This module takes cheerio page object and divides it into sections // This module takes cheerio page object and divides it into sections
// using H1,H2 heading elements as section delimiters. The text // using H1,H2 heading elements as section delimiters. The text
// that follows each heading becomes the content of the search record. // 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'] const ignoredHeadingSlugs = ['in-this-article', 'further-reading', 'prerequisites']
export default function parsePageSectionsIntoRecords(page) { export default function parsePageSectionsIntoRecords(page) {
const { href, $, languageCode } = page const { href, $ } = page
const title = $('h1').first().text().trim() const title = $('h1').first().text().trim()
const breadcrumbsArray = $('[data-search=breadcrumbs] nav.breadcrumbs a') const breadcrumbsArray = $('[data-search=breadcrumbs] nav.breadcrumbs a')
.map((i, el) => { .map((i, el) => {
@@ -81,15 +79,6 @@ export default function parsePageSectionsIntoRecords(page) {
console.warn(`${objectID} has no body and no intro.`) 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 = const content =
intro && !body.includes(intro.trim()) ? `${intro.trim()}\n${body.trim()}`.trim() : body.trim() intro && !body.includes(intro.trim()) ? `${intro.trim()}\n${body.trim()}`.trim() : body.trim()