Skip to content

Consider use of {owner} and {repo} in gh api examples in the REST API documentation #42738

@rneatherway

Description

@rneatherway

Code of Conduct

What article on docs.github.com is affected?

As an example, look at https://docs.github.com/en/rest/code-scanning/code-scanning?apiVersion=2022-11-28#get-a-code-scanning-alert

What changes are you suggesting?

The code sample with GitHub CLI selected looks like:

Image

The content is copyable, but unfortunately will not work without replacing OWNER and REPO with concrete values. However, since cli/cli#3536, the GitHub CLI understands the standard path parameter replacement syntax of {owner} and {repo} (as well as {branch}) and replaces them with the current repository if the current working directory is a clone of a GitHub repository.

You can see that they are actually used already in the API path just above (GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}).

Making this change would allow clicking the copy button, pasting directory into your terminal and hitting enter to run.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    contentThis issue or pull request belongs to the Docs Content teamtriageDo not begin working on this issue until triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions