diff --git a/.github/actions-scripts/content-changes-table-comment.js b/.github/actions-scripts/content-changes-table-comment.js index 9e4e77960f..318fd9e96e 100755 --- a/.github/actions-scripts/content-changes-table-comment.js +++ b/.github/actions-scripts/content-changes-table-comment.js @@ -28,50 +28,58 @@ const MAX_COMMENT_SIZE = 125000 const PROD_URL = 'https://docs.github.com' -run() +// When this file is invoked directly from action as opposed to being imported +if (import.meta.url.endsWith(process.argv[1])) { + const owner = context.repo.owner + const repo = context.payload.repository.name + const baseSHA = context.payload.pull_request.base.sha + const headSHA = context.payload.pull_request.head.sha -async function run() { const isHealthy = await waitUntilUrlIsHealthy(new URL('/healthz', APP_URL).toString()) if (!isHealthy) { - return core.setFailed(`Timeout waiting for preview environment: ${APP_URL}`) + core.setFailed(`Timeout waiting for preview environment: ${APP_URL}`) + } else { + const markdownTable = await main(owner, repo, baseSHA, headSHA) + core.setOutput('changesTable', markdownTable) } +} +async function main(owner, repo, baseSHA, headSHA) { const octokit = github.getOctokit(GITHUB_TOKEN) // get the list of file changes from the PR const response = await octokit.rest.repos.compareCommitsWithBasehead({ - owner: context.repo.owner, - repo: context.payload.repository.name, - basehead: `${context.payload.pull_request.base.sha}...${context.payload.pull_request.head.sha}`, + owner, + repo, + basehead: `${baseSHA}...${headSHA}`, }) const { files } = response.data - let markdownTable = - '| **Source** | **Preview** | **Production** | **What Changed** |\n|:----------- |:----------- |:----------- |:----------- |\n' + const markdownTableHead = [ + '| **Source** | **Preview** | **Production** | **What Changed** |', + '|:----------- |:----------- |:----------- |:----------- |', + ] + let markdownTable = '' const pathPrefix = 'content/' - const articleFiles = files.filter( - ({ filename }) => filename.startsWith(pathPrefix) && !filename.endsWith('/index.md') - ) + const articleFiles = files.filter(({ filename }) => filename.startsWith(pathPrefix)) const lines = await Promise.all( articleFiles.map(async (file) => { const sourceUrl = file.blob_url const fileName = file.filename.slice(pathPrefix.length) - const fileUrl = fileName.slice(0, fileName.lastIndexOf('.')) + const fileUrl = fileName.replace('/index.md', '').replace(/\.md$/, '') // get the file contents and decode them // this script is called from the main branch, so we need the API call to get the contents from the branch, instead const fileContents = await getContents( - context.repo.owner, - context.payload.repository.name, + owner, + repo, // Can't get its content if it no longer exists. // Meaning, you'd get a 404 on the `getContents()` utility function. // So, to be able to get necessary meta data about what it *was*, // if it was removed, fall back to the 'base'. - file.status === 'removed' - ? context.payload.pull_request.base.sha - : context.payload.pull_request.head.sha, + file.status === 'removed' ? baseSHA : headSHA, file.filename ) @@ -164,7 +172,13 @@ async function run() { return previous }, markdownTable.length) + if (cappedLines.length) { + cappedLines.unshift(...markdownTableHead) + } + markdownTable += cappedLines.join('\n') - core.setOutput('changesTable', markdownTable) + return markdownTable } + +export default main diff --git a/.github/actions/clone-translations/action.yml b/.github/actions/clone-translations/action.yml new file mode 100644 index 0000000000..a0bbab893e --- /dev/null +++ b/.github/actions/clone-translations/action.yml @@ -0,0 +1,67 @@ +name: Clone translations + +description: Clone all remote translations so they're available + +inputs: + token: + description: PAT + required: true + +runs: + using: 'composite' + steps: + - name: Clone Simplified Chinese + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + repository: github/docs-internal.zh-cn + token: ${{ inputs.token }} + path: translations/zh-cn + + - name: Clone Japanese + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + repository: github/docs-internal.ja-jp + token: ${{ inputs.token }} + path: translations/ja-jp + + - name: Clone Spanish + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + repository: github/docs-internal.es-es + token: ${{ inputs.token }} + path: translations/es-es + + - name: Clone Portuguese + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + repository: github/docs-internal.pt-br + token: ${{ inputs.token }} + path: translations/pt-br + + - name: Clone German + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + repository: github/docs-internal.de-de + token: ${{ inputs.token }} + path: translations/de-de + + - name: Clone French + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + repository: github/docs-internal.fr-fr + token: ${{ inputs.token }} + path: translations/fr-fr + + - name: Clone Russian + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + repository: github/docs-internal.ru-ru + token: ${{ inputs.token }} + path: translations/ru-ru + + - name: Clone Korean + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + repository: github/docs-internal.ko-kr + token: ${{ inputs.token }} + path: translations/ko-kr diff --git a/.github/workflows/azure-prod-build-deploy.yml b/.github/workflows/azure-prod-build-deploy.yml index de30d69477..c4a3be7c09 100644 --- a/.github/workflows/azure-prod-build-deploy.yml +++ b/.github/workflows/azure-prod-build-deploy.yml @@ -71,61 +71,9 @@ jobs: - name: Merge docs-early-access repo's folders run: .github/actions-scripts/merge-early-access.sh - - name: Clone Simplified Chinese - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - uses: ./.github/actions/clone-translations with: - repository: github/docs-internal.zh-cn token: ${{ secrets.DOCUBOT_REPO_PAT }} - path: translations/zh-cn - - - name: Clone Japanese - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - repository: github/docs-internal.ja-jp - token: ${{ secrets.DOCUBOT_REPO_PAT }} - path: translations/ja-jp - - - name: Clone Spanish - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - repository: github/docs-internal.es-es - token: ${{ secrets.DOCUBOT_REPO_PAT }} - path: translations/es-es - - - name: Clone Portuguese - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - repository: github/docs-internal.pt-br - token: ${{ secrets.DOCUBOT_REPO_PAT }} - path: translations/pt-br - - - name: Clone German - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - repository: github/docs-internal.de-de - token: ${{ secrets.DOCUBOT_REPO_PAT }} - path: translations/de-de - - - name: Clone French - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - repository: github/docs-internal.fr-fr - token: ${{ secrets.DOCUBOT_REPO_PAT }} - path: translations/fr-fr - - - name: Clone Russian - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - repository: github/docs-internal.ru-ru - token: ${{ secrets.DOCUBOT_REPO_PAT }} - path: translations/ru-ru - - - name: Clone Korean - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - repository: github/docs-internal.ko-kr - token: ${{ secrets.DOCUBOT_REPO_PAT }} - path: translations/ko-kr - name: 'Build and push image' uses: docker/build-push-action@1cb9d22b932e4832bb29793b7777ec860fc1cde0 @@ -194,13 +142,8 @@ jobs: run: | az webapp deployment slot swap --slot canary --target-slot production -n ghdocs-prod -g docs-prod - send-slack-notification-on-failure: - needs: [azure-prod-build-and-deploy] - runs-on: ubuntu-latest - if: ${{ failure() }} - steps: - name: Send Slack notification if workflow failed - uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340 + uses: someimportantcompany/github-actions-slack-message@1d367080235edfa53df415bd8e0bbab480f29bad if: ${{ failure() }} with: channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }} diff --git a/.github/workflows/confirm-internal-staff-work-in-docs.yml b/.github/workflows/confirm-internal-staff-work-in-docs.yml index 81fa3788b5..3e8a070780 100644 --- a/.github/workflows/confirm-internal-staff-work-in-docs.yml +++ b/.github/workflows/confirm-internal-staff-work-in-docs.yml @@ -74,7 +74,7 @@ jobs: - name: Send Slack notification if a GitHub employee who isn't on the docs team opens an issue in public if: ${{ steps.membership_check.outputs.did_warn && github.repository == 'github/docs' }} - uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340 + uses: someimportantcompany/github-actions-slack-message@1d367080235edfa53df415bd8e0bbab480f29bad with: channel: ${{ secrets.DOCS_OPEN_SOURCE_SLACK_CHANNEL_ID }} bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }} diff --git a/.github/workflows/content-changes-table-comment.yml b/.github/workflows/content-changes-table-comment.yml index e3a3f0cec0..8c21198c17 100644 --- a/.github/workflows/content-changes-table-comment.yml +++ b/.github/workflows/content-changes-table-comment.yml @@ -83,6 +83,7 @@ jobs: body-includes: '' - name: Update comment + if: ${{ steps.changes.outputs.changesTable != '' }} uses: peter-evans/create-or-update-comment@c9fcb64660bc90ec1cc535646af190c992007c32 with: comment-id: ${{ steps.findComment.outputs.comment-id }} diff --git a/.github/workflows/enterprise-dates.yml b/.github/workflows/enterprise-dates.yml index bb03dbc1e4..401c91284a 100644 --- a/.github/workflows/enterprise-dates.yml +++ b/.github/workflows/enterprise-dates.yml @@ -86,7 +86,7 @@ jobs: number: ${{ steps.create-pull-request.outputs.pull-request-number }} - name: Send Slack notification if workflow fails - uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340 + uses: someimportantcompany/github-actions-slack-message@1d367080235edfa53df415bd8e0bbab480f29bad if: ${{ failure() && env.FREEZE != 'true' }} with: channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }} diff --git a/.github/workflows/openapi-decorate.yml b/.github/workflows/openapi-decorate.yml index bec10987d4..d4f55043e6 100644 --- a/.github/workflows/openapi-decorate.yml +++ b/.github/workflows/openapi-decorate.yml @@ -1,15 +1,19 @@ -name: OpenAPI generate decorated schema files +name: Sync OpenAPI schema -# **What it does**: On 'Update OpenAPI Descriptions' PRs opened by github-openapi-bot, this workflow runs the script to generate the decorated OpenAPI files and commit them to the PR. -# **Why we have it**: So we can consume OpenAPI changes, decorate them, and publish them to the REST API docs. +# **What it does**: Once a day, this workflow syncs the dereferenced files from github/rest-api-description and creates a pull request if there are updates to any of the static files we generate from the OpenAPI. +# **Why we have it**: So we can consume OpenAPI changes. # **Who does it impact**: Anyone making OpenAPI changes in `github/github`, and wanting to get them published on the docs site. on: - pull_request: - # This prevents the workflow from running continuously. We only want - # this workflow to run once on the initial open. - types: - - opened + workflow_dispatch: + inputs: + SOURCE_BRANCH: + description: 'Branch to pull the dereferenced OpenAPI source files from in the github/rest-api-descriptions repo.' + type: string + required: true + default: 'main' + schedule: + - cron: '20 16 * * *' # Run every day at 16:20 UTC / 8:20 PST permissions: contents: write @@ -22,75 +26,86 @@ concurrency: jobs: generate-decorated-files: - if: >- - ${{ - github.repository == 'github/docs-internal' && - github.event.pull_request.user.login == 'github-openapi-bot' - }} + if: github.repository == 'github/docs-internal' runs-on: ubuntu-latest steps: - - name: Label pull requests with 'github-openapi-bot' - uses: andymckay/labeler@e6c4322d0397f3240f0e7e30a33b5c5df2d39e90 - with: - add-labels: 'github-openapi-bot' + - if: ${{ env.FREEZE == 'true' }} + run: | + echo 'The repo is currently frozen! Exiting this workflow.' + exit 1 # prevents further steps from running - name: Checkout repository code uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + + # Check out a nested repository inside of previous checkout + - name: Checkout rest-api-description repo + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 with: - # actions/checkout by default will leave you in a detached head state - # so we need to specify the PR head ref explicitly since we're making - # changes that we want to commit to the branch. - ref: ${{ github.event.pull_request.head.ref }} - # Using a PAT is necessary so that the new commit will trigger the - # CI in the PR. (Events from GITHUB_TOKEN don't trigger new workflows.) - token: ${{ secrets.DOCUBOT_REPO_PAT }} + # By default, only the most recent commit of the `main` branch + # will be checked out + repository: github/rest-api-description + path: rest-api-description + ref: ${{ github.event.inputs.SOURCE_BRANCH }} - uses: ./.github/actions/node-npm-setup - - name: Decorate the dereferenced OpenAPI schemas - run: script/rest/update-files.js --decorate-only - - - name: Check if pull request should be closed - id: close-pr - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_URL: ${{ github.event.pull_request.html_url }} + - name: Copy dereferenced OpenAPI files + id: rest-api-description run: | - echo "If there are no changes, exit" - NUM_FILES_CHANGED=$(git diff --name-only -- lib/rest/static/decorated | wc -l) - if [[ $NUM_FILES_CHANGED -eq 0 ]] - then - echo "No decorated file changes found" - gh pr comment "$PR_URL" --body "🤖 This pull request has no changes to lib/rest/static/decorated, so it is being closed automatically." - gh pr close "$PR_URL" --delete-branch - echo "NO_DECORATED=true" >> $GITHUB_OUTPUT - exit 0 + mkdir ./lib/rest/static/dereferenced + find rest-api-description/descriptions-next -type f -name "*.deref.json" -exec sh -c 'cp $1 ./lib/rest/static/dereferenced' sh {} \; + cd rest-api-description + OPENAPI_COMMIT_SHA=$(git rev-parse HEAD) + echo "OPENAPI_COMMIT_SHA=$OPENAPI_COMMIT_SHA" >> $GITHUB_OUTPUT + echo "Copied files from github/rest-api-description repo. Commit SHA: $OPENAPI_COMMIT_SHA" + + - name: Decorate the dereferenced OpenAPI schemas + run: | + script/rest/update-files.js --decorate-only --open-source + git status + echo "Deleting the cloned github/rest-api-description repo..." + rm -rf rest-api-description + + - name: Create pull request + env: + # Needed for gh + GITHUB_TOKEN: ${{ secrets.DOCUBOT_REPO_PAT }} + run: | + # If nothing to commit, exit now. It's fine. No orphans. + changes=$(git diff --name-only | wc -l) + if [[ $changes -eq 0 ]]; then + echo "There are no changes to commit after running lib/rest/update-files.js. Exiting..." + exit 0 fi - - name: Check in the decorated files - if: ${{ steps.close-pr.outputs.NO_DECORATED != 'true' }} - uses: EndBug/add-and-commit@050a66787244b10a4874a2a5f682130263edc192 + git config --global user.name "docubot" + git config --global user.email "67483024+docubot@users.noreply.github.com" + + branchname=openapi-update-${{ steps.rest-api-description.outputs.OPENAPI_COMMIT_SHA }} + + branchCheckout=$(git checkout -b $branchname) + if [[! $? -eq 0 ]]; then + echo "Branch $branchname already exists in `github/docs-internal`. Exiting..." + exit 0 + fi + git add . + git commit -m "Add decorated OpenAPI schema files" + git push origin $branchname + + echo "Creating pull request..." + gh pr create \ + --title "Update OpenAPI Description" \ + --body '👋 humans. This PR updates the OpenAPI description with the latest changes. (Synced from github/rest-api-description@${{ steps.rest-api-description.outputs.OPENAPI_COMMIT_SHA }}) + + If CI does not pass or other problems arise, contact #docs-engineering on slack.' \ + --repo github/docs-internal \ + --label github-openapi-bot + + - name: Send Slack notification if workflow fails + uses: someimportantcompany/github-actions-slack-message@1d367080235edfa53df415bd8e0bbab480f29bad + if: ${{ failure() && env.FREEZE != 'true' }} with: - # The arguments for the `git add` command - add: '["lib/rest/static/apps", "lib/rest/static/decorated", "lib/webhooks/static/decorated", "lib/redirects/static/client-side-rest-api-redirects.json"]' - - # The message for the commit - message: 'Add decorated OpenAPI schema files' - - env: - # Disable pre-commit hooks; they don't play nicely with add-and-commit - HUSKY: '0' - - - name: Remove the dereferenced files - if: ${{ steps.close-pr.outputs.NO_DECORATED != 'true' }} - uses: EndBug/add-and-commit@050a66787244b10a4874a2a5f682130263edc192 - with: - # The arguments for the `git add` command - remove: '["lib/rest/static/dereferenced/*"]' - - # The message for the commit - message: 'Removed dereferenced OpenAPI schema files' - - env: - # Disable pre-commit hooks; they don't play nicely with add-and-commit - HUSKY: '0' + channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }} + bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }} + color: failure + text: The last Sync OpenAPI schema run for ${{github.repository}} failed. See https://github.com/${{github.repository}}/actions/workflows/sync-openapi.yml diff --git a/.github/workflows/repo-sync-stalls.yml b/.github/workflows/repo-sync-stalls.yml index 09ff02e1e2..acd96e3c2b 100644 --- a/.github/workflows/repo-sync-stalls.yml +++ b/.github/workflows/repo-sync-stalls.yml @@ -52,7 +52,7 @@ jobs: } }) - name: Send Slack notification if workflow fails - uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340 + uses: someimportantcompany/github-actions-slack-message@1d367080235edfa53df415bd8e0bbab480f29bad if: ${{ failure() }} with: channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }} diff --git a/.github/workflows/repo-sync.yml b/.github/workflows/repo-sync.yml index f50afa22ed..f0cbe44eeb 100644 --- a/.github/workflows/repo-sync.yml +++ b/.github/workflows/repo-sync.yml @@ -256,7 +256,7 @@ jobs: gh pr merge $PR_NUMBER --admin --merge - name: Send Slack notification if workflow fails - uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340 + uses: someimportantcompany/github-actions-slack-message@1d367080235edfa53df415bd8e0bbab480f29bad if: failure() with: channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }} diff --git a/.github/workflows/sync-search-elasticsearch.yml b/.github/workflows/sync-search-elasticsearch.yml index 12eb39175a..bcb69a64c9 100644 --- a/.github/workflows/sync-search-elasticsearch.yml +++ b/.github/workflows/sync-search-elasticsearch.yml @@ -35,18 +35,6 @@ env: FREEZE: ${{ secrets.FREEZE }} ELASTICSEARCH_URL: ${{ secrets.ELASTICSEARCH_URL }} - # This might seem a bit strange, but it's clever. Since this action - # uses a matrix to deal with one language at a time, we can use this - # to pretend it's always the same directory. - TRANSLATIONS_ROOT_ES_ES: translation - TRANSLATIONS_ROOT_ZH_CN: translation - TRANSLATIONS_ROOT_JA_JP: translation - TRANSLATIONS_ROOT_PT_BR: translation - TRANSLATIONS_ROOT_FR_FR: translation - TRANSLATIONS_ROOT_RU_RU: translation - TRANSLATIONS_ROOT_KO_KR: translation - TRANSLATIONS_ROOT_DE_DE: translation - jobs: figureOutMatrix: runs-on: ubuntu-latest @@ -110,13 +98,11 @@ jobs: - name: Check out repo uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Checkout the non-English repo + - name: Clone all translations if: ${{ matrix.language != 'en' }} - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: ./.github/actions/clone-translations with: - repository: github/docs-internal.${{ fromJSON('{"zh":"zh-cn","es":"es-es","ru":"ru-ru","ja":"ja-jp","pt":"pt-br","de":"de-de","fr":"fr-fr","ko":"ko-kr"}')[matrix.language] }} - token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }} - path: translation + token: ${{ secrets.DOCUBOT_REPO_PAT }} - uses: ./.github/actions/node-npm-setup @@ -199,7 +185,7 @@ jobs: run: .github/actions-scripts/purge-fastly-edge-cache.js - name: Send Slack notification if workflow fails - uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340 + uses: someimportantcompany/github-actions-slack-message@1d367080235edfa53df415bd8e0bbab480f29bad if: failure() with: channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fb8adab9ea..277265806d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,8 +27,36 @@ env: ENABLE_SEARCH_RESULTS_PAGE: true jobs: - test: + figureOutMatrix: if: github.repository == 'github/docs-internal' || github.repository == 'github/docs' + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.result }} + steps: + - uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 + id: set-matrix + with: + script: | + // We only want to run the 'translations' suite when we know + // we're on the private docs-internal repo because only that + // one has ability to clone the remote (private) translations + // repos. + const all = [ + 'content', + 'graphql', + 'meta', + 'rendering', + 'routing', + 'unit', + 'linting', + ]; + if (context.payload.repository.full_name === 'github/docs-internal') { + all.push('translations'); + } + return all; + + test: + needs: figureOutMatrix # Run on ubuntu-20.04-xl if the private repo or ubuntu-latest if the public repo # See pull # 17442 in the private repo for context runs-on: ${{ fromJSON('["ubuntu-latest", "ubuntu-20.04-xl"]')[github.repository == 'github/docs-internal'] }} @@ -36,17 +64,7 @@ jobs: strategy: fail-fast: false matrix: - test-group: - [ - content, - graphql, - meta, - rendering, - routing, - unit, - linting, - translations, - ] + test-group: ${{ fromJSON(needs.figureOutMatrix.outputs.matrix) }} steps: - name: Install a local Elasticsearch for testing # For the sake of saving time, only run this step if the test-group @@ -92,69 +110,11 @@ jobs: .github/actions-scripts/merge-early-access.sh rm -fr docs-early-access - - name: Clone Simplified Chinese + - name: Clone all translations if: ${{ matrix.test-group == 'translations' }} - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: ./.github/actions/clone-translations with: - repository: github/docs-internal.zh-cn token: ${{ secrets.DOCUBOT_REPO_PAT }} - path: translations/zh-cn - - - name: Clone Japanese - if: ${{ matrix.test-group == 'translations' }} - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - repository: github/docs-internal.ja-jp - token: ${{ secrets.DOCUBOT_REPO_PAT }} - path: translations/ja-jp - - - name: Clone Spanish - if: ${{ matrix.test-group == 'translations' }} - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - repository: github/docs-internal.es-es - token: ${{ secrets.DOCUBOT_REPO_PAT }} - path: translations/es-es - - - name: Clone Portuguese - if: ${{ matrix.test-group == 'translations' }} - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - repository: github/docs-internal.pt-br - token: ${{ secrets.DOCUBOT_REPO_PAT }} - path: translations/pt-br - - - name: Clone German - if: ${{ matrix.test-group == 'translations' }} - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - repository: github/docs-internal.de-de - token: ${{ secrets.DOCUBOT_REPO_PAT }} - path: translations/de-de - - - name: Clone French - if: ${{ matrix.test-group == 'translations' }} - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - repository: github/docs-internal.fr-fr - token: ${{ secrets.DOCUBOT_REPO_PAT }} - path: translations/fr-fr - - - name: Clone Russian - if: ${{ matrix.test-group == 'translations' }} - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - repository: github/docs-internal.ru-ru - token: ${{ secrets.DOCUBOT_REPO_PAT }} - path: translations/ru-ru - - - name: Clone Korean - if: ${{ matrix.test-group == 'translations' }} - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - repository: github/docs-internal.ko-kr - token: ${{ secrets.DOCUBOT_REPO_PAT }} - path: translations/ko-kr - name: Gather files changed env: diff --git a/.github/workflows/translation-health-report.yml b/.github/workflows/translation-health-report.yml index eb4b2f2c0b..14326c2977 100644 --- a/.github/workflows/translation-health-report.yml +++ b/.github/workflows/translation-health-report.yml @@ -123,7 +123,7 @@ jobs: # Emit a notification for the first responder to triage if the workflow failed. - name: Send Slack notification if workflow failed - uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340 + uses: someimportantcompany/github-actions-slack-message@1d367080235edfa53df415bd8e0bbab480f29bad if: failure() with: channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }} diff --git a/.github/workflows/update-graphql-files.yml b/.github/workflows/update-graphql-files.yml index 7a1de46113..7d4df1b01f 100644 --- a/.github/workflows/update-graphql-files.yml +++ b/.github/workflows/update-graphql-files.yml @@ -81,7 +81,7 @@ jobs: github-token: ${{ secrets.DOCUBOT_REPO_PAT }} number: ${{ steps.create-pull-request.outputs.pull-request-number }} - name: Send Slack notification if workflow fails - uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340 + uses: someimportantcompany/github-actions-slack-message@1d367080235edfa53df415bd8e0bbab480f29bad if: ${{ failure() && env.FREEZE != 'true' }} with: channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }} diff --git a/assets/images/help/2fa/continue-unlinking-email.png b/assets/images/help/2fa/continue-unlinking-email.png new file mode 100644 index 0000000000..ddc54f0eac Binary files /dev/null and b/assets/images/help/2fa/continue-unlinking-email.png differ diff --git a/assets/images/help/2fa/final-unlink-button.png b/assets/images/help/2fa/final-unlink-button.png new file mode 100644 index 0000000000..247c5b3a41 Binary files /dev/null and b/assets/images/help/2fa/final-unlink-button.png differ diff --git a/assets/images/help/2fa/recovery-code-or-reset.png b/assets/images/help/2fa/recovery-code-or-reset.png new file mode 100644 index 0000000000..545a7f0459 Binary files /dev/null and b/assets/images/help/2fa/recovery-code-or-reset.png differ diff --git a/assets/images/help/2fa/start-unlinking-email.png b/assets/images/help/2fa/start-unlinking-email.png new file mode 100644 index 0000000000..ce264e3613 Binary files /dev/null and b/assets/images/help/2fa/start-unlinking-email.png differ diff --git a/assets/images/help/2fa/try-recovering-account.png b/assets/images/help/2fa/try-recovering-account.png new file mode 100644 index 0000000000..b3a67baec4 Binary files /dev/null and b/assets/images/help/2fa/try-recovering-account.png differ diff --git a/assets/images/help/2fa/unlink-email-create-new-account.png b/assets/images/help/2fa/unlink-email-create-new-account.png new file mode 100644 index 0000000000..0c5bb20765 Binary files /dev/null and b/assets/images/help/2fa/unlink-email-create-new-account.png differ diff --git a/assets/images/help/2fa/unlink-this-email.png b/assets/images/help/2fa/unlink-this-email.png new file mode 100644 index 0000000000..01b3f73816 Binary files /dev/null and b/assets/images/help/2fa/unlink-this-email.png differ diff --git a/assets/images/help/business-accounts/add-user-to-org.png b/assets/images/help/business-accounts/add-user-to-org.png new file mode 100644 index 0000000000..6bdabb5e0f Binary files /dev/null and b/assets/images/help/business-accounts/add-user-to-org.png differ diff --git a/assets/images/help/business-accounts/enterprise-add-or-remove-from-org.png b/assets/images/help/business-accounts/enterprise-add-or-remove-from-org.png new file mode 100644 index 0000000000..964d124c39 Binary files /dev/null and b/assets/images/help/business-accounts/enterprise-add-or-remove-from-org.png differ diff --git a/assets/images/help/business-accounts/enterprise-failed-invitations.png b/assets/images/help/business-accounts/enterprise-failed-invitations.png new file mode 100644 index 0000000000..2bbcba5fde Binary files /dev/null and b/assets/images/help/business-accounts/enterprise-failed-invitations.png differ diff --git a/assets/images/help/business-accounts/enterprise-invitation-retry-or-cancel.png b/assets/images/help/business-accounts/enterprise-invitation-retry-or-cancel.png new file mode 100644 index 0000000000..194f3f1f0a Binary files /dev/null and b/assets/images/help/business-accounts/enterprise-invitation-retry-or-cancel.png differ diff --git a/assets/images/help/business-accounts/retry-invitation-pop-up-enterprise.png b/assets/images/help/business-accounts/retry-invitation-pop-up-enterprise.png new file mode 100644 index 0000000000..1a9e84cc73 Binary files /dev/null and b/assets/images/help/business-accounts/retry-invitation-pop-up-enterprise.png differ diff --git a/assets/images/help/codespaces/add-ant-feature.png b/assets/images/help/codespaces/add-ant-feature.png new file mode 100644 index 0000000000..54f87147f5 Binary files /dev/null and b/assets/images/help/codespaces/add-ant-feature.png differ diff --git a/assets/images/help/codespaces/add-csharp-prebuilt-container.png b/assets/images/help/codespaces/add-csharp-prebuilt-container.png new file mode 100644 index 0000000000..7e3984966a Binary files /dev/null and b/assets/images/help/codespaces/add-csharp-prebuilt-container.png differ diff --git a/assets/images/help/codespaces/add-dotnet-features.png b/assets/images/help/codespaces/add-dotnet-features.png new file mode 100644 index 0000000000..1947330b38 Binary files /dev/null and b/assets/images/help/codespaces/add-dotnet-features.png differ diff --git a/assets/images/help/codespaces/add-dotnet-prebuilt-container.png b/assets/images/help/codespaces/add-dotnet-prebuilt-container.png deleted file mode 100644 index 6fb494a82a..0000000000 Binary files a/assets/images/help/codespaces/add-dotnet-prebuilt-container.png and /dev/null differ diff --git a/assets/images/help/codespaces/add-dotnet-version.png b/assets/images/help/codespaces/add-dotnet-version.png index 3d8321d529..e3277dc016 100644 Binary files a/assets/images/help/codespaces/add-dotnet-version.png and b/assets/images/help/codespaces/add-dotnet-version.png differ diff --git a/assets/images/help/codespaces/add-java-prebuilt-container.png b/assets/images/help/codespaces/add-java-prebuilt-container.png index 1b2c474170..fa8a588b88 100644 Binary files a/assets/images/help/codespaces/add-java-prebuilt-container.png and b/assets/images/help/codespaces/add-java-prebuilt-container.png differ diff --git a/assets/images/help/codespaces/add-java-version.png b/assets/images/help/codespaces/add-java-version.png index 7bab0af376..8e3b0b28c3 100644 Binary files a/assets/images/help/codespaces/add-java-version.png and b/assets/images/help/codespaces/add-java-version.png differ diff --git a/assets/images/help/codespaces/add-jshint-config.png b/assets/images/help/codespaces/add-jshint-config.png new file mode 100644 index 0000000000..196af580f6 Binary files /dev/null and b/assets/images/help/codespaces/add-jshint-config.png differ diff --git a/assets/images/help/codespaces/add-maven.png b/assets/images/help/codespaces/add-maven.png new file mode 100644 index 0000000000..f10bef4c66 Binary files /dev/null and b/assets/images/help/codespaces/add-maven.png differ diff --git a/assets/images/help/codespaces/add-node-devcontainer-config.png b/assets/images/help/codespaces/add-node-devcontainer-config.png new file mode 100644 index 0000000000..83a22e4374 Binary files /dev/null and b/assets/images/help/codespaces/add-node-devcontainer-config.png differ diff --git a/assets/images/help/codespaces/add-node-prebuilt-container.png b/assets/images/help/codespaces/add-node-prebuilt-container.png deleted file mode 100644 index 38413632e5..0000000000 Binary files a/assets/images/help/codespaces/add-node-prebuilt-container.png and /dev/null differ diff --git a/assets/images/help/codespaces/add-node-version.png b/assets/images/help/codespaces/add-node-version.png index 3c79cd2958..c13f530c3e 100644 Binary files a/assets/images/help/codespaces/add-node-version.png and b/assets/images/help/codespaces/add-node-version.png differ diff --git a/assets/images/help/codespaces/add-prebuilt-container-command.png b/assets/images/help/codespaces/add-prebuilt-container-command.png index 2536767e2a..67be08789b 100644 Binary files a/assets/images/help/codespaces/add-prebuilt-container-command.png and b/assets/images/help/codespaces/add-prebuilt-container-command.png differ diff --git a/assets/images/help/codespaces/add-python-features.png b/assets/images/help/codespaces/add-python-features.png new file mode 100644 index 0000000000..03ed6f1d6c Binary files /dev/null and b/assets/images/help/codespaces/add-python-features.png differ diff --git a/assets/images/help/codespaces/add-python-prebuilt-container.png b/assets/images/help/codespaces/add-python-prebuilt-container.png index d43b550740..46537f210f 100644 Binary files a/assets/images/help/codespaces/add-python-prebuilt-container.png and b/assets/images/help/codespaces/add-python-prebuilt-container.png differ diff --git a/assets/images/help/codespaces/add-python-version.png b/assets/images/help/codespaces/add-python-version.png index 894fa14672..5747ee3742 100644 Binary files a/assets/images/help/codespaces/add-python-version.png and b/assets/images/help/codespaces/add-python-version.png differ diff --git a/assets/images/help/codespaces/codespaces-npmstart.png b/assets/images/help/codespaces/codespaces-npmstart.png index 40cf0de57e..f61e616d13 100644 Binary files a/assets/images/help/codespaces/codespaces-npmstart.png and b/assets/images/help/codespaces/codespaces-npmstart.png differ diff --git a/assets/images/help/codespaces/codespaces-port-toast.png b/assets/images/help/codespaces/codespaces-port-toast.png deleted file mode 100644 index ff42378a04..0000000000 Binary files a/assets/images/help/codespaces/codespaces-port-toast.png and /dev/null differ diff --git a/assets/images/help/codespaces/codespaces-port3000-toast.png b/assets/images/help/codespaces/codespaces-port3000-toast.png new file mode 100644 index 0000000000..b6b3226791 Binary files /dev/null and b/assets/images/help/codespaces/codespaces-port3000-toast.png differ diff --git a/assets/images/help/codespaces/codespaces-port5000-toast.png b/assets/images/help/codespaces/codespaces-port5000-toast.png new file mode 100644 index 0000000000..0646cc75f5 Binary files /dev/null and b/assets/images/help/codespaces/codespaces-port5000-toast.png differ diff --git a/assets/images/help/codespaces/copy-local-address.png b/assets/images/help/codespaces/copy-local-address.png new file mode 100644 index 0000000000..6976104037 Binary files /dev/null and b/assets/images/help/codespaces/copy-local-address.png differ diff --git a/assets/images/help/codespaces/devcontainers-options.png b/assets/images/help/codespaces/devcontainers-options.png deleted file mode 100644 index 3591381007..0000000000 Binary files a/assets/images/help/codespaces/devcontainers-options.png and /dev/null differ diff --git a/assets/images/help/codespaces/dotnet-extensions.png b/assets/images/help/codespaces/dotnet-extensions.png deleted file mode 100644 index 5997ef900e..0000000000 Binary files a/assets/images/help/codespaces/dotnet-extensions.png and /dev/null differ diff --git a/assets/images/help/codespaces/java-debug-output.png b/assets/images/help/codespaces/java-debug-output.png new file mode 100644 index 0000000000..733efdb92b Binary files /dev/null and b/assets/images/help/codespaces/java-debug-output.png differ diff --git a/assets/images/help/codespaces/open-port5000-in-browser.png b/assets/images/help/codespaces/open-port5000-in-browser.png new file mode 100644 index 0000000000..147bbf5e96 Binary files /dev/null and b/assets/images/help/codespaces/open-port5000-in-browser.png differ diff --git a/assets/images/help/codespaces/postman-screenshot-key-token.png b/assets/images/help/codespaces/postman-screenshot-key-token.png new file mode 100644 index 0000000000..b812e9caaa Binary files /dev/null and b/assets/images/help/codespaces/postman-screenshot-key-token.png differ diff --git a/assets/images/help/codespaces/postman-screenshot-url.png b/assets/images/help/codespaces/postman-screenshot-url.png new file mode 100644 index 0000000000..aa8bcc7d8c Binary files /dev/null and b/assets/images/help/codespaces/postman-screenshot-url.png differ diff --git a/assets/images/help/codespaces/python-flask-run.png b/assets/images/help/codespaces/python-flask-run.png new file mode 100644 index 0000000000..83387d2224 Binary files /dev/null and b/assets/images/help/codespaces/python-flask-run.png differ diff --git a/assets/images/help/codespaces/show-all-definitions.png b/assets/images/help/codespaces/show-all-definitions.png new file mode 100644 index 0000000000..93de38d37d Binary files /dev/null and b/assets/images/help/codespaces/show-all-definitions.png differ diff --git a/assets/images/help/codespaces/switch-to-standard-mode.png b/assets/images/help/codespaces/switch-to-standard-mode.png new file mode 100644 index 0000000000..e8ec86f4ca Binary files /dev/null and b/assets/images/help/codespaces/switch-to-standard-mode.png differ diff --git a/assets/images/help/enterprises/enterprise-invitations-bulk-select.png b/assets/images/help/enterprises/enterprise-invitations-bulk-select.png new file mode 100644 index 0000000000..7c03505bf4 Binary files /dev/null and b/assets/images/help/enterprises/enterprise-invitations-bulk-select.png differ diff --git a/assets/images/help/enterprises/enterprise-invitations-multiple-selection.png b/assets/images/help/enterprises/enterprise-invitations-multiple-selection.png new file mode 100644 index 0000000000..31aa4fb74d Binary files /dev/null and b/assets/images/help/enterprises/enterprise-invitations-multiple-selection.png differ diff --git a/assets/images/help/organizations/organization-failed-invitations.png b/assets/images/help/organizations/organization-failed-invitations.png new file mode 100644 index 0000000000..47d9165cf7 Binary files /dev/null and b/assets/images/help/organizations/organization-failed-invitations.png differ diff --git a/assets/images/help/organizations/organization-invitations-bulk-select.png b/assets/images/help/organizations/organization-invitations-bulk-select.png new file mode 100644 index 0000000000..559073a5cb Binary files /dev/null and b/assets/images/help/organizations/organization-invitations-bulk-select.png differ diff --git a/assets/images/help/organizations/organization-invitations-multiple-selection.png b/assets/images/help/organizations/organization-invitations-multiple-selection.png new file mode 100644 index 0000000000..3d1e057387 Binary files /dev/null and b/assets/images/help/organizations/organization-invitations-multiple-selection.png differ diff --git a/assets/images/help/organizations/retry-invitation-pop-up.png b/assets/images/help/organizations/retry-invitation-pop-up.png new file mode 100644 index 0000000000..57c829af6d Binary files /dev/null and b/assets/images/help/organizations/retry-invitation-pop-up.png differ diff --git a/assets/images/help/organizations/retry-or-cancel-invitation.png b/assets/images/help/organizations/retry-or-cancel-invitation.png new file mode 100644 index 0000000000..10bc08993f Binary files /dev/null and b/assets/images/help/organizations/retry-or-cancel-invitation.png differ diff --git a/assets/images/help/projects-v2/copy-include-drafts.png b/assets/images/help/projects-v2/copy-include-drafts.png new file mode 100644 index 0000000000..baa009bdeb Binary files /dev/null and b/assets/images/help/projects-v2/copy-include-drafts.png differ diff --git a/assets/images/help/projects-v2/copy-name.png b/assets/images/help/projects-v2/copy-name.png new file mode 100644 index 0000000000..65f90c2bca Binary files /dev/null and b/assets/images/help/projects-v2/copy-name.png differ diff --git a/assets/images/help/projects-v2/copy-owner.png b/assets/images/help/projects-v2/copy-owner.png new file mode 100644 index 0000000000..5a1024dd1d Binary files /dev/null and b/assets/images/help/projects-v2/copy-owner.png differ diff --git a/assets/images/help/projects-v2/copy-submit.png b/assets/images/help/projects-v2/copy-submit.png new file mode 100644 index 0000000000..92189382fe Binary files /dev/null and b/assets/images/help/projects-v2/copy-submit.png differ diff --git a/assets/images/help/projects-v2/make-a-copy.png b/assets/images/help/projects-v2/make-a-copy.png new file mode 100644 index 0000000000..700f275920 Binary files /dev/null and b/assets/images/help/projects-v2/make-a-copy.png differ diff --git a/assets/images/help/projects-v2/workflow-autoadd-filter.png b/assets/images/help/projects-v2/workflow-autoadd-filter.png new file mode 100644 index 0000000000..0eeff18d60 Binary files /dev/null and b/assets/images/help/projects-v2/workflow-autoadd-filter.png differ diff --git a/assets/images/help/projects-v2/workflow-autoadd-repo.png b/assets/images/help/projects-v2/workflow-autoadd-repo.png new file mode 100644 index 0000000000..a368c52c66 Binary files /dev/null and b/assets/images/help/projects-v2/workflow-autoadd-repo.png differ diff --git a/assets/images/help/projects-v2/workflow-autoadd.png b/assets/images/help/projects-v2/workflow-autoadd.png new file mode 100644 index 0000000000..9e10f33a87 Binary files /dev/null and b/assets/images/help/projects-v2/workflow-autoadd.png differ diff --git a/assets/images/help/projects-v2/workflow-save-and-turn-on.png b/assets/images/help/projects-v2/workflow-save-and-turn-on.png new file mode 100644 index 0000000000..58c7257afb Binary files /dev/null and b/assets/images/help/projects-v2/workflow-save-and-turn-on.png differ diff --git a/assets/images/help/projects-v2/workflow-start-editing.png b/assets/images/help/projects-v2/workflow-start-editing.png new file mode 100644 index 0000000000..552fa97704 Binary files /dev/null and b/assets/images/help/projects-v2/workflow-start-editing.png differ diff --git a/assets/images/help/repository/use-this-template-button.png b/assets/images/help/repository/use-this-template-button.png index b6b8eeac03..0d5e30e92e 100644 Binary files a/assets/images/help/repository/use-this-template-button.png and b/assets/images/help/repository/use-this-template-button.png differ diff --git a/assets/images/help/sponsors/example-sponsors-invoice.png b/assets/images/help/sponsors/example-sponsors-invoice.png new file mode 100644 index 0000000000..faf1cfaf59 Binary files /dev/null and b/assets/images/help/sponsors/example-sponsors-invoice.png differ diff --git a/components/article/ArticlePage.tsx b/components/article/ArticlePage.tsx index 40cfa61920..969940e0b5 100644 --- a/components/article/ArticlePage.tsx +++ b/components/article/ArticlePage.tsx @@ -1,10 +1,9 @@ import { useRouter } from 'next/router' import dynamic from 'next/dynamic' -import { ZapIcon, InfoIcon } from '@primer/octicons-react' +import { InfoIcon } from '@primer/octicons-react' import { Callout } from 'components/ui/Callout' -import { Link } from 'components/Link' import { DefaultLayout } from 'components/DefaultLayout' import { ArticleTitle } from 'components/article/ArticleTitle' import { useArticleContext } from 'components/context/ArticleContext' @@ -26,26 +25,6 @@ const ClientSideRefresh = dynamic(() => import('components/ClientSideRefresh'), }) const isDev = process.env.NODE_ENV === 'development' -// Mapping of a "normal" article to it's interactive counterpart -const interactiveAlternatives: Record = { - '/codespaces/setting-up-your-project-for-codespaces/setting-up-your-nodejs-project-for-codespaces': - { - href: '/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces?langId=nodejs', - }, - '/codespaces/setting-up-your-project-for-codespaces/setting-up-your-dotnet-project-for-codespaces': - { - href: '/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces?langId=dotnet', - }, - '/codespaces/setting-up-your-project-for-codespaces/setting-up-your-java-project-for-codespaces': - { - href: '/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces?langId=java', - }, - '/codespaces/setting-up-your-project-for-codespaces/setting-up-your-python-project-for-codespaces': - { - href: '/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces?langId=py', - }, -} - export const ArticlePage = () => { const router = useRouter() const { @@ -62,7 +41,6 @@ export const ArticlePage = () => { currentLearningTrack, } = useArticleContext() const { t } = useTranslation('pages') - const currentPath = router.asPath.split('?')[0] const isLearningPath = !!currentLearningTrack?.trackName @@ -109,14 +87,6 @@ export const ArticlePage = () => { } toc={ <> - {!!interactiveAlternatives[currentPath] && ( -
- - - Try the new interactive article - -
- )} {isLearningPath && } {miniTocItems.length > 1 && } diff --git a/components/context/ArticleContext.tsx b/components/context/ArticleContext.tsx index 145b837708..324cd01c86 100644 --- a/components/context/ArticleContext.tsx +++ b/components/context/ArticleContext.tsx @@ -62,7 +62,7 @@ export const getArticleContextFromRequest = (req: any): ArticleContextT => { } return { - title: page.titlePlainText, + title: page.title, intro: page.intro, effectiveDate: page.effectiveDate || '', renderedPage: req.context.renderedPage || '', diff --git a/components/context/AutomatedPageContext.tsx b/components/context/AutomatedPageContext.tsx index 1810027294..79a0093a73 100644 --- a/components/context/AutomatedPageContext.tsx +++ b/components/context/AutomatedPageContext.tsx @@ -28,7 +28,7 @@ export const getAutomatedPageContextFromRequest = (req: any): AutomatedPageConte const page = req.context.page return { - title: page.titlePlainText, + title: page.title, intro: page.intro, renderedPage: req.context.renderedPage || '', miniTocItems: req.context.miniTocItems || [], diff --git a/components/context/PlaygroundContext.tsx b/components/context/PlaygroundContext.tsx deleted file mode 100644 index 3047070894..0000000000 --- a/components/context/PlaygroundContext.tsx +++ /dev/null @@ -1,88 +0,0 @@ -import React, { createContext, useContext, useState } from 'react' -import { CodeLanguage, PlaygroundArticleT } from 'components/playground/types' -import { useRouter } from 'next/router' - -import codespacesJsArticle from 'components/playground/content/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces/nodejs' -import codespacesPyArticle from 'components/playground/content/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces/python' -import codespacesNetArticle from 'components/playground/content/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces/dotnet' -import codespacesJavaArticle from 'components/playground/content/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces/java' - -const articles = [ - codespacesJsArticle, - codespacesPyArticle, - codespacesJavaArticle, - codespacesNetArticle, -] - -const codeLanguages: Array = [ - { - id: 'nodejs', - label: 'Node.js', - }, - { - id: 'py', - label: 'Python', - }, - { - id: 'dotnet', - label: 'C#', - }, - { - id: 'java', - label: 'Java', - }, -] - -type PlaygroundContextT = { - activeSectionIndex: number - setActiveSectionIndex: (sectionIndex: number) => void - scrollToSection: number | undefined - setScrollToSection: (sectionIndex?: number) => void - codeLanguages: Array - currentLanguage: CodeLanguage - article: PlaygroundArticleT | undefined -} - -export const PlaygroundContext = createContext(null) - -export const usePlaygroundContext = (): PlaygroundContextT => { - const context = useContext(PlaygroundContext) - - if (!context) { - throw new Error('"usePlaygroundContext" may only be used inside "PlaygroundContext.Provider"') - } - - return context -} - -export const PlaygroundContextProvider = (props: { children: React.ReactNode }) => { - const router = useRouter() - const [activeSectionIndex, setActiveSectionIndex] = useState(0) - const [scrollToSection, setScrollToSection] = useState() - const path = router.asPath.includes('@latest') - ? router.asPath.split('?')[0].split('#')[0].split('@latest')[1] - : router.asPath.split('?')[0].split('#')[0] - const relevantArticles = articles.filter(({ slug }) => slug === path) - - const { langId } = router.query - const availableLanguageIds = relevantArticles.map(({ codeLanguageId }) => codeLanguageId) - const currentLanguage = - codeLanguages.find(({ id }) => id === langId) || - (codeLanguages.find(({ id }) => id === availableLanguageIds[0]) as CodeLanguage) - - const article = relevantArticles.find( - ({ codeLanguageId }) => codeLanguageId === currentLanguage?.id - ) - - const context = { - activeSectionIndex, - setActiveSectionIndex, - scrollToSection, - setScrollToSection, - currentLanguage, - codeLanguages: codeLanguages.filter(({ id }) => availableLanguageIds.includes(id)), - article, - } - - return {props.children} -} diff --git a/components/context/TocLandingContext.tsx b/components/context/TocLandingContext.tsx index 8fe21595ec..054134e03d 100644 --- a/components/context/TocLandingContext.tsx +++ b/components/context/TocLandingContext.tsx @@ -11,7 +11,7 @@ export type TocItem = { export type TocLandingContextT = { title: string - introPlainText: string + intro: string productCallout: string tocItems: Array variant?: 'compact' | 'expanded' @@ -34,9 +34,9 @@ export const useTocLandingContext = (): TocLandingContextT => { export const getTocLandingContextFromRequest = (req: any): TocLandingContextT => { return { - title: req.context.page.titlePlainText, + title: req.context.page.title, productCallout: req.context.page.product || '', - introPlainText: req.context.page.introPlainText, + intro: req.context.page.intro, tocItems: (req.context.genericTocFlat || req.context.genericTocNested || []).map((obj: any) => pick(obj, ['fullPath', 'title', 'intro', 'childTocItems']) ), diff --git a/components/guides/ArticleCard.tsx b/components/guides/ArticleCard.tsx index 95e9bc9958..efc72d25f8 100644 --- a/components/guides/ArticleCard.tsx +++ b/components/guides/ArticleCard.tsx @@ -17,11 +17,11 @@ export const ArticleCard = ({ tabIndex, card, typeLabel }: Props) => { className="d-flex col-12 col-md-4 pr-0 pr-md-6 pr-lg-8" > -

+

{card.title}

{typeLabel}
-

+

{card.intro}

{card.topics.length > 0 && (
    {card.topics.map((topic) => { diff --git a/components/landing/ArticleList.tsx b/components/landing/ArticleList.tsx index e167d9e6cf..e5f2cba2ce 100644 --- a/components/landing/ArticleList.tsx +++ b/components/landing/ArticleList.tsx @@ -62,29 +62,18 @@ export const ArticleList = ({ title={ !link.hideIntro && link.intro ? (

    - + {link.fullTitle ? link.fullTitle : link.title}

    ) : ( - + + {link.fullTitle ? link.fullTitle : link.title} + ) } > {!link.hideIntro && link.intro && ( - + {link.intro} )} {link.date && ( diff --git a/components/landing/CodeExampleCard.tsx b/components/landing/CodeExampleCard.tsx index a64c0c4b1f..b8f050715a 100644 --- a/components/landing/CodeExampleCard.tsx +++ b/components/landing/CodeExampleCard.tsx @@ -14,11 +14,8 @@ export const CodeExampleCard = ({ example }: Props) => { href={`https://github.com/${example.href}`} >
    -

    -

    +

    {example.title}

    +

    {example.description}

    {example.tags.map((tag) => { return ( diff --git a/components/landing/GuideCard.tsx b/components/landing/GuideCard.tsx index 38305d18c2..4d050440cb 100644 --- a/components/landing/GuideCard.tsx +++ b/components/landing/GuideCard.tsx @@ -13,11 +13,8 @@ export const GuideCard = ({ guide }: Props) => { className="Box color-shadow-medium height-full d-block hover-shadow-large no-underline color-fg-default p-5" href={guide.href} > -

    -

    +

    {guide.title}

    +

    {guide.intro || ''}