Skip to content

Commit

Permalink
Migrate early access files to src (#38711)
Browse files Browse the repository at this point in the history
undefined
  • Loading branch information
heiskr authored Jul 10, 2023
1 parent b236eaa commit 18978d2
Show file tree
Hide file tree
Showing 18 changed files with 26 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/actions/get-docs-early-access/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ runs:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
GITHUB_TOKEN: ${{ inputs.token }}
shell: bash
run: node .github/actions-scripts/what-docs-early-access-branch.js
run: node src/early-access/scripts/what-docs-early-access-branch.js

- name: Clone
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
Expand All @@ -29,5 +29,5 @@ runs:
- name: Merge docs-early-access repo's folders
shell: bash
run: |
.github/actions-scripts/merge-early-access.sh
src/early-access/scripts/merge-early-access.sh
rm -fr docs-early-access
2 changes: 1 addition & 1 deletion .github/workflows/azure-preview-env-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ jobs:

- if: ${{ env.IS_INTERNAL_BUILD == 'true' }}
name: Merge docs-early-access repo's folders
run: .github/actions-scripts/merge-early-access.sh
run: src/early-access/scripts/merge-early-access.sh

- name: Determine if we should include translations?
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/azure-prod-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
path: docs-early-access

- name: Merge docs-early-access repo's folders
run: .github/actions-scripts/merge-early-access.sh
run: src/early-access/scripts/merge-early-access.sh

- uses: ./.github/actions/warmup-remotejson-cache
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/azure-staging-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
ref: main

- name: Merge docs-early-access repo's folders
run: .github/actions-scripts/merge-early-access.sh
run: src/early-access/scripts/merge-early-access.sh

- name: 'Build and push image'
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/link-check-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_READPUBLICKEY }}
run: node .github/actions-scripts/what-docs-early-access-branch.js
run: node src/early-access/scripts/what-docs-early-access-branch.js

- name: Check out docs-early-access too, if internal repo
if: ${{ github.repository == 'github/docs-internal' }}
Expand All @@ -46,7 +46,7 @@ jobs:

- name: Merge docs-early-access repo's folders
if: ${{ github.repository == 'github/docs-internal' }}
run: .github/actions-scripts/merge-early-access.sh
run: src/early-access/scripts/merge-early-access.sh

- name: Restore disk-cache file for external link checking
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main-preview-docker-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:

- if: ${{ env.ENABLE_EARLY_ACCESS }}
name: Merge docs-early-access repo's folders
run: .github/actions-scripts/merge-early-access.sh
run: src/early-access/scripts/merge-early-access.sh

# In addition to making the final image smaller, we also save time by not sending unnecessary files to the docker build context
- name: 'Prune for preview env'
Expand Down
2 changes: 1 addition & 1 deletion middleware/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import remoteIP from './remote-ip.js'
import buildInfo from './build-info.js'
import archivedEnterpriseVersions from './archived-enterprise-versions.js'
import robots from './robots.js'
import earlyAccessLinks from './contextualizers/early-access-links.js'
import earlyAccessLinks from '#src/early-access/middleware/early-access-links.js'
import categoriesForSupport from './categories-for-support.js'
import triggerError from '#src/observability/middleware/trigger-error.js'
import secretScanning from './contextualizers/secret-scanning.js'
Expand Down
3 changes: 3 additions & 0 deletions src/early-access/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Early access

Early access allows the Docs team to publish docs to docs.github.com without putting the content files in github/docs or github/docs-internal. This allows the Docs team to publish articles about limited access features.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ git clone [email protected]:github/docs-early-access.git
popd > /dev/null

# Symlink the local docs-early-access repo into this repo
node script/early-access/symlink-from-local-repo.js -p ../docs-early-access
node src/early-access/scripts/symlink-from-local-repo.js -p ../docs-early-access

echo -e '\nDone!'
echo -e '\nDone!'
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import yaml from 'js-yaml'
import { last } from 'lodash-es'
import { program } from 'commander'
import { execFileSync } from 'child_process'
import frontmatter from '../../lib/read-frontmatter.js'
import patterns from '../../lib/patterns.js'
import addRedirectToFrontmatter from '../helpers/add-redirect-to-frontmatter.js'
import walkFiles from '../helpers/walk-files.js'
import frontmatter from '../../../lib/read-frontmatter.js'
import patterns from '../../../lib/patterns.js'
import addRedirectToFrontmatter from '../../../script/helpers/add-redirect-to-frontmatter.js'
import walkFiles from '../../../script/helpers/walk-files.js'

const contentFiles = walkFiles('content', '.md', { includeEarlyAccess: true })
const contentDir = path.posix.join(process.cwd(), 'content')
Expand Down Expand Up @@ -58,7 +58,7 @@ const migratePath = path.posix.join(contentDir, newPathId)

// 1. Update the image and data refs in the to-be-migrated early access files BEFORE moving them.
try {
execFileSync('script/early-access/update-data-and-image-paths.js', [
execFileSync('src/early-access/scripts/update-data-and-image-paths.js', [
'-p',
`content/${oldPathId}`,
'--remove',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import fs from 'fs'
import path from 'path'
import { program } from 'commander'
import walkFiles from '../helpers/walk-files.js'
import walkFiles from '../../../script/helpers/walk-files.js'
import { escapeRegExp } from 'lodash-es'
import patterns from '../../lib/patterns.js'
import patterns from '../../../lib/patterns.js'

program
.description('Update data and image paths.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import path from 'path'

import { expect } from '@jest/globals'

import { testViaActionsOnly } from '../helpers/conditional-runs.js'
import { get, getDOM } from '../helpers/e2etest.js'
import { testViaActionsOnly } from '../../../tests/helpers/conditional-runs.js'
import { get, getDOM } from '../../../tests/helpers/e2etest.js'

describe('cloning early-access', () => {
testViaActionsOnly('the content directory exists', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect, jest, test } from '@jest/globals'
import { get, getDOM } from '../helpers/e2etest.js'
import { get, getDOM } from '../../../tests/helpers/e2etest.js'

import { describeIfDocsEarlyAccess } from '../helpers/conditional-runs.js'
import languages from '../../lib/languages.js'
import { describeIfDocsEarlyAccess } from '../../../tests/helpers/conditional-runs.js'
import languages from '../../../lib/languages.js'

const VALID_EARLY_ACCESS_URI = '/early-access/github/save-time-with-slash-commands'

Expand Down

0 comments on commit 18978d2

Please sign in to comment.