Skip to content

Commit b923896

Browse files
committed
feat: update docs for fine-grained-access tokens
1 parent e5ad862 commit b923896

File tree

1 file changed

+62
-4
lines changed

1 file changed

+62
-4
lines changed

docs/batch-changes/configuring-credentials.mdx

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,71 @@ Let's learn how you can do it for different code hosts.
101101

102102
### GitHub
103103

104-
On GitHub.com, [create a personal access token (classic) with the correct scopes](https://github.com/settings/tokens/new?scopes=repo,read:org,user:email,read:discussion,workflow).
104+
On GitHub.com, create a personal access token or fine-grained access token with the correct scopes.
105105

106106
The `workflow` scope is technically only required if your batch changes modify files in the `.github` directory of a repository. Still, it's recommended to enable it regardless to avoid confusing errors at a later time.
107107

108108
When working with organizations that have SAML SSO (Single Sign On) enabled, configuring credentials requires an additional step that [involves white-listing the token for use in that organization](https://docs.github.com/en/enterprise-cloud@latest/authentication/authenticating-with-saml-single-sign-on/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on).
109109

110-
<Callout type="info">At present, only classic personal access tokens (PATs) are supported. Alternative token types like OAuth access tokens (e.g., OAuth apps), and fine-grained personal access tokens (PATv2) are not supported.</Callout>
110+
<Callout type="info">At present, only classic and fine-grained access tokens are supported. Alternative token types like OAuth access tokens (e.g. OAuth apps) are not supported.</Callout>
111+
112+
#### Personal Access Token
113+
114+
Personal access tokens will have access to all repositories that you have access to.
115+
116+
[Click here to prefill the form](https://github.com/settings/tokens/new?scopes=repo,read:org,user:email,read:discussion,workflow).
117+
118+
Required Scopes:
119+
- `repo`
120+
- `read:org`
121+
- `user:email`
122+
- `read:discussion`
123+
- `workflow`
124+
125+
#### Fine-Grained Access Token
126+
127+
Fine-grained access tokens allow more granular control of what actions can be performed for a given set of repositories. Most notably, fine-grained access tokens don't grant access by default to all repositories that you have access to.
128+
129+
In contrast to personal access tokens, fine-grained access tokens for organization resources may be restricted, may have an expiration, and may require approval.
130+
131+
**Restriction**: If an administrator of your GitHub organization has restricted access via fine-grained access tokens, you may not be able to use them for Batch Changes.
132+
133+
**Expiration**: If your organization has configured fine-grained access tokens to have maximum lifetimes, you may need to recreate the token when it has expired.
134+
135+
**Approval**: If your organization has configured fine-grained access tokens to require approval, you may need to wait for an administrator to approve the token before you can use it with Batch Changes.
136+
137+
Start by navigating to the form for creating a [new fine-grained access token](https://github.com/settings/personal-access-tokens/new).
138+
139+
Pick the resource owner that owns the repositories you want to use with Batch Changes. This will most likely be your company's GitHub organization.
140+
141+
PICTURE
142+
143+
Scroll down and select "All repositories" so that your token can access all current and future repositories that you have access to. You may restrict it to "Only select repositories", but may have to generate a new token when you want to handle a new repository with Batch Changes.
144+
145+
PICTURE
146+
147+
Under "Permissions" click on the arrows on the right-hand side to expand the list for repository and organization permissions.
148+
149+
PICTURE
150+
151+
Under "Repository permissions", select the following permissions:
152+
- Commit statuses: Read-only
153+
- Contents: Read and write
154+
- Discussions: Read-only
155+
- Metadata: Read-only
156+
- Pull requests: Read and write
157+
- Workflows: Read and write
158+
159+
Under "Organization permissions", select the following permissions:
160+
- Custom properties: Read-only
161+
162+
Once you created the token, copy it and add it to your Batch Changes credentials.
163+
164+
If your organization requires approval for fine-grained access tokens, you need to wait for an administrator to approve the token.
165+
166+
PICTURE
167+
168+
TODO: Rest of text
111169

112170
### GitHub Enterprise
113171

@@ -129,7 +187,7 @@ When working with organizations that have SAML SSO (Single Sign On) enabled, con
129187

130188
<Callout type="warning">Currently, for customers on an instance of GitHub Enterprise Cloud that uses [SSH certificate authorities](https://docs.github.com/en/enterprise-cloud@latest/organizations/managing-git-access-to-your-organizations-repositories/about-ssh-certificate-authorities) and requires SSH certificates to authenticate, we are unable to provide a means of authenticating Batch Changes to your code host.</Callout>
131189

132-
<Callout type="info">At present, only classic personal access tokens (PATs) are supported. Alternative token types like OAuth access tokens (e.g. OAuth apps), and fine-grained personal access tokens (PATv2) are not supported.</Callout>
190+
<Callout type="info">At present, only classic personal and fine-grained access tokens are supported. Alternative token types like OAuth access tokens (e.g. OAuth apps) are not supported.</Callout>
133191

134192
### GitLab
135193

@@ -239,4 +297,4 @@ To remove a GitHub app from your Sourcegraph instance, navigate back to the same
239297
<source src="https://sourcegraphstatic.com/docs/videos/batch_changes/2024/batches-github-app-delete.mp4" type="video/mp4" />
240298
</video>
241299

242-
If you want to delete the GitHub app entirely you have to navigate to [GitHub's list of applications](https://github.com/settings/apps/), and delete it from there.
300+
If you want to delete the GitHub app entirely you have to navigate to [GitHub's list of applications](https://github.com/settings/apps/), and delete it from there.

0 commit comments

Comments
 (0)