From 1fda56a199d92eb7f83f49703e071cc68c5ea154 Mon Sep 17 00:00:00 2001 From: Jess Hosman <1183847+jhosman@users.noreply.github.com> Date: Tue, 18 Jul 2023 14:50:11 -0600 Subject: [PATCH 1/3] Add missing code block languages for API, events, and Apps docs (#39180) --- .../choosing-permissions-for-a-github-app.md | 4 ++-- .../building-a-cli-with-a-github-app.md | 18 +++++++++--------- ...thub-app-that-responds-to-webhook-events.md | 2 +- ...gin-with-github-button-with-a-github-app.md | 12 ++++++------ .../quickstart.md | 2 +- .../authorizing-oauth-apps.md | 10 +++++----- .../graphql/guides/introduction-to-graphql.md | 2 +- .../migrating-graphql-global-node-ids.md | 6 +++--- content/rest/deployments/deployments.md | 2 +- content/rest/enterprise-admin/scim.md | 4 ++-- .../getting-started-with-the-rest-api.md | 4 ++-- .../guides/using-pagination-in-the-rest-api.md | 8 ++++---- content/rest/migrations/source-imports.md | 2 +- content/rest/search/search.md | 4 ++-- .../events/github-event-types.md | 2 +- .../pre-release-program/starfox-preview.md | 2 +- 16 files changed, 42 insertions(+), 42 deletions(-) diff --git a/content/apps/creating-github-apps/registering-a-github-app/choosing-permissions-for-a-github-app.md b/content/apps/creating-github-apps/registering-a-github-app/choosing-permissions-for-a-github-app.md index 6a09bca9929a..32b72cfe834d 100644 --- a/content/apps/creating-github-apps/registering-a-github-app/choosing-permissions-for-a-github-app.md +++ b/content/apps/creating-github-apps/registering-a-github-app/choosing-permissions-for-a-github-app.md @@ -66,6 +66,6 @@ If you want your app to use an installation or user access token to authenticate You can then use the access token as the HTTP password. Replace `TOKEN` with the access token: -``` -git clone https://x-access-token:TOKEN@github.com/owner/repo.git" +```shell +git clone https://x-access-token:TOKEN@github.com/owner/repo.git ``` diff --git a/content/apps/creating-github-apps/writing-code-for-a-github-app/building-a-cli-with-a-github-app.md b/content/apps/creating-github-apps/writing-code-for-a-github-app/building-a-cli-with-a-github-app.md index 323066405fc0..59537edb1f87 100644 --- a/content/apps/creating-github-apps/writing-code-for-a-github-app/building-a-cli-with-a-github-app.md +++ b/content/apps/creating-github-apps/writing-code-for-a-github-app/building-a-cli-with-a-github-app.md @@ -133,13 +133,13 @@ These steps lead you through building a CLI and using device flow to get a user In your terminal, from the directory where `app_cli.rb` is stored, run `./app_cli.rb help`. You should see this output: - ``` + ```shell `help` is not yet defined ``` You can also test your script without a command or with an unhandled command. For example, `./app_cli.rb create-issue` should output: - ``` + ```shell Unknown command `create-issue` ``` @@ -204,7 +204,7 @@ These steps lead you through building a CLI and using device flow to get a user In your terminal, from the directory where `app_cli.rb` is stored, run `./app_cli.rb help`. You should see this output: - ``` + ```shell usage: app_cli ``` @@ -474,7 +474,7 @@ The `login` command will run the device flow to get a user access token. For mor 1. In your terminal, from the directory where `app_cli.rb` is stored, run `./app_cli.rb login`. You should see output that looks like this. The code will differ every time: - ``` + ```shell Please visit: {% data variables.product.oauth_host_code %}/login/device and enter code: CA86-8D94 ``` @@ -705,13 +705,13 @@ This tutorial assumes that your app code is stored in a file named `app_cli.rb`. 1. In your terminal, from the directory where `app_cli.rb` is stored, run `./app_cli.rb help`. You should see output that looks like this. - ``` + ```shell usage: app_cli ``` 1. In your terminal, from the directory where `app_cli.rb` is stored, run `./app_cli.rb login`. You should see output that looks like this. The code will differ every time: - ``` + ```shell Please visit: {% data variables.product.oauth_host_code %}/login/device and enter code: CA86-8D94 ``` @@ -721,21 +721,21 @@ This tutorial assumes that your app code is stored in a file named `app_cli.rb`. 1. Your terminal should now say "Successfully authenticated!". 1. In your terminal, from the directory where `app_cli.rb` is stored, run `./app_cli.rb whoami`. You should see output that looks like this, where `octocat` is your username. - ``` + ```shell You are octocat ``` 1. Open the `.token` file in your editor, and modify the token. Now, the token is invalid. 1. In your terminal, from the directory where `app_cli.rb` is stored, run `./app_cli.rb whoami`. You should see output that looks like this: - ``` + ```shell You are not authorized. Run the `login` command. ``` 1. Delete the `.token` file. 1. In your terminal, from the directory where `app_cli.rb` is stored, run `./app_cli.rb whoami`. You should see output that looks like this: - ``` + ```shell You are not authorized. Run the `login` command. ``` diff --git a/content/apps/creating-github-apps/writing-code-for-a-github-app/building-a-github-app-that-responds-to-webhook-events.md b/content/apps/creating-github-apps/writing-code-for-a-github-app/building-a-github-app-that-responds-to-webhook-events.md index cd9bd6bc3caa..229d1a1f1929 100644 --- a/content/apps/creating-github-apps/writing-code-for-a-github-app/building-a-github-app-that-responds-to-webhook-events.md +++ b/content/apps/creating-github-apps/writing-code-for-a-github-app/building-a-github-app-that-responds-to-webhook-events.md @@ -308,7 +308,7 @@ For testing, you will use your computer or codespace as a server. Your app will You should see output that looks like this, where `WEBHOOK_PROXY_URL` is your webhook proxy URL: - ``` + ```shell Forwarding WEBHOOK_PROXY_URL to http://localhost:3000/api/webhook Connected WEBHOOK_PROXY_URL ``` diff --git a/content/apps/creating-github-apps/writing-code-for-a-github-app/building-a-login-with-github-button-with-a-github-app.md b/content/apps/creating-github-apps/writing-code-for-a-github-app/building-a-login-with-github-button-with-a-github-app.md index d40175ffa9b8..ad8513092399 100644 --- a/content/apps/creating-github-apps/writing-code-for-a-github-app/building-a-login-with-github-button-with-a-github-app.md +++ b/content/apps/creating-github-apps/writing-code-for-a-github-app/building-a-login-with-github-button-with-a-github-app.md @@ -44,29 +44,29 @@ To follow this tutorial, you must install the Sinatra and dotenv gems in your Ru 1. If you don't already have Bundler installed, run the following command in your terminal: - ``` + ```shell gem install bundler ``` 1. If you don't already have a Gemfile for your app, run the following command in your terminal: - ``` + ```shell bundle init ``` 1. If you don't already have a Gemfile.lock for your app, run the following command in your terminal: - ``` + ```shell bundle install ``` 1. Install the gems by running the following commands in your terminal: - ``` + ```shell bundle add sinatra ``` - ``` + ```shell bundle add dotenv ``` @@ -85,7 +85,7 @@ This tutorial will show you how to store the client ID and client secret in envi 1. Add `.env` to your `.gitignore` file. This will prevent you from accidentally committing your client secret. For more information about `.gitignore` files, see "[AUTOTITLE](/get-started/getting-started-with-git/ignoring-files)." 1. Add the following contents to your `.env` file. Replace `YOUR_CLIENT_ID` with the client ID of your app. Replace `YOUR_CLIENT_SECRET` with the client secret for your app. - ``` + ```text CLIENT_ID="YOUR_CLIENT_ID" CLIENT_SECRET="YOUR_CLIENT_SECRET" ``` diff --git a/content/apps/creating-github-apps/writing-code-for-a-github-app/quickstart.md b/content/apps/creating-github-apps/writing-code-for-a-github-app/quickstart.md index 0e515cb4dfeb..7e497466bd2c 100644 --- a/content/apps/creating-github-apps/writing-code-for-a-github-app/quickstart.md +++ b/content/apps/creating-github-apps/writing-code-for-a-github-app/quickstart.md @@ -121,7 +121,7 @@ For testing, you will use your computer or codespace as a server. Your app will You should see output that looks like this, where `WEBHOOK_PROXY_URL` is your webhook proxy URL: - ``` + ```shell Forwarding WEBHOOK_PROXY_URL to http://localhost:3000/api/webhook Connected WEBHOOK_PROXY_URL ``` diff --git a/content/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps.md b/content/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps.md index 3bc2122ad102..8d4e326f568c 100644 --- a/content/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps.md +++ b/content/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps.md @@ -88,7 +88,7 @@ Parameter name | Type | Description By default, the response takes the following form: -``` +```shell access_token=gho_16C7e42F292c6912E7710c838347Ae178B4a&scope=repo%2Cgist&token_type=bearer ``` @@ -162,7 +162,7 @@ Parameter name | Type | Description By default, the response takes the following form: -``` +```shell device_code=3584d83530557fdd1f46af8289938c8ef79f9dc5&expires_in=900&interval=5&user_code=WDJB-MJHT&verification_uri=https%3A%2F%{% data variables.product.product_url %}%2Flogin%2Fdevice ``` @@ -222,7 +222,7 @@ Parameter name | Type | Description By default, the response takes the following form: -``` +```shell access_token=gho_16C7e42F292c6912E7710c838347Ae178B4a&token_type=bearer&scope=repo%2Cgist ``` @@ -297,7 +297,7 @@ The optional `redirect_uri` parameter can also be used for loopback URLs. If the For the `http://127.0.0.1/path` callback URL, you can use this `redirect_uri`: -``` +```http http://127.0.0.1:1234/path ``` @@ -319,7 +319,7 @@ You can link to authorization information for an {% data variables.product.prodn To build this link, you'll need your {% data variables.product.prodname_oauth_app %}'s `client_id` that you received from GitHub when you registered the application. -``` +```http {% data variables.product.oauth_host_code %}/settings/connections/applications/:client_id ``` diff --git a/content/graphql/guides/introduction-to-graphql.md b/content/graphql/guides/introduction-to-graphql.md index 182e270a0f33..d3867793e299 100644 --- a/content/graphql/guides/introduction-to-graphql.md +++ b/content/graphql/guides/introduction-to-graphql.md @@ -42,7 +42,7 @@ A GraphQL schema may use the term _implements_ to define how an object inherits Here's a contrived example of a schema that defines interface `X` and object `Y`: -``` +```graphql interface X { some_field: String! other_field: String! diff --git a/content/graphql/guides/migrating-graphql-global-node-ids.md b/content/graphql/guides/migrating-graphql-global-node-ids.md index 831bdd913f29..3dc82266313a 100644 --- a/content/graphql/guides/migrating-graphql-global-node-ids.md +++ b/content/graphql/guides/migrating-graphql-global-node-ids.md @@ -29,7 +29,7 @@ To facilitate migration to the new ID format, you can use the `X-Github-Next-Glo Here is an example request using a `curl` command: -``` +```shell $ curl \ -H "Authorization: Bearer $GITHUB_TOKEN" \ -H "X-Github-Next-Global-ID: 1" \ @@ -39,7 +39,7 @@ $ curl \ Even though the legacy ID `MDQ6VXNlcjM0MDczMDM=` was used in the query, the response will contain the new ID format: -``` +```json {"data":{"node":{"id":"U_kgDOADP9xw"}}} ``` @@ -48,7 +48,7 @@ To perform bulk operations, you can use aliases to submit multiple node queries You can also get the new ID for a collection of items. For example, if you wanted to get the new ID for the last 10 repositories in your organization, you could use a query like this: -``` +```json { organization(login: "github") { repositories(last: 10) { diff --git a/content/rest/deployments/deployments.md b/content/rest/deployments/deployments.md index 0ebe46b553ea..4c4156696a45 100644 --- a/content/rest/deployments/deployments.md +++ b/content/rest/deployments/deployments.md @@ -24,7 +24,7 @@ GitHub dispatches `deployment` and `deployment_status` events when new deploymen Below is a simple sequence diagram for how these interactions would work. -``` +```text +---------+ +--------+ +-----------+ +-------------+ | Tooling | | GitHub | | 3rd Party | | Your Server | +---------+ +--------+ +-----------+ +-------------+ diff --git a/content/rest/enterprise-admin/scim.md b/content/rest/enterprise-admin/scim.md index 0a88d6c1b594..46f0de915067 100644 --- a/content/rest/enterprise-admin/scim.md +++ b/content/rest/enterprise-admin/scim.md @@ -22,7 +22,7 @@ These endpoints are based on SCIM 2.0. For more information, refer to your IdP's An IdP can use the following root URL to communicate with the endpoints in this category for a {% data variables.product.product_name %} instance. -``` +```http {% data variables.product.api_url_code %}/scim/v2/ ``` @@ -45,7 +45,7 @@ To authenticate API requests, the person who configures SCIM on the IdP must use {% endnote %} ### Mapping of SAML and SCIM data - + The {% data variables.product.product_name %} instance links each user who authenticates successfully with SAML SSO to a SCIM identity. To link the identities successfully, the SAML IdP and the SCIM integration must use matching SAML `NameID` and SCIM `userName` values for each user. {% ifversion ghes > 3.7 %} diff --git a/content/rest/guides/getting-started-with-the-rest-api.md b/content/rest/guides/getting-started-with-the-rest-api.md index 3c1ee866ee50..b890795b17ae 100644 --- a/content/rest/guides/getting-started-with-the-rest-api.md +++ b/content/rest/guides/getting-started-with-the-rest-api.md @@ -707,7 +707,7 @@ jq '.[] | {title: .title, authorID: .user.id}' data.json The previous two commands return something like: -``` +```json { "title": "Update index.html", "authorID": 10701255 @@ -764,7 +764,7 @@ jq '.[] | {title: .title, authorID: .user.id}' data.json The previous two commands return something like: -``` +```json { "title": "Update index.html", "authorID": 10701255 diff --git a/content/rest/guides/using-pagination-in-the-rest-api.md b/content/rest/guides/using-pagination-in-the-rest-api.md index 9038146f13b3..e5176b5e7dda 100644 --- a/content/rest/guides/using-pagination-in-the-rest-api.md +++ b/content/rest/guides/using-pagination-in-the-rest-api.md @@ -33,7 +33,7 @@ curl --include --request GET \ If the response is paginated, the link header will look something like this: -``` +```http link: ; rel="prev", ; rel="next", ; rel="last", ; rel="first" ``` @@ -54,7 +54,7 @@ curl --include --request GET \ --header "Accept: application/vnd.github+json" ``` -The URLs in the link header use query parameters to indicate what page of results to return. The query parameters in the link URLs may differ between endpoints: each paginated endpoint will use the `page`, `before`/`after`, or `since` query parameters. (Some endpoints use the `since` parameter for something other than pagination.) In all cases, you can use the URLs in the link header to fetch additional pages of results. For more information about query parameters see "[AUTOTITLE](/rest/guides/getting-started-with-the-rest-api#using-query-parameters)." +The URLs in the link header use query parameters to indicate what page of results to return. The query parameters in the link URLs may differ between endpoints: each paginated endpoint will use the `page`, `before`/`after`, or `since` query parameters. (Some endpoints use the `since` parameter for something other than pagination.) In all cases, you can use the URLs in the link header to fetch additional pages of results. For more information about query parameters see "[AUTOTITLE](/rest/guides/getting-started-with-the-rest-api#using-query-parameters)." ## Changing the number of items per page @@ -70,7 +70,7 @@ curl --include --request GET \ The `per_page` parameter will automatically be included in the link header. For example: -``` +```http link: ; rel="next", ; rel="last" ``` @@ -169,7 +169,7 @@ function parseData(data) { // Pull out the array of items const namespaceKey = Object.keys(data)[0]; data = data[namespaceKey]; - + return data; } diff --git a/content/rest/migrations/source-imports.md b/content/rest/migrations/source-imports.md index 24ba11c60409..d2944db24fa8 100644 --- a/content/rest/migrations/source-imports.md +++ b/content/rest/migrations/source-imports.md @@ -21,7 +21,7 @@ autogenerated: rest The following diagram provides a more detailed example: -``` +```text +---------+ +--------+ +---------------------+ | Tooling | | GitHub | | Original Repository | +---------+ +--------+ +---------------------+ diff --git a/content/rest/search/search.md b/content/rest/search/search.md index 498f3b51cff4..f065a9850156 100644 --- a/content/rest/search/search.md +++ b/content/rest/search/search.md @@ -41,7 +41,7 @@ Each endpoint for searching uses [query parameters](https://en.wikipedia.org/wik A query can contain any combination of search qualifiers supported on {% data variables.product.product_name %}. The format of the search query is: -``` +```text SEARCH_KEYWORD_1 SEARCH_KEYWORD_N QUALIFIER_1 QUALIFIER_N ``` @@ -49,7 +49,7 @@ For example, if you wanted to search for all _repositories_ owned by `defunkt` t contained the word `GitHub` and `Octocat` in the README file, you would use the following query with the _search repositories_ endpoint: -``` +```text GitHub Octocat in:readme user:defunkt ``` diff --git a/content/webhooks-and-events/events/github-event-types.md b/content/webhooks-and-events/events/github-event-types.md index 8b8340128778..8a9122ca6571 100644 --- a/content/webhooks-and-events/events/github-event-types.md +++ b/content/webhooks-and-events/events/github-event-types.md @@ -52,7 +52,7 @@ The event objects returned from the Events API endpoints have the same structure This example shows the format of the [WatchEvent](#watchevent) response when using the [Events API](/rest/activity#events). -``` +```http HTTP/2 200 Link: ; rel="next", ; rel="last" diff --git a/data/reusables/pre-release-program/starfox-preview.md b/data/reusables/pre-release-program/starfox-preview.md index 909845229031..aca22eee88d0 100644 --- a/data/reusables/pre-release-program/starfox-preview.md +++ b/data/reusables/pre-release-program/starfox-preview.md @@ -4,7 +4,7 @@ To receive the `project_card` attribute, project boards must be [enabled](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/disabling-project-boards-in-a-repository) for a repository, and you must provide a custom [media type](/rest/overview/media-types) in the `Accept` header: -``` +```text application/vnd.github.starfox-preview+json ``` From 47c420631ea307106f38e48d599169441a3167ae Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 18 Jul 2023 16:58:08 -0400 Subject: [PATCH 2/3] Local-dev using enterprise-cloud instead (#39256) --- .github/actions-scripts/test-local-dev.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions-scripts/test-local-dev.js b/.github/actions-scripts/test-local-dev.js index d9435ff2557f..94bfe46c5cca 100755 --- a/.github/actions-scripts/test-local-dev.js +++ b/.github/actions-scripts/test-local-dev.js @@ -125,9 +125,9 @@ async function testSiteSearch() { assert(/[\d,]+ Search results for "github"/.test($('h1').text())) assert($('[data-testid="search-result"]').length > 0) } - // Find 0 things on enterprise-server@latest + // Find 0 things on enterprise-cloud@latest { - const res = await get('/en/enterprise-server@latest/search?query=gobligook') + const res = await get('/en/enterprise-cloud@latest/search?query=gobligook') const $ = cheerio.load(res.body) assert(/0 Search results for "gobligook"/.test($('h1').text())) assert($('[data-testid="search-result"]').length === 0) From f3f72a134a6c6a93a3a36a4ce7b3a84d9e284fa4 Mon Sep 17 00:00:00 2001 From: Kevin Heis Date: Tue, 18 Jul 2023 14:12:02 -0700 Subject: [PATCH 3/3] Delete repository-references.js (#39239) --- .../tests/repository-references.js | 138 ------------------ 1 file changed, 138 deletions(-) delete mode 100644 src/observability/tests/repository-references.js diff --git a/src/observability/tests/repository-references.js b/src/observability/tests/repository-references.js deleted file mode 100644 index fff235917571..000000000000 --- a/src/observability/tests/repository-references.js +++ /dev/null @@ -1,138 +0,0 @@ -import fs from 'fs' - -import walkSync from 'walk-sync' - -/* -This test exists to make sure we don't reference private GitHub owned repositories -in our open-source repository. - -If this test is failing... -(1) edit the file to remove the reference; or -(2) the repository is public, - add the repository name to PUBLIC_REPOS. -*/ - -// These are a list of known public repositories in the GitHub organization. -// The names below on their own, plus the same names ending with '.git', will be accepted. -// Do not include '.git' in the names below. -const PUBLIC_REPOS = new Set([ - 'actions-oidc-gateway-example', - 'advisory-database', - 'backup-utils', - 'browser-support', - 'choosealicense.com', - 'codeql-action-sync-tool', - 'codeql-action', - 'codeql-cli-binaries', - 'codeql-go', - 'codeql', - 'codespaces-precache', - 'codespaces-jupyter', - 'copilot.vim', - 'dependency-submission-toolkit', - 'dmca', - 'docs', - 'enterprise-releases', - 'explore', - 'feedback', - 'gh-net', - 'gh-actions-importer', - 'git-lfs', - 'git-sizer', - 'github-services', - 'gitignore', - 'gov-takedowns', - 'haikus-for-codespaces', - 'hello-world', - 'help-docs-archived-enterprise-versions', - 'hubot', - 'insights-releases', - 'issue-metrics', - 'janky', - 'linguist', - 'localization-support', - 'markup', - 'platform-samples', - 'renaming', - 'rest-api-description', - 'roadmap', - 'securitylab', - 'semantic', - 'ssh_data', - 'site-policy', - 'smimesign', - 'stack-graphs', - 'super-linter', - 'tweetsodium', - 'VisualStudio', - 'codespaces-getting-started-ml', - 'dependabot-action', - 'gh-migration-analyzer', - 'github-app-js-sample', -]) - -// This regexp will capture the last segment of a GitHub repo name. -// E.g., it will capture `backup-utils.git` from `https://github.com/github/backup-utils.git`. -const REPO_REGEXP = /\/\/github\.com\/github\/([\w\-.]+)/gi - -const IGNORE_PATHS = [ - '.git', - '.next', - '.vscode', // Not part of the repo but could be for a developer locally - 'node_modules', - 'translations', - '**/*.png', // Do not check images or font files. - '**/*.jpg', // We could just put all of assets/* here, but that would prevent any - '**/*.gif', // READMEs or other text-based files from being checked. - '**/*.webp', - '**/*.pdf', - '**/*.ico', - '**/*.woff', - '**/*.csv', - '**/*.br', // E.g. the search index .json.br files - '**/*.graphql', // E.g. data/graphql/ghec/schema.docs.graphql - 'package-lock.json', // At the time of writing it's 1.5MB! - 'tests/**/*.json', - 'src/**/*.json', // OpenAPI schema files - 'content/early-access', // Not committed to public repository. - 'data/early-access', // Not committed to public repository. - 'data/release-notes', // These include links to many internal issues in Liquid comments. - 'lib/redirects/.redirects-cache*', -] - -describe('check if a GitHub-owned private repository is referenced', () => { - const filenames = walkSync(process.cwd(), { - directories: false, - ignore: IGNORE_PATHS, - }).filter( - (filename) => - // Skip the large static json files because they're not code. - !( - filename.includes('static') && - (filename.endsWith('.json') || filename.endsWith('.json.br')) - ), - ) - - test.each(filenames)('in file %s', (filename) => { - // When you're reading many small files, it's faster to do it - // *synchronously* because the event-loop overhead is less since - // the disk I/O is sufficiently small. - const file = fs.readFileSync(filename, 'utf8') - const matches = Array.from(file.matchAll(REPO_REGEXP)) - // The referenced repo may or may not end with '.git', so ignore that extension. - .map(([, repoName]) => repoName.replace(/\.git$/, '')) - .filter((repoName) => !PUBLIC_REPOS.has(repoName)) - .filter((repoName) => !repoName.startsWith('docs')) - expect( - matches, - `This test exists to make sure we don't reference private GitHub owned repositories in our open-source repository. - - In '${filename}' we found references to these private repositories: ${matches.join(', ')} - - You can: - - (1) edit the file to remove the repository reference; or - (2) if the repository is public, add the repository name to the 'PUBLIC_REPOS' variable in this test file.`, - ).toHaveLength(0) - }) -})