Skip to content

Commit 8baa85c

Browse files
authored
Merge pull request #44121 from github/repo-sync
Repo sync
2 parents fd89248 + ee6aaca commit 8baa85c

13 files changed

Lines changed: 195 additions & 12 deletions

File tree

content/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-code-governance.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ Rulesets allow you to flexibly target the organizations, repositories, and branc
3232
* Within those organizations, you can target all **repositories**, or target a dynamic list by custom property or deployment context.
3333
* Within the repositories, you can target certain **branches or tags**: all branches, the default branch, or a dynamic list using `fnmatch` syntax.
3434

35-
When you create a ruleset that targets branches in a repository, repository administrators can no longer rename branches or change the default branch in the targeted repository. They can still create and delete branches if they have the appropriate permissions.
36-
3735
## How can I control the format of commits?
3836

3937
In branch or tag rulesets, you can add a rule that restricts the format of commit metadata such as commit message or author email.

content/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,19 @@ Across all organizations owned by your enterprise, you can allow members with ad
190190
1. Under "Repository issue deletion", review the information about changing the setting. {% data reusables.enterprise-accounts.view-current-policy-config-orgs %}
191191
1. Under "Repository issue deletion", select the dropdown menu and click a policy.
192192

193+
{% ifversion repo-admin-branch-rename %}
194+
195+
## Enforcing a policy for renaming protected branches
196+
197+
By default, repository administrators can rename branches that are targeted by enterprise-level rules, provided the new branch name is still targeted by those rules. You can restrict this ability to enterprise owners only.
198+
199+
{% data reusables.enterprise-accounts.access-enterprise %}
200+
{% data reusables.enterprise-accounts.policies-tab %}
201+
{% data reusables.enterprise-accounts.repositories-tab %}
202+
1. Under "Repository branch renames", select the dropdown menu and click a policy.
203+
204+
{% endif %}
205+
193206
{% ifversion ghes %}
194207

195208
## Enforcing a policy for Git push limits

content/code-security/reference/code-scanning/codeql/codeql-cli-manual/database-finalize.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ Indicates that the directory given on the command line is not a database
5454
itself, but a directory that _contains_ one or more databases under
5555
construction. Those databases will be processed together.
5656

57+
#### `--working-dir=<dir>`
58+
59+
\[Advanced] The directory in which the specified command should be
60+
executed. If this argument is not provided, the command is executed in
61+
the value of `--source-root` passed to [codeql database create](/code-security/reference/code-scanning/codeql/codeql-cli-manual/database-create), if one exists. If no `--source-root` argument is provided, the command is executed in the
62+
current working directory.
63+
5764
#### `--additional-dbs=<database>[:<database>...]`
5865

5966
\[Advanced] Path to additional CodeQL databases under construction.

content/copilot/how-tos/use-copilot-agents/cloud-agent/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ children:
1313
- /integrate-cloud-agent-with-teams
1414
- /integrate-cloud-agent-with-linear
1515
- /integrate-cloud-agent-with-azure-boards
16+
- /use-cloud-agent-via-the-api
1617
- /changing-the-ai-model
1718
- /configuring-agent-settings
1819
- /create-custom-agents-in-your-ide
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
title: Using Copilot cloud agent via the API
3+
shortTitle: Use cloud agent via the API
4+
intro: 'You can start and manage {% data variables.copilot.copilot_cloud_agent %} tasks programmatically using the REST API.'
5+
product: '{% data reusables.gated-features.copilot-business-and-enterprise %}'
6+
versions:
7+
feature: copilot
8+
contentType: how-tos
9+
category:
10+
- Integrate Copilot with your tools
11+
---
12+
13+
> [!NOTE]
14+
> The agent tasks API is in {% data variables.release-phases.public_preview %} and subject to change.
15+
16+
You can use the agent tasks API to integrate {% data variables.copilot.copilot_cloud_agent_short %} into your own tools and workflows. For example, you can start a new task, list existing tasks, or check the status of a task.
17+
18+
For the full API reference, see [AUTOTITLE](/rest/agent-tasks/agent-tasks).
19+
20+
## Authentication
21+
22+
The agent tasks API only supports user-to-server tokens. You can authenticate using a {% data variables.product.pat_generic %}, a {% data variables.product.prodname_oauth_app %} token or a {% data variables.product.prodname_github_app %} user-to-server token.
23+
24+
Server-to-server tokens, such as {% data variables.product.prodname_github_app %} installation access tokens, are not supported.
25+
26+
## Starting a task via the API
27+
28+
To start a new {% data variables.copilot.copilot_cloud_agent_short %} task, send a `POST` request to `/agents/repos/{owner}/{repo}/tasks`. The only required parameter is `prompt`, which is the prompt for the agent.
29+
30+
```shell copy
31+
curl -X POST \
32+
-H "Accept: application/vnd.github+json" \
33+
-H "X-GitHub-Api-Version: {{ defaultRestApiVersion }}" \
34+
-H "Authorization: Bearer YOUR-TOKEN" \
35+
https://api.github.com/agents/repos/OWNER/REPO/tasks \
36+
-d '{
37+
"prompt": "Fix the login button on the homepage",
38+
"base_ref": "main"
39+
}'
40+
```
41+
42+
Replace the following placeholder values:
43+
44+
* `YOUR-TOKEN`: A {% data variables.product.pat_generic %} or {% data variables.product.prodname_github_app %} user-to-server token.
45+
* `OWNER`: The account owner of the repository.
46+
* `REPO`: The name of the repository.
47+
48+
You can also include the following optional parameters in the request body:
49+
50+
* `base_ref`: The base branch for the new branch and pull request.
51+
* `model`: The AI model to use for the task. If omitted, {% data variables.copilot.copilot_auto_model_selection_short %} is used. For more information about supported models, see [AUTOTITLE](/rest/agent-tasks/agent-tasks).
52+
* `create_pull_request`: A boolean that determines whether to create a pull request for the task.
53+
54+
## Listing tasks
55+
56+
You can list tasks for a specific repository or across all repositories you have access to.
57+
58+
To list tasks for a specific repository:
59+
60+
```shell copy
61+
curl -H "Accept: application/vnd.github+json" \
62+
-H "X-GitHub-Api-Version: {{ defaultRestApiVersion }}" \
63+
-H "Authorization: Bearer YOUR-TOKEN" \
64+
https://api.github.com/agents/repos/OWNER/REPO/tasks
65+
```
66+
67+
To list your tasks across all repositories:
68+
69+
```shell copy
70+
curl -H "Accept: application/vnd.github+json" \
71+
-H "X-GitHub-Api-Version: {{ defaultRestApiVersion }}" \
72+
-H "Authorization: Bearer YOUR-TOKEN" \
73+
https://api.github.com/agents/tasks
74+
```
75+
76+
## Checking the status of a task
77+
78+
To check the status of a specific task, send a `GET` request with the task ID:
79+
80+
```shell copy
81+
curl -H "Accept: application/vnd.github+json" \
82+
-H "X-GitHub-Api-Version: {{ defaultRestApiVersion }}" \
83+
-H "Authorization: Bearer YOUR-TOKEN" \
84+
https://api.github.com/agents/repos/OWNER/REPO/tasks/TASK-ID
85+
```
86+
87+
Replace `TASK-ID` with the ID of the task you want to check. You can get this ID from the response when you create a task or list tasks. The response includes the task's current `state`, which can be one of: `queued`, `in_progress`, `completed`, `failed`, `idle`, `waiting_for_user`, `timed_out`, or `cancelled`.
88+
89+
## Further reading
90+
91+
* [AUTOTITLE](/rest/agent-tasks/agent-tasks)
92+
* [AUTOTITLE](/copilot/concepts/agents/cloud-agent/about-cloud-agent)
93+
* [AUTOTITLE](/copilot/how-tos/use-copilot-agents/cloud-agent/start-copilot-sessions)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: Allowing repository admins to rename branches with organization rulesets
3+
intro: 'Organization owners can allow people with repository admin permission to rename branches that are targeted by organization rulesets.'
4+
versions:
5+
feature: repo-admin-branch-rename
6+
permissions: Organization owners can manage this setting.
7+
shortTitle: Allow branch renames
8+
category:
9+
- Configure organization features
10+
---
11+
12+
Organization owners control whether repository administrators can rename branches that are targeted by one or more branch rulesets. For existing organizations, this setting is off by default. For newly created organizations, this setting is on by default.
13+
14+
When this setting is enabled, repository administrators can rename these branches, provided the new branch name is still targeted by all the same organization rulesets as the current branch name. This ensures that rulesets cannot be circumvented through branch renaming.
15+
16+
Organization administrators can rename branches targeted by organization rulesets without restriction.
17+
18+
> [!NOTE]
19+
> Even with this setting enabled, changing the default branch of a repository still requires an organization administrator when organization rulesets are in play.
20+
21+
{% data reusables.profile.access_org %}
22+
{% data reusables.profile.org_settings %}
23+
{% data reusables.organizations.member-privileges %}
24+
1. Under "Branch renames", select **Allow repository administrators to rename branches protected by organization rules**.
25+
1. Click **Save**.
26+
27+
## Further reading
28+
29+
* [AUTOTITLE](/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/renaming-a-branch)
30+
* [AUTOTITLE](/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise#enforcing-a-policy-for-renaming-protected-branches)

content/organizations/managing-organization-settings/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ children:
2727
- /configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-organization
2828
- /setting-permissions-for-adding-outside-collaborators
2929
- /allowing-people-to-delete-issues-in-your-organization
30+
- /allowing-repository-admins-to-rename-branches-with-organization-rulesets
3031
- /enabling-or-disabling-github-discussions-for-an-organization
3132
- /managing-discussion-creation-for-repositories-in-your-organization
3233
- /managing-the-commit-signoff-policy-for-your-organization

content/organizations/managing-organization-settings/managing-rulesets-for-repositories-in-your-organization.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,17 @@ category:
1313

1414
## About managing rulesets for an organization
1515

16-
After creating a ruleset at the organization level, you can make changes to the ruleset to alter how people can interact with the targeted repositories. For example, you can add rules to better protect the branches or tags in those repositories{% ifversion not fpt %}, or you can switch your ruleset from "Evaluate" mode to "Active" after testing its effects on the contributor experience for your repositories{% endif %}. Organizational rulesets that apply to branches of a repository will no longer allow the repository administrator to rename branches of the targeted repository or change the default branch to another branch. Repository administrators may create and delete branches so long as they have the appropriate permissions.
16+
After creating a ruleset at the organization level, you can make changes to the ruleset to alter how people can interact with the targeted repositories. For example, you can add rules to better protect the branches or tags in those repositories{% ifversion not fpt %}, or you can switch your ruleset from "Evaluate" mode to "Active" after testing its effects on the contributor experience for your repositories{% endif %}.
17+
18+
{% ifversion repo-admin-branch-rename %}
19+
20+
For information about how organizational rulesets affect branch renaming, see [AUTOTITLE](/organizations/managing-organization-settings/allowing-repository-admins-to-rename-branches-with-organization-rulesets).
21+
22+
{% else %}
23+
24+
Organizational rulesets that apply to branches of a repository will not allow the repository administrator to rename branches of the targeted repository or change the default branch to another branch.
25+
26+
{% endif %}
1727

1828
{% ifversion push-rule-delegated-bypass %}
1929

content/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/changing-the-default-branch.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ You can also rename the default branch. For more information, see [AUTOTITLE](/r
2727

2828
To change the default branch, your repository must have more than one branch. For more information, see [AUTOTITLE](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-and-deleting-branches-within-your-repository#creating-a-branch).
2929

30-
{% ifversion not fpt %}
30+
{% ifversion repo-admin-branch-rename %}
3131

32-
Rulesets at the organization{% ifversion ghec %} or enterprise{% endif %} level that apply to branches of a repository will not allow the repository administrator to rename branches of the targeted repository or change the default branch to another branch. See [AUTOTITLE](/organizations/managing-organization-settings/managing-rulesets-for-repositories-in-your-organization){% ifversion ghec %} or [AUTOTITLE](/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-code-governance){% endif %}.
32+
If organizational or enterprise rulesets target branches in your repository, changing the default branch requires an organization or enterprise administrator. Whether repository administrators can rename other targeted branches depends on the branch-rename setting or policy configured by your organization or enterprise. For more information, see [AUTOTITLE](/organizations/managing-organization-settings/allowing-repository-admins-to-rename-branches-with-organization-rulesets).
33+
34+
{% else %}
35+
36+
Rulesets at the organization level that apply to branches of a repository will not allow the repository administrator to rename branches of the targeted repository or change the default branch to another branch. See [AUTOTITLE](/organizations/managing-organization-settings/managing-rulesets-for-repositories-in-your-organization).
3337

3438
{% endif %}
3539

content/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/renaming-a-branch.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Renaming a branch
33
intro: You can change the name of a branch in a repository.
4-
permissions: 'People with write permissions to a repository can rename a branch in the repository unless it is the [default branch](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches#about-the-default-branch) or a [protected branch](/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches). People with admin permissions can rename the default branch and protected branches.'
4+
permissions: 'People with write permissions to a repository can rename a branch in the repository unless it is the [default branch](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches#about-the-default-branch) or covered by a [branch protection](/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches) or ruleset. People with admin permissions can rename the default branch and protected branches.'
55
versions:
66
fpt: '*'
77
ghes: '*'
@@ -24,7 +24,27 @@ Although file URLs are automatically redirected, raw file URLs are not redirecte
2424

2525
{% data variables.product.prodname_actions %} workflows do not follow renames, so if your repository publishes an action, anyone using that action with `@{old-branch-name}` will break. You should consider adding a new branch with the original content plus an additional commit reporting that the branch name is {% data variables.release-phases.closing_down %} and suggesting that users migrate to the new branch name.
2626

27-
Organizational rulesets that apply to branches of a repository will no longer allow the repository administrator to rename branches of the targeted repository or change the default branch to another branch. Repository administrators may create and delete branches so long as they have the appropriate permissions.
27+
## Who can rename a branch
28+
29+
Most branches can be renamed by any user with **write** permission to the repository.
30+
31+
Some branches can only be renamed by a repository administrator: the repository's default branch, and any branch covered by a branch protection or a repository-level branch ruleset.
32+
33+
{% ifversion repo-admin-branch-rename %}
34+
35+
When organization-level or enterprise-level rulesets target branches in a repository, renaming those branches typically requires an organization or enterprise administrator.
36+
37+
However, organization and enterprise owners can allow repository administrators to rename branches covered by these rulesets, provided the new branch name is still subject to all the same rules as the current name. Changing the default branch still requires an organization or enterprise administrator when rulesets are in play.
38+
39+
For more information, see [AUTOTITLE](/organizations/managing-organization-settings/allowing-repository-admins-to-rename-branches-with-organization-rulesets) and [AUTOTITLE](/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise#enforcing-a-policy-for-renaming-protected-branches).
40+
41+
{% else %}
42+
43+
Organizational rulesets that apply to branches of a repository will not allow the repository administrator to rename branches of the targeted repository or change the default branch to another branch.
44+
45+
{% endif %}
46+
47+
Repository administrators may create and delete branches so long as they have the appropriate permissions.
2848

2949
## Renaming a branch
3050

0 commit comments

Comments
 (0)