Skip to content

Commit

Permalink
Merge pull request github#28566 from github/repo-sync
Browse files Browse the repository at this point in the history
Repo sync
  • Loading branch information
docs-bot authored Sep 28, 2023
2 parents 0fe98ff + fadc57f commit f2cd562
Show file tree
Hide file tree
Showing 22 changed files with 276 additions and 146 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ For more information, see "[AUTOTITLE](/actions/learn-github-actions/contexts#gi

#### `runs.steps[*].shell`

**Optional** The shell where you want to run the command. You can use any of the shells listed [here](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell). Required if `run` is set.
**Optional** The shell where you want to run the command. You can use any of the shells listed in "[AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell)." Required if `run` is set.

#### `runs.steps[*].if`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Here is an example process that you can follow to automatically run tests, creat

- When a pull request is opened, either from a branch or a fork, your testing workflow will again run the tests, this time with the merge commit.

- **Note:** for security reasons, workflows triggered by `pull_request` from forks have restricted `GITHUB_TOKEN` permissions and do not have access to secrets. If your tests or other workflows triggered upon pull request require access to secrets, consider using a different event like a [manual trigger](/actions/using-workflows/events-that-trigger-workflows#manual-events) or a [`pull_request_target`](/actions/using-workflows/events-that-trigger-workflows#pull_request_target). Read more [here](/actions/using-workflows/events-that-trigger-workflows#pull-request-events-for-forked-repositories).
- **Note:** for security reasons, workflows triggered by `pull_request` from forks have restricted `GITHUB_TOKEN` permissions and do not have access to secrets. If your tests or other workflows triggered upon pull request require access to secrets, consider using a different event like a [manual trigger](/actions/using-workflows/events-that-trigger-workflows#manual-events) or a [`pull_request_target`](/actions/using-workflows/events-that-trigger-workflows#pull_request_target). For more information, see "[AUTOTITLE](/actions/using-workflows/events-that-trigger-workflows#pull-request-events-for-forked-repositories)."

1. Create a semantically tagged release. {% ifversion fpt or ghec %} You may also publish to {% data variables.product.prodname_marketplace %} with a simple checkbox. {% endif %} For more information, see "[AUTOTITLE](/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release)"{% ifversion fpt or ghec %} and "[AUTOTITLE](/actions/creating-actions/publishing-actions-in-github-marketplace#publishing-an-action)"{% endif %}.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ By default, {% data variables.product.prodname_actions_importer %} fetches pipel
For example:

```shell
gh actions-importer dry-run azure-devops --output-dir ./output/ --source-file-path ./path/to/azure_devops/pipeline.yml
gh actions-importer dry-run azure-devops pipeline --output-dir ./output/ --source-file-path ./path/to/azure_devops/pipeline.yml
```

#### `--config-file-path`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ The `--config-file-path` argument can also be used to specify which repository a
In this example, {% data variables.product.prodname_actions_importer %} uses the specified YAML configuration file to perform an audit.

```shell
gh actions-importer audit gitlab --output-dir path/to/output/ --config-file-path path/to/gitlab/config.yml
gh actions-importer audit gitlab --output-dir path/to/output/ --namespace my-gitlab-namespace --config-file-path path/to/gitlab/config.yml
```

To audit a GitLab instance using a configuration file, the file must be in the following format, and each `repository_slug` value must be unique:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This will include an "Open in {% data variables.product.prodname_vscode_shortnam

{% note %}

**Note:** The student must have Git installed on their computer to push code from {% data variables.product.prodname_vscode_shortname %} to their repository. This is not automatically installed when clicking the **Open in {% data variables.product.prodname_vscode_shortname %}** button. The student can download Git from [here](https://git-scm.com/downloads).
**Note:** The student must have Git installed on their computer to push code from {% data variables.product.prodname_vscode_shortname %} to their repository. This is not automatically installed when clicking the **Open in {% data variables.product.prodname_vscode_shortname %}** button. The student can download Git from [Git download](https://git-scm.com/downloads).

{% endnote %}

Expand All @@ -40,6 +40,6 @@ When the student launches the extension for the first time, they are automatical
The student can push their commits to the latest version of remote, by clicking the **sync changes** button, displayed when hovering over the "Active Assignment" line. This abstracts away source control with Git, allowing instructors to teach Git at their own pace.
Syncing changes also triggers "Tests" to run if a teacher has configured autograding for their assignment.

The "Group" node under "Active Assignment" will show members of a group, if the assignment is a group project. It will also show the admin members of the repository who can help when a student is stuck. To collaborate on the project, a student can start a Live Share session with anyone in the group node, and they will immediately share the entire context of the repository with them. You can learn more about Live Share and collaborating with it [here](https://docs.microsoft.com/en-us/visualstudio/liveshare/).
The "Group" node under "Active Assignment" will show members of a group, if the assignment is a group project. It will also show the admin members of the repository who can help when a student is stuck. To collaborate on the project, a student can start a Live Share session with anyone in the group node, and they will immediately share the entire context of the repository with them. For more information about Live Share and collaborating with it, see [What is Visual Studio Live Share?](https://docs.microsoft.com/en-us/visualstudio/liveshare/).

Once a student is done with the assignment, they can also navigate to see other Assignments and Classrooms. These can be found under the GitHub tab.
4 changes: 2 additions & 2 deletions content/rest/commits/comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ You can create, edit, and view commit comments using the REST API. A commit comm

### Custom media types for commit comments

These are the supported media types for commit comments. You can read more
about the use of media types in the API [here](/rest/overview/media-types).
These are the supported media types for commit comments. For more information
about the use of media types in the API, see "[AUTOTITLE](/rest/overview/media-types)."

application/vnd.github-commitcomment.raw+json
application/vnd.github-commitcomment.text+json
Expand Down
2 changes: 1 addition & 1 deletion content/rest/git/blobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ autogenerated: rest
## About Git blobs

A Git blob (binary large object) is the object type used to store the contents of each file in a repository. The file's SHA-1 hash is computed and stored in the blob object. These endpoints allow you to read and write [blob objects](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects)
to your Git database on {% data variables.product.product_name %}. Blobs leverage [these custom media types](#custom-media-types-for-blobs). You can read more about the use of media types in the API [here](/rest/overview/media-types).
to your Git database on {% data variables.product.product_name %}. Blobs leverage [these custom media types](#custom-media-types-for-blobs). For more information about the use of media types in the API, see "[AUTOTITLE](/rest/overview/media-types)."

### Custom media types for blobs

Expand Down
2 changes: 1 addition & 1 deletion content/rest/repos/contents.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ For markup files such as Markdown or AsciiDoc, you can retrieve the rendered HTM
Use the `object` media type parameter to retrieve the contents in a consistent object format regardless of the content type. For example, instead of an array of objects
for a directory, the response will be an object with an `entries` attribute containing the array of objects.

You can read more about the use of media types in the API [here](/rest/overview/media-types).
For more information about the use of media types in the API, see "[AUTOTITLE](/rest/overview/media-types)."

<!-- Content after this section is automatically generated -->
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ topics:

{% note %}

**Note:** The below Educational Use Agreement is related to the GitHub Campus Program Partner Schools, also found [here](https://education.github.com/schools/terms), and is considered the program terms and conditions.
**Note:** The below Educational Use Agreement is related to the GitHub Campus Program Partner Schools, also found [here](https://education.github.com/schools/terms), and is considered the program terms and conditions.<!-- markdownlint-disable-line no-generic-link-text -->

{% endnote %}

Expand Down
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"@actions/core": "^1.10.0",
"@actions/github": "^5.0.3",
"@axe-core/playwright": "^4.7.3",
"@github/markdownlint-github": "^0.4.1",
"@graphql-inspector/core": "^5.0.0",
"@graphql-tools/load": "^8.0.0",
"@jest/globals": "29.7.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { addError, ellipsify } from 'markdownlint-rule-helpers'

import { getRange } from '../helpers/utils.js'
/*
This rule currently only checks for one hardcoded string but
can be generalized in the future to check for strings that
have data reusables.
*/
export const githubOwnedActionReferences = {
names: ['GHD013', 'github-owned-action-references'],
description:
'Strings that have a data reusable should use the reusable instead of the hardcoded string.',
tags: ['actions'],
information: new URL('https://github.com/github/docs/blob/main/src/content-linter/README.md'),
function: function GHD013(params, onError) {
const filepath = params.name
if (filepath.startsWith('data/reusables/actions/action-')) return

const regex =
/(actions\/(checkout|delete-package-versions|download-artifact|upload-artifact|github-script|setup-dotnet|setup-go|setup-java|setup-node|setup-python|stale|cache)|github\/codeql-action[/a-zA-Z-]*)@v\d+/g

for (let i = 0; i < params.lines.length; i++) {
const line = params.lines[i]
const matches = line.match(regex)
if (!matches) continue

for (const match of matches) {
const lineNumber = i + 1
const range = getRange(line, match)
addError(
onError,
lineNumber,
`The string ${match} is using hardcoding a reference to a GitHub-owned action. You should use the reusables for the action. e.g {% data reusables.actions.action-checkout %}.`,
ellipsify(line),
range,
null, // No fix possible
)
}
}
},
}
41 changes: 41 additions & 0 deletions src/content-linter/lib/linting-rules/hardcoded-data-variable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { addError, ellipsify } from 'markdownlint-rule-helpers'

import { getRange } from '../helpers/utils.js'
import frontmatter from '../../../../lib/read-frontmatter.js'

/*
This rule currently only checks for one hardcoded string but
can be generalized in the future to check for strings that
have data variables.
*/
export const hardcodedDataVariable = {
names: ['GHD012', 'hardcoded-data-variable'],
description:
'Strings that have a data reusable should use the reusable instead of the hardcoded string.',
tags: ['single-source'],
information: new URL('https://github.com/github/docs/blob/main/src/content-linter/README.md'),
function: function GHD012(params, onError) {
const frontmatterString = params.frontMatterLines.join('\n')
const fm = frontmatter(frontmatterString).data
if (fm.autogenerated) return
for (let i = 0; i < params.lines.length; i++) {
const line = params.lines[i]
const regex = /personal access tokens?/gi
const matches = line.match(regex)
if (!matches) continue

for (const match of matches) {
const lineNumber = i + 1
const range = getRange(line, match)
addError(
onError,
lineNumber,
`The string ${match} can be replaced with a variable. You should use one of the variables from data/variables/product.yml instead of the literal phrase(s):`,
ellipsify(line),
range,
null, // No fix possible
)
}
}
},
}
16 changes: 16 additions & 0 deletions src/content-linter/lib/linting-rules/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import searchReplace from 'markdownlint-rule-search-replace'
import markdownlintGitHub from '@github/markdownlint-github'

import { codeFenceLineLength } from './code-fence-line-length.js'
import { imageAltTextEndPunctuation } from './image-alt-text-end-punctuation.js'
Expand All @@ -11,11 +12,23 @@ import { listFirstWordCapitalization } from './list-first-word-capitalization.js
import { linkPunctuation } from './link-punctuation.js'
import { earlyAccessReferences } from './early-access-references.js'
import { yamlScheduledJobs } from './yaml-scheduled-jobs.js'
import { internalLinksOldVersion } from './internal-links-old-version.js'
import { hardcodedDataVariable } from './hardcoded-data-variable.js'
import { githubOwnedActionReferences } from './github-owned-action-references.js'
import { liquidQuotedConditionalArg } from './liquid-quoted-conditional-arg.js'

const noDefaultAltText = markdownlintGitHub.find((elem) =>
elem.names.includes('no-default-alt-text'),
)
const noGenericLinkText = markdownlintGitHub.find((elem) =>
elem.names.includes('no-generic-link-text'),
)

export const gitHubDocsMarkdownlint = {
rules: [
searchReplace, // Open-source plugin
noDefaultAltText, // markdownlint-github rule
noGenericLinkText, // markdownlint-github rule
codeFenceLineLength,
imageAltTextEndPunctuation,
imageFileKebab,
Expand All @@ -27,6 +40,9 @@ export const gitHubDocsMarkdownlint = {
linkPunctuation,
earlyAccessReferences,
yamlScheduledJobs,
internalLinksOldVersion,
hardcodedDataVariable,
githubOwnedActionReferences,
liquidQuotedConditionalArg,
],
}
57 changes: 57 additions & 0 deletions src/content-linter/lib/linting-rules/internal-links-old-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { filterTokens, addError } from 'markdownlint-rule-helpers'
import { getRange } from '../helpers/utils.js'

export const internalLinksOldVersion = {
names: ['GHD010', 'internal-links-old-version'],
description: 'Internal links must not have a hardcoded version using old versioning patterns',
tags: ['links', 'url'],
information: new URL('https://github.com/github/docs/blob/main/src/content-linter/README.md'),
function: function GHD010(params, onError) {
filterTokens(params, 'inline', (token) => {
if (
params.name.endsWith('migrating-from-github-enterprise-1110x-to-2123.md') ||
params.name.endsWith('all-releases.md')
)
return
for (const child of token.children) {
if (child.type !== 'link_open') continue
// Things matched by this RegExp:
// - /enterprise/2.19/admin/blah
// - https://docs.github.com/enterprise/11.10.340/admin/blah
// - http://help.github.com/enterprise/2.8/admin/blah
//
// Things intentionally NOT matched by this RegExp:
// - https://someservice.com/enterprise/1.0/blah
// - /github/site-policy/enterprise/2.2/admin/blah
const versionLinkRegEx =
/(?:(?:https?:\/\/(?:help|docs|developer)\.github\.com)(?:\/enterprise\/\d+(\.\d+)+\/[^)\s]*)?|^\/enterprise\/\d+(\.\d+)+\/[^)\s]*)(?=\s|$)/gm
// Example child.attrs:
// [
// ['href', 'get-started'], ['target', '_blank'],
// ['rel', 'canonical'],
// ]
const hrefsMissingSlashes = child.attrs
// The attribute could also be `target` or `rel`
.filter((attr) => attr[0] === 'href')
.filter((attr) => attr[1].startsWith('/') || !attr[1].startsWith('//'))
// Filter out link paths that matches the version link regex
.filter((attr) => attr[1].match(versionLinkRegEx))
// Get the link path from the attribute
.map((attr) => attr[1])

// Create errors for each link path that includes a hardcoded version
for (const linkPath of hrefsMissingSlashes) {
const range = getRange(child.line, linkPath)
addError(
onError,
child.lineNumber,
`There looks to be a hardcoded version in this link: ${linkPath}`,
linkPath,
range,
null, // No fix possible
)
}
}
})
},
}
Loading

0 comments on commit f2cd562

Please sign in to comment.