From 2cdb5c8b52dc5738df5373f5207810274f543583 Mon Sep 17 00:00:00 2001 From: Andy McKay Date: Mon, 16 Nov 2020 15:33:24 -0800 Subject: [PATCH 01/45] Remove starter workflows from code examples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 👋🏾 This PR removes starter workflows from code examples on the docs page (I think). The workflows are all visible when a user hits the Actions tab and starts a new workflow. But on the way we do a transformation for example `$default-branch` to whatever your default branch is. So they don't work too well. Some of the other things in the actions org might work, although not sure they qualify as good examples for learning from. --- data/variables/action_code_examples.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/data/variables/action_code_examples.yml b/data/variables/action_code_examples.yml index a0f12b0384..b8e1a26447 100644 --- a/data/variables/action_code_examples.yml +++ b/data/variables/action_code_examples.yml @@ -1,10 +1,3 @@ -- title: Starter workflows - description: Workflow files for helping people get started with GitHub Actions - languages: TypeScript - href: actions/starter-workflows - tags: - - official - - workflows - title: Example services description: Example workflows using service containers languages: JavaScript From ff2bf89803ce4cab17406d441a88c231c2c80163 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Fri, 4 Dec 2020 11:22:35 -0500 Subject: [PATCH 02/45] add script --- script/early-access/create-branch | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 script/early-access/create-branch diff --git a/script/early-access/create-branch b/script/early-access/create-branch new file mode 100755 index 0000000000..3afe3a3cf0 --- /dev/null +++ b/script/early-access/create-branch @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +# [start-readme] +# +# This script is run on a writer's machine to create an Early Access branch that matches the current docs-internal branch. +# +# [end-readme] + +set -e + +# Get current branch name +currentBranch=$(git rev-parse --abbrev-ref HEAD) + +if [ $currentBranch == "main" ]; then + echo "You cannot run this script on the 'main' branch. Checkout a new branch first." + exit 0 +fi + +# Go up a directory +pushd .. > /dev/null + +if [ ! -d "docs-early-access" ]; then + echo "A 'docs-early-access' directory does not exist! Run script/early-access/clone-locally first." + popd > /dev/null + exit 0 +fi + +# Navigate to docs-early-access +cd docs-early-access + +# Check out main and update +git checkout main +git pull origin main + +# Creat a branch with the current docs-internal branch name +git checkout -b $currentBranch + +# Go back to the previous working directory +popd > /dev/null + +echo -e "\nDone! Created a branch called ${currentBranch}. Remember to commit your work in ../docs-early-access when you're ready." From ef82435371f6a5b6fe88f760739f97efc3f53908 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Mon, 7 Dec 2020 09:55:24 -0500 Subject: [PATCH 03/45] check repo --- tests/rendering/server.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/rendering/server.js b/tests/rendering/server.js index 4be479a49f..063b76c634 100644 --- a/tests/rendering/server.js +++ b/tests/rendering/server.js @@ -5,6 +5,8 @@ const path = require('path') const nonEnterpriseDefaultVersion = require('../../lib/non-enterprise-default-version') const { loadPages } = require('../../lib/pages') +const describeInternalOnly = process.env.GITHUB_REPOSITORY === 'github/docs-internal' ? describe : describe.skip + describe('server', () => { jest.setTimeout(60 * 1000) @@ -356,7 +358,7 @@ describe('server', () => { }) }) - describe.skip('Early Access articles', () => { + describeInternalOnly('Early Access articles', () => { let hiddenPageHrefs, hiddenPages beforeAll(async (done) => { From 526c05f4ce6f236b5d1aa9c482b8ad8432c76b7f Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Mon, 7 Dec 2020 11:32:39 -0500 Subject: [PATCH 04/45] support hardcoded versions in links --- lib/rewrite-local-links.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/rewrite-local-links.js b/lib/rewrite-local-links.js index 4854a739cd..e0f4a12b1e 100644 --- a/lib/rewrite-local-links.js +++ b/lib/rewrite-local-links.js @@ -2,6 +2,7 @@ const externalRedirects = Object.keys(require('./redirects/external-sites')) const pathUtils = require('./path-utils') const assert = require('assert') const nonEnterpriseDefaultVersion = require('./non-enterprise-default-version') +const supportedPlans = Object.values(require('./all-versions')).map(v => v.plan) // Content authors write links like `/some/article/path`, but they need to be // rewritten on the fly to match the current language and page version @@ -24,9 +25,17 @@ function getNewHref (link, languageCode, version) { // e.g. `/contact` should not be replaced with `/en/contact` if (externalRedirects.includes(href)) return + let newHref + + // If the link has a hardcoded plan name in it (e.g., /enterprise-server/rest/reference/oauth-authorizations), + // only rewrite it with a language code + if (supportedPlans.includes(href.split('/')[1])) { + newHref = pathUtils.getPathWithLanguage(href, languageCode) + } + // If link is dotcom-only, just get the language code // Otherwise, get the versioned path with language code - const newHref = link.hasClass('dotcom-only') + if (!newHref) newHref = link.hasClass('dotcom-only') ? pathUtils.getVersionedPathWithLanguage(href, nonEnterpriseDefaultVersion, languageCode) : pathUtils.getVersionedPathWithLanguage(href, version, languageCode) From ba2ebcfb30fb4b72da61dcacbf8ef7a14afb3ddf Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Mon, 7 Dec 2020 11:32:55 -0500 Subject: [PATCH 05/45] remove version number and leave plan name in Enterprise link --- content/rest/overview/troubleshooting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/rest/overview/troubleshooting.md b/content/rest/overview/troubleshooting.md index 0a22fab27b..a430cfd7be 100644 --- a/content/rest/overview/troubleshooting.md +++ b/content/rest/overview/troubleshooting.md @@ -63,7 +63,7 @@ curl -H 'Authorization: token my-oauth-token' https://api.github.com/user/repos #### Calls to OAuth Authorizations API -If you're making [OAuth Authorization API](/enterprise-server@2.22/rest/reference/oauth-authorizations) calls to manage your OAuth app's authorizations or to generate access tokens, similar to this example: +If you're making [OAuth Authorization API](/enterprise-server/rest/reference/oauth-authorizations) calls to manage your OAuth app's authorizations or to generate access tokens, similar to this example: ```bash curl -u my_username:my_password -X POST "https://api.github.com/authorizations" -d '{"scopes":["public_repo"], "note":"my token", "client_id":"my_client_id", "client_secret":"my_client_secret"}' From 797911dee334995e616a6c0fd7a60a0eedeb229c Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Mon, 7 Dec 2020 16:17:38 -0500 Subject: [PATCH 06/45] make Early Access banner more prominent --- data/ui.yml | 2 +- includes/header-notification.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/ui.yml b/data/ui.yml index d144567335..32a89f27d7 100644 --- a/data/ui.yml +++ b/data/ui.yml @@ -17,7 +17,7 @@ header: still in translation. For the most up-to-date and accurate information, please visit our English documentation. - early_access: 👋 This page contains content about an early access feature. Please do not share this URL publicly. + early_access: 📣 Please do not share this URL publicly. This page contains content about an early access feature. search: need_help: Need help? placeholder: Search topics, products... diff --git a/includes/header-notification.html b/includes/header-notification.html index 7c65d65ba3..ed50ce780c 100644 --- a/includes/header-notification.html +++ b/includes/header-notification.html @@ -49,7 +49,7 @@ {% endif %} {% if early_access_notification_type %} -
+
{{ early_access_notification }}
{% endif %} \ No newline at end of file From dc38acdde8dd5594fcca412077a17773628e6ac6 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Mon, 7 Dec 2020 16:18:03 -0500 Subject: [PATCH 07/45] support custom Early Access breadcrumbs --- includes/breadcrumbs.html | 4 +- middleware/breadcrumbs.js | 5 +- .../contextualizers/early-access-links.js | 6 +- middleware/early-access-breadcrumbs.js | 67 +++++++++++++++++++ middleware/index.js | 1 + stylesheets/article.scss | 2 +- 6 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 middleware/early-access-breadcrumbs.js diff --git a/includes/breadcrumbs.html b/includes/breadcrumbs.html index 6d56072949..47dc43c17a 100644 --- a/includes/breadcrumbs.html +++ b/includes/breadcrumbs.html @@ -1,7 +1,7 @@