Pre-filling form fields when creating a new repo (#36508)

Co-authored-by: Steve Guntrip <stevecat@github.com>
Co-authored-by: Paul Loeb <90000203+thispaul@users.noreply.github.com>
This commit is contained in:
Jules 2023-05-02 12:11:56 +02:00 коммит произвёл GitHub
Родитель c6d86906ce
Коммит 81ec7ee2f3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 30 добавлений и 0 удалений

Просмотреть файл

@ -31,6 +31,12 @@ topics:
{% endtip %}
{% ifversion create-new-repos-with-query-params %}
## Creating a new repository from the web UI
{% endif %}
{% data reusables.repositories.create_new %}
1. Optionally, to create a repository with the directory structure and files of an existing repository, select the **Choose a template** dropdown menu and click a template repository. You'll see template repositories that are owned by you and organizations you're a member of or that you've used before. For more information, see "[AUTOTITLE](/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template)."
1. Optionally, if you chose to use a template, to include the directory structure and files from all branches in the template, and not just the default branch, select **Include all branches**.
@ -47,6 +53,26 @@ topics:
1. At the bottom of the resulting Quick Setup page, under "Import code from an old repository", you can choose to import a project to your new repository. To do so, click **Import code**.
{% endif %}
{% ifversion create-new-repos-with-query-params %}
## Creating a new repository from a URL query
You can use query parameters to pre-fill form fields when creating a new repository. Query parameters are optional parts of a URL you can customize to share a specific web page view, such as search filter results or an issue template on {% data variables.product.prodname_dotcom %}. To specify values for the predefined query parameters, you must match the key and value pair.
Pre-filling form fields with a URL query may be useful if you often want to create repositories with the same default settings. For example, a teacher may want each student in a class to create a repository in their personal account with the same name, description and visibility. Using a URL query, the teacher can create a link that pre-fills the repository name, description and visibility fields and share it with the whole class.
You must have the proper permissions for any action to use the equivalent query parameter. For example, you must have permission to create a repository in an organization to specify the organization as the repository owner in a query parameter. For more information, see "[AUTOTITLE](/organizations/managing-user-access-to-your-organizations-repositories/repository-roles-for-an-organization)."
If you create an invalid URL using query parameters, or if you dont have the proper permissions, the invalid query parameters will be ignored and the rest of the URL will function as normal. If you create a URL that exceeds the server limit, the URL will return a `414 URI Too Long` error page.
Query parameter | Example | Valid values
--- | --- | ---
`name` | `https://{% data variables.product.product_url %}/new?name=test-repo&owner=avocado-corp` creates a repository called "test-repo" owned by the "avocado-corp" organization. | Any valid repository name. Spaces must be replaced with `+` or `%20`.
`description` | `https://{% data variables.product.product_url %}/new?description=An+exciting+repository&visibility=private&owner=octocat` creates a repo with the description "An exciting repository" with private visibility owned by @octocat. | Any string. Spaces must be replaced with `+` or `%20`.
`visibility` | `https://{% data variables.product.product_url %}/new?visibility=private` creates a repository with private visibility. | `public`<br> `private`<br>{% ifversion not fpt %}`internal`{% endif %}
`owner` | `https://{% data variables.product.product_url %}/new?owner=avocado-corp&visibility=public` creates a public repository owned by the "avocado-corp" organization. | Any valid organization name or username.
`template_owner` and `template_name` | `https://{% data variables.product.product_url %}/new?owner=avocado-corp&template_owner=avocado-corp&template_name=octo-repo` creates a repository owned by the "avocado-corp" using the avocado-corp's template "octo-repo". | The username of the template owner and the name of the repository template.
{% endif %}
## Further reading
- "[AUTOTITLE](/organizations/managing-user-access-to-your-organizations-repositories)"

Просмотреть файл

@ -0,0 +1,4 @@
# Reference issue: 10015
versions:
fpt: '*'
ghec: '*'