Skip to content

Commit 05153ce

Browse files
authored
Merge pull request #37067 from github/repo-sync
Repo sync
2 parents fa3207e + 37e2b38 commit 05153ce

File tree

8 files changed

+155
-13
lines changed

8 files changed

+155
-13
lines changed

.github/workflows/ready-for-doc-review.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
4646
# Check if the PR is connected to an issue that has the DIY docs label. The grep command parses through the PR description to find issue numbers that are linked in the PR description. The GitHub CLI command then checks if the issue exists in the docs-content repo, then checks if the linked docs-content issues have the DIY docs label. If the linked issues have the DIY docs label, the DIY_DOCS_LABEL environment variable is set to true.
4747
- name: Check if PR is connected to DIY docs issue
48+
if: github.repository == 'github/docs-internal'
4849
id: check-diy-docs
4950
env:
5051
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
@@ -74,7 +75,7 @@ jobs:
7475
7576
# If the PR description contains a link to a DIY docs issue, add the DIY docs label to the PR.
7677
- name: Add the DIY docs label if connected to a DIY docs issue
77-
if: ${{ env.DIY_DOCS_LABEL == 'true' }}
78+
if: ${{ env.DIY_DOCS_LABEL == 'true' }} && github.repository == 'github/docs-internal'
7879
env:
7980
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
8081
PR_URL: ${{ github.event.pull_request.html_url }}

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
@@ -16,8 +16,6 @@ topics:
1616

1717
## Introduction
1818

19-
>[!NOTE] Enterprise code rulesets are currently in public preview and subject to change.
20-
2119
You can create rulesets to control how users can interact with code in repositories across your enterprise. You can:
2220

2321
* Create a **branch or tag ruleset** to control things like who can push commits to a certain branch, how commits must be formatted, or who can delete or rename a tag.

content/admin/managing-accounts-and-repositories/managing-repositories-in-your-enterprise/managing-custom-properties-for-repositories-in-your-enterprise.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ topics:
99
shortTitle: Custom properties
1010
---
1111

12-
> [!NOTE] Custom properties for your enterprise are in {% data variables.release-phases.public_preview %} and subject to change.
13-
1412
Custom properties allow you to decorate your repositories with information such as compliance frameworks, data sensitivity, or project details. Custom properties are private and can only be viewed by people with read permissions to the repository. An enterprise can have up to 100 property definitions. An allowed value list can have up to 200 items.
1513

1614
Defining custom properties at the enterprise level allows you to create consistent values that users can apply to repositories. With custom properties in place, you can apply consistent governance across repositories in your enterprise by creating a ruleset or repository policy targeting repositories with certain properties. See [AUTOTITLE](/admin/managing-accounts-and-repositories/managing-repositories-in-your-enterprise/governing-how-people-use-repositories-in-your-enterprise).

content/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/available-rules-for-rulesets.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,7 @@ For complex pull requests that require many reviews, requiring an approval from
131131
Optionally, you can require all comments on the pull request to be resolved before it can be merged to a branch. This ensures that all comments are addressed or acknowledged before merge.
132132

133133
{% ifversion repo-rules-merge-type %}
134-
> [!NOTE]
135-
> Allowed merge method is currently in public preview, the rule is currently non-bypassable, and subject to change.
136-
137-
Optionally, you can require a merge type of merge, squash or rebase. This means the targeted branches may only be merged based on the allowed type. Additionally if the repository has disabled a merge method and the ruleset required a different method, the merge will be blocked. For more information, see [AUTOTITLE](/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/about-merge-methods-on-github).
134+
Optionally, you can require a merge type of merge, squash, or rebase. This means the targeted branches may only be merged based on the allowed type. Additionally if the repository has disabled a merge method and the ruleset required a different method, the merge will be blocked. See [AUTOTITLE](/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/about-merge-methods-on-github).
138135
{% endif %}
139136

140137
## Require status checks to pass before merging
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: Api Article Body Test Page
3+
shortTitle: About GitHub and Git
4+
intro: 'You can use Github and Git to collaborate on work.'
5+
versions:
6+
fpt: '*'
7+
ghes: '*'
8+
ghec: '*'
9+
type: overview
10+
topics:
11+
- Git
12+
- Fundamentals
13+
- GitHub
14+
- Collaboration
15+
- Community
16+
redirect_from:
17+
- /get-started/quickstart/about-github-and-git
18+
---
19+
20+
## About GitHub
21+
22+
GitHub is a cloud-based platform where you can store, share, and work together with others to write code.
23+
24+
Storing your code in a "repository" on GitHub allows you to:
25+
26+
* **Showcase or share** your work.
27+
* **Track and manage** changes to your code over time.
28+
* Let others **review** your code, and make suggestions to improve it.
29+
* **Collaborate** on a shared project, without worrying that your changes will impact the work of your collaborators before you're ready to integrate them.
30+
31+
Collaborative working, one of GitHub’s fundamental features, is made possible by the open-source software, Git, upon which GitHub is built.
32+
33+
## About Git
34+
35+
Git is a version control system that intelligently tracks changes in files. Git is particularly useful when you and a group of people are all making changes to the same files at the same time.
36+
37+
Typically, to do this in a Git-based workflow, you would:
38+
39+
* **Create a branch** off from the main copy of files that you (and your collaborators) are working on.
40+
* **Make edits** to the files independently and safely on your own personal branch.
41+
* Let Git intelligently **merge** your specific changes back into the main copy of files, so that your changes don't impact other people's updates.
42+
* Let Git **keep track** of your and other people's changes, so you all stay working on the most up-to-date version of the project.
43+
44+
45+
46+
### How do Git and GitHub work together?
47+
48+
When you upload files to GitHub , you'll store them in a "Git repository." This means that when you make changes (or "commits") to your files in GitHub, Git will automatically start to track and manage your changes.
49+
50+
There are plenty of Git-related actions that you can complete on GitHub directly in your browser, such as creating a Git repository, creating branches, and uploading and editing files.
51+
52+
However, most people work on their files locally (on their own computer), then continually sync these local changes—and all the related Git data—with the central "remote" repository on GitHub. There are plenty of tools that you can use to do this, such as GitHub Desktop.
53+
54+
Once you start to collaborate with others and all need to work on the same repository at the same time, you’ll continually:
55+
56+
* **Pull** all the latest changes made by your collaborators from the remote repository on GitHub.
57+
* **Push** back your own changes to the same remote repository on GitHub.
58+
59+
Git figures out how to intelligently merge this flow of changes, and GitHub helps you manage the flow through features such as "pull requests."
60+
61+
## Where do I start?
62+
63+
If you're new to GitHub, and unfamiliar with Git, we recommend working through the articles in the Start Your Journey category. The articles focus on tasks you can complete directly in your browser on GitHub and will help you to:
64+
65+
* **Create an account** on GitHub.
66+
* **Learn the "GitHub Flow"**, and the key principles of collaborative working (branches, commits, pull requests, merges).
67+
* **Personalise your profile** to share your interests and skills.
68+
* **Explore GitHub** to find inspiration for your own projects and connect with others.
69+
* Learn how to **download** interesting code for your own use.
70+
* Learn how to **upload** something you're working on to a GitHub repository.

src/fixtures/fixtures/content/get-started/start-your-journey/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ children:
99
- /hello-world
1010
- /link-rewriting
1111
- /dynamic-title
12+
- /api-article-body-test-page
1213
redirect_from:
1314
- /get-started/quickstart
1415
---
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import { beforeAll, describe, expect, test } from 'vitest'
2+
3+
import { get } from '#src/tests/helpers/e2etest.js'
4+
5+
const makeURL = (pathname: string) => `/api/article/body?${new URLSearchParams({ pathname })}`
6+
7+
describe('article body api', () => {
8+
beforeAll(() => {
9+
// If you didn't set the `ROOT` variable, the tests will fail rather
10+
// cryptically. So as a warning for engineers running these tests,
11+
// alert in case it was accidentally forgotten.
12+
if (!process.env.ROOT) {
13+
console.warn(
14+
'WARNING: The articlebody tests require the ROOT environment variable to be set to the fixture root',
15+
)
16+
}
17+
// Ditto for fixture-based translations to work
18+
if (!process.env.TRANSLATIONS_FIXTURE_ROOT) {
19+
console.warn(
20+
'WARNING: The articlebody tests require the TRANSLATIONS_FIXTURE_ROOT environment variable to be set',
21+
)
22+
}
23+
})
24+
25+
test('happy path', async () => {
26+
const res = await get(makeURL('/en/get-started/start-your-journey/api-article-body-test-page'))
27+
expect(res.statusCode).toBe(200)
28+
expect(res.headers['content-type']).toContain('text/markdown')
29+
expect(res.body).toContain('## About GitHub')
30+
expect(res.body).toContain('## About Git')
31+
expect(res.body).toMatch(/^#+\s+\w+/m) // Check for any markdown heading pattern
32+
33+
expect(res.headers['set-cookie']).toBeUndefined()
34+
expect(res.headers['cache-control']).toContain('public')
35+
expect(res.headers['cache-control']).toMatch(/max-age=[1-9]/)
36+
expect(res.headers['surrogate-control']).toContain('public')
37+
expect(res.headers['surrogate-control']).toMatch(/max-age=[1-9]/)
38+
})
39+
40+
test('a pathname that does not exist', async () => {
41+
const res = await get(makeURL('/en/never/heard/of'))
42+
expect(res.statusCode).toBe(404)
43+
const { error } = JSON.parse(res.body)
44+
expect(error).toBe("No page found for '/en/never/heard/of'")
45+
})
46+
47+
test("no 'pathname' query string at all", async () => {
48+
const res = await get('/api/article/body')
49+
expect(res.statusCode).toBe(400)
50+
const { error } = JSON.parse(res.body)
51+
expect(error).toBe("No 'pathname' query")
52+
})
53+
54+
test('has proper markdown structure with frontmatter removed', async () => {
55+
const res = await get(makeURL('/en/get-started/start-your-journey/api-article-body-test-page'))
56+
57+
expect(res.statusCode).toBe(200)
58+
// Should not contain frontmatter
59+
expect(res.body).not.toMatch(/^---/)
60+
// Should have at least one heading
61+
expect(res.body).toMatch(/^#{1,6}\s+\w+/m)
62+
})
63+
64+
test("empty 'pathname' query string", async () => {
65+
const res = await get('/api/article/body?pathname=%20')
66+
expect(res.statusCode).toBe(400)
67+
const { error } = JSON.parse(res.body)
68+
expect(error).toBe("'pathname' query empty")
69+
})
70+
71+
test('repeated pathname query string key', async () => {
72+
const res = await get('/api/article/body?pathname=a&pathname=b')
73+
expect(res.statusCode).toBe(400)
74+
const { error } = JSON.parse(res.body)
75+
expect(error).toBe("Multiple 'pathname' keys")
76+
})
77+
})

src/shielding/tests/shielding.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,24 +72,24 @@ describe('index.md and .md suffixes', () => {
7272
})
7373

7474
// TODO-ARTICLEAPI: unskip tests or replace when ready to ship article API
75-
test.skip('any URL that ends with /.md redirects', async () => {
75+
test('any URL that ends with /.md redirects', async () => {
7676
// With language prefix
7777
{
7878
const res = await get('/en/get-started/hello.md')
7979
expect(res.statusCode).toBe(302)
80-
expect(res.headers.location).toBe('/en/get-started/hello')
80+
expect(res.headers.location).toBe('/api/article/body?pathname=/en/get-started/hello')
8181
}
8282
// Without language prefix
8383
{
8484
const res = await get('/get-started/hello.md')
8585
expect(res.statusCode).toBe(302)
86-
expect(res.headers.location).toBe('/get-started/hello')
86+
expect(res.headers.location).toBe('/api/article/body?pathname=/get-started/hello')
8787
}
8888
// With query string
8989
{
9090
const res = await get('/get-started/hello.md?foo=bar')
9191
expect(res.statusCode).toBe(302)
92-
expect(res.headers.location).toBe('/get-started/hello?foo=bar')
92+
expect(res.headers.location).toBe('/api/article/body?pathname=/get-started/hello')
9393
}
9494
})
9595
})

0 commit comments

Comments
 (0)