Skip to content

Commit e6af9ae

Browse files
lucascostirachmari
andauthored
Remove Actions REST enterprise subcategory (moved to Actions page) (github#25065)
Co-authored-by: Rachael Sewell <[email protected]>
1 parent f0bcb98 commit e6af9ae

File tree

13 files changed

+290
-89
lines changed

13 files changed

+290
-89
lines changed

.github/actions-scripts/openapi-schema-branch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const changedFiles = execSync('git diff --name-only HEAD').toString()
3636
if (changedFiles !== '') {
3737
console.log(`These files were changed:\n${changedFiles}`)
3838
console.log(
39-
`🚧⚠️ Your decorated and dereferenced schema files don't match. Ensure you're using decorated and dereferenced schemas from the automatically created pull requests by the 'github-openapi-bot' user. \n\n If this test is failing after updates to the script/rest directory, run script/rest/update-files.js --decorate-only to re-generate the decorated files from the existing dereferenced files and check those in. \n\n If this test is failing after an update to a package, check the changes the new package makes to the decorated files by running script/rest/update-files.js --decorate-only. If the changes are small style changes that don't impact the overall experience, check the updated decorated file in. Otherwise, more work may be needed to be compatible with the updated package. \n\n For more information, see 'script/rest/README.md'. 🛑`
39+
`🚧⚠️ Your decorated and dereferenced schema files don't match. Ensure you're using decorated and dereferenced schemas from the automatically created pull requests by the 'github-openapi-bot' user. \n\n If this test is failing after updates to the script/rest directory, run script/rest/update-files.js --decorate-only to re-generate the decorated files from the existing dereferenced files and check those in. \n\n If this test is failing after an update to a package, check the changes the new package makes to the decorated files by running script/rest/update-files.js --decorate-only.\n\nIf you updated script/rest/utils/rest-api-overrides.json, you'll need to run script/rest/update-files.js --decorate-only to regenerate the decorated file and redirects file (check in the changed lib/rest/static/decorated files).\n\nIf the changes are small style changes that don't impact the overall experience, check the updated decorated file in. Otherwise, more work may be needed to be compatible with the updated package. \n\n For more information, see 'script/rest/README.md'. 🛑`
4040
)
4141
process.exit(1)
4242
}

components/DefaultLayout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { SmallFooter } from 'components/page-footer/SmallFooter'
66
import { ScrollButton } from 'components/ui/ScrollButton'
77
import { SupportSection } from 'components/page-footer/SupportSection'
88
import { DeprecationBanner } from 'components/page-header/DeprecationBanner'
9-
import { RestRepoBanner } from 'components/page-header/RestRepoBanner'
9+
import { RestBanner } from 'components/page-header/RestBanner'
1010
import { useMainContext } from 'components/context/MainContext'
1111
import { useTranslation } from 'components/hooks/useTranslation'
1212
import { useRouter } from 'next/router'
@@ -89,7 +89,7 @@ export const DefaultLayout = (props: Props) => {
8989
<Header />
9090
<main id="main-content">
9191
<DeprecationBanner />
92-
<RestRepoBanner />
92+
<RestBanner />
9393

9494
{props.children}
9595
</main>

components/article/ArticlePage.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ export const ArticlePage = () => {
107107
// In the future there might be more.
108108
// Hopefully, we can some day delete all of this and no longer
109109
// be dependent on the URL hash to do the redirect.
110-
if (hash && pathname.endsWith('/rest/reference/repos')) {
110+
if (
111+
hash &&
112+
(pathname.endsWith('/rest/reference/repos') ||
113+
pathname.endsWith('/rest/reference/enterprise-admin'))
114+
) {
111115
setLoadClientsideRedirectExceptions(true)
112116
}
113117
}, [])

components/page-header/RestBanner.tsx

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import React from 'react'
2+
import { Flash } from '@primer/components'
3+
import { useRouter } from 'next/router'
4+
import { Link } from 'components/Link'
5+
6+
const restRepoDisplayPages = [
7+
'/rest/reference/branches',
8+
'/rest/reference/collaborators',
9+
'/rest/reference/commits',
10+
'/rest/reference/deployments',
11+
'/rest/reference/pages',
12+
'/rest/reference/releases',
13+
'/rest/reference/repos',
14+
'/rest/reference/metrics',
15+
'/rest/reference/webhooks',
16+
]
17+
const restEnterpriseDisplayPages = ['/rest/reference/enterprise-admin']
18+
const restRepoCategoryExceptionsTitles = {
19+
branches: 'Branches',
20+
collaborators: 'Collaborators',
21+
commits: 'Commits',
22+
deployments: 'Deployments',
23+
pages: 'GitHub Pages',
24+
releases: 'Releases',
25+
metrics: 'Metrics',
26+
webhooks: 'Webhooks',
27+
}
28+
29+
export const RestBanner = () => {
30+
const router = useRouter()
31+
const restPage = (router.query.restPage as string[]) || []
32+
const asPathRoot = `/${router.query.productId}/${restPage.join('/')}`
33+
if (
34+
!restRepoDisplayPages.includes(asPathRoot) &&
35+
!restEnterpriseDisplayPages.includes(asPathRoot)
36+
) {
37+
return null
38+
}
39+
40+
let noticeString
41+
42+
if (restRepoDisplayPages.includes(asPathRoot)) {
43+
const pages = Object.keys(restRepoCategoryExceptionsTitles) as Array<
44+
keyof typeof restRepoCategoryExceptionsTitles
45+
>
46+
const newRestPagesText = pages.map((page, i) => [
47+
<React.Fragment key={page}>
48+
<Link href={`/${router.locale}/rest/reference/${page}`}>
49+
{restRepoCategoryExceptionsTitles[page]}
50+
</Link>
51+
{i < pages.length - 1 && ', '}
52+
</React.Fragment>,
53+
])
54+
55+
noticeString = (
56+
<React.Fragment>
57+
If you can't find what you're looking for, you might try the new {newRestPagesText} REST API
58+
pages.
59+
</React.Fragment>
60+
)
61+
} else if (restEnterpriseDisplayPages.includes(asPathRoot)) {
62+
noticeString = (
63+
<React.Fragment>
64+
If you can't find what you're looking for, you might try the{' '}
65+
<Link href={`/${router.locale}/rest/reference/actions`}>Actions</Link> REST API page.
66+
</React.Fragment>
67+
)
68+
}
69+
70+
return (
71+
<div data-testid="rest-api-repos-banner" className="container-xl mt-3 mx-auto p-responsive">
72+
<Flash variant="warning">
73+
<p>
74+
<b className="text-bold">
75+
<span>We've recently moved some of the REST API documentation. {noticeString}</span>
76+
</b>{' '}
77+
</p>
78+
</Flash>
79+
</div>
80+
)
81+
}

components/page-header/RestRepoBanner.tsx

Lines changed: 0 additions & 61 deletions
This file was deleted.

content/actions/hosting-your-own-runners/adding-self-hosted-runners.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ You can add self-hosted runners at the organization level, where they can be use
8585
New runners are assigned to the default group. You can modify the runner's group after you've registered the runner. For more information, see "[Managing access to self-hosted runners](/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups#moving-a-self-hosted-runner-to-a-group)."
8686

8787
{% ifversion ghec or ghes > 3.3 or ghae-issue-5091 %}
88-
To add a self-hosted runner to an enterprise account, you must be an enterprise owner. For information about how to add a self-hosted runner with the REST API, see the [Enterprise Administration GitHub Actions APIs](/rest/reference/enterprise-admin#github-actions).
88+
To add a self-hosted runner to an enterprise account, you must be an enterprise owner. For information about how to add a self-hosted runner with the REST API, see the enterprise endpoints in the [{% data variables.product.prodname_actions %} REST API](/rest/reference/actions#self-hosted-runners).
8989

9090
{% data reusables.enterprise-accounts.access-enterprise %}
9191
{% data reusables.enterprise-accounts.policies-tab %}

content/actions/hosting-your-own-runners/autoscaling-with-self-hosted-runners.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,6 @@ To authenticate using a {% data variables.product.prodname_dotcom %} App, it mu
9696
- For repositories, assign the `administration` permission.
9797
- For organizations, assign the `organization_self_hosted_runners` permission.
9898

99-
You can register and delete enterprise self-hosted runners using [the API](/rest/reference/enterprise-admin#github-actions). To authenticate to the API, your autoscaling implementation can use an access token.
99+
You can register and delete enterprise self-hosted runners using [the API](/rest/reference/actions#self-hosted-runners). To authenticate to the API, your autoscaling implementation can use an access token.
100100

101101
Your access token will require the `manage_runners:enterprise` scope.

content/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ When creating a group, you must choose a policy that defines which repositories
8787

8888
## Creating a self-hosted runner group for an enterprise
8989

90-
Enterprises can add their self-hosted runners to groups for access management. Enterprises can create groups of self-hosted runners that are accessible to specific organizations in the enterprise account. Organization admins can then assign additional granular repository access policies to the enterprise runner groups. For information about how to create a self-hosted runner group with the REST API, see the [Enterprise Administration GitHub Actions APIs](/rest/reference/enterprise-admin#github-actions).
90+
Enterprises can add their self-hosted runners to groups for access management. Enterprises can create groups of self-hosted runners that are accessible to specific organizations in the enterprise account. Organization admins can then assign additional granular repository access policies to the enterprise runner groups. For information about how to create a self-hosted runner group with the REST API, see the enterprise endpoints in the [{% data variables.product.prodname_actions %} REST API](/rest/reference/actions#self-hosted-runner-groups).
9191

9292
Self-hosted runners are automatically assigned to the default group when created, and can only be members of one group at a time. You can assign the runner to a specific group during the registration process, or you can later move the runner from the default group to a custom group.
9393

content/actions/hosting-your-own-runners/removing-self-hosted-runners.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ If you use {% data variables.product.prodname_ghe_cloud %}, you can also remove
8585

8686
{% endnote %}
8787

88-
To remove a self-hosted runner from an enterprise, you must be an enterprise owner. We recommend that you also have access to the self-hosted runner machine. For information about how to remove a self-hosted runner with the REST API, see the [Enterprise Administration GitHub Actions APIs](/rest/reference/enterprise-admin#github-actions).
88+
To remove a self-hosted runner from an enterprise, you must be an enterprise owner. We recommend that you also have access to the self-hosted runner machine. For information about how to remove a self-hosted runner with the REST API, see the enterprise endpoints in the [{% data variables.product.prodname_actions %} REST API](/rest/reference/actions#self-hosted-runners).
8989

9090
{% data reusables.github-actions.self-hosted-runner-reusing %}
9191
{% ifversion ghec or ghes > 3.3 or ghae-issue-5091 %}

content/rest/reference/actions.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ The Artifacts API allows you to download, delete, and retrieve information about
3333
{% ifversion fpt or ghes > 2.22 or ghae or ghec %}
3434
## Permissions
3535

36-
The Permissions API allows you to set permissions for what organizations and repositories are allowed to run {% data variables.product.prodname_actions %}, and what actions are allowed to run.{% ifversion fpt or ghec or ghes %} For more information, see "[Usage limits, billing, and administration](/actions/reference/usage-limits-billing-and-administration#disabling-or-limiting-github-actions-for-your-repository-or-organization)."{% endif %}
37-
38-
You can also set permissions for an enterprise. For more information, see the "[{% data variables.product.prodname_dotcom %} Enterprise administration](/rest/reference/enterprise-admin#github-actions)" REST API.
36+
The Permissions API allows you to set permissions for what enterprises, organizations, and repositories are allowed to run {% data variables.product.prodname_actions %}, and what actions are allowed to run.{% ifversion fpt or ghec or ghes %} For more information, see "[Usage limits, billing, and administration](/actions/reference/usage-limits-billing-and-administration#disabling-or-limiting-github-actions-for-your-repository-or-organization)."{% endif %}
3937

4038
{% for operation in currentRestOperations %}
4139
{% if operation.subcategory == 'permissions' %}{% include rest_operation %}{% endif %}
@@ -58,9 +56,7 @@ The Secrets API lets you create, update, delete, and retrieve information about
5856

5957
The Self-hosted Runners API allows you to register, view, and delete self-hosted runners. {% data reusables.actions.about-self-hosted-runners %} For more information, see "[Hosting your own runners](/actions/hosting-your-own-runners)."
6058

61-
{% data reusables.actions.actions-authentication %} {% data variables.product.prodname_github_apps %} must have the `administration` permission for repositories or the `organization_self_hosted_runners` permission for organizations. Authenticated users must have admin access to the repository or organization to use this API.
62-
63-
You can manage self-hosted runners for an enterprise. For more information, see the "[{% data variables.product.prodname_dotcom %} Enterprise administration](/rest/reference/enterprise-admin#github-actions)" REST API.
59+
{% data reusables.actions.actions-authentication %} {% data variables.product.prodname_github_apps %} must have the `administration` permission for repositories the `organization_self_hosted_runners` permission for organizations. Authenticated users must have admin access to repositories or organizations, or the `manage_runners:enterprise` scope for enterprises to use this API.
6460

6561
{% for operation in currentRestOperations %}
6662
{% if operation.subcategory == 'self-hosted-runners' %}{% include rest_operation %}{% endif %}
@@ -72,9 +68,7 @@ You can manage self-hosted runners for an enterprise. For more information, see
7268

7369
The Self-hosted Runners Groups API allows you manage groups of self-hosted runners. For more information, see "[Managing access to self-hosted runners using groups](/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups)."
7470

75-
{% data reusables.actions.actions-authentication %} {% data variables.product.prodname_github_apps %} must have the `administration` permission for repositories or the `organization_self_hosted_runners` permission for organizations. Authenticated users must have admin access to the repository or organization to use this API.
76-
77-
You can manage self-hosted runner groups for an enterprise. For more information, see the "[{% data variables.product.prodname_dotcom %} Enterprise administration](/rest/reference/enterprise-admin##github-actions)" REST API.
71+
{% data reusables.actions.actions-authentication %} {% data variables.product.prodname_github_apps %} must have the `administration` permission for repositories or the `organization_self_hosted_runners` permission for organizations. Authenticated users must have admin access to repositories or organizations, or the `manage_runners:enterprise` scope for enterprises to use this API.
7872

7973
{% for operation in currentRestOperations %}
8074
{% if operation.subcategory == 'self-hosted-runner-groups' %}{% include rest_operation %}{% endif %}

0 commit comments

Comments
 (0)