Skip to content

Commit

Permalink
remove LFS from codebase (github#33777)
Browse files Browse the repository at this point in the history
  • Loading branch information
rachmari authored Jan 6, 2023
1 parent fbfc550 commit 8c20a9c
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 61 deletions.
3 changes: 1 addition & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

// Install features. Type 'feature' in the VS Code command palette for a full list.
"features": {
"git-lfs": "latest",
"sshd": "latest"
},

Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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-<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).
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:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/azure-preview-env-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ jobs:
with:
ref: 'main'
persist-credentials: 'false'
lfs: 'true'

- if: ${{ env.IS_INTERNAL_BUILD == 'true' }}
name: Check out PR code
Expand All @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/azure-staging-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/browser-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/main-preview-docker-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/repo-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down
8 changes: 3 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,17 @@ 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)!

- 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

Expand Down
4 changes: 1 addition & 3 deletions contributing/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions lib/search/config.js
Original file line number Diff line number Diff line change
@@ -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,
}
2 changes: 1 addition & 1 deletion script/copy-to-test-repo.sh
Original file line number Diff line number Diff line change
@@ -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!"

Expand Down
13 changes: 1 addition & 12 deletions script/search/parse-page-sections-into-records.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#!/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.

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) => {
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 8c20a9c

Please sign in to comment.