docs/script
Peter Bengtsson 5d7973b928
make PR about deletable orphan assets (#26484)
* warn on orphan images

* oops

* temporarily adding orphan image

* fix the bug

* permission

* better comment

* try this

* try this

* debugging

* debugging

* using fs

* cjs

* remove experiment image

* debugging

* debugging

* try that

* try that

* git config

* cleaning

* token

* body

* label

* try that

* try that

* try that

* not upstream

* try that

* token twice

* try again

* cleaning up

* fix unit test

* one more exception

* feedbacked
2022-03-30 11:56:18 -04:00
..
content-migrations remove update-short-titles-from-csv.js (#25129) 2022-02-08 21:05:05 +00:00
deployment Remove most of Heroku references (#25208) 2022-02-10 17:36:07 -06:00
early-access Remove most of Heroku references (#25208) 2022-02-10 17:36:07 -06:00
enterprise-server-deprecations move 'website-scraper' to optional dependencies (#24651) 2022-01-26 16:50:13 +00:00
enterprise-server-releases
graphql Bump @graphql-inspector/core from 2.9.0 to 3.1.1 (#25384) 2022-02-22 23:08:35 +00:00
helpers sleep longer and more when code searching (#24385) 2022-01-18 20:08:52 +00:00
i18n move 'bottleneck' to optional dependencies (#24829) 2022-01-31 18:30:38 +00:00
rest Move deploy keys from deployments to keys in rest pages (#26166) 2022-03-17 17:25:12 +00:00
search remove need for 'count-array-values' (#24867) 2022-02-01 21:27:47 +00:00
README.md delete old deploy.js script (#24862) 2022-02-08 16:11:11 +00:00
anonymize-branch.js
backfill-missing-localizations.js Bump @babel/eslint-parser from 7.16.0 to 7.16.3 (#22751) 2021-11-12 16:35:11 +00:00
bootstrap
check-english-links.js mention about false positives (#24864) 2022-02-01 16:33:49 +00:00
check-for-node
check-github-github-links.js update check-github-github-links.js to ignore specific link path (#22479) 2021-10-29 04:44:10 +00:00
create-glossary-from-spreadsheet.js
find-orphaned-assets.mjs make PR about deletable orphan assets (#26484) 2022-03-30 11:56:18 -04:00
get-new-dotcom-path.js
kill-server-for-jest.mjs automatically start server for jest (#26206) 2022-03-18 21:46:07 +00:00
list-image-sizes.js move 'image-size' to optional dependencies (#24670) 2022-01-26 19:50:01 +00:00
migrate-colors-primer-18.js Primer 18 b (#22462) 2021-10-28 19:17:23 +00:00
move-category-to-product.js
move-content.mjs CLI tool to rename file or tree (#25306) 2022-03-18 20:44:43 +00:00
move-reusables-to-markdown.js
package.json
pages-with-liquid-titles.js
prevent-pushes-to-main.js
prevent-translation-commits.js
purge-fastly
purge-fastly-by-url.js
reconcile-category-dirs-with-ids.js
reconcile-filenames-with-ids.js
remove-unused-assets.js
rendered-content-link-checker.mjs Decouple redirects from language (#24597) 2022-02-14 20:19:10 +00:00
sample-unix-commands.md
server
server-all-languages
server-for-jest.mjs automatically start server for jest (#26206) 2022-03-18 21:46:07 +00:00
standardize-frontmatter-order.js
start-server-for-jest.mjs automatically start server for jest (#26206) 2022-03-18 21:46:07 +00:00
sync-search-indices.js
test
todo
toggle-ghae-feature-flags.js
update-enterprise-dates.js
update-internal-links.js Decouple redirects from language (#24597) 2022-02-14 20:19:10 +00:00
update-readme.js

README.md

Scripts

Scripts to rule them all

This directory follows the Scripts to Rule Them All pattern:

bootstrap

Installs/updates all dependencies necessary for the docs environment. Equivalent of npm install.


server

Starts the local development server. Equivalent of npm start.

To keep things snappy, only English and Japanese are enabled. To run the server with all languages enabled, run script/server-all-languages


test

Runs tests. Equivalent of npm test.


Additional scripts

anonymize-branch.js

Flatten all the commits in the current branch into a single anonymized @Octomerger commit

Usage: script/anonymize-branch.js [base-branch] Example: script/anonymize-branch.js "nothing to see here" If the optional [base-branch] argument is omitted, it will default to main


backfill-missing-localizations.js

This script copies any English files that are missing from the translations directory into the translations directory. We only need to run this if problems occur with Crowdin's automatic sync.


check-english-links.js

This script runs once per day via a scheduled GitHub Action to check all links in English content, not including deprecated Enterprise Server content. It opens an issue if it finds broken links. To exclude a link path, add it to lib/excluded-links.js.


check-for-node

This script is run automatically when you run the server locally. It checks whether Node.js is installed.


content-migrations/extended-markdown-tags.js


content-migrations/octicon-tag.js


content-migrations/remove-html-comments-from-index-files.js


content-migrations/site-data-tag.js


content-migrations/update-developer-site-links.js


create-glossary-from-spreadsheet.js

This script turns a Google Sheets CSV spreadsheet into a YAML file.


early-access/clone-for-build.js

This script is run as a postbuild script during staging and deployments on Heroku. It clones a branch in the early-access repo that matches the current branch in the docs repo; if one can't be found, it clones the main branch.


early-access/clone-locally

This script is run on a writer's machine to begin developing Early Access content locally.


early-access/create-branch

This script is run on a writer's machine to create an Early Access branch that matches the current docs-internal branch.


This script is run on a writer's machine while developing Early Access content locally. You must pass the script the location of your local copy of the github/docs-early-access git repo as the first argument.


early-access/update-data-and-image-paths.js

This script is run on a writer's machine while developing Early Access content locally. It updates the data and image paths to either include early-access or remove it.


enterprise-server-deprecations/archive-version.js

Run this script during the Enterprise deprecation process to download static copies of all pages for the oldest supported Enterprise version. See the Enterprise deprecation issue template for instructions.


enterprise-server-deprecations/remove-static-files.js

This script removes the static GraphQL, REST, and webhook files for any deprecated GHES versions.


enterprise-server-deprecations/remove-version-markup.js

Run this script after an Enterprise deprecation to remove Liquid statements and frontmatter that contain the deprecated Enterprise version. See the Enterprise deprecation issue template for instructions.


enterprise-server-releases/create-graphql-files.js

This script creates the static GraphQL files for a new version.


enterprise-server-releases/create-rest-files.js

This script creates new static openAPI files for a new version and modifies the info.version.


enterprise-server-releases/create-webhook-files.js

This script creates new static webhook payload files for a new version.


enterprise-server-releases/ghes-to-ghae-versioning.js

Run this script to add versions frontmatter and Liquid conditionals for GitHub AE, based on anything currently versioned for the provided release of Enterprise Server. This script should be run as part of the Enterprise Server release process.


enterprise-server-releases/release-banner.js

This script creates or removes a release candidate banner for a specified version.


get-new-dotcom-path.js

Pass this script any old dotcom path (e.g., articles/foo or foo.md) and it will output the new path in the content/github directory.


get-new-version-path.js

Helper script that returns a "new" versioned path given an "old" versioned path.

Examples:

Given: /github/getting-started-with-github/using-github Returns: /free-pro-team@latest/github/getting-started-with-github/using-github

Given: /enterprise/admin/installation/upgrading-github-enterprise Returns: /enterprise-server@2.22/admin/installation/upgrading-github-enterprise


graphql/build-changelog.js


graphql/update-files.js


graphql/utils/data-filenames.json


graphql/utils/prerender-objects.js


graphql/utils/process-previews.js


graphql/utils/process-schemas.js


graphql/utils/process-upcoming-changes.js


graphql/utils/schema-helpers.js


list-image-sizes.js

This script lists all local image files, sorted by their dimensions.


move-category-to-product.js

Pass this script three arguments: 1. current category path (e.g., github/automating-your-workflows-with-github-actions) 2. new product ID (e.g., actions) 3. new product name in quotes (e.g., "GitHub Actions") and it does everything that needs to be done to make the category into a new product.


move-reusables-to-markdown.js

This script moves reusables out of YAML files into individual Markdown files.


pages-with-liquid-titles.js

This is a temporary script to visualize which pages have liquid (and conditionals) in their title frontmatter


ping-staging-apps.js

This script finds all Heroku staging apps and pings them to make sure they're always "warmed" and responsive to requests.


prevent-pushes-to-main.js

This script is intended to be used as a git "prepush" hook. If the current branch is main, it will exit unsuccessfully and prevent the push.


prevent-translation-commits.js

This script is run as a git precommit hook (installed by husky after npm install). It detects changes to files the in the translations folder and prevents the commit if any changes exist.


purge-fastly

Run this script to manually purge the Fastly cache. Note this script requires a FASTLY_SERVICE_ID and FASTLY_TOKEN in your .env file.


purge-fastly-by-url.js

Run this script to manually purge the Fastly cache for all language variants of a single URL or for a batch of URLs in a file. This script does not require authentication.


reconcile-category-dirs-with-ids.js

An automated test checks for discrepancies between category directory names and slugified category titles as IDs.

If the test fails, a human needs to run this script to update the directory names and add appropriate redirects.

This script is not currently supported on Windows.


reconcile-filenames-with-ids.js

An automated test checks for discrepancies between filenames and autogenerated heading IDs. If the test fails, a human needs to run this script to update the filenames.

This script is not currently supported on Windows.


remove-stale-staging-apps.js

This script removes all stale Heroku staging apps that outlasted the closure of their corresponding pull requests, or correspond to spammy pull requests.


remove-unused-assets.js

Run this script to remove reusables and image files that exist in the repo but are not used in content files. It also displays a list of unused variables. Set the --dry-run to flag to print results without deleting any files. For images you don't want to delete, add them to ignoreList in lib/find-unused-assets.js


reset-translated-file.js

This is a convenience script for replacing the contents of translated files with the English content from their corresponding source file.

It's intended to be a workaround to temporarily bypass Crowdin parser bugs while we wait for translators to fix them.

Usage: script/i18n/reset-translated-file.js

Examples:

reset a single translated file using a relative path: $ script/i18n/reset-translated-file.js translations/es-XL/content/actions/index.md

reset a single translated file using a full path: $ script/i18n/reset-translated-file.js /Users/z/git/github/docs-internal/translations/es-XL/content/actions/index.md

reset all language variants of a single English file (using a relative path): script/i18n/reset-translated-file.js content/actions/index.md script/i18n/reset-translated-file.js data/ui.yml

reset all language variants of a single English file (using a full path): script/i18n/reset-translated-file.js /Users/z/git/github/docs-internal/content/desktop/index.md script/i18n/reset-translated-file.js /Users/z/git/github/docs-internal/data/ui.yml


rest/update-files.js

Run this script to pull openAPI files from github/github, dereference them, and decorate them.


rest/utils/create-code-samples.js


rest/utils/get-operations.js


rest/utils/operation-schema.js


rest/utils/operation.js


sample-unix-commands.md


server-all-languages

Starts the local development server with all of the available languages enabled.


standardize-frontmatter-order.js

Run this script to standardize frontmatter fields in all content files, per the order: - title - intro - product callout - productVersion - map topic status - hidden status - layout - redirect


sync-search-indices.js

This script is run on a schedule every four hours to generate searchable data. It can also be run manually. To run it manually, click "Run workflow" button in the Actions tab. For more info see contributing/search.md


todo

List all the TODOs in our JavaScript files and stylesheets.


update-enterprise-dates.js

This script fetches data from https://github.com/github/enterprise-releases/blob/master/releases.json and updates lib/enterprise-dates.json, which the site uses for various functionality.


update-readme.js

This script crawls the script directory, hooks on special comment markers in each script, and adds the comment to script/README.md.


update-versioning-in-files.js