Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repo sync #37067

Merged
merged 4 commits into from
Mar 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ready-for-doc-review.yml
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@ jobs:

# 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.
- name: Check if PR is connected to DIY docs issue
if: github.repository == 'github/docs-internal'
id: check-diy-docs
env:
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
@@ -74,7 +75,7 @@ jobs:

# If the PR description contains a link to a DIY docs issue, add the DIY docs label to the PR.
- name: Add the DIY docs label if connected to a DIY docs issue
if: ${{ env.DIY_DOCS_LABEL == 'true' }}
if: ${{ env.DIY_DOCS_LABEL == 'true' }} && github.repository == 'github/docs-internal'
env:
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
PR_URL: ${{ github.event.pull_request.html_url }}
Original file line number Diff line number Diff line change
@@ -16,8 +16,6 @@ topics:

## Introduction

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

* 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.
Original file line number Diff line number Diff line change
@@ -9,8 +9,6 @@ topics:
shortTitle: Custom properties
---

> [!NOTE] Custom properties for your enterprise are in {% data variables.release-phases.public_preview %} and subject to change.
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.

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).
Original file line number Diff line number Diff line change
@@ -131,10 +131,7 @@ For complex pull requests that require many reviews, requiring an approval from
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.

{% ifversion repo-rules-merge-type %}
> [!NOTE]
> Allowed merge method is currently in public preview, the rule is currently non-bypassable, and subject to change.

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).
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).
{% endif %}

## Require status checks to pass before merging
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: Api Article Body Test Page
shortTitle: About GitHub and Git
intro: 'You can use Github and Git to collaborate on work.'
versions:
fpt: '*'
ghes: '*'
ghec: '*'
type: overview
topics:
- Git
- Fundamentals
- GitHub
- Collaboration
- Community
redirect_from:
- /get-started/quickstart/about-github-and-git
---

## About GitHub

GitHub is a cloud-based platform where you can store, share, and work together with others to write code.

Storing your code in a "repository" on GitHub allows you to:

* **Showcase or share** your work.
* **Track and manage** changes to your code over time.
* Let others **review** your code, and make suggestions to improve it.
* **Collaborate** on a shared project, without worrying that your changes will impact the work of your collaborators before you're ready to integrate them.

Collaborative working, one of GitHub’s fundamental features, is made possible by the open-source software, Git, upon which GitHub is built.

## About Git

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.

Typically, to do this in a Git-based workflow, you would:

* **Create a branch** off from the main copy of files that you (and your collaborators) are working on.
* **Make edits** to the files independently and safely on your own personal branch.
* 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.
* 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.



### How do Git and GitHub work together?

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.

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.

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.

Once you start to collaborate with others and all need to work on the same repository at the same time, you’ll continually:

* **Pull** all the latest changes made by your collaborators from the remote repository on GitHub.
* **Push** back your own changes to the same remote repository on GitHub.

Git figures out how to intelligently merge this flow of changes, and GitHub helps you manage the flow through features such as "pull requests."

## Where do I start?

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:

* **Create an account** on GitHub.
* **Learn the "GitHub Flow"**, and the key principles of collaborative working (branches, commits, pull requests, merges).
* **Personalise your profile** to share your interests and skills.
* **Explore GitHub** to find inspiration for your own projects and connect with others.
* Learn how to **download** interesting code for your own use.
* Learn how to **upload** something you're working on to a GitHub repository.
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ children:
- /hello-world
- /link-rewriting
- /dynamic-title
- /api-article-body-test-page
redirect_from:
- /get-started/quickstart
---
77 changes: 77 additions & 0 deletions src/fixtures/tests/api-article-body.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { beforeAll, describe, expect, test } from 'vitest'

import { get } from '#src/tests/helpers/e2etest.js'

const makeURL = (pathname: string) => `/api/article/body?${new URLSearchParams({ pathname })}`

describe('article body api', () => {
beforeAll(() => {
// If you didn't set the `ROOT` variable, the tests will fail rather
// cryptically. So as a warning for engineers running these tests,
// alert in case it was accidentally forgotten.
if (!process.env.ROOT) {
console.warn(
'WARNING: The articlebody tests require the ROOT environment variable to be set to the fixture root',
)
}
// Ditto for fixture-based translations to work
if (!process.env.TRANSLATIONS_FIXTURE_ROOT) {
console.warn(
'WARNING: The articlebody tests require the TRANSLATIONS_FIXTURE_ROOT environment variable to be set',
)
}
})

test('happy path', async () => {
const res = await get(makeURL('/en/get-started/start-your-journey/api-article-body-test-page'))
expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toContain('text/markdown')
expect(res.body).toContain('## About GitHub')
expect(res.body).toContain('## About Git')
expect(res.body).toMatch(/^#+\s+\w+/m) // Check for any markdown heading pattern

expect(res.headers['set-cookie']).toBeUndefined()
expect(res.headers['cache-control']).toContain('public')
expect(res.headers['cache-control']).toMatch(/max-age=[1-9]/)
expect(res.headers['surrogate-control']).toContain('public')
expect(res.headers['surrogate-control']).toMatch(/max-age=[1-9]/)
})

test('a pathname that does not exist', async () => {
const res = await get(makeURL('/en/never/heard/of'))
expect(res.statusCode).toBe(404)
const { error } = JSON.parse(res.body)
expect(error).toBe("No page found for '/en/never/heard/of'")
})

test("no 'pathname' query string at all", async () => {
const res = await get('/api/article/body')
expect(res.statusCode).toBe(400)
const { error } = JSON.parse(res.body)
expect(error).toBe("No 'pathname' query")
})

test('has proper markdown structure with frontmatter removed', async () => {
const res = await get(makeURL('/en/get-started/start-your-journey/api-article-body-test-page'))

expect(res.statusCode).toBe(200)
// Should not contain frontmatter
expect(res.body).not.toMatch(/^---/)
// Should have at least one heading
expect(res.body).toMatch(/^#{1,6}\s+\w+/m)
})

test("empty 'pathname' query string", async () => {
const res = await get('/api/article/body?pathname=%20')
expect(res.statusCode).toBe(400)
const { error } = JSON.parse(res.body)
expect(error).toBe("'pathname' query empty")
})

test('repeated pathname query string key', async () => {
const res = await get('/api/article/body?pathname=a&pathname=b')
expect(res.statusCode).toBe(400)
const { error } = JSON.parse(res.body)
expect(error).toBe("Multiple 'pathname' keys")
})
})
8 changes: 4 additions & 4 deletions src/shielding/tests/shielding.ts
Original file line number Diff line number Diff line change
@@ -72,24 +72,24 @@ describe('index.md and .md suffixes', () => {
})

// TODO-ARTICLEAPI: unskip tests or replace when ready to ship article API
test.skip('any URL that ends with /.md redirects', async () => {
test('any URL that ends with /.md redirects', async () => {
// With language prefix
{
const res = await get('/en/get-started/hello.md')
expect(res.statusCode).toBe(302)
expect(res.headers.location).toBe('/en/get-started/hello')
expect(res.headers.location).toBe('/api/article/body?pathname=/en/get-started/hello')
}
// Without language prefix
{
const res = await get('/get-started/hello.md')
expect(res.statusCode).toBe(302)
expect(res.headers.location).toBe('/get-started/hello')
expect(res.headers.location).toBe('/api/article/body?pathname=/get-started/hello')
}
// With query string
{
const res = await get('/get-started/hello.md?foo=bar')
expect(res.statusCode).toBe(302)
expect(res.headers.location).toBe('/get-started/hello?foo=bar')
expect(res.headers.location).toBe('/api/article/body?pathname=/get-started/hello')
}
})
})