Skip to content

Commit c2c6344

Browse files
authored
Merge pull request #33699 from github/repo-sync
Repo sync
2 parents 22f3389 + 63fc83b commit c2c6344

File tree

15 files changed

+135
-40
lines changed

15 files changed

+135
-40
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ The following operating systems are supported for the self-hosted runner applica
117117
The following processor architectures are supported for the self-hosted runner application.
118118

119119
* `x64` - Linux, macOS, Windows.
120-
* `ARM64` - Linux{% ifversion actions-macos-arm %}, macOS{% endif %}{% ifversion actions-windows-arm %}, Windows (currently in beta){% endif %}.
120+
* `ARM64` - Linux, macOS{% ifversion actions-windows-arm %}, Windows (currently in beta){% endif %}.
121121
* `ARM32` - Linux.
122122

123123
{% ifversion ghes %}

content/actions/security-guides/automatic-token-authentication.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ The following table shows the permissions granted to the `GITHUB_TOKEN` by defau
8888
| checks | read/write | none | read |
8989
| contents | read/write | read | read |
9090
| deployments | read/write | none | read |
91+
| discussions | read/write | none | read |
9192
| {% ifversion fpt or ghec %} |
9293
| id-token | none | none | read |
9394
| {% endif %} |

content/actions/using-workflows/workflow-commands-for-github-actions.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,6 @@ This example demonstrates how to set the `SELECTED_COLOR` output parameter and l
813813

814814
{% endpowershell %}
815815

816-
{% ifversion actions-job-summaries %}
817-
818816
## Adding a job summary
819817

820818
{% bash %}
@@ -955,8 +953,6 @@ After a step has completed, job summaries are uploaded and subsequent steps cann
955953

956954
Job summaries are isolated between steps and each step is restricted to a maximum size of 1MiB. Isolation is enforced between steps so that potentially malformed Markdown from a single step cannot break Markdown rendering for subsequent steps. If more than 1MiB of content is added for a step, then the upload for the step will fail and an error annotation will be created. Upload failures for job summaries do not affect the overall status of a step or a job. A maximum of 20 job summaries from steps are displayed per job.
957955

958-
{% endif %}
959-
960956
## Adding a system path
961957

962958
Prepends a directory to the system `PATH` variable and automatically makes it available to all subsequent actions in the current job; the currently running action cannot access the updated path variable. To see the currently defined paths for your job, you can use `echo "$PATH"` in a step or an action.

content/issues/planning-and-tracking-with-projects/automating-your-project/adding-items-automatically.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
title: Adding items automatically
33
intro: 'You can configure your project''s built-in workflows to automatically add items from {% ifversion projects-v2-duplicate-auto-add %}repositories{% else%}a repository{% endif %} that match a filter.'
44
versions:
5-
feature: projects-v2-auto-add
5+
fpt: '*'
6+
ghes: '*'
7+
ghec: '*'
68
type: tutorial
79
topics:
810
- Projects

content/issues/planning-and-tracking-with-projects/automating-your-project/archiving-items-automatically.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ title: Archiving items automatically
33
shortTitle: Archiving items automatically
44
intro: You can configure your project's built-in workflows to automatically archive items that match a filter.
55
versions:
6-
feature: projects-v2-auto-archive
6+
fpt: '*'
7+
ghes: '*'
8+
ghec: '*'
79
type: tutorial
810
topics:
911
- Projects

content/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ To learn more about the different fields you can add to a project, see "[AUTOTIT
3939

4040
### Automating your projects
4141

42-
There are a number of ways you can add automation to your project. Built-in workflows allow you to automatically set fields when items are added or changed{% ifversion projects-v2-auto-archive %}, and you can also configure your project to automatically archive items when they meet certain criteria{% ifversion projects-v2-auto-add %} and automatically add items from a repository when they match set criteria{% endif %}{% endif %}. For more information, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/using-the-built-in-automations)."
42+
There are a number of ways you can add automation to your project. Built-in workflows allow you to automatically set fields when items are added or changed, and you can also configure your project to automatically archive items when they meet certain criteria and automatically add items from a repository when they match set criteria. For more information, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/using-the-built-in-automations)."
4343

4444
You can also use the GraphQL API and {% data variables.product.prodname_actions %} to take even greater control of your project. For more information, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/using-the-api-to-manage-projects)" and "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/automating-projects-using-actions)."
4545

content/issues/planning-and-tracking-with-projects/learning-about-projects/best-practices-for-projects.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ To prevent information from getting out of sync, maintain a single source of tru
6565

6666
You can automate tasks to spend less time on busy work and more time on the project itself. The less you need to remember to do manually, the more likely your project will stay up to date.
6767

68-
{% data variables.product.prodname_projects_v2 %} offers built-in workflows. For example, when an issue is closed, you can automatically set the status to "Done." {% ifversion projects-v2-auto-archive %}You can also configure built-in workflows to automatically archive items when they meet certain criteria{% ifversion projects-v2-auto-add %} and to automatically add items from a repository when they match a filter{% endif %}.{% endif %}
68+
{% data variables.product.prodname_projects_v2 %} offers built-in workflows. For example, when an issue is closed, you can automatically set the status to "Done". You can also configure built-in workflows to automatically archive items when they meet certain criteria and to automatically add items from a repository when they match a filter.
6969

7070
Additionally, {% data variables.product.prodname_actions %} and the GraphQL API enable you to automate routine project management tasks. For example, to keep track of pull requests awaiting review, you can create a workflow that adds a pull request to a project and sets the status to "needs review"; this process can be automatically triggered when a pull request is marked as "ready for review."
7171

72-
* For more information about the built-in workflows, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/using-the-built-in-automations)."{% ifversion projects-v2-auto-archive %}
73-
* For more information about automatically archiving items, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/archiving-items-automatically)."{% endif %}{% ifversion projects-v2-auto-add %}
74-
* For more information about automatically adding items, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/adding-items-automatically)."{% endif %}
72+
* For more information about the built-in workflows, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/using-the-built-in-automations)."
73+
* For more information about automatically archiving items, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/archiving-items-automatically)."
74+
* For more information about automatically adding items, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/adding-items-automatically)."
7575
* For an example workflow, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/automating-projects-using-actions)."
7676
* For more information about the API, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/using-the-api-to-manage-projects)."
7777
* For more information about {% data variables.product.prodname_actions %}, see "[AUTOTITLE](/actions)."

content/issues/planning-and-tracking-with-projects/learning-about-projects/quickstart-for-projects.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ To indicate the purpose of the view, give it a descriptive name.
127127

128128
## Configure built-in automation
129129

130-
{% ifversion projects-v2-auto-add %}
131-
132130
Next, configure the auto-add workflow to automatically add issues opened in a repository with a specific label to your project.
133131

134132
{% data reusables.projects.access-workflows %}
@@ -141,8 +139,6 @@ Next, configure the auto-add workflow to automatically add issues opened in a re
141139
1. Next to the repository selection, type the filter criteria you want items to match before they are automatically added to your project. For example, to catch all issues and PRs opened with the label "bug", use `is:issue,pr label:bug`.
142140
1. To enable the new workflow, click **Save and turn on workflow**.
143141

144-
{% endif %}
145-
146142
Finally, add a built in workflow to set the status to **Todo** when an item is added to your project.
147143

148144
1. In the top-right, click {% octicon "kebab-horizontal" aria-label="The menu icon" %} to open the menu.

content/issues/planning-and-tracking-with-projects/managing-items-in-your-project/adding-items-to-your-project.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ allowTitleToDifferFromFilename: true
1212

1313
{% note %}
1414

15-
**Note:** A project can contain a maximum of {% data variables.projects.item_limit %} items and {% data variables.projects.archived_item_limit %} archived items. {% ifversion projects-v2-auto-archive %}To learn more about automatically archiving items when they meet specific criteria, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/archiving-items-automatically)."{% endif %}
15+
**Note:** A project can contain a maximum of {% data variables.projects.item_limit %} items and {% data variables.projects.archived_item_limit %} archived items. To learn more about automatically archiving items when they meet specific criteria, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/archiving-items-automatically)."
1616

1717
{% endnote %}
1818

1919
## Adding issues and pull requests to a project
2020

21-
You have several options for adding issues and pull requests to your project. You can add them individually{% ifversion projects-v2-auto-add %}, automatically, {% endif %} or in bulk. Furthermore, you can include issues and pull requests from any organization, and you also have the ability to add draft issues that can be converted into regular issues later on. For more information, see "[Creating draft issues](#creating-draft-issues)."
21+
You have several options for adding issues and pull requests to your project. You can add them individually, automatically, or in bulk. Furthermore, you can include issues and pull requests from any organization, and you also have the ability to add draft issues that can be converted into regular issues later on. For more information, see "[Creating draft issues](#creating-draft-issues)."
2222

2323
{% ifversion projects-v2-timeline-events %}
2424

@@ -38,14 +38,10 @@ For more information about making bulk changes to your items after adding them,
3838

3939
{% endif %}
4040

41-
{% ifversion projects-v2-auto-add %}
42-
4341
### Automatically adding issues and pull requests
4442

4543
You can configure a built-in workflow to automatically add issues and pull requests from a repository when they meet specific filter criteria. For more information about configuring a workflow, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/adding-items-automatically)."
4644

47-
{% endif %}
48-
4945
### Pasting the URL of an issue or pull request
5046

5147
You can copy the URL of an issue or pull request into your clipboard and paste that into your project.

content/issues/planning-and-tracking-with-projects/managing-items-in-your-project/archiving-items-from-your-project.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ allowTitleToDifferFromFilename: true
1818

1919
## Archiving items
2020

21-
You can archive an item to keep the context about the item in the project but remove it from the project views. {% ifversion projects-v2-auto-archive %}You can also configure your project's built-in workflows to automatically archive items that meet certain criteria. For more information, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/archiving-items-automatically)."{% endif %}
21+
You can archive an item to keep the context about the item in the project but remove it from the project views. You can also configure your project's built-in workflows to automatically archive items that meet certain criteria. For more information, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/automating-your-project/archiving-items-automatically)."
2222

2323
{% data reusables.projects.select-an-item %}
2424
{% data reusables.projects.open-item-menu %}
@@ -31,7 +31,7 @@ You can archive an item to keep the context about the item in the project but re
3131
1. In the top-right, click {% octicon "kebab-horizontal" aria-label="More options" %}.
3232

3333
![Screenshot showing a project's menu bar. The menu icon is highlighted with an orange outline.](/assets/images/help/projects-v2/open-menu.png)
34-
34+
3535
1. In the menu, click {% octicon "archive" aria-hidden="true" %} **Archived items**.
3636
1. Optionally, to filter the archived items displayed, type your filter into the text box above the list of items. For more information about the available filters, see "[AUTOTITLE](/issues/planning-and-tracking-with-projects/customizing-views-in-your-project/filtering-projects)."
3737
1. To the left of each item title, select the items you would like to restore.

src/frame/middleware/context/product-groups.js renamed to src/frame/middleware/context/product-groups.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
import { getProductGroups } from '#src/products/lib/get-product-groups.js'
2-
import warmServer from '#src/frame/lib/warm-server.js'
3-
import { languageKeys } from '#src/languages/lib/languages.js'
4-
import { allVersionKeys } from '#src/versions/lib/all-versions.js'
1+
import type { Response, NextFunction } from 'express'
52

6-
const isHomepage = (path) => {
3+
import type { ExtendedRequest } from '@/types'
4+
import { getProductGroups } from '@/products/lib/get-product-groups'
5+
import warmServer from '@/frame/lib/warm-server.js'
6+
import { languageKeys } from '@/languages/lib/languages.js'
7+
import { allVersionKeys } from '@/versions/lib/all-versions.js'
8+
9+
const isHomepage = (path: string) => {
710
const split = path.split('/')
811
// E.g. `/foo` but not `foo/bar` or `foo/`
912
if (split.length === 2 && split[1] && !split[0]) {
@@ -17,7 +20,14 @@ const isHomepage = (path) => {
1720
return false
1821
}
1922

20-
export default async function productGroups(req, res, next) {
23+
export default async function productGroups(
24+
req: ExtendedRequest,
25+
res: Response,
26+
next: NextFunction,
27+
) {
28+
if (!req.context) throw new Error('request is not contextualized')
29+
if (!req.pagePath) throw new Error('pagePath is not set on request')
30+
if (!req.language) throw new Error('language is not set on request')
2131
// It's important to use `req.pathPage` instead of `req.path` because
2232
// the request could be the client-side routing from Next where the URL
2333
// might be something like `/_next/data/foo/bar.json` which is translated,
@@ -31,7 +41,7 @@ export default async function productGroups(req, res, next) {
3141
// known versions. Because if it's not valid, any possible
3242
// use of `{% ifversion ... %}` in Liquid, will throw an error.
3343
if (isHomepage(req.pagePath) && req.context.currentVersionObj) {
34-
const { pages } = await warmServer()
44+
const { pages } = await warmServer([])
3545
req.context.productGroups = await getProductGroups(pages, req.language, req.context)
3646
}
3747

src/frame/middleware/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import glossaries from './context/glossaries'
4747
import renderProductName from './context/render-product-name'
4848
import features from '@/versions/middleware/features.js'
4949
import productExamples from './context/product-examples'
50-
import productGroups from './context/product-groups.js'
50+
import productGroups from './context/product-groups'
5151
import featuredLinks from '@/landings/middleware/featured-links.js'
5252
import learningTrack from '@/learning-track/middleware/learning-track.js'
5353
import next from './next.js'

src/products/lib/all-products.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { Product } from '@/types'
1+
import type { PageFrontmatter, Product } from '@/types'
22

3-
export const { data }: Record<string, any>
3+
export const data: PageFrontmatter
44

55
export const productIds: string[]
66

src/products/lib/get-product-groups.js renamed to src/products/lib/get-product-groups.ts

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
import path from 'path'
22

3+
import type { Page, ProductGroup, ProductGroupChild, Context } from '@/types'
34
import { productMap, data } from './all-products.js'
4-
import { renderContentWithFallback } from '#src/languages/lib/render-with-fallback.js'
5-
import removeFPTFromPath from '#src/versions/lib/remove-fpt-from-path.js'
5+
import { renderContentWithFallback } from '@/languages/lib/render-with-fallback.js'
6+
import removeFPTFromPath from '@/versions/lib/remove-fpt-from-path.js'
67

7-
async function getPage(id, lang, pageMap, context) {
8+
type PageMap = Record<string, Page>
9+
10+
async function getPage(
11+
id: string,
12+
lang: string,
13+
pageMap: PageMap,
14+
context: Context,
15+
): Promise<ProductGroupChild | undefined> {
816
const productId = id.split('/')[0]
917
const product = productMap[productId]
18+
1019
const external = product.external || false // undefined becomes false
1120

1221
// The href depends. Initially all we have is an `id` which might be
@@ -26,6 +35,8 @@ async function getPage(id, lang, pageMap, context) {
2635

2736
let name = product.name
2837

38+
if (!context.currentVersion) throw new Error('context.currentVersion is not set')
39+
2940
if (!external) {
3041
// First we have to find it as a page object based on its ID.
3142
href = removeFPTFromPath(path.posix.join('/', lang, context.currentVersion, id))
@@ -34,6 +45,7 @@ async function getPage(id, lang, pageMap, context) {
3445
// fall back it its default version, which is `product.versions[0]`.
3546
// For example, you're on `/en/enterprise-server@3.1` and you're
3647
// but a `/foo/bar` is only available in `enterprise-cloud@latest`.
48+
if (!product.versions) throw new Error(`Product ${productId} has no versions`)
3749
href = removeFPTFromPath(path.posix.join('/', lang, product.versions[0], id))
3850
}
3951
const page = pageMap[href]
@@ -74,17 +86,21 @@ async function getPage(id, lang, pageMap, context) {
7486
}
7587
}
7688

77-
export async function getProductGroups(pageMap, lang, context) {
89+
export async function getProductGroups(
90+
pageMap: PageMap,
91+
lang: string,
92+
context: Context,
93+
): Promise<ProductGroup[]> {
7894
return await Promise.all(
79-
data.childGroups.map(async (group) => {
95+
data.childGroups!.map(async (group) => {
8096
return {
8197
name: group.name,
8298
icon: group.icon || null,
8399
octicon: group.octicon || null,
84100
// Typically the children are product IDs, but we support deeper page paths too
85101
children: (
86102
await Promise.all(group.children.map((id) => getPage(id, lang, pageMap, context)))
87-
).filter(Boolean),
103+
).filter(Boolean) as ProductGroupChild[],
88104
}
89105
}),
90106
)

src/types.ts

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,66 @@ export type ExtendedRequest = Request & {
1414
// Add more properties here as needed
1515
}
1616

17+
// TODO: Make this type from inference using AJV based on the schema.
18+
// For now, it's based on `schema` in frame/lib/frontmatter.js
19+
export type PageFrontmatter = {
20+
title: string
21+
versions: FrontmatterVersions
22+
shortTitle?: string
23+
intro?: string
24+
product?: string
25+
permissions?: string
26+
showMiniToc?: boolean
27+
miniTocMaxHeadingLevel?: number
28+
mapTopic?: boolean
29+
hidden?: boolean
30+
noEarlyAccessBanner?: boolean
31+
earlyAccessToc?: string
32+
layout?: string | boolean
33+
redirect_from?: string[]
34+
allowTitleToDifferFromFilename?: boolean
35+
introLinks?: object
36+
authors?: string[]
37+
examples_source?: string
38+
effectiveDate?: string
39+
40+
featuredLinks?: {
41+
gettingStarted?: string[]
42+
startHere?: string[]
43+
guideCards?: string[]
44+
popular?: string[]
45+
popularHeading?: string
46+
videos?: {
47+
title: string
48+
href: string
49+
}[]
50+
videoHeadings?: string
51+
}[]
52+
changelog?: ChangeLog
53+
type?: string
54+
topics?: string[]
55+
includeGuides?: string[]
56+
learningTracks?: string[]
57+
beta_product?: boolean
58+
product_video?: boolean
59+
product_video_transcript?: string
60+
interactive?: boolean
61+
communityRedirect?: {
62+
name: string
63+
href: string
64+
}
65+
defaultPlatform?: 'mac' | 'windows' | 'linux'
66+
defaultTool?: string
67+
childGroups?: ChildGroup[]
68+
}
69+
70+
export type ChildGroup = {
71+
name: string
72+
octicon: string
73+
children: string[]
74+
icon?: string
75+
}
76+
1777
export type Product = {
1878
id: string
1979
name: string
@@ -23,6 +83,7 @@ export type Product = {
2383
wip?: boolean
2484
hidden?: boolean
2585
versions?: string[]
86+
external?: boolean
2687
}
2788

2889
type ProductMap = {
@@ -95,6 +156,21 @@ export type Context = {
95156
currentProductName?: string
96157
productCommunityExamples?: ProductExample[]
97158
productUserExamples?: ProductExample[]
159+
productGroups?: ProductGroup[]
160+
}
161+
162+
export type ProductGroup = {
163+
name: string
164+
icon: string | null
165+
octicon: string | null
166+
children: ProductGroupChild[]
167+
}
168+
169+
export type ProductGroupChild = {
170+
id: string
171+
name: string
172+
href: string
173+
external: boolean
98174
}
99175

100176
export type Glossary = {

0 commit comments

Comments
 (0)