This commit is contained in:
docubot 2022-09-29 10:51:24 -07:00 коммит произвёл GitHub
Родитель 11ceffd23c
Коммит e836268e42
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
29 изменённых файлов: 914 добавлений и 686 удалений

Просмотреть файл

@ -280,7 +280,9 @@ translations/zh-CN/content/actions/using-workflows/sharing-workflows-secrets-and
translations/zh-CN/content/actions/using-workflows/triggering-a-workflow.md,rendering error
translations/zh-CN/content/actions/using-workflows/workflow-commands-for-github-actions.md,rendering error
translations/zh-CN/content/actions/using-workflows/workflow-syntax-for-github-actions.md,rendering error
translations/zh-CN/content/admin/code-security/managing-github-advanced-security-for-your-enterprise/configuring-code-scanning-for-your-appliance.md,broken liquid tags
translations/zh-CN/content/admin/configuration/configuring-github-connect/about-github-connect.md,broken liquid tags
translations/zh-CN/content/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise.md,broken liquid tags
translations/zh-CN/content/admin/configuration/configuring-github-connect/enabling-unified-search-for-your-enterprise.md,rendering error
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/configuring-email-for-notifications.md,broken liquid tags
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/configuring-rate-limits.md,rendering error
@ -301,6 +303,7 @@ translations/zh-CN/content/admin/monitoring-activity-in-your-enterprise/reviewin
translations/zh-CN/content/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/using-the-audit-log-api-for-your-enterprise.md,rendering error
translations/zh-CN/content/admin/overview/about-enterprise-accounts.md,rendering error
translations/zh-CN/content/admin/overview/about-github-for-enterprises.md,rendering error
translations/zh-CN/content/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise.md,broken liquid tags
translations/zh-CN/content/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-security-settings-in-your-enterprise.md,broken liquid tags
translations/zh-CN/content/admin/policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise.md,broken liquid tags
translations/zh-CN/content/authentication/connecting-to-github-with-ssh/about-ssh.md,broken liquid tags
@ -340,11 +343,13 @@ translations/zh-CN/content/code-security/code-scanning/integrating-with-code-sca
translations/zh-CN/content/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning.md,broken liquid tags
translations/zh-CN/content/code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/about-codeql-code-scanning-in-your-ci-system.md,rendering error
translations/zh-CN/content/code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/configuring-codeql-cli-in-your-ci-system.md,rendering error
translations/zh-CN/content/code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/installing-codeql-cli-in-your-ci-system.md,broken liquid tags
translations/zh-CN/content/code-security/dependabot/dependabot-alerts/browsing-security-advisories-in-the-github-advisory-database.md,rendering error
translations/zh-CN/content/code-security/dependabot/dependabot-alerts/editing-security-advisories-in-the-github-advisory-database.md,broken liquid tags
translations/zh-CN/content/code-security/dependabot/dependabot-alerts/viewing-and-updating-dependabot-alerts.md,rendering error
translations/zh-CN/content/code-security/dependabot/dependabot-security-updates/about-dependabot-security-updates.md,rendering error
translations/zh-CN/content/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates.md,rendering error
translations/zh-CN/content/code-security/dependabot/dependabot-version-updates/about-dependabot-version-updates.md,broken liquid tags
translations/zh-CN/content/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file.md,rendering error
translations/zh-CN/content/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates.md,rendering error
translations/zh-CN/content/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions.md,rendering error
@ -360,6 +365,7 @@ translations/zh-CN/content/code-security/security-overview/viewing-the-security-
translations/zh-CN/content/code-security/supply-chain-security/end-to-end-supply-chain/securing-accounts.md,rendering error
translations/zh-CN/content/code-security/supply-chain-security/end-to-end-supply-chain/securing-code.md,rendering error
translations/zh-CN/content/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review.md,rendering error
translations/zh-CN/content/code-security/supply-chain-security/understanding-your-software-supply-chain/about-supply-chain-security.md,broken liquid tags
translations/zh-CN/content/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph.md,rendering error
translations/zh-CN/content/codespaces/codespaces-reference/allowing-your-codespace-to-access-a-private-image-registry.md,broken liquid tags
translations/zh-CN/content/codespaces/codespaces-reference/disaster-recovery-for-github-codespaces.md,broken liquid tags
@ -414,11 +420,17 @@ translations/zh-CN/content/codespaces/troubleshooting/troubleshooting-prebuilds.
translations/zh-CN/content/codespaces/troubleshooting/troubleshooting-your-connection-to-github-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/troubleshooting/working-with-support-for-github-codespaces.md,broken liquid tags
translations/zh-CN/content/communities/documenting-your-project-with-wikis/editing-wiki-content.md,rendering error
translations/zh-CN/content/copilot/getting-started-with-github-copilot/getting-started-with-github-copilot-in-a-jetbrains-ide.md,broken liquid tags
translations/zh-CN/content/copilot/getting-started-with-github-copilot/getting-started-with-github-copilot-in-visual-studio-code.md,broken liquid tags
translations/zh-CN/content/copilot/getting-started-with-github-copilot/getting-started-with-github-copilot-in-visual-studio.md,broken liquid tags
translations/zh-CN/content/copilot/quickstart.md,broken liquid tags
translations/zh-CN/content/developers/apps/building-github-apps/authenticating-with-github-apps.md,rendering error
translations/zh-CN/content/developers/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps.md,rendering error
translations/zh-CN/content/developers/apps/building-github-apps/managing-allowed-ip-addresses-for-a-github-app.md,rendering error
translations/zh-CN/content/developers/overview/about-githubs-apis.md,broken liquid tags
translations/zh-CN/content/developers/webhooks-and-events/webhooks/webhook-events-and-payloads.md,rendering error
translations/zh-CN/content/discussions/collaborating-with-your-community-using-discussions/collaborating-with-maintainers-using-discussions.md,broken liquid tags
translations/zh-CN/content/discussions/collaborating-with-your-community-using-discussions/participating-in-a-discussion.md,broken liquid tags
translations/zh-CN/content/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/integrate-github-classroom-with-an-ide.md,broken liquid tags
translations/zh-CN/content/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/using-github-codespaces-with-github-classroom.md,broken liquid tags
translations/zh-CN/content/education/manage-coursework-with-github-classroom/teach-with-github-classroom/connect-a-learning-management-system-to-github-classroom.md,broken liquid tags
@ -438,7 +450,7 @@ translations/zh-CN/content/issues/tracking-your-work-with-issues/filtering-and-s
translations/zh-CN/content/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue.md,rendering error
translations/zh-CN/content/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/reviewing-the-audit-log-for-your-organization.md,rendering error
translations/zh-CN/content/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/reviewing-your-organizations-installed-integrations.md,rendering error
translations/zh-CN/content/organizations/managing-access-to-your-organizations-project-boards/managing-team-access-to-an-organization-project-board.md,broken liquid tags
translations/zh-CN/content/organizations/managing-access-to-your-organizations-project-boards/managing-team-access-to-an-organization-project-board.md,rendering error
translations/zh-CN/content/organizations/managing-access-to-your-organizations-repositories/adding-outside-collaborators-to-repositories-in-your-organization.md,rendering error
translations/zh-CN/content/organizations/managing-access-to-your-organizations-repositories/managing-an-individuals-access-to-an-organization-repository.md,rendering error
translations/zh-CN/content/organizations/managing-access-to-your-organizations-repositories/managing-team-access-to-an-organization-repository.md,rendering error
@ -446,8 +458,10 @@ translations/zh-CN/content/organizations/managing-access-to-your-organizations-r
translations/zh-CN/content/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization.md,rendering error
translations/zh-CN/content/organizations/managing-access-to-your-organizations-repositories/viewing-people-with-access-to-your-repository.md,rendering error
translations/zh-CN/content/organizations/managing-organization-settings/allowing-project-visibility-changes-in-your-organization.md,broken liquid tags
translations/zh-CN/content/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization.md,broken liquid tags
translations/zh-CN/content/organizations/managing-organization-settings/disabling-project-boards-in-your-organization.md,rendering error
translations/zh-CN/content/organizations/managing-organization-settings/integrating-jira-with-your-organization-project-board.md,rendering error
translations/zh-CN/content/organizations/managing-organization-settings/managing-the-forking-policy-for-your-organization.md,broken liquid tags
translations/zh-CN/content/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization.md,rendering error
translations/zh-CN/content/organizations/organizing-members-into-teams/managing-code-review-settings-for-your-team.md,rendering error
translations/zh-CN/content/packages/learn-github-packages/about-permissions-for-github-packages.md,rendering error
@ -539,6 +553,7 @@ translations/zh-CN/data/reusables/actions/about-actions-for-enterprises.md,rende
translations/zh-CN/data/reusables/actions/actions-audit-events-workflow.md,rendering error
translations/zh-CN/data/reusables/actions/actions-billing.md,broken liquid tags
translations/zh-CN/data/reusables/actions/create-runner-group.md,rendering error
translations/zh-CN/data/reusables/actions/ip-allow-list-self-hosted-runners.md,broken liquid tags
translations/zh-CN/data/reusables/actions/jobs/section-running-jobs-in-a-container.md,broken liquid tags
translations/zh-CN/data/reusables/actions/ref_name-description.md,broken liquid tags
translations/zh-CN/data/reusables/actions/reusable-workflow-artifacts.md,rendering error
@ -608,6 +623,7 @@ translations/zh-CN/data/reusables/pull_requests/resolving-conversations.md,broke
translations/zh-CN/data/reusables/release-notes/ghas-3.4-secret-scanning-known-issue.md,rendering error
translations/zh-CN/data/reusables/repositories/changed-files.md,broken liquid tags
translations/zh-CN/data/reusables/repositories/navigate-to-code-security-and-analysis.md,rendering error
translations/zh-CN/data/reusables/repositories/navigate-to-commit-page.md,broken liquid tags
translations/zh-CN/data/reusables/repositories/repository-branches.md,rendering error
translations/zh-CN/data/reusables/repositories/sidebar-notifications.md,rendering error
translations/zh-CN/data/reusables/repositories/suggest-changes.md,broken liquid tags

1 file reason
280 translations/zh-CN/content/actions/using-workflows/triggering-a-workflow.md rendering error
281 translations/zh-CN/content/actions/using-workflows/workflow-commands-for-github-actions.md rendering error
282 translations/zh-CN/content/actions/using-workflows/workflow-syntax-for-github-actions.md rendering error
283 translations/zh-CN/content/admin/code-security/managing-github-advanced-security-for-your-enterprise/configuring-code-scanning-for-your-appliance.md broken liquid tags
284 translations/zh-CN/content/admin/configuration/configuring-github-connect/about-github-connect.md broken liquid tags
285 translations/zh-CN/content/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise.md broken liquid tags
286 translations/zh-CN/content/admin/configuration/configuring-github-connect/enabling-unified-search-for-your-enterprise.md rendering error
287 translations/zh-CN/content/admin/configuration/configuring-your-enterprise/configuring-email-for-notifications.md broken liquid tags
288 translations/zh-CN/content/admin/configuration/configuring-your-enterprise/configuring-rate-limits.md rendering error
303 translations/zh-CN/content/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/using-the-audit-log-api-for-your-enterprise.md rendering error
304 translations/zh-CN/content/admin/overview/about-enterprise-accounts.md rendering error
305 translations/zh-CN/content/admin/overview/about-github-for-enterprises.md rendering error
306 translations/zh-CN/content/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise.md broken liquid tags
307 translations/zh-CN/content/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-security-settings-in-your-enterprise.md broken liquid tags
308 translations/zh-CN/content/admin/policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise.md broken liquid tags
309 translations/zh-CN/content/authentication/connecting-to-github-with-ssh/about-ssh.md broken liquid tags
343 translations/zh-CN/content/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning.md broken liquid tags
344 translations/zh-CN/content/code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/about-codeql-code-scanning-in-your-ci-system.md rendering error
345 translations/zh-CN/content/code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/configuring-codeql-cli-in-your-ci-system.md rendering error
346 translations/zh-CN/content/code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/installing-codeql-cli-in-your-ci-system.md broken liquid tags
347 translations/zh-CN/content/code-security/dependabot/dependabot-alerts/browsing-security-advisories-in-the-github-advisory-database.md rendering error
348 translations/zh-CN/content/code-security/dependabot/dependabot-alerts/editing-security-advisories-in-the-github-advisory-database.md broken liquid tags
349 translations/zh-CN/content/code-security/dependabot/dependabot-alerts/viewing-and-updating-dependabot-alerts.md rendering error
350 translations/zh-CN/content/code-security/dependabot/dependabot-security-updates/about-dependabot-security-updates.md rendering error
351 translations/zh-CN/content/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates.md rendering error
352 translations/zh-CN/content/code-security/dependabot/dependabot-version-updates/about-dependabot-version-updates.md broken liquid tags
353 translations/zh-CN/content/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file.md rendering error
354 translations/zh-CN/content/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates.md rendering error
355 translations/zh-CN/content/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions.md rendering error
365 translations/zh-CN/content/code-security/supply-chain-security/end-to-end-supply-chain/securing-accounts.md rendering error
366 translations/zh-CN/content/code-security/supply-chain-security/end-to-end-supply-chain/securing-code.md rendering error
367 translations/zh-CN/content/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review.md rendering error
368 translations/zh-CN/content/code-security/supply-chain-security/understanding-your-software-supply-chain/about-supply-chain-security.md broken liquid tags
369 translations/zh-CN/content/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph.md rendering error
370 translations/zh-CN/content/codespaces/codespaces-reference/allowing-your-codespace-to-access-a-private-image-registry.md broken liquid tags
371 translations/zh-CN/content/codespaces/codespaces-reference/disaster-recovery-for-github-codespaces.md broken liquid tags
420 translations/zh-CN/content/codespaces/troubleshooting/troubleshooting-your-connection-to-github-codespaces.md broken liquid tags
421 translations/zh-CN/content/codespaces/troubleshooting/working-with-support-for-github-codespaces.md broken liquid tags
422 translations/zh-CN/content/communities/documenting-your-project-with-wikis/editing-wiki-content.md rendering error
423 translations/zh-CN/content/copilot/getting-started-with-github-copilot/getting-started-with-github-copilot-in-a-jetbrains-ide.md broken liquid tags
424 translations/zh-CN/content/copilot/getting-started-with-github-copilot/getting-started-with-github-copilot-in-visual-studio-code.md broken liquid tags
425 translations/zh-CN/content/copilot/getting-started-with-github-copilot/getting-started-with-github-copilot-in-visual-studio.md broken liquid tags
426 translations/zh-CN/content/copilot/quickstart.md broken liquid tags
427 translations/zh-CN/content/developers/apps/building-github-apps/authenticating-with-github-apps.md rendering error
428 translations/zh-CN/content/developers/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps.md rendering error
429 translations/zh-CN/content/developers/apps/building-github-apps/managing-allowed-ip-addresses-for-a-github-app.md rendering error
430 translations/zh-CN/content/developers/overview/about-githubs-apis.md broken liquid tags
431 translations/zh-CN/content/developers/webhooks-and-events/webhooks/webhook-events-and-payloads.md rendering error
432 translations/zh-CN/content/discussions/collaborating-with-your-community-using-discussions/collaborating-with-maintainers-using-discussions.md broken liquid tags
433 translations/zh-CN/content/discussions/collaborating-with-your-community-using-discussions/participating-in-a-discussion.md broken liquid tags
434 translations/zh-CN/content/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/integrate-github-classroom-with-an-ide.md broken liquid tags
435 translations/zh-CN/content/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/using-github-codespaces-with-github-classroom.md broken liquid tags
436 translations/zh-CN/content/education/manage-coursework-with-github-classroom/teach-with-github-classroom/connect-a-learning-management-system-to-github-classroom.md broken liquid tags
450 translations/zh-CN/content/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue.md rendering error
451 translations/zh-CN/content/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/reviewing-the-audit-log-for-your-organization.md rendering error
452 translations/zh-CN/content/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/reviewing-your-organizations-installed-integrations.md rendering error
453 translations/zh-CN/content/organizations/managing-access-to-your-organizations-project-boards/managing-team-access-to-an-organization-project-board.md broken liquid tags rendering error
454 translations/zh-CN/content/organizations/managing-access-to-your-organizations-repositories/adding-outside-collaborators-to-repositories-in-your-organization.md rendering error
455 translations/zh-CN/content/organizations/managing-access-to-your-organizations-repositories/managing-an-individuals-access-to-an-organization-repository.md rendering error
456 translations/zh-CN/content/organizations/managing-access-to-your-organizations-repositories/managing-team-access-to-an-organization-repository.md rendering error
458 translations/zh-CN/content/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization.md rendering error
459 translations/zh-CN/content/organizations/managing-access-to-your-organizations-repositories/viewing-people-with-access-to-your-repository.md rendering error
460 translations/zh-CN/content/organizations/managing-organization-settings/allowing-project-visibility-changes-in-your-organization.md broken liquid tags
461 translations/zh-CN/content/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization.md broken liquid tags
462 translations/zh-CN/content/organizations/managing-organization-settings/disabling-project-boards-in-your-organization.md rendering error
463 translations/zh-CN/content/organizations/managing-organization-settings/integrating-jira-with-your-organization-project-board.md rendering error
464 translations/zh-CN/content/organizations/managing-organization-settings/managing-the-forking-policy-for-your-organization.md broken liquid tags
465 translations/zh-CN/content/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization.md rendering error
466 translations/zh-CN/content/organizations/organizing-members-into-teams/managing-code-review-settings-for-your-team.md rendering error
467 translations/zh-CN/content/packages/learn-github-packages/about-permissions-for-github-packages.md rendering error
553 translations/zh-CN/data/reusables/actions/actions-audit-events-workflow.md rendering error
554 translations/zh-CN/data/reusables/actions/actions-billing.md broken liquid tags
555 translations/zh-CN/data/reusables/actions/create-runner-group.md rendering error
556 translations/zh-CN/data/reusables/actions/ip-allow-list-self-hosted-runners.md broken liquid tags
557 translations/zh-CN/data/reusables/actions/jobs/section-running-jobs-in-a-container.md broken liquid tags
558 translations/zh-CN/data/reusables/actions/ref_name-description.md broken liquid tags
559 translations/zh-CN/data/reusables/actions/reusable-workflow-artifacts.md rendering error
623 translations/zh-CN/data/reusables/release-notes/ghas-3.4-secret-scanning-known-issue.md rendering error
624 translations/zh-CN/data/reusables/repositories/changed-files.md broken liquid tags
625 translations/zh-CN/data/reusables/repositories/navigate-to-code-security-and-analysis.md rendering error
626 translations/zh-CN/data/reusables/repositories/navigate-to-commit-page.md broken liquid tags
627 translations/zh-CN/data/reusables/repositories/repository-branches.md rendering error
628 translations/zh-CN/data/reusables/repositories/sidebar-notifications.md rendering error
629 translations/zh-CN/data/reusables/repositories/suggest-changes.md broken liquid tags

Просмотреть файл

@ -73,6 +73,10 @@ After changing your username, links to your previous profile page, such as `http
{% ifversion fpt or ghec %}Git commits that were associated with your {% data variables.product.product_name %}-provided `noreply` email address won't be attributed to your new username and won't appear in your contributions graph.{% endif %} If your Git commits are associated with another email address you've [added to your GitHub account](/articles/adding-an-email-address-to-your-github-account), {% ifversion fpt or ghec %}including the ID-based {% data variables.product.product_name %}-provided `noreply` email address, {% endif %}they'll continue to be attributed to you and appear in your contributions graph after you've changed your username. For more information on setting your email address, see "[Setting your commit email address](/articles/setting-your-commit-email-address)."
## Your gists
After changing your username, the URLs to any public or secret gists will also change and previous links to these will return a 404 error. We recommend updating the links to these gists anywhere you may have shared them.
## Changing your username
{% data reusables.user-settings.access_settings %}

Просмотреть файл

@ -214,6 +214,9 @@ The `github` context contains information about the workflow run and the event t
{%- ifversion fpt or ghec or ghes > 3.5 or ghae > 3.4 %}
| `github.run_attempt` | `string` | A unique number for each attempt of a particular workflow run in a repository. This number begins at 1 for the workflow run's first attempt, and increments with each re-run. |
{%- endif %}
{%- ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
| `github.secret_source` | `string` | The source of a secret used in a workflow. Possible values are `None`, `Actions`, `Dependabot`, or `Codespaces`. |
{%- endif %}
| `github.server_url` | `string` | The URL of the GitHub server. For example: `https://github.com`. |
| `github.sha` | `string` | {% data reusables.actions.github_sha_description %} |
| `github.token` | `string` | A token to authenticate on behalf of the GitHub App installed on your repository. This is functionally equivalent to the `GITHUB_TOKEN` secret. For more information, see "[Automatic token authentication](/actions/security-guides/automatic-token-authentication)." <br /> Note: This context property is set by the Actions runner, and is only available within the execution `steps` of a job. Otherwise, the value of this property will be `null`. |{% ifversion actions-stable-actor-ids %}

Просмотреть файл

@ -1,7 +1,7 @@
---
title: 为设备配置代码扫描
title: Configuring code scanning for your appliance
shortTitle: Configuring code scanning
intro: '你可以为 {% data variables.product.product_location %} 启用、配置和禁用 {% data variables.product.prodname_code_scanning %}。 {% data variables.product.prodname_code_scanning_capc %} 允许用户扫描代码以发现漏洞和错误。'
intro: 'You can enable, configure and disable {% data variables.product.prodname_code_scanning %} for {% data variables.product.product_location %}. {% data variables.product.prodname_code_scanning_capc %} allows users to scan code for vulnerabilities and errors.'
product: '{% data reusables.gated-features.code-scanning %}'
miniTocMaxHeadingLevel: 3
redirect_from:
@ -16,78 +16,82 @@ topics:
- Code scanning
- Enterprise
- Security
ms.openlocfilehash: ad1bab39f7fe6af6f07e59d8d5c8b95ccd144711
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/10/2022
ms.locfileid: '147880643'
---
{% data reusables.code-scanning.beta %}
## 关于 {% data variables.product.prodname_code_scanning %}
## About {% data variables.product.prodname_code_scanning %}
{% data reusables.code-scanning.about-code-scanning %}
您可以配置 {% data variables.product.prodname_code_scanning %} 以运行 {% data variables.product.prodname_codeql %} 分析和第三方分析。 {% data variables.product.prodname_code_scanning_capc %} 还支持使用 {% data variables.product.prodname_actions %} 在本地运行分析,或使用现有 CI/CD 基础架构在外部运行分析。 下表总结了用户在配置 {% data variables.product.product_location %} 以允许 {% data variables.product.prodname_code_scanning %} 使用操作时用户可用的所有选项。
You can configure {% data variables.product.prodname_code_scanning %} to run {% data variables.product.prodname_codeql %} analysis and third-party analysis. {% data variables.product.prodname_code_scanning_capc %} also supports running analysis natively using {% data variables.product.prodname_actions %} or externally using existing CI/CD infrastructure. The table below summarizes all the options available to users when you configure {% data variables.product.product_location %} to allow {% data variables.product.prodname_code_scanning %} using actions.
{% data reusables.code-scanning.enabling-options %}
## 检查您的许可是否包含 {% data variables.product.prodname_GH_advanced_security %}
## Checking whether your license includes {% data variables.product.prodname_GH_advanced_security %}
{% data reusables.advanced-security.check-for-ghas-license %}
## {% data variables.product.prodname_code_scanning %} 的前提条件
## Prerequisites for {% data variables.product.prodname_code_scanning %}
- {% data variables.product.prodname_GH_advanced_security %}{% ifversion ghes %} 的许可证(请参阅“[关于 {% data variables.product.prodname_GH_advanced_security %} 的计费](/billing/managing-billing-for-github-advanced-security/about-billing-for-github-advanced-security)”){% endif %}
- A license for {% data variables.product.prodname_GH_advanced_security %}{% ifversion ghes %} (see "[About billing for {% data variables.product.prodname_GH_advanced_security %}](/billing/managing-billing-for-github-advanced-security/about-billing-for-github-advanced-security)"){% endif %}
- 在管理控制台中启用的 {% data variables.product.prodname_code_scanning_capc %}(请参阅“[为企业启用 {% data variables.product.prodname_GH_advanced_security %}](/admin/advanced-security/enabling-github-advanced-security-for-your-enterprise)”)
- {% data variables.product.prodname_code_scanning_capc %} enabled in the management console (see "[Enabling {% data variables.product.prodname_GH_advanced_security %} for your enterprise](/admin/advanced-security/enabling-github-advanced-security-for-your-enterprise)")
- 用于运行 {% data variables.product.prodname_code_scanning %} 分析的 VM 或容器。
- A VM or container for {% data variables.product.prodname_code_scanning %} analysis to run in.
## 使用 {% data variables.product.prodname_actions %} 运行 {% data variables.product.prodname_code_scanning %}
## Running {% data variables.product.prodname_code_scanning %} using {% data variables.product.prodname_actions %}
### 设置自托管运行器
### Setting up a self-hosted runner
{% data variables.product.prodname_ghe_server %} 可以使用 {% data variables.product.prodname_actions %} 工作流程运行 {% data variables.product.prodname_code_scanning %}。 首先,您需要在环境中预配一个或多个自托管的 {% data variables.product.prodname_actions %} 运行器。 您可以在仓库、组织或企业帐户级别预配自托管运行器。 有关详细信息,请参阅“[关于自托管运行器](/actions/hosting-your-own-runners/about-self-hosted-runners)”和“[添加自托管运行器](/actions/hosting-your-own-runners/adding-self-hosted-runners)。”
{% data variables.product.prodname_ghe_server %} can run {% data variables.product.prodname_code_scanning %} using a {% data variables.product.prodname_actions %} workflow. First, you need to provision one or more self-hosted {% data variables.product.prodname_actions %} runners in your environment. You can provision self-hosted runners at the repository, organization, or enterprise account level. For more information, see "[About self-hosted runners](/actions/hosting-your-own-runners/about-self-hosted-runners)" and "[Adding self-hosted runners](/actions/hosting-your-own-runners/adding-self-hosted-runners)."
您必须确保 Git 在用于运行 {% data variables.product.prodname_codeql %} 操作的任何自托管运行器上的 PATH 变量中。
You must ensure that Git is in the PATH variable on any self-hosted runners you use to run {% data variables.product.prodname_codeql %} actions.
### 预配 {% data variables.product.prodname_code_scanning %} 的操作
{% ifversion ghes > 3.7 or ghae > 3.7 %}
{% note %}
{% ifversion ghes %} 如果想使用操作在 {% data variables.product.prodname_ghe_server %} 上运行 {% data variables.product.prodname_code_scanning %},则这些操作必须在设备上可用。
If you use {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %} to analyze code written in Python in your enterprise, you must make sure that your self-hosted runner has Python 3 installed.
{% data variables.product.prodname_codeql %} 操作包含在您安装的 {% data variables.product.prodname_ghe_server %} 中。 如果 {% data variables.product.prodname_ghe_server %} {{ allVersions[currentVersion].currentRelease }} 可以访问 Internet操作将自动下载执行分析所需的 {% data variables.product.prodname_codeql %} {% data variables.product.codeql_cli_ghes_recommended_version %} 包。 或者,你也可以使用同步工具使最新发布版本的 {% data variables.product.prodname_codeql %} 分析包在本地可用。 有关详细信息,请参阅下面的“[在没有 Internet 访问的服务器上配置 {% data variables.product.prodname_codeql %} 分析](#configuring-codeql-analysis-on-a-server-without-internet-access)”。
{% endnote %}
{% endif %}
您也可以通过设置 {% data variables.product.prodname_github_connect %},使第三方操作可供 {% data variables.product.prodname_code_scanning %} 的用户使用。 有关详细信息,请参阅下面的“[配置 {% data variables.product.prodname_github_connect %} 以同步 {% data variables.product.prodname_actions %}](/enterprise/admin/configuration/configuring-code-scanning-for-your-appliance#configuring-github-connect-to-sync-github-actions)”。
### Provisioning the actions for {% data variables.product.prodname_code_scanning %}
### 在没有互联网接入的服务器上配置 {% data variables.product.prodname_codeql %} 分析
如果您在上面运行 {% data variables.product.prodname_ghe_server %} 的服务器未连接到互联网,但您要允许用户对其仓库启用 {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %},则您必须使用 {% data variables.product.prodname_codeql %} 操作同步工具将 {% data variables.product.prodname_codeql %} 分析包从 {% data variables.product.prodname_dotcom_the_website %} 复制到您的服务器。 该工具及其用法的详细信息在 [https://github.com/github/codeql-action-sync-tool](https://github.com/github/codeql-action-sync-tool/) 提供。
{% ifversion ghes %}
If you want to use actions to run {% data variables.product.prodname_code_scanning %} on {% data variables.product.prodname_ghe_server %}, the actions must be available on your appliance.
如果您设置了 {% data variables.product.prodname_codeql %} 操作同步工具,您可以使用它来同步最新发布的 {% data variables.product.prodname_codeql %} 操作和相关的 {% data variables.product.prodname_codeql %} 分析包。 这些兼容 {% data variables.product.prodname_ghe_server %}。
The {% data variables.product.prodname_codeql %} action is included in your installation of {% data variables.product.prodname_ghe_server %}. If {% data variables.product.prodname_ghe_server %} {{ allVersions[currentVersion].currentRelease }} has access to the internet, the action will automatically download the {% data variables.product.prodname_codeql %} {% data variables.product.codeql_cli_ghes_recommended_version %} bundle required to perform analysis. Alternatively, you can use a synchronization tool to make the latest released version of the {% data variables.product.prodname_codeql %} analysis bundle available locally. For more information, see "[Configuring {% data variables.product.prodname_codeql %} analysis on a server without internet access](#configuring-codeql-analysis-on-a-server-without-internet-access)" below.
You can also make third-party actions available to users for {% data variables.product.prodname_code_scanning %}, by setting up {% data variables.product.prodname_github_connect %}. For more information, see "[Configuring {% data variables.product.prodname_github_connect %} to sync {% data variables.product.prodname_actions %}](/enterprise/admin/configuration/configuring-code-scanning-for-your-appliance#configuring-github-connect-to-sync-github-actions)" below.
### Configuring {% data variables.product.prodname_codeql %} analysis on a server without internet access
If the server on which you are running {% data variables.product.prodname_ghe_server %} is not connected to the internet, and you want to allow users to enable {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %} for their repositories, you must use the {% data variables.product.prodname_codeql %} action sync tool to copy the {% data variables.product.prodname_codeql %} analysis bundle from {% data variables.product.prodname_dotcom_the_website %} to your server. The tool, and details of how to use it, are available at [https://github.com/github/codeql-action-sync-tool](https://github.com/github/codeql-action-sync-tool/).
If you set up the {% data variables.product.prodname_codeql %} action sync tool, you can use it to sync the latest releases of the {% data variables.product.prodname_codeql %} action and associated {% data variables.product.prodname_codeql %} analysis bundle. These are compatible with {% data variables.product.prodname_ghe_server %}.
{% endif %}
### 配置 {% data variables.product.prodname_github_connect %} 以同步 {% data variables.product.prodname_actions %}
1. 如果要从 {% data variables.product.prodname_dotcom_the_website %} 下载按需操作工作流程,则需要启用 {% data variables.product.prodname_github_connect %}。 有关详细信息,请参阅“[启用 {% data variables.product.prodname_github_connect %}](/admin/configuration/managing-connections-between-your-enterprise-accounts/connecting-your-enterprise-account-to-github-enterprise-cloud#enabling-github-connect)。”
2. 还需要为 {% data variables.product.product_location %} 启用 {% data variables.product.prodname_actions %}。 有关详细信息,请参阅“[{% data variables.product.prodname_ghe_server %} 的 {% data variables.product.prodname_actions %} 使用入门](/admin/github-actions/getting-started-with-github-actions-for-github-enterprise-server)。”
3. 下一步是使用 {% data variables.product.prodname_github_connect %} 配置对 {% data variables.product.prodname_dotcom_the_website %} 上的操作的访问权限。 有关详细信息,请参阅“[使用 {% data variables.product.prodname_github_connect %} 启用对 {% data variables.product.prodname_dotcom_the_website %} 操作的自动访问](/enterprise/admin/github-actions/enabling-automatic-access-to-githubcom-actions-using-github-connect)。”
4. 将自托管运行器添加到仓库、组织或企业帐户。 有关详细信息,请参阅“[关于自托管运行器](/actions/hosting-your-own-runners/adding-self-hosted-runners)。”
### Configuring {% data variables.product.prodname_github_connect %} to sync {% data variables.product.prodname_actions %}
1. If you want to download action workflows on demand from {% data variables.product.prodname_dotcom_the_website %}, you need to enable {% data variables.product.prodname_github_connect %}. For more information, see "[Enabling {% data variables.product.prodname_github_connect %}](/admin/configuration/managing-connections-between-your-enterprise-accounts/connecting-your-enterprise-account-to-github-enterprise-cloud#enabling-github-connect)."
2. You'll also need to enable {% data variables.product.prodname_actions %} for {% data variables.product.product_location %}. For more information, see "[Getting started with {% data variables.product.prodname_actions %} for {% data variables.product.prodname_ghe_server %}](/admin/github-actions/getting-started-with-github-actions-for-github-enterprise-server)."
3. The next step is to configure access to actions on {% data variables.product.prodname_dotcom_the_website %} using {% data variables.product.prodname_github_connect %}. For more information, see "[Enabling automatic access to {% data variables.product.prodname_dotcom_the_website %} actions using {% data variables.product.prodname_github_connect %}](/enterprise/admin/github-actions/enabling-automatic-access-to-githubcom-actions-using-github-connect)."
4. Add a self-hosted runner to your repository, organization, or enterprise account. For more information, see "[Adding self-hosted runners](/actions/hosting-your-own-runners/adding-self-hosted-runners)."
## 使用 {% data variables.product.prodname_codeql_cli %} 运行代码扫描
## Running code scanning using the {% data variables.product.prodname_codeql_cli %}
如果不想使用 {% data variables.product.prodname_actions %},应该使用 {% data variables.product.prodname_codeql_cli %} 运行 {% data variables.product.prodname_code_scanning %}。
If you don't want to use {% data variables.product.prodname_actions %}, you should run {% data variables.product.prodname_code_scanning %} using the {% data variables.product.prodname_codeql_cli %}.
{% data variables.product.prodname_codeql_cli %} 是一个命令行工具,可用于分析任何计算机上的代码库,包括第三方 CI/CD 系统。 有关详细信息,请参阅“[在 CI 系统中安装 CodeQL CLI](/code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/installing-codeql-cli-in-your-ci-system)。”
The {% data variables.product.prodname_codeql_cli %} is a command-line tool that you use to analyze codebases on any machine, including a third-party CI/CD system. For more information, see "[Installing CodeQL CLI in your CI system](/code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/installing-codeql-cli-in-your-ci-system)."
{% ifversion codeql-runner-supported %}
## 使用 {% data variables.product.prodname_codeql_runner %} 运行 {% data variables.product.prodname_code_scanning %}
## Running {% data variables.product.prodname_code_scanning %} using the {% data variables.product.prodname_codeql_runner %}
{% data reusables.code-scanning.deprecation-codeql-runner %}
如果您不想使用 {% data variables.product.prodname_actions %},您可以使用 {% data variables.product.prodname_codeql_runner %} 运行 {% data variables.product.prodname_code_scanning %}。
If you don't want to use {% data variables.product.prodname_actions %}, you can run {% data variables.product.prodname_code_scanning %} using the {% data variables.product.prodname_codeql_runner %}.
该 {% data variables.product.prodname_codeql_runner %} 是一个命令行工具,您可以将其添加到第三方 CI/CD 系统中。 该工具在 {% data variables.product.prodname_dotcom %} 仓库检出时运行 {% data variables.product.prodname_codeql %} 分析。 有关详细信息,请参阅“[在 CI 系统中运行 {% data variables.product.prodname_code_scanning %}](/github/finding-security-vulnerabilities-and-errors-in-your-code/running-codeql-code-scanning-in-your-ci-system)。”
The {% data variables.product.prodname_codeql_runner %} is a command-line tool that you can add to your third-party CI/CD system. The tool runs {% data variables.product.prodname_codeql %} analysis on a checkout of a {% data variables.product.prodname_dotcom %} repository. For more information, see "[Running {% data variables.product.prodname_code_scanning %} in your CI system](/github/finding-security-vulnerabilities-and-errors-in-your-code/running-codeql-code-scanning-in-your-ci-system)."
{% endif %}

Просмотреть файл

@ -1,6 +1,6 @@
---
title: 为企业启用 Dependabot
intro: '可以通过启用 {% data variables.product.prodname_dependabot_alerts %}{% ifversion ghes > 3.2 %} 和 {% data variables.product.prodname_dependabot_updates %}{% endif %} 允许 {% data variables.product.product_location %} 的用户查找并修复其代码依赖项中的漏洞。'
title: Enabling Dependabot for your enterprise
intro: 'You can allow users of {% data variables.product.product_location %} to find and fix vulnerabilities in code dependencies by enabling {% data variables.product.prodname_dependabot_alerts %}{% ifversion ghes > 3.2 %} and {% data variables.product.prodname_dependabot_updates %}{% endif %}.'
miniTocMaxHeadingLevel: 3
shortTitle: Dependabot
redirect_from:
@ -22,107 +22,112 @@ topics:
- Security
- Dependency graph
- Dependabot
ms.openlocfilehash: 271e0ad3a81ea8c8cefac9c4a4db6e18ecad5069
ms.sourcegitcommit: fb047f9450b41b24afc43d9512a5db2a2b750a2a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/10/2022
ms.locfileid: '146455571'
---
## 关于 {% data variables.product.product_name %} 的 {% data variables.product.prodname_dependabot %}
{% data variables.product.prodname_dependabot %} 有助于 {% data variables.product.product_location %} 的用户查找和修复其依赖项中的漏洞。{% ifversion ghes > 3.2 %}可启用 {% data variables.product.prodname_dependabot_alerts %} 以通知用户漏洞依赖项,启用 {% data variables.product.prodname_dependabot_updates %} 以修复漏洞并将依赖项更新到最新版本。
## About {% data variables.product.prodname_dependabot %} for {% data variables.product.product_name %}
### 关于 {% data variables.product.prodname_dependabot_alerts %}
{% data variables.product.prodname_dependabot %} helps users of {% data variables.product.product_location %} find and fix vulnerabilities in their dependencies.{% ifversion ghes > 3.2 %} You can enable {% data variables.product.prodname_dependabot_alerts %} to notify users about vulnerable dependencies and {% data variables.product.prodname_dependabot_updates %} to fix the vulnerabilities and keep dependencies updated to the latest version.
### About {% data variables.product.prodname_dependabot_alerts %}
{% endif %}
{% data reusables.dependabot.dependabot-alerts-beta %}
使用 {% data variables.product.prodname_dependabot_alerts %}{% data variables.product.prodname_dotcom %} 可识别存储库中不安全的依赖项,并使用来自 {% data variables.product.prodname_advisory_database %} 和依赖项关系图服务的数据在 {% data variables.product.product_location %} 上创建警报。
With {% data variables.product.prodname_dependabot_alerts %}, {% data variables.product.prodname_dotcom %} identifies insecure dependencies in repositories and creates alerts on {% data variables.product.product_location %}, using data from the {% data variables.product.prodname_advisory_database %} and the dependency graph service.
{% data reusables.repositories.tracks-vulnerabilities %}
为企业启用 {% data variables.product.prodname_dependabot_alerts %} 后,漏洞数据会每小时一次从 {% data variables.product.prodname_advisory_database %} 同步到你的实例。 仅同步 {% data variables.product.company_short %} 审核的公告。 {% data reusables.security-advisory.link-browsing-advisory-db %}
After you enable {% data variables.product.prodname_dependabot_alerts %} for your enterprise, vulnerability data is synced from the {% data variables.product.prodname_advisory_database %} to your instance once every hour. Only {% data variables.product.company_short %}-reviewed advisories are synchronized. {% data reusables.security-advisory.link-browsing-advisory-db %}
您还可以随时选择手动同步漏洞数据。 有关详细信息,请参阅“[查看企业的漏洞数据](/admin/code-security/managing-supply-chain-security-for-your-enterprise/viewing-the-vulnerability-data-for-your-enterprise)”。
You can also choose to manually sync vulnerability data at any time. For more information, see "[Viewing the vulnerability data for your enterprise](/admin/code-security/managing-supply-chain-security-for-your-enterprise/viewing-the-vulnerability-data-for-your-enterprise)."
{% note %}
注意:启用 {% data variables.product.prodname_dependabot_alerts %} 时,不会将来自 {% data variables.product.product_location %} 的代码或有关代码的信息上传到 {% data variables.product.prodname_dotcom_the_website %}。
**Note:** When you enable {% data variables.product.prodname_dependabot_alerts %}, no code or information about code from {% data variables.product.product_location %} is uploaded to {% data variables.product.prodname_dotcom_the_website %}.
{% endnote %}
当 {% data variables.product.product_location %} 接收到有关漏洞的信息时,它将识别 {% data variables.product.product_location %} 中使用受影响依赖项版本的存储库,并生成 {% data variables.product.prodname_dependabot_alerts %}。 可选择是否自动通知用户有关新的 {% data variables.product.prodname_dependabot_alerts %}。
When {% data variables.product.product_location %} receives information about a vulnerability, it identifies repositories in {% data variables.product.product_location %} that use the affected version of the dependency and generates {% data variables.product.prodname_dependabot_alerts %}. You can choose whether or not to notify users automatically about new {% data variables.product.prodname_dependabot_alerts %}.
对于启用了 {% data variables.product.prodname_dependabot_alerts %} 的存储库,扫描会在任何推送到包含清单文件或锁定文件的默认分支时触发。 此外,当向 {% data variables.product.product_location %} 添加新漏洞记录时,{% data variables.product.product_name %} 会扫描 {% data variables.product.product_location %} 上的所有现有存储库并对任何易受攻击的存储库生成警报。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_alerts %}](/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies)”。
For repositories with {% data variables.product.prodname_dependabot_alerts %} enabled, scanning is triggered on any push to the default branch that contains a manifest file or lock file. Additionally, when a new vulnerability record is added to {% data variables.product.product_location %}, {% data variables.product.product_name %} scans all existing repositories on {% data variables.product.product_location %} and generates alerts for any repository that is vulnerable. For more information, see "[About {% data variables.product.prodname_dependabot_alerts %}](/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies)."
{% ifversion ghes > 3.2 %}
### 关于 {% data variables.product.prodname_dependabot_updates %}
### About {% data variables.product.prodname_dependabot_updates %}
{% data reusables.dependabot.beta-security-and-version-updates %}
启用 {% data variables.product.prodname_dependabot_alerts %} 之后,可选择启用 {% data variables.product.prodname_dependabot_updates %}。 为 {% data variables.product.product_location %} 启用 {% data variables.product.prodname_dependabot_updates %} 之后,用户可以配置存储库,以便它们的依赖项自动进行更新并保持安全。
After you enable {% data variables.product.prodname_dependabot_alerts %}, you can choose to enable {% data variables.product.prodname_dependabot_updates %}. When {% data variables.product.prodname_dependabot_updates %} are enabled for {% data variables.product.product_location %}, users can configure repositories so that their dependencies are updated and kept secure automatically.
{% note %}
注意:{% data variables.product.product_name %} 上的 {% data variables.product.prodname_dependabot_updates %} 需要带自托管运行器的 {% data variables.product.prodname_actions %}。
**Note:** {% data variables.product.prodname_dependabot_updates %} on {% data variables.product.product_name %} requires {% data variables.product.prodname_actions %} with self-hosted runners.
{% endnote %}
默认情况下,{% data variables.product.prodname_dependabot %} 使用的 {% data variables.product.prodname_actions %} 运行器需要访问 Internet以便从上游包管理器下载更新的包。 对于由 {% data variables.product.prodname_github_connect %} 提供支持的 {% data variables.product.prodname_dependabot_updates %}Internet 访问权限为运行器提供了一个令牌,允许访问托管在 {% data variables.product.prodname_dotcom_the_website %} 上的依赖项和公告。
By default, {% data variables.product.prodname_actions %} runners used by {% data variables.product.prodname_dependabot %} need access to the internet, to download updated packages from upstream package managers. For {% data variables.product.prodname_dependabot_updates %} powered by {% data variables.product.prodname_github_connect %}, internet access provides your runners with a token that allows access to dependencies and advisories hosted on {% data variables.product.prodname_dotcom_the_website %}.
使用 {% data variables.product.prodname_dependabot_updates %}{% data variables.product.company_short %} 将自动创建拉取请求,以两种方式更新依赖项。
With {% data variables.product.prodname_dependabot_updates %}, {% data variables.product.company_short %} automatically creates pull requests to update dependencies in two ways.
- **{% data variables.product.prodname_dependabot_version_updates %}** :用户将 {% data variables.product.prodname_dependabot %} 配置文件添加到存储库,启用 {% data variables.product.prodname_dependabot %} 在发布跟踪依赖项的新版本时创建拉取请求。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_version_updates %}](/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates)”。
- **{% data variables.product.prodname_dependabot_security_updates %}** :当 {% data variables.product.prodname_dotcom %} 检测到存储库的依赖项关系图的依赖项之一存在漏洞时,用户切换存储库设置以启用 {% data variables.product.prodname_dependabot %} 来创建拉取请求。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-alerts-for-vulnerable-dependencies)”和“[关于 {% data variables.product.prodname_dependabot_security_updates %}](/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-dependabot-security-updates)”。
- **{% data variables.product.prodname_dependabot_version_updates %}**: Users add a {% data variables.product.prodname_dependabot %} configuration file to the repository to enable {% data variables.product.prodname_dependabot %} to create pull requests when a new version of a tracked dependency is released. For more information, see "[About {% data variables.product.prodname_dependabot_version_updates %}](/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates)."
- **{% data variables.product.prodname_dependabot_security_updates %}**: Users toggle a repository setting to enable {% data variables.product.prodname_dependabot %} to create pull requests when {% data variables.product.prodname_dotcom %} detects a vulnerability in one of the dependencies of the dependency graph for the repository. For more information, see "[About {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-alerts-for-vulnerable-dependencies)" and "[About {% data variables.product.prodname_dependabot_security_updates %}](/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-dependabot-security-updates)."
{% endif %}
## 启用 {% data variables.product.prodname_dependabot_alerts %}
## Enabling {% data variables.product.prodname_dependabot_alerts %}
在启用 {% data variables.product.prodname_dependabot_alerts %} 之前:
- 必须启用 {% data variables.product.prodname_github_connect %}。 有关详细信息,请参阅“[管理 {% data variables.product.prodname_github_connect %}](/admin/configuration/configuring-github-connect/managing-github-connect)”。{% ifversion ghes %}
- 您必须启用依赖关系图。 有关详细信息,请参阅“[为企业启用依赖项关系图](/admin/code-security/managing-supply-chain-security-for-your-enterprise/enabling-the-dependency-graph-for-your-enterprise)”。{% endif %}
Before you can enable {% data variables.product.prodname_dependabot_alerts %}:
- You must enable {% data variables.product.prodname_github_connect %}. For more information, see "[Managing {% data variables.product.prodname_github_connect %}](/admin/configuration/configuring-github-connect/managing-github-connect)."{% ifversion ghes %}
- You must enable the dependency graph. For more information, see "[Enabling the dependency graph for your enterprise](/admin/code-security/managing-supply-chain-security-for-your-enterprise/enabling-the-dependency-graph-for-your-enterprise)."{% endif %}
{% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.github-connect-tab %} {%- ifversion dependabot-updates-github-connect %}
1. 在“{% data variables.product.prodname_dependabot %}”下,在“用户可以接收开放源代码依赖项的漏洞警报”右侧,选择下拉菜单并单击“启用但不通知”。 (可选)要启用警报和通知,请单击“启用并通知”。
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.github-connect-tab %}
{%- ifversion dependabot-updates-github-connect %}
1. Under "{% data variables.product.prodname_dependabot %}", to the right of "Users can receive vulnerability alerts for open source code dependencies", select the dropdown menu and click **Enabled without notifications**. Optionally, to enable alerts with notifications, click **Enabled with notifications**.
![用于启用扫描存储库有无漏洞的下拉菜单屏幕截图](/assets/images/enterprise/site-admin-settings/dependabot-alerts-dropdown.png)
![Screenshot of the dropdown menu to enable scanning repositories for vulnerabilities](/assets/images/enterprise/site-admin-settings/dependabot-alerts-dropdown.png)
{%- else %}
1. 在“可扫描存储库有无漏洞”下,使用下拉菜单,并单击“启用但不通知”。 (可选)要启用警报和通知,请单击“启用并通知”。
![用于启用扫描存储库有无漏洞的下拉菜单](/assets/images/enterprise/site-admin-settings/enable-vulnerability-scanning-in-repositories.png) {%- endif %} {% tip %}
1. Under "Repositories can be scanned for vulnerabilities", select the drop-down menu and click **Enabled without notifications**. Optionally, to enable alerts with notifications, click **Enabled with notifications**.
![Drop-down menu to enable scanning repositories for vulnerabilities](/assets/images/enterprise/site-admin-settings/enable-vulnerability-scanning-in-repositories.png)
{%- endif %}
{% tip %}
提示:我们建议将 {% data variables.product.prodname_dependabot_alerts %} 配置为在前几天发出警报但不通知,以避免电子邮件过载。 几天后,可以启用通知,像往常一样接收 {% data variables.product.prodname_dependabot_alerts %}。
**Tip**: We recommend configuring {% data variables.product.prodname_dependabot_alerts %} without notifications for the first few days to avoid an overload of emails. After a few days, you can enable notifications to receive {% data variables.product.prodname_dependabot_alerts %} as usual.
{% endtip %}
{% ifversion dependabot-updates-github-connect %}
## 启用 {% data variables.product.prodname_dependabot_updates %}
## Enabling {% data variables.product.prodname_dependabot_updates %}
为企业启用 {% data variables.product.prodname_dependabot_alerts %} 之后,可启用 {% data variables.product.prodname_dependabot_updates %}。
After you enable {% data variables.product.prodname_dependabot_alerts %} for your enterprise, you can enable {% data variables.product.prodname_dependabot_updates %}.
{% ifversion ghes %}启用 {% data variables.product.prodname_dependabot_updates %} 之前,必须配置 {% data variables.product.product_location %} 以使用带自托管运行器的 {% data variables.product.prodname_actions %}。 有关详细信息,请参阅“[适用于 GitHub Enterprise Server 的 {% data variables.product.prodname_actions %} 的使用入门](/admin/github-actions/enabling-github-actions-for-github-enterprise-server/getting-started-with-github-actions-for-github-enterprise-server)。”
{% ifversion ghes %}
{% data reusables.dependabot.enabling-actions-for-ghes %} For more information, see "[Getting started with {% data variables.product.prodname_actions %} for GitHub Enterprise Server](/admin/github-actions/enabling-github-actions-for-github-enterprise-server/getting-started-with-github-actions-for-github-enterprise-server)."
如果企业使用聚类分析,{% data variables.product.product_name %} 上不支持 {% data variables.product.prodname_dependabot_updates %}。
{% data variables.product.prodname_dependabot_updates %} are not supported on {% data variables.product.product_name %} if your enterprise uses clustering.
{% endif %}
{% data reusables.enterprise_site_admin_settings.sign-in %} {% data reusables.enterprise_site_admin_settings.access-settings %} {% data reusables.enterprise_site_admin_settings.management-console %} {% data reusables.enterprise_management_console.advanced-security-tab %}
1. 在“安全”下,选择 {% data variables.product.prodname_dependabot_security_updates %}。
{% data reusables.enterprise_site_admin_settings.sign-in %}
{% data reusables.enterprise_site_admin_settings.access-settings %}
{% data reusables.enterprise_site_admin_settings.management-console %}
{% data reusables.enterprise_management_console.advanced-security-tab %}
1. Under "Security", select **{% data variables.product.prodname_dependabot_security_updates %}**.
![用于启用或禁用 {% data variables.product.prodname_dependabot_security_updates %} 的复选框屏幕截图](/assets/images/enterprise/management-console/enable-dependabot-updates.png)
![Screenshot of the checkbox to enable or disable {% data variables.product.prodname_dependabot_security_updates %}](/assets/images/enterprise/management-console/enable-dependabot-updates.png)
{% data reusables.enterprise_management_console.save-settings %}
1. 单击“访问实例”。
1. 配置自托管运行器以创建将更新依赖项的拉取请求。 有关详细信息,请参阅“[为企业中的 {% data variables.product.prodname_dependabot_updates %} 管理自托管运行器](/admin/github-actions/enabling-github-actions-for-github-enterprise-server/managing-self-hosted-runners-for-dependabot-updates)”。
{% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.github-connect-tab %}
1. 在“{% data variables.product.prodname_dependabot %}”下,在“用户可以轻松升级到非易受攻击的开源代码依赖项”右侧,单击“启用”。
1. Click **Visit your instance**.
1. Configure self-hosted runners to create the pull requests that will update dependencies. For more information, see "[Managing self-hosted runners for {% data variables.product.prodname_dependabot_updates %} on your enterprise](/admin/github-actions/enabling-github-actions-for-github-enterprise-server/managing-self-hosted-runners-for-dependabot-updates)."
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.github-connect-tab %}
1. Under "{% data variables.product.prodname_dependabot %}", to the right of "Users can easily upgrade to non-vulnerable open source code dependencies", click **Enable**.
![用于启用更新易受攻击的依赖项下拉菜单屏幕截图](/assets/images/enterprise/site-admin-settings/dependabot-updates-button.png)
{% endif %} {% ifversion ghes > 3.2 %}
启用 {% data variables.product.prodname_dependabot_alerts %} 时,还应考虑为 {% data variables.product.prodname_dependabot_security_updates %} 设置 {% data variables.product.prodname_actions %}。 此功能使开发人员可以修复其依赖项中的漏洞。 有关详细信息,请参阅“[为企业中的 {% data variables.product.prodname_dependabot_updates %} 管理自托管运行器](/admin/github-actions/enabling-github-actions-for-github-enterprise-server/managing-self-hosted-runners-for-dependabot-updates)”。
如果需要增强安全性,建议将 {% data variables.product.prodname_dependabot %} 配置为使用专用注册表。 有关详细信息,请参阅“[管理 {% data variables.product.prodname_dependabot %} 的加密机密](/code-security/dependabot/working-with-dependabot/managing-encrypted-secrets-for-dependabot)”。
![Screenshot of the dropdown menu to enable updating vulnerable dependencies](/assets/images/enterprise/site-admin-settings/dependabot-updates-button.png)
{% endif %}
{% ifversion ghes > 3.2 %}
When you enable {% data variables.product.prodname_dependabot_alerts %}, you should consider also setting up {% data variables.product.prodname_actions %} for {% data variables.product.prodname_dependabot_security_updates %}. This feature allows developers to fix vulnerabilities in their dependencies. For more information, see "[Managing self-hosted runners for {% data variables.product.prodname_dependabot_updates %} on your enterprise](/admin/github-actions/enabling-github-actions-for-github-enterprise-server/managing-self-hosted-runners-for-dependabot-updates)."
If you need enhanced security, we recommend configuring {% data variables.product.prodname_dependabot %} to use private registries. For more information, see "[Managing encrypted secrets for {% data variables.product.prodname_dependabot %}](/code-security/dependabot/working-with-dependabot/managing-encrypted-secrets-for-dependabot)."
{% endif %}

Просмотреть файл

@ -1,6 +1,6 @@
---
title: 在企业中为 GitHub Actions 实施策略
intro: '您可以为企业组织内的 {% data variables.product.prodname_actions %} 执行策略,或者允许在每个组织中设置策略。'
title: Enforcing policies for GitHub Actions in your enterprise
intro: 'You can enforce policies for {% data variables.product.prodname_actions %} within your enterprise''s organizations, or allow policies to be set in each organization.'
permissions: 'Enterprise owners can enforce policies for {% data variables.product.prodname_actions %} in an enterprise.'
miniTocMaxHeadingLevel: 3
redirect_from:
@ -24,127 +24,158 @@ topics:
- Enterprise
- Policies
shortTitle: GitHub Actions policies
ms.openlocfilehash: 21b2cfa73ef84ba6635f05b9fc25bb48df2b87cb
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147400336'
---
{% data reusables.actions.enterprise-beta %}
## 关于企业中 {% data variables.product.prodname_actions %} 的策略
## About policies for {% data variables.product.prodname_actions %} in your enterprise
{% data variables.product.prodname_actions %} 可帮助您的企业成员在 {% data variables.product.product_name %} 上自动执行软件开发工作流程。 有关详细信息,请参阅“[了解 {% data variables.product.prodname_actions %}](/actions/learn-github-actions/understanding-github-actions)”。
{% data variables.product.prodname_actions %} helps members of your enterprise automate software development workflows on {% data variables.product.product_name %}. For more information, see "[Understanding {% data variables.product.prodname_actions %}](/actions/learn-github-actions/understanding-github-actions)."
{% ifversion ghes %}如果启用 {% data variables.product.prodname_actions %},则 {% data variables.product.product_location %} 上的任何{% else %}任何{% endif %} 组织都可以使用 {% data variables.product.prodname_actions %}。 你可以强制实施策略来控制 {% data variables.product.product_name %} 上的企业成员如何使用 {% data variables.product.prodname_actions %}。 默认情况下,组织所有者可以管理成员使用 {% data variables.product.prodname_actions %} 的方式。 有关详细信息,请参阅“[为组织禁用或限制 {% data variables.product.prodname_actions %}](/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization)”。
{% ifversion ghes %}If you enable {% data variables.product.prodname_actions %}, any{% else %}Any{% endif %} organization on {% data variables.product.product_location %} can use {% data variables.product.prodname_actions %}. You can enforce policies to control how members of your enterprise on {% data variables.product.product_name %} use {% data variables.product.prodname_actions %}. By default, organization owners can manage how members use {% data variables.product.prodname_actions %}. For more information, see "[Disabling or limiting {% data variables.product.prodname_actions %} for your organization](/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization)."
## 强制实施策略以限制企业中 {% data variables.product.prodname_actions %} 的使用
## Enforcing a policy to restrict the use of {% data variables.product.prodname_actions %} in your enterprise
您可以选择对企业中的所有组织禁用 {% data variables.product.prodname_actions %},或只允许特定的组织。 还可以限制公共操作{% ifversion actions-workflow-policy %}和可重用工作流{% endif %}的使用,让用户只能使用企业中现有的本地操作{% ifversion actions-workflow-policy %}和可重用工作流{% endif %}。
You can choose to disable {% data variables.product.prodname_actions %} for all organizations in your enterprise, or only allow specific organizations. You can also limit the use of public actions {% ifversion actions-workflow-policy %}and reusable workflows{% endif %}, so that people can only use local actions {% ifversion actions-workflow-policy %}and reusable workflows{% endif %} that exist in your enterprise.
{% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %}
1. 在“Policies策略”下选择选项。
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.policies-tab %}
{% data reusables.enterprise-accounts.actions-tab %}
1. Under "Policies", select your options.
{% indented_data_reference reusables.actions.actions-use-policy-settings spaces=3 %}
{%- ifversion ghes or ghae %} {% note %}
{%- ifversion ghes or ghae %}
{% note %}
注意:若要启用对公共操作{% ifversion actions-workflow-policy %}和可重用工作流{% endif %}的访问,首先必须配置 {% data variables.product.product_location %},以连接到 {% data variables.product.prodname_dotcom_the_website %}。 有关详细信息,请参阅“[使用 GitHub Connect 启用对 GitHub.com 操作的自动访问](/admin/github-actions/enabling-automatic-access-to-githubcom-actions-using-github-connect)”。
**Note:** To enable access to public actions{% ifversion actions-workflow-policy %} and reusable workflows{% endif %}, you must first configure {% data variables.product.product_location %} to connect to {% data variables.product.prodname_dotcom_the_website %}. For more information, see "[Enabling automatic access to GitHub.com actions using GitHub Connect](/admin/github-actions/enabling-automatic-access-to-githubcom-actions-using-github-connect)."
{% endnote %} {%- endif %} {% ifversion actions-workflow-policy %}![启用、禁用或限制该企业帐户的操作](/assets/images/help/organizations/enterprise-actions-policy-with-workflows.png){%- else %}![启用、禁用或限制该企业帐户的操作](/assets/images/help/organizations/enterprise-actions-policy.png){%- endif %}
1. 单击“ **保存**”。
{% endnote %}
{%- endif %}
{% ifversion actions-workflow-policy %}
![Enable, disable, or limits actions for this enterprise account](/assets/images/help/organizations/enterprise-actions-policy-with-workflows.png)
{%- else %}
![Enable, disable, or limits actions for this enterprise account](/assets/images/help/organizations/enterprise-actions-policy.png)
{%- endif %}
1. Click **Save**.
{% data reusables.actions.allow-specific-actions-intro %}
{% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %}
1. 在“策略”下,选择 {% data reusables.actions.policy-label-for-select-actions-workflows %} 并向列表添加所需操作{% ifversion actions-workflow-policy %}和可重用工作流{% endif %}。
{% ifversion actions-workflow-policy %}![将操作和可重用工作流添加到允许列表](/assets/images/help/organizations/enterprise-actions-policy-allow-list-with-workflows.png){%- elsif ghes or ghae %}![将操作添加到允许列表](/assets/images/help/organizations/enterprise-actions-policy-allow-list.png){%- elsif ghae %}![将操作添加到允许列表](/assets/images/enterprise/github-ae/enterprise-actions-policy-allow-list.png){%- endif %}
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.policies-tab %}
{% data reusables.enterprise-accounts.actions-tab %}
1. Under "Policies", select {% data reusables.actions.policy-label-for-select-actions-workflows %} and add your required actions{% ifversion actions-workflow-policy %} and reusable workflows{% endif %} to the list.
{% ifversion actions-workflow-policy %}
![Add actions and reusable workflows to the allow list](/assets/images/help/organizations/enterprise-actions-policy-allow-list-with-workflows.png)
{%- elsif ghes or ghae %}
![Add actions to the allow list](/assets/images/help/organizations/enterprise-actions-policy-allow-list.png)
{%- elsif ghae %}
![Add actions to the allow list](/assets/images/enterprise/github-ae/enterprise-actions-policy-allow-list.png)
{%- endif %}
## 在企业中实施构件和日志保留策略
## Enforcing a policy for artifact and log retention in your enterprise
{% data variables.product.prodname_actions %} 可以存储构件和日志文件。 有关详细信息,请参阅“[下载工作流工件](/actions/managing-workflow-runs/downloading-workflow-artifacts)”。
{% data variables.product.prodname_actions %} can store artifact and log files. For more information, see "[Downloading workflow artifacts](/actions/managing-workflow-runs/downloading-workflow-artifacts)."
{% data reusables.actions.about-artifact-log-retention %}
{% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.actions.change-retention-period-for-artifacts-logs %}
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.policies-tab %}
{% data reusables.enterprise-accounts.actions-tab %}
{% data reusables.actions.change-retention-period-for-artifacts-logs %}
## 在企业中实施复刻拉取请求的策略
## Enforcing a policy for fork pull requests in your enterprise
您可以实施策略以控制当企业成员{% ifversion ghec %} 或外部协作者{% endif %}从复刻运行工作流程时 {% data variables.product.prodname_actions %} 对 {% data variables.product.product_location %} 的行为方式。
You can enforce policies to control how {% data variables.product.prodname_actions %} behaves for {% data variables.product.product_location %} when members of your enterprise{% ifversion ghec %} or outside collaborators{% endif %} run workflows from forks.
{% ifversion ghec %}
### 实施用于批准来自外部协作者的拉取请求的策略
### Enforcing a policy for approval of pull requests from outside collaborators
{% data reusables.actions.workflow-run-approve-public-fork %}
{% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.actions.workflows-from-public-fork-setting %}
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.policies-tab %}
{% data reusables.enterprise-accounts.actions-tab %}
{% data reusables.actions.workflows-from-public-fork-setting %}
{% data reusables.actions.workflow-run-approve-link %}
{% endif %}
### 在私有仓库中实施复刻拉取请求的策略
### Enforcing a policy for fork pull requests in private repositories
{% data reusables.actions.private-repository-forks-overview %}
如果为企业启用了某个策略,可以在单个组织或存储库中选择性禁用该策略。 如果为企业禁用了某个策略,则单个组织或存储库无法启用该策略。
If a policy is enabled for an enterprise, the policy can be selectively disabled in individual organizations or repositories. If a policy is disabled for an enterprise, individual organizations or repositories cannot enable it.
{% data reusables.actions.private-repository-forks-options %}
{% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.actions.private-repository-forks-configure %}
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.policies-tab %}
{% data reusables.enterprise-accounts.actions-tab %}
{% data reusables.actions.private-repository-forks-configure %}
{% ifversion ghec or ghes or ghae %}
## 在企业中实施工作流程权限策略
## Enforcing a policy for workflow permissions in your enterprise
{% data reusables.actions.workflow-permissions-intro %}
可以在企业、组织或存储库的设置中为 `GITHUB_TOKEN` 设置默认权限。 如果你在企业设置中选择受限制的选项作为默认值,这将防止在组织或存储库设置中选择更宽松的设置。
You can set the default permissions for the `GITHUB_TOKEN` in the settings for your enterprise, organizations, or repositories. If you choose a restricted option as the default in your enterprise settings, this prevents the more permissive setting being chosen in the organization or repository settings.
{% data reusables.actions.workflow-permissions-modifying %}
### 配置默认 `GITHUB_TOKEN` 权限
{% ifversion allow-actions-to-approve-pr-with-ent-repo %}默认情况下,当你创建新企业时,`GITHUB_TOKEN` 仅对 `contents` 范围具有读取权限。
{% endif %}
{% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %}
1. 在“工作流权限”下,选择是要让 `GITHUB_TOKEN` 对所有范围具有读写访问权限,还是仅对 `contents` 范围具有读取访问。
![为此企业设置 GITHUB_TOKENN 权限](/assets/images/help/settings/actions-workflow-permissions-enterprise{% ifversion allow-actions-to-approve-pr-with-ent-repo %}-with-pr-approval{% endif %}.png)
1. 单击“保存”以应用设置。
### Configuring the default `GITHUB_TOKEN` permissions
{% ifversion allow-actions-to-approve-pr-with-ent-repo %}
### 阻止 {% data variables.product.prodname_actions %} 创建或批准拉取请求
By default, when you create a new enterprise, `GITHUB_TOKEN` only has read access for the `contents` scope.
{% endif %}
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.policies-tab %}
{% data reusables.enterprise-accounts.actions-tab %}
1. Under "Workflow permissions", choose whether you want the `GITHUB_TOKEN` to have read and write access for all scopes, or just read access for the `contents` scope.
{% ifversion allow-actions-to-approve-pr-with-ent-repo %}
![Set GITHUB_TOKEN permissions for this enterprise](/assets/images/help/settings/actions-workflow-permissions-enterprise-with-pr-approval.png)
{% else %}
![Set GITHUB_TOKEN permissions for this enterprise](/assets/images/help/settings/actions-workflow-permissions-enterprise.png)
{% endif %}
1. Click **Save** to apply the settings.
{% ifversion allow-actions-to-approve-pr-with-ent-repo %}
### Preventing {% data variables.product.prodname_actions %} from creating or approving pull requests
{% data reusables.actions.workflow-pr-approval-permissions-intro %}
默认情况下,创建新的企业时,不允许工作流创建或批准拉取请求。
By default, when you create a new enterprise, workflows are not allowed to create or approve pull requests.
{% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %}
1. 在“工作流权限”下,使用“允许 GitHub Actions 创建和批准拉取请求”设置配置 `GITHUB_TOKEN` 是否可以创建和批准拉取请求。
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.policies-tab %}
{% data reusables.enterprise-accounts.actions-tab %}
1. Under "Workflow permissions", use the **Allow GitHub Actions to create and approve pull requests** setting to configure whether `GITHUB_TOKEN` can create and approve pull requests.
![为此企业设置 GITHUB_TOKENN 权限](/assets/images/help/settings/actions-workflow-permissions-enterprise-with-pr-approval.png)
1. 单击“保存”以应用设置。
![Set GITHUB_TOKEN permissions for this enterprise](/assets/images/help/settings/actions-workflow-permissions-enterprise-with-pr-approval.png)
1. Click **Save** to apply the settings.
{% endif %} {% endif %}
{% endif %}
{% endif %}
{% ifversion actions-cache-policy-apis %}
## 在企业中强制实施缓存存储策略
## Enforcing a policy for cache storage in your enterprise
{% data reusables.actions.cache-default-size %} {% data reusables.actions.cache-eviction-process %}
但是,可以设置企业策略来自定义每个存储库的默认总缓存大小,以及存储库允许的最大总缓存大小。 例如,你可能希望每个存储库的默认总缓存大小为 5 GB但也允许存储库管理员根据需要配置最大 15 GB 的总缓存大小。
However, you can set an enterprise policy to customize both the default total cache size for each repository, as well as the maximum total cache size allowed for a repository. For example, you might want the default total cache size for each repository to be 5 GB, but also allow repository administrators to configure a total cache size up to 15 GB if necessary.
对存储库具有管理员访问权限的人员可以将其存储库的总缓存大小设置为企业策略设置允许的最大缓存大小。
People with admin access to a repository can set a total cache size for their repository up to the maximum cache size allowed by the enterprise policy setting.
{% data variables.product.prodname_actions %} 缓存存储的策略设置目前只能使用 REST API 进行修改:
The policy settings for {% data variables.product.prodname_actions %} cache storage can currently only be modified using the REST API:
* 若要查看当前企业策略设置,请参阅“[获取企业的 GitHub Actions 缓存使用策略](/rest/actions/cache#get-github-actions-cache-usage-policy-for-an-enterprise)”。
* 若要更改企业策略设置,请参阅“[设置企业的 GitHub Actions 缓存使用策略](/rest/actions/cache#get-github-actions-cache-usage-policy-for-an-enterprise)”。
* To view the current enterprise policy settings, see "[Get GitHub Actions cache usage policy for an enterprise](/rest/actions/cache#get-github-actions-cache-usage-policy-for-an-enterprise)."
* To change the enterprise policy settings, see "[Set GitHub Actions cache usage policy for an enterprise](/rest/actions/cache#get-github-actions-cache-usage-policy-for-an-enterprise)."
{% data reusables.actions.cache-no-org-policy %}

Просмотреть файл

@ -108,9 +108,12 @@ If you allow members to create repositories in your organizations, you can choos
![Screenshot showing the list of disabled options from forking policy](/assets/images/help/business-accounts/restrict-personal-namespace-enabled-setting.png){% endif %}
## Enforcing a policy for forking private or internal repositories
Across all organizations owned by your enterprise, you can allow people with access to a private or internal repository to fork the repository, never allow forking of private or internal repositories, or allow owners to administer the setting on the organization level.
{% ifversion org-owners-limit-forks-creation %}
People with admin permissions can set a more granular forking policy. For more information, see "[Managing the forking policy for your organization](/organizations/managing-organization-settings/managing-the-forking-policy-for-your-organization)."
{% endif %}
{% ifversion enterprise-namespace-repo-setting %}
{% note %}
@ -122,8 +125,8 @@ Across all organizations owned by your enterprise, you can allow people with acc
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.policies-tab %}
{% data reusables.enterprise-accounts.repositories-tab %}
3. Under "Repository forking", review the information about changing the setting. {% data reusables.enterprise-accounts.view-current-policy-config-orgs %}
4. Under "Repository forking", use the drop-down menu and choose a policy.
1. Under "Repository forking", review the information about changing the setting. {% data reusables.enterprise-accounts.view-current-policy-config-orgs %}
2. Under "Repository forking", use the dropdown menu and choose a policy.
![Drop-down menu with repository forking policy options](/assets/images/help/business-accounts/repository-forking-policy-drop-down.png){% ifversion innersource-fork-policies %}
5. If forking is enabled, you can specify where users are allowed to fork repositories. Review the information about changing the setting and choose a policy.

Просмотреть файл

@ -331,6 +331,15 @@ By default, {% data variables.product.prodname_code_scanning %} expects one SARI
If you want to upload more than one set of results to the {% data variables.product.prodname_code_scanning %} API for a commit in a repository, you must identify each set of results as a unique set. For repositories where you create more than one {% data variables.product.prodname_codeql %} database to analyze for each commit, use the `--sarif-category` option to specify a language or other unique category for each SARIF file that you generate for that repository.
{% ifversion fpt or ghec or ghes > 3.7 or ghae > 3.7 %}
### Issues with Python extraction
We are deprecating Python 2 support for the {% data variables.product.prodname_codeql_cli %}, more specifically for the CodeQL database generation phase (code extraction).
If you use the {% data variables.product.prodname_codeql_cli %} to run {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %} on code written in Python, you must make sure that your CI system has Python 3 installed.
{% endif %}
## Further reading
- [Creating CodeQL databases](https://codeql.github.com/docs/codeql-cli/creating-codeql-databases/)

Просмотреть файл

@ -1,7 +1,7 @@
---
title: 在 CI 系统中安装 CodeQL CLI
title: Installing CodeQL CLI in your CI system
shortTitle: Install CodeQL CLI
intro: '您可以安装 {% data variables.product.prodname_codeql_cli %} 并用它在第三方持续集成系统中执行 {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %}。'
intro: 'You can install the {% data variables.product.prodname_codeql_cli %} and use it to perform {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %} in a third-party continuous integration system.'
product: '{% data reusables.gated-features.code-scanning %}'
miniTocMaxHeadingLevel: 3
versions:
@ -23,66 +23,69 @@ redirect_from:
- /code-security/secure-coding/running-codeql-cli-in-your-ci-system
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/running-codeql-cli-in-your-ci-system
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/installing-codeql-cli-in-your-ci-system
ms.openlocfilehash: 3d7c7dc3451b844b33fe0b14fd07f9a18ec81b10
ms.sourcegitcommit: 80842b4e4c500daa051eff0ccd7cde91c2d4bb36
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/11/2022
ms.locfileid: '147884540'
---
{% data reusables.code-scanning.enterprise-enable-code-scanning %}
## 关于将 {% data variables.product.prodname_codeql_cli %} 用于 {% data variables.product.prodname_code_scanning %}
## About using the {% data variables.product.prodname_codeql_cli %} for {% data variables.product.prodname_code_scanning %}
可以使用 {% data variables.product.prodname_codeql_cli %} 在第三方持续集成 (CI) 系统中处理的代码上运行 {% data variables.product.prodname_code_scanning %}。 {% data reusables.code-scanning.about-code-scanning %} 有关信息,请参阅“[关于使用 {% data variables.product.prodname_codeql %} 进行 {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-with-codeql)”。 有关运行 {% data variables.product.prodname_codeql %} 分析的建议规范RAM、CPU 核心和磁盘),请参阅“[用于运行 {% data variables.product.prodname_codeql %} 的建议硬件资源](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/recommended-hardware-resources-for-running-codeql)”。
You can use the {% data variables.product.prodname_codeql_cli %} to run {% data variables.product.prodname_code_scanning %} on code that you're processing in a third-party continuous integration (CI) system. {% data reusables.code-scanning.about-code-scanning %} For information, see "[About {% data variables.product.prodname_code_scanning %} with {% data variables.product.prodname_codeql %}](/code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-with-codeql)." For recommended specifications (RAM, CPU cores, and disk) for running {% data variables.product.prodname_codeql %} analysis, see "[Recommended hardware resources for running {% data variables.product.prodname_codeql %}](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/recommended-hardware-resources-for-running-codeql)."
{% data reusables.code-scanning.what-is-codeql-cli %}
您也可以使用 {% data variables.product.prodname_actions %} 在 {% data variables.product.product_name %} 中运行 {% data variables.product.prodname_code_scanning %}。 有关使用操作进行 {% data variables.product.prodname_code_scanning %} 的信息,请参阅“[为存储库设置 {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/setting-up-code-scanning-for-a-repository)”。 有关 CI 系统选项的概述,请参阅“[关于 CI 系统中的 CodeQL {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/about-codeql-code-scanning-in-your-ci-system)”。
Alternatively, you can use {% data variables.product.prodname_actions %} to run {% data variables.product.prodname_code_scanning %} within {% data variables.product.product_name %}. For information about {% data variables.product.prodname_code_scanning %} using actions, see "[Setting up {% data variables.product.prodname_code_scanning %} for a repository](/code-security/secure-coding/setting-up-code-scanning-for-a-repository)." For an overview of the options for CI systems, see "[About CodeQL {% data variables.product.prodname_code_scanning %} in your CI system](/code-security/secure-coding/about-codeql-code-scanning-in-your-ci-system)".
{% data reusables.code-scanning.licensing-note %}
## 下载 {% data variables.product.prodname_codeql_cli %}
## Downloading the {% data variables.product.prodname_codeql_cli %}
应从 https://github.com/github/codeql-action/releases 下载 {% data variables.product.prodname_codeql %} 包。 该捆绑包中包含:
You should download the {% data variables.product.prodname_codeql %} bundle from https://github.com/github/codeql-action/releases. The bundle contains:
- {% data variables.product.prodname_codeql_cli %} 产品
- 来自 https://github.com/github/codeql 的查询和库的兼容版本
- 捆绑包中包含的所有查询的预编译版本
- {% data variables.product.prodname_codeql_cli %} product
- A compatible version of the queries and libraries from https://github.com/github/codeql
- Precompiled versions of all the queries included in the bundle
{% ifversion ghes or ghae %}
{% note %} 对于 {% data variables.product.product_name %}{% ifversion ghes %} {{ allVersions[currentVersion].currentRelease }},{% endif %},我们建议使用 {% data variables.product.prodname_codeql_cli %} 版本 {% data variables.product.codeql_cli_ghes_recommended_version %}。
{% note %}
For {% data variables.product.product_name %}{% ifversion ghes %} {{ allVersions[currentVersion].currentRelease }}{% endif %}, we recommend {% data variables.product.prodname_codeql_cli %} version {% data variables.product.codeql_cli_ghes_recommended_version %}.
{% endnote %}
{% endif %}
您应该始终使用 {% data variables.product.prodname_codeql %} 包,因为这样可以确保兼容性,并且比单独下载 {% data variables.product.prodname_codeql_cli %} 和检出 {% data variables.product.prodname_codeql %} 查询提供更好的性能。 如果只在一个特定平台上运行 CLI请下载相应的 `codeql-bundle-PLATFORM.tar.gz` 文件。 此外,也可以下载包含所有受支持平台的 CLI 的 `codeql-bundle.tar.gz`
You should always use the {% data variables.product.prodname_codeql %} bundle as this ensures compatibility and also gives much better performance than a separate download of the {% data variables.product.prodname_codeql_cli %} and checkout of the {% data variables.product.prodname_codeql %} queries. If you will only be running the CLI on one specific platform, download the appropriate `codeql-bundle-PLATFORM.tar.gz` file. Alternatively, you can download `codeql-bundle.tar.gz`, which contains the CLI for all supported platforms.
{% data reusables.code-scanning.beta-codeql-packs-cli %}
## 在 CI 系统中设置 {% data variables.product.prodname_codeql_cli %}
## Setting up the {% data variables.product.prodname_codeql_cli %} in your CI system
您需要将 {% data variables.product.prodname_codeql_cli %} 包的全部内容提供给要运行 CodeQL {% data variables.product.prodname_code_scanning %} 分析的每个 CI 服务器。 例如,您可以配置每台服务器从中央内部位置复制包并提取它。 或者,您可以使用 REST API 直接从 {% data variables.product.prodname_dotcom %} 获取包,以确保您从查询的最新改进中受益。 {% data variables.product.prodname_codeql_cli %} 的更新每 2-3 周发布一次。 例如:
You need to make the full contents of the {% data variables.product.prodname_codeql_cli %} bundle available to every CI server that you want to run CodeQL {% data variables.product.prodname_code_scanning %} analysis on. For example, you might configure each server to copy the bundle from a central, internal location and extract it. Alternatively, you could use the REST API to get the bundle directly from {% data variables.product.prodname_dotcom %}, ensuring that you benefit from the latest improvements to queries. Updates to the {% data variables.product.prodname_codeql_cli %} are released every 2-3 weeks. For example:
```shell
$ wget https://{% ifversion fpt or ghec %}github.com{% else %}<em>HOSTNAME</em>{% endif %}/github/codeql-action/releases/latest/download/codeql-bundle-linux64.tar.gz
$ tar -xvzf ./codeql-bundle-linux64.tar.gz
```
提取 {% data variables.product.prodname_codeql_cli %} 包后,可以在服务器上运行 `codeql` 可执行文件:
After you extract the {% data variables.product.prodname_codeql_cli %} bundle, you can run the `codeql` executable on the server:
- 通过执行 `/<extraction-root>/codeql/codeql`,其中 `<extraction-root>` 是要在其中提取 {% data variables.product.prodname_codeql_cli %} 包的文件夹。
- 通过将 `/<extraction-root>/codeql` 添加到 `PATH`,这样就可以像 `codeql` 一样运行可执行文件。
- By executing `/<extraction-root>/codeql/codeql`, where `<extraction-root>` is the folder where you extracted the {% data variables.product.prodname_codeql_cli %} bundle.
- By adding `/<extraction-root>/codeql` to your `PATH`, so that you can run the executable as just `codeql`.
## 测试 {% data variables.product.prodname_codeql_cli %} 设置
{% ifversion fpt or ghec or ghes > 3.7 or ghae > 3.7 %}
{% note %}
提取 {% data variables.product.prodname_codeql_cli %} 包后,您可以运行以下命令来验证是否正确设置了 CLI 以创建和分析数据库。
If you use the {% data variables.product.prodname_codeql_cli %} to analyze code written in Python, you must make sure that your CI system has Python 3 installed.
- `codeql resolve qlpacks` 如果 `/<extraction-root>/codeql` 位于 `PATH`
- 否则为 `/<extraction-root>/codeql/codeql resolve qlpacks`
{% endnote %}
{% endif %}
从成功的输出提取:
## Testing the {% data variables.product.prodname_codeql_cli %} set up
After you extract the {% data variables.product.prodname_codeql_cli %} bundle, you can run the following command to verify that the CLI is correctly set up to create and analyze databases.
- `codeql resolve qlpacks` if `/<extraction-root>/codeql` is on the `PATH`.
- `/<extraction-root>/codeql/codeql resolve qlpacks` otherwise.
**Extract from successful output:**
```
codeql/cpp-all (/<extraction-root>/qlpacks/codeql/cpp-all/<version>)
codeql/cpp-examples (/<extraction-root>/qlpacks/codeql/cpp-examples/<version>)
@ -105,12 +108,12 @@ codeql/ruby-queries (/<extraction-root>/qlpacks/codeql/ruby-queries/<version>)
...
```
您应该检查输出是否包含预期的语言,以及 qlpack 文件的目录位置是否正确。 位置应在提取的 {% data variables.product.prodname_codeql_cli %} 包内,如上图所示为 `<extraction root>`,除非使用的是 `github/codeql` 的签出。 如果 {% data variables.product.prodname_codeql_cli %} 找不到预期语言的 qlpacks请检查您是否下载了 {% data variables.product.prodname_codeql %} 捆绑包,而不是 {% data variables.product.prodname_codeql_cli %} 的独立副本。
You should check that the output contains the expected languages and also that the directory location for the qlpack files is correct. The location should be within the extracted {% data variables.product.prodname_codeql_cli %} bundle, shown above as `<extraction root>`, unless you are using a checkout of `github/codeql`. If the {% data variables.product.prodname_codeql_cli %} is unable to locate the qlpacks for the expected languages, check that you downloaded the {% data variables.product.prodname_codeql %} bundle and not a standalone copy of the {% data variables.product.prodname_codeql_cli %}.
## 使用 {% data variables.product.product_name %} 生成用于身份验证的令牌
## Generating a token for authentication with {% data variables.product.product_name %}
每个 CI 服务器都需要 {% data variables.product.prodname_github_app %} 或用于 {% data variables.product.prodname_codeql_cli %} 的个人访问令牌,才能将结果上传到 {% data variables.product.product_name %}。 必须使用具有 `security_events` 写入权限的访问令牌或 {% data variables.product.prodname_github_app %}。 如果CI 服务器已使用具有此作用域的令牌从 {% data variables.product.product_name %} 检出仓库, 您可以允许 {% data variables.product.prodname_codeql_cli %} 使用相同的令牌。 否则,应创建具有 `security_events` 写入权限的新令牌,然后将其添加到 CI 系统的机密存储中。 有关信息,请参阅“[生成 {% data variables.product.prodname_github_apps %}](/developers/apps/building-github-apps)”和“[创建个人访问令牌](/github/authenticating-to-github/creating-a-personal-access-token)”。
Each CI server needs a {% data variables.product.prodname_github_app %} or personal access token for the {% data variables.product.prodname_codeql_cli %} to use to upload results to {% data variables.product.product_name %}. You must use an access token or a {% data variables.product.prodname_github_app %} with the `security_events` write permission. If CI servers already use a token with this scope to checkout repositories from {% data variables.product.product_name %}, you could potentially allow the {% data variables.product.prodname_codeql_cli %} to use the same token. Otherwise, you should create a new token with the `security_events` write permission and add this to the CI system's secret store. For information, see "[Building {% data variables.product.prodname_github_apps %}](/developers/apps/building-github-apps)" and "[Creating a personal access token](/github/authenticating-to-github/creating-a-personal-access-token)."
## 后续步骤
## Next steps
您现在可以配置 CI 系统运行 {% data variables.product.prodname_codeql %} 分析、生成结果并上传到 {% data variables.product.product_name %},在那里结果将匹配分支或拉取请求并显示为 {% data variables.product.prodname_code_scanning %} 警报。 有关详细信息,请参阅“[在 CI 系统中配置 {% data variables.product.prodname_codeql_cli %}](/code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/configuring-codeql-cli-in-your-ci-system)”。
You're now ready to configure the CI system to run {% data variables.product.prodname_codeql %} analysis, generate results, and upload them to {% data variables.product.product_name %} where the results will be matched to a branch or pull request and displayed as {% data variables.product.prodname_code_scanning %} alerts. For detailed information, see "[Configuring {% data variables.product.prodname_codeql_cli %} in your CI system](/code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/configuring-codeql-cli-in-your-ci-system)."

Просмотреть файл

@ -37,6 +37,7 @@ topics:
The {% data variables.product.prodname_dependabot_security_updates %} feature is available for repositories where you have enabled the dependency graph and {% data variables.product.prodname_dependabot_alerts %}. You will see a {% data variables.product.prodname_dependabot %} alert for every vulnerable dependency identified in your full dependency graph. However, security updates are triggered only for dependencies that are specified in a manifest or lock file. For more information, see "[About the dependency graph](/github/visualizing-repository-data-with-graphs/about-the-dependency-graph#dependencies-included)."
{% ifversion dependabot-security-updates-unlock-transitive-dependencies %}
{% note %}
**Note**: For npm, {% data variables.product.prodname_dependabot %} will raise a pull request to update an explicitly defined dependency to a secure version, even if it means updating the parent dependency or dependencies{% ifversion dependabot-security-updates-npm %}, or even removing a sub-dependency that is no longer needed by the parent{% endif %}. For other ecosystems, {% data variables.product.prodname_dependabot %} is unable to update an indirect or transitive dependency if it would also require an update to the parent dependency. For more information, see "[Dependabot tries to update dependencies without an alert](/en/code-security/dependabot/working-with-dependabot/troubleshooting-dependabot-errors#dependabot-tries-to-update-dependencies-without-an-alert)."
@ -47,6 +48,8 @@ You can enable a related feature, {% data variables.product.prodname_dependabot_
{% data reusables.dependabot.pull-request-security-vs-version-updates %}
{% data reusables.dependabot.dependabot-updates-and-actions %}
## About pull requests for security updates
Each pull request contains everything you need to quickly and safely review and merge a proposed fix into your project. This includes information about the vulnerability like release notes, changelog entries, and commit details. Details of which vulnerability a pull request resolves are hidden from anyone who does not have access to {% data variables.product.prodname_dependabot_alerts %} for the repository.

Просмотреть файл

@ -1,6 +1,6 @@
---
title: 关于 Dependabot 版本更新
intro: '您可以使用 {% data variables.product.prodname_dependabot %} 来确保您使用的包更新到最新版本。'
title: About Dependabot version updates
intro: 'You can use {% data variables.product.prodname_dependabot %} to keep the packages you use updated to the latest versions.'
redirect_from:
- /github/administering-a-repository/about-dependabot
- /github/administering-a-repository/about-github-dependabot
@ -21,53 +21,51 @@ topics:
- Dependencies
- Pull requests
shortTitle: Dependabot version updates
ms.openlocfilehash: 56bac2fbf2fb42a418cffbd478aa526803b124d9
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '145186082'
---
{% data reusables.dependabot.beta-security-and-version-updates %} {% data reusables.dependabot.enterprise-enable-dependabot %}
## 关于 {% data variables.product.prodname_dependabot_version_updates %}
{% data reusables.dependabot.beta-security-and-version-updates %}
{% data reusables.dependabot.enterprise-enable-dependabot %}
{% data variables.product.prodname_dependabot %} 负责维护您的依赖项。 您可以使用它来确保仓库自动跟上它所依赖的包和应用程序的最新版本。
## About {% data variables.product.prodname_dependabot_version_updates %}
通过将 `dependabot.yml` 配置文件签入存储库,可启用 {% data variables.product.prodname_dependabot_version_updates %}。 配置文件指定存储在仓库中的清单或其他包定义文件的位置。 {% data variables.product.prodname_dependabot %} 使用此信息检查过时的包和应用程序。 {% data variables.product.prodname_dependabot %} 通过查看依赖项的语义版本控制 ([semver](https://semver.org/)) 来确定是否存在新版本的依赖项,从而决定它是否应该更新到该版本。 对于某些软件包管理器,{% data variables.product.prodname_dependabot_version_updates %} 也支持供应。 供应(或缓存)的依赖项是检入仓库中特定目录的依赖项,而不是在清单中引用的依赖项。 即使包服务器不可用,供应的依赖项在生成时也可用。 {% data variables.product.prodname_dependabot_version_updates %} 可以配置为检查为新版本供应的依赖项,并在必要时更新它们。
{% data variables.product.prodname_dependabot %} takes the effort out of maintaining your dependencies. You can use it to ensure that your repository automatically keeps up with the latest releases of the packages and applications it depends on.
当 {% data variables.product.prodname_dependabot %} 发现过时的依赖项时,它将引发一个拉取请求,用于将清单更新到依赖项的最新版本。 对于供应和依赖项,{% data variables.product.prodname_dependabot %} 提出拉取请求以直接将过时的依赖项替换为新版本。 检查测试是否通过,查看拉取请求摘要中包含的更改日志和发行说明,然后合并它。 有关详细信息,请参阅“[配置 {% data variables.product.prodname_dependabot %} 版本更新](/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/enabling-and-disabling-dependabot-version-updates)”。
You enable {% data variables.product.prodname_dependabot_version_updates %} by checking a `dependabot.yml` configuration file into your repository. The configuration file specifies the location of the manifest, or of other package definition files, stored in your repository. {% data variables.product.prodname_dependabot %} uses this information to check for outdated packages and applications. {% data variables.product.prodname_dependabot %} determines if there is a new version of a dependency by looking at the semantic versioning ([semver](https://semver.org/)) of the dependency to decide whether it should update to that version. For certain package managers, {% data variables.product.prodname_dependabot_version_updates %} also supports vendoring. Vendored (or cached) dependencies are dependencies that are checked in to a specific directory in a repository rather than referenced in a manifest. Vendored dependencies are available at build time even if package servers are unavailable. {% data variables.product.prodname_dependabot_version_updates %} can be configured to check vendored dependencies for new versions and update them if necessary.
如果启用“安全更新”,{% data variables.product.prodname_dependabot %} 还将引发用于更新易受攻击的依赖项的拉取请求。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_security_updates %}](/github/managing-security-vulnerabilities/about-dependabot-security-updates)”。
When {% data variables.product.prodname_dependabot %} identifies an outdated dependency, it raises a pull request to update the manifest to the latest version of the dependency. For vendored dependencies, {% data variables.product.prodname_dependabot %} raises a pull request to replace the outdated dependency with the new version directly. You check that your tests pass, review the changelog and release notes included in the pull request summary, and then merge it. For more information, see "[Configuring {% data variables.product.prodname_dependabot %} version updates](/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/enabling-and-disabling-dependabot-version-updates)."
If you enable _security updates_, {% data variables.product.prodname_dependabot %} also raises pull requests to update vulnerable dependencies. For more information, see "[About {% data variables.product.prodname_dependabot_security_updates %}](/github/managing-security-vulnerabilities/about-dependabot-security-updates)."
{% data reusables.dependabot.pull-request-security-vs-version-updates %}
{% data reusables.dependabot.dependabot-updates-and-actions %}
{% data reusables.dependabot.dependabot-tos %}
## {% data variables.product.prodname_dependabot %} 拉取请求的频率
## Frequency of {% data variables.product.prodname_dependabot %} pull requests
在配置文件中指定检查每个生态系统的新版本的频率:每日、每周或每月。
You specify how often to check each ecosystem for new versions in the configuration file: daily, weekly, or monthly.
{% data reusables.dependabot.initial-updates %}
如果您启用了安全更新,有时会看到额外的安全更新拉取请求。 这些请求是由依赖于默认分支的 {% data variables.product.prodname_dependabot %} 警报触发的。 {% data variables.product.prodname_dependabot %} 自动提出拉取请求以更新有漏洞的依赖项。
If you've enabled security updates, you'll sometimes see extra pull requests for security updates. These are triggered by a {% data variables.product.prodname_dependabot %} alert for a dependency on your default branch. {% data variables.product.prodname_dependabot %} automatically raises a pull request to update the vulnerable dependency.
## 支持的仓库和生态系统
## Supported repositories and ecosystems
<!-- If you make changes to this feature, check whether any of the changes affect languages listed in /get-started/learning-about-github/github-language-support. If so, please update the language support article accordingly. -->
您可以为包含其中一个受支持包管理器的依赖项清单或锁定文件的仓库配置版本更新。 对于某些软件包管理器,您也可以配置依赖项的供应。 有关详细信息,请参阅“[dependabot.yml 文件的配置选项](/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#vendor)”。
You can configure version updates for repositories that contain a dependency manifest or lock file for one of the supported package managers. For some package managers, you can also configure vendoring for dependencies. For more information, see "[Configuration options for the dependabot.yml file](/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#vendor)."
{% note %}
{% data reusables.dependabot.private-dependencies-note %}
{% data variables.product.prodname_dependabot %} 不支持所有包管理器的私有 {% data variables.product.prodname_dotcom %} 依赖项。 详见下表。
{% data variables.product.prodname_dependabot %} doesn't support private {% data variables.product.prodname_dotcom %} dependencies for all package managers. See the details in the table below.
{% endnote %}
{% data reusables.dependabot.supported-package-managers %}
如果您的仓库已使用集成进行依赖项管理,则在启用 {% data variables.product.prodname_dependabot %} 前需要禁用此集成。 {% ifversion fpt or ghec %} 有关详细信息,请参阅“[关于集成](/github/customizing-your-github-workflow/about-integrations)”。{% endif %}
If your repository already uses an integration for dependency management, you will need to disable this before enabling {% data variables.product.prodname_dependabot %}. {% ifversion fpt or ghec %}For more information, see "[About integrations](/github/customizing-your-github-workflow/about-integrations)."{% endif %}
## 关于 {% data variables.product.prodname_dependabot %} 版本更新通知
## About notifications for {% data variables.product.prodname_dependabot %} version updates
您可以按 {% data variables.product.company_short %} 筛选通知,以显示由 {% data variables.product.prodname_dependabot %}创建的拉取请求的通知。 有关详细信息,请参阅“[管理收件箱中的通知](/github/managing-subscriptions-and-notifications-on-github/managing-notifications-from-your-inbox)”。
You can filter your notifications on {% data variables.product.company_short %} to show notifications for pull requests created by {% data variables.product.prodname_dependabot %}. For more information, see "[Managing notifications from your inbox](/github/managing-subscriptions-and-notifications-on-github/managing-notifications-from-your-inbox)."

Просмотреть файл

@ -33,14 +33,14 @@ shortTitle: Manage secret alerts
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.sidebar-security %}
1. In the left sidebar, click **Secret scanning alerts**.
{% ifversion fpt or ghes or ghec %}
{% ifversion ghes or ghec %}
!["Secret scanning alerts" tab](/assets/images/help/repository/sidebar-secrets.png)
{% endif %}
{% ifversion ghae %}
!["Secret scanning alerts" tab](/assets/images/enterprise/github-ae/repository/sidebar-secrets-ghae.png)
{% endif %}
1. Under "Secret scanning" click the alert you want to view.
{% ifversion fpt or ghec %}
{% ifversion ghec %}
![List of alerts from secret scanning](/assets/images/help/repository/secret-scanning-click-alert.png)
{% endif %}
{% ifversion ghes %}
@ -48,14 +48,21 @@ shortTitle: Manage secret alerts
{% endif %}
{% ifversion ghae %}
![List of alerts from secret scanning](/assets/images/enterprise/github-ae/repository/secret-scanning-click-alert-ghae.png)
{% endif %}
1. Optionally, select the {% ifversion fpt or ghec %}"Close as"{% elsif ghes or ghae %}"Mark as"{% endif %} drop-down menu and click a reason for resolving an alert.
{% ifversion fpt or ghec %}
![Drop-down menu for resolving an alert from secret scanning](/assets/images/help/repository/secret-scanning-resolve-alert.png)
{% endif %}
{% ifversion ghes or ghae %}
![Drop-down menu for resolving an alert from secret scanning](/assets/images/help/repository/secret-scanning-resolve-alert-ghe.png)
{% endif %}
{% endif %}{% ifversion secret-scanning-dismissal-comment %}
1. To dismiss an alert, select the "Dismiss alert" dropdown menu and click a reason for resolving an alert.
![Screenshot of the dropdown menu for dismissing an alert from secret scanning](/assets/images/help/repository/secret-scanning-dismiss-alert.png){% else %}
1. To dismiss an alert, select the "Mark as" dropdown menu and click a reason for resolving an alert.
![Screenshot of the dropdown menu for resolving an alert from secret scanning](/assets/images/enterprise/3.2/repository/secret-scanning-resolve-alert-ghe.png)
{% endif %}{% ifversion secret-scanning-dismissal-comment %}
1. Optionally, add a dismissal comment. The dismissal comment will be added to the alert timeline and can be used as justification during auditing and reporting. You can view the history of all dismissed alerts and dismissal comments in the alert timeline. You can also retrieve or set a comment by using the {% data variables.product.prodname_secret_scanning_caps %} API. The comment is contained in the `resolution_comment` field. For more information, see "[{% data variables.product.prodname_secret_scanning_caps %}](/rest/secret-scanning#update-a-secret-scanning-alert)" in the REST API documentation.
![Screenshot showing how to dismiss an alert via the "Dismiss alert" dropdown, with the option to add a dismissal comment](/assets/images/help/repository/secret-scanning-dismissal-comment.png)
1. Click **Dismiss alert**.
{% endif %}
## Securing compromised secrets

Просмотреть файл

@ -1,6 +1,6 @@
---
title: 关于供应链安全性
intro: '{% data variables.product.product_name %} 有助于保护供应链,通过从了解环境中的依赖项到了解这些依赖项中的漏洞{% ifversion fpt or ghec or ghes > 3.2 %}并修补它们{% endif %}得以实现。'
title: About supply chain security
intro: '{% data variables.product.product_name %} helps you secure your supply chain, from understanding the dependencies in your environment, to knowing about vulnerabilities in those dependencies{% ifversion fpt or ghec or ghes > 3.2 %}, and patching them{% endif %}.'
miniTocMaxHeadingLevel: 3
shortTitle: Supply chain security
redirect_from:
@ -19,136 +19,154 @@ topics:
- Dependencies
- Pull requests
- Repositories
ms.openlocfilehash: 2ad16960d0445994d5414390a62e16d719a10e6c
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147064888'
---
## 关于 GitHub 上的供应链安全性
随着开放源代码的加速使用,大多数项目都依赖于数百个开源依赖项。 这就带来了一个安全问题:如果你正在使用的依赖项有漏洞,该怎么办? 你可能会使用户面临供应链攻击的风险。 保护供应链最重要的操作之一就是修补易受攻击的依赖项{% ifversion GH-advisory-db-supports-malware %}并替换任何恶意软件{% endif %}。
## About supply chain security at GitHub
当你在清单文件或锁定文件中指定依赖项时,可以直接将它们添加到供应链。 依赖项也可以通过可传递方式包含在内,也就是说,即使你没有指定某个特定的依赖项,但你的某个依赖项使用了它,那么你也会依赖于该依赖项。
With the accelerated use of open source, most projects depend on hundreds of open-source dependencies. This poses a security problem: what if the dependencies you're using are vulnerable? You could be putting your users at risk of a supply chain attack. One of the most important things you can do to protect your supply chain is to patch your vulnerable dependencies{% ifversion GH-advisory-db-supports-malware %} and replace any malware{% endif %}.
{% data variables.product.product_name %} 提供了一系列功能,可帮助你了解环境中的依赖项{% ifversion ghes < 3.3 or ghae %}并了解这些依赖项中的漏洞{% endif %}{% ifversion fpt or ghec or ghes > 3.2 %},了解这些依赖项中的漏洞并进行修补{% endif %}。
You add dependencies directly to your supply chain when you specify them in a manifest file or a lockfile. Dependencies can also be included transitively, that is, even if you dont specify a particular dependency, but a dependency of yours uses it, then youre also dependent on that dependency.
{% data variables.product.product_name %} 上的供应链功能包括:
- **依赖项关系图**
- **依赖项审查**
- **{% data variables.product.prodname_dependabot_alerts %} ** {% ifversion fpt or ghec or ghes > 3.2 %}- {% data variables.product.prodname_dependabot_updates %}
- {% data variables.product.prodname_dependabot_security_updates %}
- {% data variables.product.prodname_dependabot_version_updates %}{% endif %}
{% data variables.product.product_name %} offers a range of features to help you understand the dependencies in your environment{% ifversion ghes < 3.3 or ghae %} and know about vulnerabilities in those dependencies{% endif %}{% ifversion fpt or ghec or ghes > 3.2 %}, know about vulnerabilities in those dependencies, and patch them{% endif %}.
依赖项关系图是供应链安全性的核心。 依赖项关系图标识了存储库或包的所有上游依赖项和公共下游依赖项。 你可以在存储库的依赖项关系图上看到存储库的依赖项和它们的一些属性,例如漏洞信息。
The supply chain features on {% data variables.product.product_name %} are:
- **Dependency graph**
- **Dependency review**
- **{% data variables.product.prodname_dependabot_alerts %} **
{% ifversion fpt or ghec or ghes > 3.2 %}- **{% data variables.product.prodname_dependabot_updates %}**
- **{% data variables.product.prodname_dependabot_security_updates %}**
- **{% data variables.product.prodname_dependabot_version_updates %}**{% endif %}
{% data variables.product.prodname_dotcom %} 上的其他供应链功能依赖于依赖项关系图提供的信息。
The dependency graph is central to supply chain security. The dependency graph identifies all upstream dependencies and public downstream dependents of a repository or package. You can see your repositorys dependencies and some of their properties, like vulnerability information, on the dependency graph for the repository.
- 依赖项审查使用依赖项关系图来标识依赖项更改,在你审查拉取请求时,可帮助你了解这些更改的安全影响。
- {% data variables.product.prodname_dependabot %} 通过 {% data variables.product.prodname_advisory_database %} 中发布的公告列表交叉引用依赖项关系图提供的依赖项数据,扫描依赖项并在检测到潜在漏洞{% ifversion GH-advisory-db-supports-malware %}或恶意软件{% endif %}时生成 {% data variables.product.prodname_dependabot_alerts %}。
{% ifversion fpt or ghec or ghes > 3.2 %}- {% data variables.product.prodname_dependabot_security_updates %}通过依赖项关系图和 {% data variables.product.prodname_dependabot_alerts %}来帮助你更新存储库中有已知漏洞的依赖项。
Other supply chain features on {% data variables.product.prodname_dotcom %} rely on the information provided by the dependency graph.
{% data variables.product.prodname_dependabot_version_updates %}不使用依赖项关系图,而是依赖于依赖项的语义版本控制。 {% data variables.product.prodname_dependabot_version_updates %}可帮助你使依赖项保持最新,即使它们没有任何漏洞。
- Dependency review uses the dependency graph to identify dependency changes and help you understand the security impact of these changes when you review pull requests.
- {% data variables.product.prodname_dependabot %} cross-references dependency data provided by the dependency graph with the list of advisories published in the {% data variables.product.prodname_advisory_database %}, scans your dependencies and generates {% data variables.product.prodname_dependabot_alerts %} when a potential vulnerability {% ifversion GH-advisory-db-supports-malware %}or malware{% endif %} is detected.
{% ifversion fpt or ghec or ghes > 3.2 %}- {% data variables.product.prodname_dependabot_security_updates %} use the dependency graph and {% data variables.product.prodname_dependabot_alerts %} to help you update dependencies with known vulnerabilities in your repository.
{% data variables.product.prodname_dependabot_version_updates %} don't use the dependency graph and rely on the semantic versioning of dependencies instead. {% data variables.product.prodname_dependabot_version_updates %} help you keep your dependencies updated, even when they dont have any vulnerabilities.
{% endif %}
{% ifversion fpt or ghec or ghes %} 有关端到端供应链安全性的最佳做法指南,包括如何保护个人帐户、代码和生成流程,请参阅“[保护端到端供应链](/code-security/supply-chain-security/end-to-end-supply-chain/end-to-end-supply-chain-overview)”。
{% ifversion fpt or ghec or ghes %}
For best practice guides on end-to-end supply chain security including the protection of personal accounts, code, and build processes, see "[Securing your end-to-end supply chain](/code-security/supply-chain-security/end-to-end-supply-chain/end-to-end-supply-chain-overview)."
{% endif %}
## 功能概述
## Feature overview
### 什么是依赖项关系图
### What is the dependency graph
为了生成依赖项关系图,{% data variables.product.company_short %} 会查看清单和锁定文件中声明的存储库显式依赖项。 启用后,依赖项关系图会自动分析存储库中的所有已知包清单文件,并以此来构造一个包含已知依赖项名称和版本的关系图。
To generate the dependency graph, {% data variables.product.company_short %} looks at a repositorys explicit dependencies declared in the manifest and lockfiles. When enabled, the dependency graph automatically parses all known package manifest files in the repository, and uses this to construct a graph with known dependency names and versions.
- 依赖项关系图包含有关直接依赖项和可传递依赖项的信息。
- 当你将提交推送到 {% data variables.product.company_short %} 以更改受支持的清单或锁定文件或者将其添加到默认分支时,以及当任何人将更改推送到某个依赖项的存储库时,依赖项关系图会自动更新。
- 可以通过打开 {% data variables.product.product_name %} 上的存储库主页,并导航到“见解”选项卡来查看依赖项关系图。
- The dependency graph includes information on your _direct_ dependencies and _transitive_ dependencies.
- The dependency graph is automatically updated when you push a commit to {% data variables.product.company_short %} that changes or adds a supported manifest or lock file to the default branch, and when anyone pushes a change to the repository of one of your dependencies.
- You can see the dependency graph by opening the repository's main page on {% data variables.product.product_name %}, and navigating to the **Insights** tab.
{% ifversion dependency-submission-api %} {% data reusables.dependency-submission.dependency-submission-link %} {% endif %}
有关依赖项关系图的详细信息,请参阅“[关于依赖项关系图](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph)”。
### 什么是依赖项审查
依赖项审查可帮助审阅者和参与者了解每个拉取请求中的依赖项更改及其安全性影响。
- 依赖项审查会在拉取请求中告知你已经添加、移除或更新了哪些依赖项。 你可以使用发布日期、依赖项的受欢迎程度和漏洞信息来帮助决定是否接受更改。
- 可以通过在“已更改的文件”选项卡上显示多差异来查看拉取请求的依赖项审查。
有关依赖项审查的详细信息,请参阅“[关于依赖项审查](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review)”。
### 什么是 Dependabot
{% data variables.product.prodname_dependabot %} 通过告知你的依赖项中的任何安全漏洞使依赖项保持最新{% ifversion fpt or ghec or ghes > 3.2 or ghae %},并自动提交拉取请求,以便在触发 {% data variables.product.prodname_dependabot %} 警报时将依赖项升级到下一个可用的安全版本,或者在版本发布时将依赖项升级到最新版本,{% else %}这样你就可以更新该依赖项{% endif %}。
{% ifversion fpt or ghec or ghes > 3.2 %}术语“{% data variables.product.prodname_dependabot %}”包含了以下功能:
- {% data variables.product.prodname_dependabot_alerts %} - 在存储库的“安全性”选项卡上以及存储库的依赖项关系图中显示通知。 该警报包括指向项目中受影响的文件的链接,以及有关修复的版本的信息。
- {% data variables.product.prodname_dependabot_updates %}
- {% data variables.product.prodname_dependabot_security_updates %} - 触发更新以在触发警报时将依赖项升级到安全版本。
- {% data variables.product.prodname_dependabot_version_updates %} - 计划更新以使依赖项始终是最新版本。
{% ifversion dependency-submission-api %}
{% data reusables.dependency-submission.dependency-submission-link %}
{% endif %}
#### 什么是 Dependabot 警报
For more information about the dependency graph, see "[About the dependency graph](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph)."
{% data variables.product.prodname_dependabot_alerts %} 基于依赖项关系图和 {% data variables.product.prodname_advisory_database %} 突出显示了受新发现的漏洞影响的存储库,其中包含已知漏洞{% ifversion GH-advisory-db-supports-malware %}和恶意软件{% endif %}的公告。
### What is dependency review
- {% data variables.product.prodname_dependabot %} 执行扫描以检测不安全的依赖项,并在以下情况下发送 {% data variables.product.prodname_dependabot_alerts %}{% ifversion fpt or ghec %}
- 新公告添加到 {% data variables.product.prodname_advisory_database %}。{% else %}
- 新公告数据每小时从 {% data variables.product.prodname_dotcom_the_website %} 同步到 {% data variables.product.product_location %}。 {% data reusables.security-advisory.link-browsing-advisory-db %}{% endif %}
- 存储库的依赖关系图发生更改。
- {% data variables.product.prodname_dependabot_alerts %} 显示在{% ifversion fpt or ghec or ghes %}存储库的“安全性”选项卡上,以及{% endif %}存储库的依赖项关系图中。 警报包括项目中受影响文件的{% ifversion fpt or ghec or ghes %}链接,以及{% endif %}有关已修复的版本的信息。
Dependency review helps reviewers and contributors understand dependency changes and their security impact in every pull request.
有关详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-alerts-for-vulnerable-dependencies)”。
- Dependency review tells you which dependencies were added, removed, or updated, in a pull request. You can use the release dates, popularity of dependencies, and vulnerability information to help you decide whether to accept the change.
- You can see the dependency review for a pull request by showing the rich diff on the **Files Changed** tab.
For more information about dependency review, see "[About dependency review](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review)."
### What is Dependabot
{% data variables.product.prodname_dependabot %} keeps your dependencies up to date by informing you of any security vulnerabilities in your dependencies{% ifversion fpt or ghec or ghes > 3.2 %}, and automatically opens pull requests to upgrade your dependencies to the next available secure version when a {% data variables.product.prodname_dependabot %} alert is triggered, or to the latest version when a release is published{% else %} so that you can update that dependency{% endif %}.
{% ifversion fpt or ghec or ghes > 3.2 %}
#### 什么是 Dependabot 更新
The term "{% data variables.product.prodname_dependabot %}" encompasses the following features:
- {% data variables.product.prodname_dependabot_alerts %}—Displayed notification on the **Security** tab for the repository, and in the repository's dependency graph. The alert includes a link to the affected file in the project, and information about a fixed version.
- {% data variables.product.prodname_dependabot_updates %}:
- {% data variables.product.prodname_dependabot_security_updates %}—Triggered updates to upgrade your dependencies to a secure version when an alert is triggered.
- {% data variables.product.prodname_dependabot_version_updates %}—Scheduled updates to keep your dependencies up to date with the latest version.
有两种类型的 {% data variables.product.prodname_dependabot_updates %}{% data variables.product.prodname_dependabot %}安全更新和版本更新。 {% data variables.product.prodname_dependabot %} 会生成自动拉取请求以在这两种情况下更新依赖项,但存在一些差异。
{% data variables.product.prodname_dependabot_security_updates %}
- 由 {% data variables.product.prodname_dependabot %} 警报触发
- 将依赖项更新到可修复已知漏洞的最低版本
- 支持用于依赖项关系图支持的生态系统
- 不需要配置文件,但可使用配置文件来替代默认行为
{% data variables.product.prodname_dependabot_version_updates %}
- 需要配置文件
- 按配置的计划运行
- 将依赖项更新到与配置匹配的最新版本
- 支持用于不同类别的生态系统
有关 {% data variables.product.prodname_dependabot_updates %}的详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_security_updates %}](/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-dependabot-security-updates)”和“[关于 {% data variables.product.prodname_dependabot_version_updates %}](/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates)”。
{% endif %}
## 功能可用性
{% ifversion fpt or ghec %}
公共存储库:
- 依赖项关系图 - 默认已启用,不能禁用。
- 依赖项审查 - 默认已启用,不能禁用。
- {% data variables.product.prodname_dependabot_alerts %} - 默认未启用。 {% data variables.product.prodname_dotcom %} 检测不安全的依赖项,并在依赖项关系图中显示信息,但默认情况下不会生成 {% data variables.product.prodname_dependabot_alerts %}。 存储库所有者或具有管理员访问权限的人员可以启用 {% data variables.product.prodname_dependabot_alerts %}。
你也可以为用户帐户或组织拥有的所有存储库启用或禁用 Dependabot 警报。 有关详细信息,请参阅“[管理用户帐户的安全和分析设置](/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-personal-account-settings/managing-security-and-analysis-settings-for-your-personal-account)”或“[管理组织的安全和分析设置](/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-security-and-analysis-settings-for-your-organization)”。
{% data variables.product.prodname_dependabot_alerts %}, {% data variables.product.prodname_dependabot_security_updates %}, and {% data variables.product.prodname_dependabot_version_updates %} do not use {% data variables.product.prodname_actions %} when they run on {% data variables.product.product_name %}. However, pull requests opened by {% data variables.product.prodname_dependabot %} can trigger workflows that run actions. For more information, see "[Automating {% data variables.product.prodname_dependabot %} with {% data variables.product.prodname_actions %}](/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions)."
专用存储库:
- 依赖项关系图 - 默认未启用。 存储库管理员可以启用该功能。 有关详细信息,请参阅“[探索存储库的依赖项](/code-security/supply-chain-security/understanding-your-software-supply-chain/exploring-the-dependencies-of-a-repository#enabling-and-disabling-the-dependency-graph-for-a-private-repository)”。
{% elsif ghes %}
{% data variables.product.prodname_dependabot_security_updates %} and {% data variables.product.prodname_dependabot_version_updates %} require {% data variables.product.prodname_actions %} to run on {% data variables.product.product_name %}. {% data variables.product.prodname_dependabot_alerts %} do not require {% data variables.product.prodname_actions %}. For more information, see "[Enabling {% data variables.product.prodname_dependabot %} for your enterprise](/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise)."
{% elsif ghae %}
{% data variables.product.prodname_actions %} is not required for {% data variables.product.prodname_dependabot_alerts %} to run on {% data variables.product.product_name %}.
{% endif %}
#### What are Dependabot alerts
{% data variables.product.prodname_dependabot_alerts %} highlight repositories affected by a newly discovered vulnerability based on the dependency graph and the {% data variables.product.prodname_advisory_database %}, which contains advisories for known vulnerabilities{% ifversion GH-advisory-db-supports-malware %} and malware{% endif %}.
- {% data variables.product.prodname_dependabot %} performs a scan to detect insecure dependencies and sends {% data variables.product.prodname_dependabot_alerts %} when:
{% ifversion fpt or ghec %}
- A new advisory is added to the {% data variables.product.prodname_advisory_database %}.{% else %}
- New advisory data is synchronized to {% data variables.product.product_location %} each hour from {% data variables.product.prodname_dotcom_the_website %}. {% data reusables.security-advisory.link-browsing-advisory-db %}{% endif %}
- The dependency graph for the repository changes.
- {% data variables.product.prodname_dependabot_alerts %} are displayed {% ifversion fpt or ghec or ghes %} on the **Security** tab for the repository and{% endif %} in the repository's dependency graph. The alert includes {% ifversion fpt or ghec or ghes %}a link to the affected file in the project, and {% endif %}information about a fixed version.
For more information, see "[About {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-alerts-for-vulnerable-dependencies)."
{% ifversion fpt or ghec or ghes > 3.2 %}
#### What are Dependabot updates
There are two types of {% data variables.product.prodname_dependabot_updates %}: {% data variables.product.prodname_dependabot %} _security_ updates and _version_ updates. {% data variables.product.prodname_dependabot %} generates automatic pull requests to update your dependencies in both cases, but there are several differences.
{% data variables.product.prodname_dependabot_security_updates %}:
- Triggered by a {% data variables.product.prodname_dependabot %} alert
- Update dependencies to the minimum version that resolves a known vulnerability
- Supported for ecosystems the dependency graph supports
- Does not require a configuration file, but you can use one to override the default behavior
{% data variables.product.prodname_dependabot_version_updates %}:
- Requires a configuration file
- Run on a schedule you configure
- Update dependencies to the latest version that matches the configuration
- Supported for a different group of ecosystems
For more information about {% data variables.product.prodname_dependabot_updates %}, see "[About {% data variables.product.prodname_dependabot_security_updates %}](/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-dependabot-security-updates)" and "[About {% data variables.product.prodname_dependabot_version_updates %}](/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates)."
{% endif %}
## Feature availability
{% ifversion fpt or ghec %}
Public repositories:
- **Dependency graph**—enabled by default and cannot be disabled.
- **Dependency review**—enabled by default and cannot be disabled.
- **{% data variables.product.prodname_dependabot_alerts %}**—not enabled by default. {% data variables.product.prodname_dotcom %} detects insecure dependencies and displays information in the dependency graph, but does not generate {% data variables.product.prodname_dependabot_alerts %} by default. Repository owners or people with admin access can enable {% data variables.product.prodname_dependabot_alerts %}.
You can also enable or disable Dependabot alerts for all repositories owned by your user account or organization. For more information, see "[Managing security and analysis settings for your user account](/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-personal-account-settings/managing-security-and-analysis-settings-for-your-personal-account)" or "[Managing security and analysis settings for your organization](/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-security-and-analysis-settings-for-your-organization)."
Private repositories:
- **Dependency graph**—not enabled by default. The feature can be enabled by repository administrators. For more information, see "[Exploring the dependencies of a repository](/code-security/supply-chain-security/understanding-your-software-supply-chain/exploring-the-dependencies-of-a-repository#enabling-and-disabling-the-dependency-graph-for-a-private-repository)."
{% ifversion fpt %}
- 依赖项审查 - 可用于使用 {% data variables.product.prodname_ghe_cloud %} 并拥有 {% data variables.product.prodname_GH_advanced_security %} 的许可证的组织所拥有的专用存储库。 有关详细信息,请参阅 [{% data variables.product.prodname_ghe_cloud %} 文档](/enterprise-cloud@latest/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review)。
- **Dependency review**—available in private repositories owned by organizations that use {% data variables.product.prodname_ghe_cloud %} and have a license for {% data variables.product.prodname_GH_advanced_security %}. For more information, see the [{% data variables.product.prodname_ghe_cloud %} documentation](/enterprise-cloud@latest/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review).
{% elsif ghec %}
- 依赖项审查 - 在组织拥有的专用存储库中可用,前提是你具有 {% data variables.product.prodname_GH_advanced_security %} 许可证并启用了依赖项关系图。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_GH_advanced_security %}](/get-started/learning-about-github/about-github-advanced-security)”和“[浏览存储库的依赖项](/code-security/supply-chain-security/understanding-your-software-supply-chain/exploring-the-dependencies-of-a-repository#enabling-and-disabling-the-dependency-graph-for-a-private-repository)”。 {% endif %}
- {% data variables.product.prodname_dependabot_alerts %} - 默认未启用。 私有仓库的所有者或具有管理员权限的人员可以通过为其仓库启用依赖关系图和 {% data variables.product.prodname_dependabot_alerts %} 来启用 {% data variables.product.prodname_dependabot_alerts %}。
你也可以为用户帐户或组织拥有的所有存储库启用或禁用 Dependabot 警报。 有关详细信息,请参阅“[管理用户帐户的安全和分析设置](/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-personal-account-settings/managing-security-and-analysis-settings-for-your-personal-account)”或“[管理组织的安全和分析设置](/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-security-and-analysis-settings-for-your-organization)”。
- **Dependency review**—available in private repositories owned by organizations provided you have a license for {% data variables.product.prodname_GH_advanced_security %} and the dependency graph enabled. For more information, see "[About {% data variables.product.prodname_GH_advanced_security %}](/get-started/learning-about-github/about-github-advanced-security)" and "[Exploring the dependencies of a repository](/code-security/supply-chain-security/understanding-your-software-supply-chain/exploring-the-dependencies-of-a-repository#enabling-and-disabling-the-dependency-graph-for-a-private-repository)."
{% endif %}
- **{% data variables.product.prodname_dependabot_alerts %}**—not enabled by default. Owners of private repositories, or people with admin access, can enable {% data variables.product.prodname_dependabot_alerts %} by enabling the dependency graph and {% data variables.product.prodname_dependabot_alerts %} for their repositories.
You can also enable or disable Dependabot alerts for all repositories owned by your user account or organization. For more information, see "[Managing security and analysis settings for your user account](/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-personal-account-settings/managing-security-and-analysis-settings-for-your-personal-account)" or "[Managing security and analysis settings for your organization](/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-security-and-analysis-settings-for-your-organization)."
任意存储库类型:
- {% data variables.product.prodname_dependabot_security_updates %} - 默认未启用。 您可以为任何使用 {% data variables.product.prodname_dependabot_alerts %} 和依赖关系图的仓库启用 {% data variables.product.prodname_dependabot_security_updates %}。 若要了解如何启用安全更新,请参阅“[配置 {% data variables.product.prodname_dependabot_security_updates %}](/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates)”。
- {% data variables.product.prodname_dependabot_version_updates %} - 默认未启用。 拥有存储库写入权限的用户可以启用 {% data variables.product.prodname_dependabot_version_updates %}。 若要了解如何启用版本更新,请参阅“[配置 {% data variables.product.prodname_dependabot_version_updates %}](/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates)”。
Any repository type:
- **{% data variables.product.prodname_dependabot_security_updates %}**—not enabled by default. You can enable {% data variables.product.prodname_dependabot_security_updates %} for any repository that uses {% data variables.product.prodname_dependabot_alerts %} and the dependency graph. For information about enabling security updates, see "[Configuring {% data variables.product.prodname_dependabot_security_updates %}](/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates)."
- **{% data variables.product.prodname_dependabot_version_updates %}**—not enabled by default. People with write permissions to a repository can enable {% data variables.product.prodname_dependabot_version_updates %}. For information about enabling version updates, see "[Configuring {% data variables.product.prodname_dependabot_version_updates %}](/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates)."
{% endif %}
{% ifversion ghes or ghae %}
- 依赖项关系图和 {% data variables.product.prodname_dependabot_alerts %} - 默认未启用。 这两项功能由企业所有者在企业级别进行配置。 有关详细信息,请参阅 {% ifversion ghes %}“[为企业启用依赖项关系图](/admin/code-security/managing-supply-chain-security-for-your-enterprise/enabling-the-dependency-graph-for-your-enterprise)和 {% endif %}“[为企业启用 {% data variables.product.prodname_dependabot %} ](/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise)”。
- 依赖项审查 - 为 {% data variables.product.product_location %} 启用依赖项关系图并为组织或存储库启用 {% data variables.product.prodname_advanced_security %} 时可用。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_GH_advanced_security %}](/get-started/learning-about-github/about-github-advanced-security)”。
{% endif %} {% ifversion ghes > 3.2 %}
- {% data variables.product.prodname_dependabot_security_updates %} - 默认未启用。 您可以为任何使用 {% data variables.product.prodname_dependabot_alerts %} 和依赖关系图的仓库启用 {% data variables.product.prodname_dependabot_security_updates %}。 若要了解如何启用安全更新,请参阅“[配置 {% data variables.product.prodname_dependabot_security_updates %}](/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates)”。
- {% data variables.product.prodname_dependabot_version_updates %} - 默认未启用。 拥有存储库写入权限的用户可以启用 {% data variables.product.prodname_dependabot_version_updates %}。 若要了解如何启用版本更新,请参阅“[配置 {% data variables.product.prodname_dependabot_version_updates %}](/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates)”。
- **Dependency graph** and **{% data variables.product.prodname_dependabot_alerts %}**—not enabled by default. Both features are configured at an enterprise level by the enterprise owner. For more information, see {% ifversion ghes %}"[Enabling the dependency graph for your enterprise](/admin/code-security/managing-supply-chain-security-for-your-enterprise/enabling-the-dependency-graph-for-your-enterprise)" and {% endif %}"[Enabling {% data variables.product.prodname_dependabot %} for your enterprise](/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise)."
- **Dependency review**—available when dependency graph is enabled for {% data variables.product.product_location %} and {% data variables.product.prodname_advanced_security %} is enabled for the organization or repository. For more information, see "[About {% data variables.product.prodname_GH_advanced_security %}](/get-started/learning-about-github/about-github-advanced-security)."
{% endif %}
{% ifversion ghes > 3.2 %}
- **{% data variables.product.prodname_dependabot_security_updates %}**—not enabled by default. You can enable {% data variables.product.prodname_dependabot_security_updates %} for any repository that uses {% data variables.product.prodname_dependabot_alerts %} and the dependency graph. For information about enabling security updates, see "[Configuring {% data variables.product.prodname_dependabot_security_updates %}](/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates)."
- **{% data variables.product.prodname_dependabot_version_updates %}**—not enabled by default. People with write permissions to a repository can enable {% data variables.product.prodname_dependabot_version_updates %}. For information about enabling version updates, see "[Configuring {% data variables.product.prodname_dependabot_version_updates %}](/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates)."
{% endif %}

Просмотреть файл

@ -1,7 +1,7 @@
---
title: Changing the machine type for your codespace
shortTitle: Change the machine type
intro: 'You can change the type of machine that''s running your codespace, so that you''re using resources appropriate for work you''re doing.'
intro: 'You can change the type of machine that''s running your codespace, so that you''re using resources appropriate for the work you''re doing.'
product: '{% data reusables.gated-features.codespaces %}'
versions:
fpt: '*'
@ -23,9 +23,17 @@ type: how_to
{% data reusables.codespaces.codespaces-machine-types %} You can choose an alternative machine type either when you create a codespace or at any time after you've created a codespace.
For information on choosing a machine type when you create a codespace, see "[Creating a codespace](/codespaces/developing-in-codespaces/creating-a-codespace#creating-a-codespace)." For information on changing the machine type within {% data variables.product.prodname_vscode %}, see "[Using {% data variables.product.prodname_github_codespaces %} in {% data variables.product.prodname_vscode %}](/codespaces/developing-in-codespaces/using-github-codespaces-in-visual-studio-code#changing-the-machine-type-in-visual-studio-code)."
For information on choosing a machine type when you create a codespace, see "[Creating a codespace](/codespaces/developing-in-codespaces/creating-a-codespace#creating-a-codespace)."
## Changing the machine type in {% data variables.product.prodname_dotcom %}
## Changing the machine type
{% note %}
**Note**: {% data reusables.codespaces.codespaces-machine-type-availability %}
{% endnote %}
{% webui %}
{% data reusables.codespaces.your-codespaces-procedure-step %}
@ -37,33 +45,64 @@ For information on choosing a machine type when you create a codespace, see "[Cr
1. Click **Change machine type**.
!['Change machine type' menu option](/assets/images/help/codespaces/change-machine-type-menu-option.png)
1. If multiple machine types are available for your codespace, choose the type of machine you want to use.
![Dialog box showing available machine types to choose](/assets/images/help/codespaces/change-machine-type-choice.png)
1. Click **Update codespace**.
{% note %}
{% endwebui %}
**Note**: {% data reusables.codespaces.codespaces-machine-type-availability %}
{% vscode %}
{% endnote %}
{% data reusables.codespaces.changing-machine-type-in-vscode %}
2. Click **Update codespace**.
{% endvscode %}
The change will take effect the next time your codespace restarts.
{% cli %}
## Force an immediate update of a currently running codespace
You can use the `gh codespace edit --machine MACHINE-TYPE-NAME` {% data variables.product.prodname_cli %} command to change the machine type of a codespace. To use this command, you'll first need to find out the available machine types for your codespace.
If you change the machine type of a codespace you are currently using, and you want to apply the changes immediately, you can force the codespace to restart.
1. To view your list of codespaces, in a terminal, enter the following command.
```
gh codespace list
```
1. Optionally, to find the current machine type for a codespace, enter the following command.
```
gh api /user/codespaces/CODESPACE-NAME
```
1. At the bottom left of your codespace window, click **{% data variables.product.prodname_codespaces %}**.
Replace `CODESPACE-NAME` with the permanent name of the codespace, for example `octocat-myrepo-gmc7`. The permanent names are listed under the **NAME** column in the list returned by `gh codespace list`.
![Click '{% data variables.product.prodname_codespaces %}'](/assets/images/help/codespaces/codespaces-button.png)
If you're prompted to request the `codespace` scope, follow the instructions in the terminal.
1. From the options that are displayed at the top of the page select **Codespaces: Stop Current Codespace**.
Details for the current machine are listed under the `machine` field.
1. To find the available machine types for a codespace, enter the following command.
```
gh api /user/codespaces/CODESPACE-NAME/machines
```
!['Suspend Current Codespace' option](/assets/images/help/codespaces/suspend-current-codespace.png)
Replace `CODESPACE-NAME` with the permanent name of the codespace, for example `octocat-myrepo-gmc7`.
1. To change the machine type for a codespace, enter the following command.
1. After the codespace is stopped, click **Restart codespace**.
```
gh codespace edit --machine MACHINE-TYPE-NAME
```
![Click 'Resume'](/assets/images/help/codespaces/resume-codespace.png)
Replace `MACHINE-TYPE-NAME` with the name of an available machine type for your codespace, for example `standardLinux32gb`.
1. Using the arrow keys, navigate to the codespace you want to change, then press <kbd>Enter</kbd>.
{% endcli %}
{% data reusables.codespaces.about-changing-storage-size %}
{% cli %}
## Further reading
- "[Codespaces machines](/rest/codespaces/machines)" in the REST API documentation
- [`gh codespace edit`](https://cli.github.com/manual/gh_codespace_edit) in the {% data variables.product.prodname_cli %} manual
{% endcli %}

Просмотреть файл

@ -78,28 +78,15 @@ Use the {% data variables.product.prodname_vscode_marketplace %} to install the
{% data reusables.codespaces.codespaces-machine-types %} You can change the machine type of your codespace at any time.
1. In {% data variables.product.prodname_vscode_shortname %}, open the Command Palette (`shift command P` / `shift control P`).
1. Search for and select "Codespaces: Change Machine Type."
{% note %}
![Searching for a branch to create a new {% data variables.product.prodname_codespaces %}](/assets/images/help/codespaces/vscode-change-machine-type-option.png)
**Note**: {% data reusables.codespaces.codespaces-machine-type-availability %}
1. Click the codespace that you want to change.
{% endnote %}
![Searching for a branch to create a new {% data variables.product.prodname_codespaces %}](/assets/images/help/codespaces/vscode-change-machine-choose-repo.png)
{% data reusables.codespaces.changing-machine-type-in-vscode %}
1. Choose the machine type you want to use.
{% note %}
**Note**: {% data reusables.codespaces.codespaces-machine-type-availability %}
{% endnote %}
1. If the codespace is currently running, a message is displayed asking if you would like to restart and reconnect to your codespace now.
Click **Yes** if you want to change the machine type used for this codespace immediately.
If you click **No**, or if the codespace is not currently running, the change will take effect the next time the codespace restarts.
{% data reusables.codespaces.about-changing-storage-size %}
## Deleting a codespace in {% data variables.product.prodname_vscode_shortname %}

Просмотреть файл

@ -31,6 +31,7 @@ You can work with {% data variables.product.prodname_github_codespaces %} in the
- [Modify ports in a codespace](#modify-ports-in-a-codespace)
- [Access codespace logs](#access-codespace-logs)
- [Access remote resources](#access-remote-resources)
- [Change the machine type of a codespace](#change-the-machine-type-of-a-codespace)
## Installing {% data variables.product.prodname_cli %}
@ -206,4 +207,12 @@ You can use the {% data variables.product.prodname_cli %} extension to create a
**Note**: The {% data variables.product.prodname_cli %} extension is currently in beta and subject to change.
{% endnote %}
{% endnote %}
### Change the machine type of a codespace
```shell
gh codespace edit -m <em>machine-type-name</em>
```
For more information, see the "{% data variables.product.prodname_cli %}" tab of "[Changing the machine type for your codespace](/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace)."

Просмотреть файл

@ -1,121 +1,121 @@
---
title: 在 JetBrains IDE 中开始使用 GitHub Copilot
title: Getting started with GitHub Copilot in a JetBrains IDE
shortTitle: JetBrains IDE
intro: '了解如何在 JetBrains IDE 中安装 {% data variables.product.prodname_copilot %},并在编写注释和代码时开始查看建议。'
intro: 'Learn how to install {% data variables.product.prodname_copilot %} in a JetBrains IDE, and start seeing suggestions as you write comments and code.'
product: '{% data reusables.gated-features.copilot %}'
versions:
feature: copilot
topics:
- Copilot
ms.openlocfilehash: e031d6155f4dacf9987bee21ff80eada0e079d97
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147110327'
---
## 关于 {% data variables.product.prodname_copilot %} 和 JetBrains IDE
## About {% data variables.product.prodname_copilot %} and JetBrains IDEs
{% data reusables.copilot.procedural-intro %}
如果使用 JetBrains IDE可以直接在编辑器中查看并合并来自 {% data variables.product.prodname_copilot %} 的建议。 本指南演示如何在适用于 macOS、Windows 或 Linux 的 JetBrains IDE 中使用 {% data variables.product.prodname_copilot %}。
If you use a JetBrains IDE, you can view and incorporate suggestions from {% data variables.product.prodname_copilot %} directly within the editor. This guide demonstrates how to use {% data variables.product.prodname_copilot %} within a JetBrains IDE for macOS, Windows, or Linux.
## 先决条件
## Prerequisites
{% data reusables.copilot.jetbrains-ides %}
## 安装 JetBrains 扩展
## Installing the JetBrains extension
若要在 JetBrains IDE 中使用 {% data variables.product.prodname_copilot %},必须先安装 {% data variables.product.prodname_copilot %} 扩展。 以下过程将指导你在 IntelliJ IDEA 中安装 {% data variables.product.prodname_copilot %} 插件。 在另一个受支持的 IDE 中安装插件的步骤可能有所不同。
To use {% data variables.product.prodname_copilot %} in a JetBrains IDE, you must install the {% data variables.product.prodname_copilot %} extension. The following procedure will guide you through installation of the {% data variables.product.prodname_copilot %} plugin in IntelliJ IDEA. Steps to install the plugin in another supported IDE may differ.
1. 在 JetBrains IDE 中,在 Windows 的“文件”菜单或 IDE 名称 (Mac) 下(例如 PyCharm 或 IntelliJ单击“设置”(Windows) 或“首选项”(Mac)。
2. 在“设置/首选项”对话框的左侧菜单中,单击“插件”。
3. 在“设置/首选项”对话框顶部,单击“市场”。 在搜索栏中,搜索“{% data variables.product.prodname_copilot %}”,然后单击“安装”。
![市场搜索的屏幕截图](/assets/images/help/copilot/jetbrains-marketplace.png)
1. 安装 {% data variables.product.prodname_copilot %} 后,单击“重启 IDE”。
1. JetBrains IDE 重启后,单击“工具”菜单。 单击“{% data variables.product.prodname_copilot %}”,然后单击“登录到 {% data variables.product.prodname_dotcom %}”。
![JetBrains 工具菜单的屏幕截图](/assets/images/help/copilot/jetbrains-tools-menu.png)
1. 在“登录到 {% data variables.product.prodname_dotcom %}”对话框中,若要复制设备代码并打开设备激活窗口,请单击“复制并打开”。
![设备代码复制和打开的屏幕截图](/assets/images/help/copilot/device-code-copy-and-open.png)
1. 设备激活窗口将在浏览器中打开。 粘贴设备代码,然后单击“继续”。
1. In your JetBrains IDE, under the **File** menu for Windows or under the name of your IDE for Mac (for example, **PyCharm** or **IntelliJ**), click **Settings** for Windows or **Preferences** for Mac.
2. In the left-side menu of the **Settings/Preferences** dialog box, click **Plugins**.
3. At the top of the **Settings/Preferences** dialog box, click **Marketplace**. In the search bar, search for **{% data variables.product.prodname_copilot %}**, then click **Install**.
![Screenshot of Marketplace search](/assets/images/help/copilot/jetbrains-marketplace.png)
1. After {% data variables.product.prodname_copilot %} is installed, click **Restart IDE**.
1. After your JetBrains IDE has restarted, click the **Tools** menu. Click **{% data variables.product.prodname_copilot %}**, then click **Login to {% data variables.product.prodname_dotcom %}**.
![Screenshot of JetBrains tools menu](/assets/images/help/copilot/jetbrains-tools-menu.png)
1. In the "Sign in to {% data variables.product.prodname_dotcom %}" dialog box, to copy the device code and open the device activation window, click **Copy and Open**.
![Screenshot of device code copy and open](/assets/images/help/copilot/device-code-copy-and-open.png)
1. A device activation window will open in your browser. Paste the device code, then click **Continue**.
- 若要在 Windows 或 Linux 中粘贴代码,请按 <kbd>Ctrl</kbd>+<kbd>v</kbd>
- 若要在 macOS 中粘贴代码,请按 <kbd>command</kbd>+<kbd>v</kbd>
1. {% data variables.product.prodname_dotcom %} 将请求 {% data variables.product.prodname_copilot %} 所需的权限。 若要批准这些权限,请单击“授权 {% data variables.product.prodname_copilot %} 插件”。
1. 权限获得批准后JetBrains IDE 将显示确认。 要开始使用 {% data variables.product.prodname_copilot %},请单击“确定”。
![JetBrains IDE 权限确认的屏幕截图](/assets/images/help/copilot/jetbrains-ide-confirmation.png)
- To paste the code in Windows or Linux, press <kbd>Ctrl</kbd>+<kbd>v</kbd>.
- To paste the code in macOS, press <kbd>command</kbd>+<kbd>v</kbd>.
1. {% data variables.product.prodname_dotcom %} will request the necessary permissions for {% data variables.product.prodname_copilot %}. To approve these permissions, click **Authorize {% data variables.product.prodname_copilot %} Plugin**.
1. After the permissions have been approved, your JetBrains IDE will show a confirmation. To begin using {% data variables.product.prodname_copilot %}, click **OK**.
![Screenshot of JetBrains IDE permissions confirmation](/assets/images/help/copilot/jetbrains-ide-confirmation.png)
## 查看第一个建议
## Seeing your first suggestion
{% data reusables.copilot.supported-languages %} 以下示例使用的是 Java但其他语言的工作方式类似。
{% data reusables.copilot.code-examples-limitations %}
{% data reusables.copilot.supported-languages %} The following samples are in Java, but other languages will work similarly.
{% data reusables.copilot.create-java-file %}
1. 在 Java 文件中,通过键入 `class Test` 创建类。
{% data variables.product.prodname_copilot %} 将自动以灰色文本建议类正文,如下所示。 具体的建议可能会有所不同。
![Java 类正文建议的屏幕截图](/assets/images/help/copilot/java-class-body-suggestion-jetbrains.png) {% data reusables.copilot.accept-suggestion %}
1. 若要提示 {% data variables.product.prodname_copilot %} 建议函数正文,请在 `main` 函数括号下方键入以下行。 具体的建议可能会有所不同。
1. In the Java file, create a class by typing `class Test`.
{% data variables.product.prodname_copilot %} will automatically suggest a class body in grayed text, as shown below. The exact suggestion may vary.
![Screenshot of the Java class body suggestion](/assets/images/help/copilot/java-class-body-suggestion-jetbrains.png)
{% data reusables.copilot.accept-suggestion %}
1. To prompt {% data variables.product.prodname_copilot %} to suggest a function body, type the following line below the bracket of the `main` function. The exact suggestion may vary.
{% indented_data_reference reusables.copilot.java-int-snippet spaces=3 %}
![Java 函数正文建议的屏幕截图](/assets/images/help/copilot/java-function-body-suggestion-jetbrains.png) {% data reusables.copilot.accept-suggestion %}
![Screenshot of the Java function body suggestion](/assets/images/help/copilot/java-function-body-suggestion-jetbrains.png)
{% data reusables.copilot.accept-suggestion %}
{% data variables.product.prodname_copilot %} 将尝试与代码的上下文和样式匹配。 始终可以编辑建议的代码。
{% data variables.product.prodname_copilot %} will attempt to match the context and style of your code. You can always edit the suggested code.
## 查看替代建议
## Seeing alternative suggestions
{% data reusables.copilot.alternative-suggestions %}
{% data reusables.copilot.create-java-file %}
1. 若要提示 {% data variables.product.prodname_copilot %} 显示建议,请在 Java 文件中键入以下行。
{% indented_data_reference reusables.copilot.java-int-snippet spaces=3 %} {% data reusables.copilot.see-alternative-suggestions %}
1. To prompt {% data variables.product.prodname_copilot %} to show you a suggestion, type the following line in the Java file.
{% indented_data_reference reusables.copilot.java-int-snippet spaces=3 %}
{% data reusables.copilot.see-alternative-suggestions %}
| OS | 查看下一个建议 | 查看上一个建议 |
| OS | See next suggestion | See previous suggestion |
| :- | :- | :- |
| macOS | <kbd>选项</kbd>+<kbd>]</kbd> | <kbd>选项</kbd>+<kbd>[</kbd> |
| macOS | <kbd>Option</kbd>+<kbd>]</kbd> | <kbd>Option</kbd>+<kbd>[</kbd> |
| Windows | <kbd>Alt</kbd>+<kbd>]</kbd> | <kbd>Alt</kbd>+<kbd>[</kbd> |
| Linux | <kbd>Alt</kbd>+<kbd>]</kbd> | <kbd>Alt</kbd>+<kbd>[</kbd> |
{% data reusables.copilot.accept-or-reject-suggestion %}
## 在新选项卡中查看多个建议
## Seeing multiple suggestions in a new tab
{% data reusables.copilot.suggestions-new-tab %}
{% data reusables.copilot.create-java-file %}
1. 若要提示 {% data variables.product.prodname_copilot %} 显示建议,请在 Java 文件中键入以下行。
1. To prompt {% data variables.product.prodname_copilot %} to show you a suggestion, type the following line in the Java file.
{% indented_data_reference reusables.copilot.java-int-snippet spaces=3 %}
1. 打开包含多个附加建议的新选项卡。
- 在 macOS 上,按 <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>A</kbd>,然后单击“打开 GitHub Copilot”或按 <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>\</kbd> 立即打开新选项卡。
- 在 Windows 或 Linux 上,按 <kbd>Ctrl</kbd>+<kbd>Enter</kbd>,然后单击“打开 GitHub Copilot”。
![用于打开 Copilot 的对话的屏幕截图](/assets/images/help/copilot/open-copilot-tab-jetbrains.png)
1. 若要接受建议,请在建议上方单击“接受解决方案”。 若要拒绝所有建议,请关闭选项卡。
1. Open a new tab with multiple additional suggestions.
- On macOS, press <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>A</kbd>, then click **Open GitHub Copilot**, or press <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>\</kbd> to open the new tab immediately.
- On Windows or Linux, press <kbd>Ctrl</kbd>+<kbd>Enter</kbd>, then click **Open GitHub Copilot**.
![Screenshot of dialogue to open Copilot](/assets/images/help/copilot/open-copilot-tab-jetbrains.png)
1. To accept a suggestion, above the suggestion, click **Accept Solution**. To reject all suggestions, close the tab.
## 从注释生成代码建议
## Generating code suggestions from comments
{% data reusables.copilot.generating-suggestions-from-comments %}
{% data reusables.copilot.create-java-file %}
1. 若要提示 {% data variables.product.prodname_copilot %} 以建议 Java 文件中函数的实现,请键入以下行。
1. To prompt {% data variables.product.prodname_copilot %} to suggest an implementation of a function in the Java file, type the following lines.
```java{:copy}
// find all images without alternate text
// and give them a red border
void process () {
```
![Java 函数正文建议的屏幕截图](/assets/images/help/copilot/comment-suggestion-jetbrains.png)
![Screenshot of the Java function body suggestion](/assets/images/help/copilot/comment-suggestion-jetbrains.png)
## 启用或禁用 {% data variables.product.prodname_copilot %}
## Enabling and disabling {% data variables.product.prodname_copilot %}
可以为所有语言或单个语言启用或禁用 {% data variables.product.prodname_copilot %}。 JetBrains IDE 窗口底部面板中的 {% data variables.product.prodname_copilot %} 状态图标指示 {% data variables.product.prodname_copilot %} 是启用还是禁用。 启用后,将突出显示图标。 禁用后,图标灰显。
You can enable or disable {% data variables.product.prodname_copilot %} for all languages, or for individual languages. The {% data variables.product.prodname_copilot %} status icon in the bottom panel of your JetBrains IDE window indicates whether {% data variables.product.prodname_copilot %} is enabled or disabled. When enabled, the icon is highlighted. When disabled, the icon is grayed out.
1. 若要启用或禁用 {% data variables.product.prodname_copilot %},请单击 JetBrains 窗口底部面板中的状态图标。
![IntelliJ IDEA 中“状态”图标的屏幕截图](/assets/images/help/copilot/status-icon-jetbrains.png)
2. 如果要禁用 {% data variables.product.prodname_copilot %},系统会询问是全局禁用它,还是要禁用当前正在编辑的文件的语言。
1. To enable or disable {% data variables.product.prodname_copilot %}, click the status icon in the bottom panel of the JetBrains window.
![Screenshot of the status icon in IntelliJ IDEA](/assets/images/help/copilot/status-icon-jetbrains.png)
2. If you are disabling {% data variables.product.prodname_copilot %}, you will be asked whether you want to disable it globally, or for the language of the file you are currently editing.
- 若要全局禁用 {% data variables.product.prodname_copilot %} 的建议,请单击“禁用完成”。
- 若要禁用指定语言的 {% data variables.product.prodname_copilot %} 的建议,请单击“禁用 LANGUAGE 完成”。
![全局或为当前语言禁用 {% data variables.product.prodname_copilot %} 的选项的屏幕截图](/assets/images/help/copilot/disable-copilot-global-or-langugage-jetbrains.png)
- To disable suggestions from {% data variables.product.prodname_copilot %} globally, click **Disable Completions**.
- To disable suggestions from {% data variables.product.prodname_copilot %} for the specified language, click **Disable Completions for _LANGUAGE_**.
![Screenshot of option to disable {% data variables.product.prodname_copilot %} globally or for the current language](/assets/images/help/copilot/disable-copilot-global-or-langugage-jetbrains.png)
## 延伸阅读
## Further reading
- [{% data variables.product.prodname_copilot %} 网站](https://copilot.github.com/)
- [关于 {% data variables.product.prodname_copilot %}](/copilot/overview-of-github-copilot/about-github-copilot#about-the-license-for-the-github-copilot-plugin-in-jetbrains-ides)
- [The {% data variables.product.prodname_copilot %} website](https://copilot.github.com/)
- [About {% data variables.product.prodname_copilot %}](/copilot/overview-of-github-copilot/about-github-copilot#about-the-license-for-the-github-copilot-plugin-in-jetbrains-ides)

Просмотреть файл

@ -1,105 +1,103 @@
---
title: 在 Visual Studio Code 中开始使用 GitHub Copilot
title: Getting started with GitHub Copilot in Visual Studio Code
shortTitle: Visual Studio Code
intro: '了解如何在 {% data variables.product.prodname_vscode %} 中安装 {% data variables.product.prodname_copilot %},并在编写注释和代码时开始查看建议。'
intro: 'Learn how to install {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_vscode %}, and start seeing suggestions as you write comments and code.'
product: '{% data reusables.gated-features.copilot %}'
versions:
feature: copilot
topics:
- Copilot
ms.openlocfilehash: 854d489eaa90690dd670fb01068fe0166c134afb
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147079733'
---
## 关于 {% data variables.product.prodname_copilot %} 和 {% data variables.product.prodname_vscode %}
## About {% data variables.product.prodname_copilot %} and {% data variables.product.prodname_vscode %}
{% data reusables.copilot.procedural-intro %}
如果使用 {% data variables.product.prodname_vscode %},可以直接在编辑器中查看并合并来自 {% data variables.product.prodname_copilot %} 的建议。 本指南演示如何在适用于 macOS、Windows 或 Linux 的 {% data variables.product.prodname_vscode %} 中使用 {% data variables.product.prodname_copilot %}。
If you use {% data variables.product.prodname_vscode %}, you can view and incorporate suggestions from {% data variables.product.prodname_copilot %} directly within the editor. This guide demonstrates how to use {% data variables.product.prodname_copilot %} within {% data variables.product.prodname_vscode %} for macOS, Windows, or Linux.
## 先决条件
## Prerequisites
若要在 {% data variables.product.prodname_vscode %} 中使用 {% data variables.product.prodname_copilot %},必须安装 {% data variables.product.prodname_vscode %}。 有关详细信息,请参阅 [{% data variables.product.prodname_vscode %} 下载页面](https://code.visualstudio.com/Download)。
To use {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_vscode %}, you must have {% data variables.product.prodname_vscode %} installed. For more information, see the [{% data variables.product.prodname_vscode %} download page](https://code.visualstudio.com/Download).
## 安装 {% data variables.product.prodname_vscode %} 扩展
## Installing the {% data variables.product.prodname_vscode %} extension
若要使用 {% data variables.product.prodname_copilot %},必须先安装 {% data variables.product.prodname_vscode %} 扩展。
To use {% data variables.product.prodname_copilot %}, you must first install the {% data variables.product.prodname_vscode %} extension.
1. 在 {% data variables.product.prodname_vscode %} 市场中,转到 [{% data variables.product.prodname_copilot %} 扩展](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot)页,然后单击“安装”。
![安装 {% data variables.product.prodname_copilot %} 扩展 {% data variables.product.prodname_vscode %}](/assets/images/help/copilot/install-copilot-extension-visual-studio-code.png)
1. 此时会显示一个弹出窗口,要求打开 {% data variables.product.prodname_vscode %}。 单击“打开 {% data variables.product.prodname_vscode %}”。
1. 在 {% data variables.product.prodname_vscode %} 的“扩展: {% data variables.product.prodname_copilot %}”选项卡中,单击“安装”。
![{% data variables.product.prodname_vscode %} 中的“安装”按钮](/assets/images/help/copilot/in-visual-studio-code-install-button.png)
1. 如果以前未在 {% data variables.product.prodname_dotcom %} 帐户中授权 {% data variables.product.prodname_vscode %},系统会提示你在 {% data variables.product.prodname_vscode %} 中登录到 {% data variables.product.prodname_dotcom %}。
- 如果以前已在 {% data variables.product.prodname_dotcom %} 上的帐户中授权 {% data variables.product.prodname_vscode %},系统将会自动授权 {% data variables.product.prodname_copilot %}。
![{% data variables.product.prodname_vscode %} 授权屏幕的屏幕截图](/assets/images/help/copilot/vsc-copilot-authorize.png)
1. 在浏览器中,{% data variables.product.prodname_dotcom %} 将请求 {% data variables.product.prodname_copilot %} 所需的权限。 若要批准这些权限,请单击“授权 {% data variables.product.prodname_vscode %}”。
1. 在 {% data variables.product.prodname_vscode %} 的“{% data variables.product.prodname_vscode %}”对话框中,若要确认身份验证,请单击“打开”。
1. In the {% data variables.product.prodname_vscode %} Marketplace, go to the [{% data variables.product.prodname_copilot %} extension](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) page and click **Install**.
![Install {% data variables.product.prodname_copilot %} extension {% data variables.product.prodname_vscode %}](/assets/images/help/copilot/install-copilot-extension-visual-studio-code.png)
1. A popup will appear, asking to open {% data variables.product.prodname_vscode %}. Click **Open {% data variables.product.prodname_vscode %}**.
1. In the "Extension: {% data variables.product.prodname_copilot %}" tab in {% data variables.product.prodname_vscode %}, click **Install**.
![Install button in {% data variables.product.prodname_vscode %}](/assets/images/help/copilot/in-visual-studio-code-install-button.png)
1. If you have not previously authorized {% data variables.product.prodname_vscode %} in your {% data variables.product.prodname_dotcom %} account, you will be prompted to sign in to {% data variables.product.prodname_dotcom %} in {% data variables.product.prodname_vscode %}.
- If you have previously authorized {% data variables.product.prodname_vscode %} for your account on {% data variables.product.prodname_dotcom %}, {% data variables.product.prodname_copilot %} will be automatically authorized.
![Screen shot of {% data variables.product.prodname_vscode %} authorization screen](/assets/images/help/copilot/vsc-copilot-authorize.png)
1. In your browser, {% data variables.product.prodname_dotcom %} will request the necessary permissions for {% data variables.product.prodname_copilot %}. To approve these permissions, click **Authorize {% data variables.product.prodname_vscode %}**.
1. In {% data variables.product.prodname_vscode %}, in the "{% data variables.product.prodname_vscode %}" dialog box, to confirm the authentication, click **Open**.
## 查看第一个建议
## Seeing your first suggestion
{% data reusables.copilot.supported-languages %} 以下示例使用的是 JavaScript但其他语言的工作方式类似。
{% data reusables.copilot.code-examples-limitations %}
{% data reusables.copilot.supported-languages %} The following samples are in JavaScript, but other languages will work similarly.
{% data reusables.copilot.create-js-file %}
1. 在 JavaScript 文件中,键入以下函数标头。 {% data variables.product.prodname_copilot %} 将自动以灰色文本建议整个函数正文,如下所示。 具体的建议可能会有所不同。
1. In the JavaScript file, type the following function header. {% data variables.product.prodname_copilot %} will automatically suggest an entire function body in grayed text, as shown below. The exact suggestion may vary.
```javascript{:copy}
function calculateDaysBetweenDates(begin, end) {
```
![第一个建议 {% data variables.product.prodname_vscode %} 的屏幕截图](/assets/images/help/copilot/first-suggestion-visual-studio-code.png) {% data reusables.copilot.accept-suggestion %}
![Screenshot of a first suggestion {% data variables.product.prodname_vscode %}](/assets/images/help/copilot/first-suggestion-visual-studio-code.png)
{% data reusables.copilot.accept-suggestion %}
## 查看替代建议
## Seeing alternative suggestions
{% data reusables.copilot.alternative-suggestions %}
{% data reusables.copilot.create-js-file %}
1. 在 JavaScript 文件中,键入以下函数标头。 {% data variables.product.prodname_copilot %} 将向你显示建议。
1. In the JavaScript file, type the following function header. {% data variables.product.prodname_copilot %} will show you a suggestion.
```javascript{:copy}
function calculateDaysBetweenDates(begin, end) {
```
{% data reusables.copilot.see-alternative-suggestions %}
| OS | 查看下一个建议 | 查看上一个建议 |
| OS | See next suggestion | See previous suggestion |
| :- | :- | :- |
|macOS|<kbd>Option (⌥) Alt</kbd>+<kbd>]</kbd>|<kbd>Option (⌥) Alt</kbd>+<kbd>[</kbd>|
|macOS|<kbd>Option (⌥) or Alt</kbd>+<kbd>]</kbd>|<kbd>Option (⌥) or Alt</kbd>+<kbd>[</kbd>|
|Windows|<kbd>Alt</kbd>+<kbd>]</kbd>|<kbd>Alt</kbd>+<kbd>[</kbd>|
|Linux|<kbd>Alt</kbd>+<kbd>]</kbd>|<kbd>Alt</kbd>+<kbd>[</kbd>|
1. 或者,可以将鼠标悬停在建议上方,查看 {% data variables.product.prodname_copilot %} 命令面板以选择建议。
1. Alternatively, you can hover over the suggestion to see the {% data variables.product.prodname_copilot %} command palette for choosing suggestions.
{% data reusables.copilot.accept-or-reject-suggestion %}
## 在新选项卡中查看多个建议
## Seeing multiple suggestions in a new tab
{% data reusables.copilot.suggestions-new-tab %}
{% data reusables.copilot.create-js-file %}
1. 在 JavaScript 文件中,键入以下函数标头。 {% data variables.product.prodname_copilot %} 将向你显示建议。
1. In the JavaScript file, type the following function header. {% data variables.product.prodname_copilot %} will show you a suggestion.
```javascript{:copy}
function calculateDaysBetweenDates(begin, end) {
```
1. 若要打开具有多个其他选项的新选项卡,请按 <kbd>Ctrl</kbd>+<kbd>Enter</kbd>
1. 若要接受建议,请在建议上方单击“接受解决方案”。 若要拒绝所有建议,请关闭选项卡。
1. To open a new tab with multiple additional options, press <kbd>Ctrl</kbd>+<kbd>Enter</kbd>.
1. To accept a suggestion, above the suggestion, click **Accept Solution**. To reject all suggestions, close the tab.
## 从注释生成代码建议
## Generating code suggestions from comments
{% data reusables.copilot.generating-suggestions-from-comments %}
{% data reusables.copilot.create-js-file %}
1. 在 JavaScript 文件中,键入以下注释。 {% data variables.product.prodname_copilot %} 将建议函数的实现。
1. In the JavaScript file, type the following comment. {% data variables.product.prodname_copilot %} will suggest an implementation of the function.
```javascript{:copy}
// find all images without alternate text
// and give them a red border
function process() {
```
## 使用框架
## Using a framework
还可以使 {% data variables.product.prodname_copilot %} 为 API 和框架生成建议。 以下示例使用 {% data variables.product.prodname_copilot %} 创建将返回当前时间的简单 Express 服务器。
You can also use {% data variables.product.prodname_copilot %} to generate suggestions for APIs and frameworks. The following example uses {% data variables.product.prodname_copilot %} to create a simple Express server that returns the current time.
{% data reusables.copilot.create-js-file %}
1. 在 JavaScript 文件中,键入以下注释,然后按 <kbd>Enter</kbd>。 {% data variables.product.prodname_copilot %} 将建议 Express 应用的实现。
1. In the JavaScript file, type the following comment and then press <kbd>Enter</kbd>. {% data variables.product.prodname_copilot %} will suggest an implementation of the Express app.
```javascript{:copy}
// Express server on port 3000
1. To accept each line, press <kbd>Tab</kbd>, then <kbd>Enter</kbd>.
@ -107,10 +105,10 @@ ms.locfileid: '147079733'
```javascript{:copy}
// Return the current time
```
1. 若要接受每行,请按 <kbd>Tab</kbd>
1. To accept each line, press <kbd>Tab</kbd>.
{% data reusables.copilot.enabling-or-disabling-in-vsc %}
## 延伸阅读
## Further reading
- [{% data variables.product.prodname_copilot %}](https://copilot.github.com/)

Просмотреть файл

@ -1,83 +1,82 @@
---
title: 在 Visual Studio 中开始使用 GitHub Copilot
title: Getting started with GitHub Copilot in Visual Studio
shortTitle: Visual Studio
product: '{% data reusables.gated-features.copilot %}'
intro: '了解如何在 {% data variables.product.prodname_vs %} 中安装 {% data variables.product.prodname_copilot %},并在编写注释和代码时开始查看建议。'
intro: 'Learn how to install {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_vs %}, and start seeing suggestions as you write comments and code.'
versions:
feature: copilot
topics:
- Copilot
ms.openlocfilehash: 1d3c65cf1709ece9ea7b0eae9e6fadaa0df0c7f0
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147098023'
---
## 关于 {% data variables.product.prodname_copilot %} 和 Visual Studio
## About {% data variables.product.prodname_copilot %} and Visual Studio
{% data reusables.copilot.procedural-intro %}
如果使用 {% data variables.product.prodname_vs %},可以直接在编辑器中查看并合并来自 {% data variables.product.prodname_copilot %} 的建议。 本指南演示如何在适用于 Windows 的 {% data variables.product.prodname_vs %} 中使用 {% data variables.product.prodname_copilot %}。
If you use {% data variables.product.prodname_vs %}, you can view and incorporate suggestions from {% data variables.product.prodname_copilot %} directly within the editor. This guide demonstrates how to use {% data variables.product.prodname_copilot %} within {% data variables.product.prodname_vs %} for Windows.
## 先决条件
## Prerequisites
若要在 {% data variables.product.prodname_vs %} 中使用 {% data variables.product.prodname_copilot %},必须安装 {% data variables.product.prodname_vs %} 2022 17.2 或更高版本。 有关详细信息,请参阅 [Visual Studio IDE](https://visualstudio.microsoft.com/vs/) 文档。
To use {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_vs %}, you must have {% data variables.product.prodname_vs %} 2022 17.2 or later installed. For more information, see the [Visual Studio IDE](https://visualstudio.microsoft.com/vs/) documentation.
{% note %}
注意:{% data variables.product.prodname_copilot %} 当前不适用于 Visual Studio for Mac。
**Note**: {% data variables.product.prodname_copilot %} is not currently available for use with Visual Studio for Mac.
{% endnote %}
## 安装 {% data variables.product.prodname_vs %} 扩展
## Installing the {% data variables.product.prodname_vs %} extension
若要使用 {% data variables.product.prodname_copilot %},必须先安装 {% data variables.product.prodname_vs %} 扩展。
1. 在 Visual Studio 工具栏中,单击“扩展”,然后单击“管理扩展”。
![Visual Studio 工具栏的屏幕截图](/assets/images/help/copilot/visual-studio-toolbar.png)
1. 在“管理扩展”窗口中单击“Visual Studio Marketplace”搜索 {% data variables.product.prodname_copilot %} 扩展,然后单击“下载”。
![Visual Studio GitHub Copilot 扩展的屏幕截图,其中突出显示了“下载”按钮](/assets/images/help/copilot/install-copilot-extension-visual-studio.png)
1. 关闭“管理扩展”窗口,然后退出并重新启动 {% data variables.product.prodname_vs %}。
1. (可选)若要检查是否已安装并启用 {% data variables.product.prodname_copilot %},请返回到“管理扩展”,单击“已安装的扩展”以查看当前安装的扩展,然后单击“{% data variables.product.prodname_copilot %}”以查看状态信息。
![Visual Studio 中已安装的扩展的屏幕截图,其中突出显示 GitHub Copilot](/assets/images/help/copilot/installed-copilot-extension-visual-studio.png)
1. 在 {% data variables.product.prodname_vs %} 中打开或创建新项目。
1. 在“Microsoft {% data variables.product.prodname_vs %}”对话框中,若要复制设备激活代码,请单击“确定”。
![“Microsoft {% data variables.product.prodname_vs %}”对话框的屏幕截图](/assets/images/help/copilot/vs-auth-dialogue.png)
1. 设备激活窗口将在浏览器中打开。 粘贴设备代码,然后单击“继续”。
To use {% data variables.product.prodname_copilot %}, you must first install the {% data variables.product.prodname_vs %} extension.
1. In the Visual Studio toolbar, click **Extensions**, then click **Manage Extensions**.
![Screenshot of the Visual Studio toolbar](/assets/images/help/copilot/visual-studio-toolbar.png)
1. In the "Manage Extensions" window, click **Visual Studio Marketplace**, search for the {% data variables.product.prodname_copilot %} extension, then click **Download**.
![Screenshot of GitHub Copilot extension for Visual Studio with the download button emphasized](/assets/images/help/copilot/install-copilot-extension-visual-studio.png)
1. Close the "Manage Extensions" window, then exit and relaunch {% data variables.product.prodname_vs %}.
1. Optionally, to check that {% data variables.product.prodname_copilot %} is installed and enabled, go back to **Manage Extensions**, click **Installed** to view your currently installed extensions, then click **{% data variables.product.prodname_copilot %}** to see status information.
![Screenshot of installed extensions in Visual Studio with GitHub Copilot emphasized](/assets/images/help/copilot/installed-copilot-extension-visual-studio.png)
1. Open or create a new project in {% data variables.product.prodname_vs %}.
1. In the "Microsoft {% data variables.product.prodname_vs %}" dialog box, to copy your device activation code, click **OK**.
![Screenshot of the Microsoft {% data variables.product.prodname_vs %} dialogue box](/assets/images/help/copilot/vs-auth-dialogue.png)
1. A device activation window will open in your browser. Paste the device code, then click **Continue**.
- 若要在 Windows 或 Linux 中粘贴代码,请按 <kbd>Ctrl</kbd>+<kbd>v</kbd>
- 若要在 macOS 中粘贴代码,请按 <kbd>command</kbd>+<kbd>v</kbd>
1. {% data variables.product.prodname_dotcom %} 将请求 {% data variables.product.prodname_copilot %} 所需的权限。 若要批准这些权限,请单击“授权 {% data variables.product.prodname_copilot %} 插件”。
1. 批准权限后,{% data variables.product.prodname_vs %} 将显示确认。
![{% data variables.product.prodname_vs %} 权限确认的屏幕截图](/assets/images/help/copilot/vs-confirmation.png)
- To paste the code in Windows or Linux, press <kbd>Ctrl</kbd>+<kbd>v</kbd>.
- To paste the code in macOS, press <kbd>command</kbd>+<kbd>v</kbd>.
1. {% data variables.product.prodname_dotcom %} will request the necessary permissions for {% data variables.product.prodname_copilot %}. To approve these permissions, click **Authorize {% data variables.product.prodname_copilot %} Plugin**.
1. After you approve the permissions, {% data variables.product.prodname_vs %} will show a confirmation.
![Screenshot of {% data variables.product.prodname_vs %} permissions confirmation](/assets/images/help/copilot/vs-confirmation.png)
## 查看第一个建议
{% data reusables.copilot.supported-languages %} 以下示例使用的是 C#,但其他语言的工作方式类似。
## Seeing your first suggestion
{% data reusables.copilot.code-examples-limitations %}
{% data reusables.copilot.supported-languages %} The following samples are in C#, but other languages will work similarly.
{% data reusables.copilot.create-c-file %}
1. 在 C# 文件中,键入以下函数签名。 {% data variables.product.prodname_copilot %} 将自动以灰色文本建议整个函数正文,如下所示。 具体的建议可能会有所不同。
1. In the C# file, type the following function signature. {% data variables.product.prodname_copilot %} will automatically suggest an entire function body in grayed text, as shown below. The exact suggestion may vary.
```csharp{:copy}
int CalculateDaysBetweenDates(
```
![第一个建议 Visual Studio Code 的屏幕截图](/assets/images/help/copilot/first-suggestion-visual-studio.png) {% data reusables.copilot.accept-suggestion %}
![Screenshot of a first suggestion Visual Studio Code](/assets/images/help/copilot/first-suggestion-visual-studio.png)
{% data reusables.copilot.accept-suggestion %}
## 查看替代建议
{% data reusables.copilot.alternative-suggestions %} {% data reusables.copilot.create-c-file %}
1. 在 C# 文件中,键入以下函数签名。 {% data variables.product.prodname_copilot %} 将向你显示建议。
## Seeing alternative suggestions
{% data reusables.copilot.alternative-suggestions %}
{% data reusables.copilot.create-c-file %}
1. In the C# file, type the following function signature. {% data variables.product.prodname_copilot %} will show you a suggestion.
```csharp{:copy}
int CalculateDaysBetweenDates(
```
1. 如果替代建议可用,可以通过按 <kbd>Alt</kbd>+]<kbd>(或 </kbd>Alt<kbd></kbd>+<kbd>[</kbd>)来查看这些替代项。
1. 或者,可以将鼠标悬停在建议上方,查看 {% data variables.product.prodname_copilot %} 命令面板以选择建议。
1. If alternative suggestions are available, you can see these alternatives by pressing <kbd>Alt</kbd>+<kbd>]</kbd> (or <kbd>Alt</kbd>+<kbd>[</kbd>).
1. Optionally, you can hover over the suggestion to see the {% data variables.product.prodname_copilot %} command palette for choosing suggestions.
{% data reusables.copilot.accept-or-reject-suggestion %}
## 从注释生成代码建议
## Generating code suggestions from comments
{% data reusables.copilot.generating-suggestions-from-comments %}
{% data reusables.copilot.create-c-file %}
1. 在 C# 文件中,键入以下注释。 {% data variables.product.prodname_copilot %} 将建议函数的实现。
1. In the C# file, type the following comment. {% data variables.product.prodname_copilot %} will suggest an implementation of the function.
```csharp{:copy}
using System.Xml.Linq;
@ -90,6 +89,6 @@ ms.locfileid: '147098023'
{% data reusables.copilot.enabling-or-disabling-vs %}
## 延伸阅读
## Further reading
- [{% data variables.product.prodname_copilot %}](https://copilot.github.com/)

Просмотреть файл

@ -1,6 +1,6 @@
---
title: GitHub Copilot 快速入门
intro: '{% data variables.product.prodname_copilot %} 通过在你编写代码时提供内联建议,为你的工作提供帮助。'
title: Quickstart for GitHub Copilot
intro: '{% data variables.product.prodname_copilot %} can help you work, by offering inline suggestions as you code.'
product: '{% data reusables.gated-features.copilot %}'
allowTitleToDifferFromFilename: true
versions:
@ -8,60 +8,60 @@ versions:
shortTitle: Quickstart
topics:
- Copilot
ms.openlocfilehash: 5aa3071cddc2bf83e7ee7082eabea00f79a66ea5
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147079793'
---
## 简介
{% data variables.product.prodname_copilot %} 是 AI 结对程序员。 可以使用 {% data variables.product.prodname_copilot %} 在编辑器中获取整行或整个函数的建议。
## Introduction
本指南将介绍如何注册 {% data variables.product.prodname_copilot %},在 {% data variables.product.prodname_vscode %} 中安装 {% data variables.product.prodname_copilot %} 扩展,并获得第一个建议。 有关 {% data variables.product.prodname_copilot %} 的详细信息,请参阅“[关于 {% data variables.product.prodname_copilot %}](/copilot/overview-of-github-copilot/about-github-copilot)”。 有关如何在各种环境中使用 {% data variables.product.prodname_copilot %} 的更深入信息,请参阅“[入门](/copilot/getting-started-with-github-copilot)”。
{% data variables.product.prodname_copilot %} is an AI pair programmer. You can use {% data variables.product.prodname_copilot %} to get suggestions for whole lines or entire functions right inside your editor.
## 先决条件
This guide will show you how to sign up for {% data variables.product.prodname_copilot %}, install the {% data variables.product.prodname_copilot %} extension in {% data variables.product.prodname_vscode %}, and get your first suggestion. For more information on {% data variables.product.prodname_copilot %}, see "[About {% data variables.product.prodname_copilot %}](/copilot/overview-of-github-copilot/about-github-copilot)." For more in-depth information on how to use {% data variables.product.prodname_copilot %} in a variety of environments, see "[Getting Started](/copilot/getting-started-with-github-copilot)."
## Prerequisites
{% data reusables.copilot.copilot-prerequisites %}
- 若要在 {% data variables.product.prodname_vscode %} 中使用 {% data variables.product.prodname_copilot %},必须安装 {% data variables.product.prodname_vscode %}。 有关详细信息,请参阅 [{% data variables.product.prodname_vscode %}](https://code.visualstudio.com/) 文档。
- To use {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_vscode %}, you must have {% data variables.product.prodname_vscode %} installed. For more information, see the [{% data variables.product.prodname_vscode %}](https://code.visualstudio.com/) documentation.
## 注册 {% data variables.product.prodname_copilot %}
## Signing up for {% data variables.product.prodname_copilot %}
{% data reusables.copilot.signup-procedure %}
## 为 {% data variables.product.prodname_vscode %} 安装 {% data variables.product.prodname_copilot %} 扩展
## Installing the {% data variables.product.prodname_copilot %} extension for {% data variables.product.prodname_vscode %}
若要使用 {% data variables.product.prodname_copilot %},必须先安装 {% data variables.product.prodname_vscode %} 扩展。
To use {% data variables.product.prodname_copilot %}, you must first install the {% data variables.product.prodname_vscode %} extension.
1. 在 {% data variables.product.prodname_vscode %} 市场中,转到 [{% data variables.product.prodname_copilot %} 扩展](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot)页,然后单击“安装”。
![安装 {% data variables.product.prodname_copilot %} 扩展 {% data variables.product.prodname_vscode %}](/assets/images/help/copilot/install-copilot-extension-visual-studio-code.png)
1. 此时会显示一个弹出窗口,要求打开 {% data variables.product.prodname_vscode %}。 单击“打开 {% data variables.product.prodname_vscode %}”。
1. 在 {% data variables.product.prodname_vscode %} 的“扩展: {% data variables.product.prodname_copilot %}”选项卡中,单击“安装”。
![{% data variables.product.prodname_vscode %} 中的“安装”按钮](/assets/images/help/copilot/in-visual-studio-code-install-button.png)
1. 如果以前未在 {% data variables.product.prodname_dotcom %} 帐户中授权 {% data variables.product.prodname_vscode %},系统会提示你在 {% data variables.product.prodname_vscode %} 中登录到 {% data variables.product.prodname_dotcom %}。
- 如果以前已在 {% data variables.product.prodname_dotcom %} 帐户中授权 {% data variables.product.prodname_vscode %},系统将会自动授权 {% data variables.product.prodname_copilot %}。
![{% data variables.product.prodname_vscode %} 授权屏幕的屏幕截图](/assets/images/help/copilot/vsc-copilot-authorize.png)
1. 在浏览器中,{% data variables.product.prodname_dotcom %} 将请求 {% data variables.product.prodname_copilot %} 所需的权限。 若要批准这些权限,请单击“授权 {% data variables.product.prodname_vscode %}”。
1. 在 {% data variables.product.prodname_vscode %} 的“{% data variables.product.prodname_vscode %}”对话框中,若要确认身份验证,请单击“打开”。
1. In the {% data variables.product.prodname_vscode %} Marketplace, go to the [{% data variables.product.prodname_copilot %} extension](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) page and click **Install**.
![Install {% data variables.product.prodname_copilot %} extension {% data variables.product.prodname_vscode %}](/assets/images/help/copilot/install-copilot-extension-visual-studio-code.png)
1. A popup will appear, asking to open {% data variables.product.prodname_vscode %}. Click **Open {% data variables.product.prodname_vscode %}**.
1. In the "Extension: {% data variables.product.prodname_copilot %}" tab in {% data variables.product.prodname_vscode %}, click **Install**.
![Install button in {% data variables.product.prodname_vscode %}](/assets/images/help/copilot/in-visual-studio-code-install-button.png)
1. If you have not previously authorized {% data variables.product.prodname_vscode %} in your {% data variables.product.prodname_dotcom %} account, you will be prompted to sign in to {% data variables.product.prodname_dotcom %} in {% data variables.product.prodname_vscode %}.
- If you have previously authorized {% data variables.product.prodname_vscode %} in your {% data variables.product.prodname_dotcom %} account, {% data variables.product.prodname_copilot %} will be automatically authorized.
![Screen shot of {% data variables.product.prodname_vscode %} authorization screen](/assets/images/help/copilot/vsc-copilot-authorize.png)
1. In your browser, {% data variables.product.prodname_dotcom %} will request the necessary permissions for {% data variables.product.prodname_copilot %}. To approve these permissions, click **Authorize {% data variables.product.prodname_vscode %}**.
1. In {% data variables.product.prodname_vscode %}, in the "{% data variables.product.prodname_vscode %}" dialogue box, to confirm the authentication, click **Open**.
## 获得第一个建议
## Getting your first suggestion
{% data reusables.copilot.supported-languages %} 以下示例使用的是 JavaScript但其他语言的工作方式类似。
{% data reusables.copilot.code-examples-limitations %}
1. 打开 {% data variables.product.prodname_vscode %}。
{% data reusables.copilot.create-js-file %} {% data reusables.copilot.type-function-header %} {% data variables.product.prodname_copilot %} 将自动以灰色文本建议整个函数正文,如下所示。 具体的建议可能会有所不同。
![第一个建议 {% data variables.product.prodname_vscode %}](/assets/images/help/copilot/first-suggestion-visual-studio-code.png) {% data reusables.copilot.accept-suggestion %}
{% data reusables.copilot.supported-languages %} The following samples are in JavaScript, but other languages will work similarly.
## 后续步骤
1. Open {% data variables.product.prodname_vscode %}.
{% data reusables.copilot.create-js-file %}
{% data reusables.copilot.type-function-header %}
{% data variables.product.prodname_copilot %} will automatically suggest an entire function body in grayed text, as shown below. The exact suggestion may vary.
![First suggestion {% data variables.product.prodname_vscode %}](/assets/images/help/copilot/first-suggestion-visual-studio-code.png)
{% data reusables.copilot.accept-suggestion %}
你已成功安装 {% data variables.product.prodname_copilot %} 并收到了你的第一个建议,但这只是开始! 以下是一些有用的资源,可帮助你对 {% data variables.product.prodname_copilot %} 执行后续操作。
## Next Steps
- [入门](/copilot/getting-started-with-github-copilot):你已了解如何在 {% data variables.product.prodname_vscode %} 中获得你的第一个建议。 这些指南介绍了如何在所有受支持的环境中设置和导航 {% data variables.product.prodname_copilot %} 的各种功能。
- [{% data variables.product.prodname_copilot %}](https://copilot.github.com/):查看 {% data variables.product.prodname_copilot %} 如何帮助你工作的实用示例。
- [配置 {% data variables.product.prodname_copilot %}](/copilot/configuring-github-copilot):这些指南提供了有关如何将 {% data variables.product.prodname_copilot %} 配置为个人首选项的详细信息。
You successfully installed {% data variables.product.prodname_copilot %} and received your first suggestion, but that's just the beginning! Here are some helpful resources for taking your next steps with {% data variables.product.prodname_copilot %}.
- [Getting Started](/copilot/getting-started-with-github-copilot): You've learned how to get your first suggestion in {% data variables.product.prodname_vscode %}. These guides show you how to set up and navigate the various functions of {% data variables.product.prodname_copilot %} across all of the supported environments.
- [{% data variables.product.prodname_copilot %}](https://copilot.github.com/): See practical examples of how {% data variables.product.prodname_copilot %} can help you work.
- [Configuring {% data variables.product.prodname_copilot %}](/copilot/configuring-github-copilot): These guides provide details on how to configure {% data variables.product.prodname_copilot %} to your personal preferences.
## 延伸阅读
## Further reading
- [关于 {% data variables.product.prodname_copilot %}](/copilot/overview-of-github-copilot/about-github-copilot)
- [About {% data variables.product.prodname_copilot %}](/copilot/overview-of-github-copilot/about-github-copilot)

Просмотреть файл

@ -1,60 +1,89 @@
---
title: 使用讨论与维护者协作
title: Collaborating with maintainers using discussions
shortTitle: Collaborating with maintainers
intro: '您可以通过在讨论中与项目的维护者沟通,为 {% data variables.product.product_name %} 项目的目标、计划、运行状况和社区做出贡献。'
intro: 'You can contribute to the goals, plans, health, and community for a project on {% data variables.product.product_name %} by communicating with the maintainers of the project in a discussion.'
permissions: 'People with read access to a repository can start and participate in discussions and polls in the repository. People with read access to the source repository for organization discussions can start and participate in discussions and polls in the organization. {% data reusables.enterprise-accounts.emu-permission-interact %}'
versions:
feature: discussions
ms.openlocfilehash: f090088d55e946e67c1f0b5d790deca9fd794a90
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147410249'
---
## 关于使用 {% data variables.product.prodname_discussions %} 与维护者的协作
{% data reusables.discussions.about-discussions %} 如果您使用或参与某个项目,可以发起讨论,以提出建议,并就您的计划、问题、想法和反馈与维护者及社区成员进行互动。 有关详细信息,请参阅“[关于讨论](/discussions/collaborating-with-your-community-using-discussions/about-discussions)”。
## About collaboration with maintainers using {% data variables.product.prodname_discussions %}
{% data reusables.discussions.about-discussions %} If you use or contribute to a project, you can start a discussion to make suggestions and engage with maintainers and community members about your plans, questions, ideas, and feedback. For more information, see "[About discussions](/discussions/collaborating-with-your-community-using-discussions/about-discussions)."
{% data reusables.discussions.about-categories-and-formats %} {% data reusables.discussions.about-announcement-format %}
存储库管理员和项目维护者可以删除该存储库中的讨论。 同样,组织讨论的源存储库的管理员和维护者也可以删除该组织中的讨论。 有关详细信息,请参阅“[管理讨论](/discussions/managing-discussions-for-your-community/managing-discussions#deleting-a-discussion)”。
Repository administrators and project maintainers can delete a discussion in that repository. Similarly, administrators and maintainers of the source repository for an organization's discussions can delete a discussion in that organization. For more information, see "[Managing discussions](/discussions/managing-discussions-for-your-community/managing-discussions#deleting-a-discussion)."
{% data reusables.discussions.github-recognizes-members %} 这些成员出现在对项目讨论最有帮助的贡献者名单中。 随着项目的发展,您可以向社区的活动成员授予更高的访问权限。 有关详细信息,请参阅“[向顶级贡献者授予更高的权限](/discussions/guides/granting-higher-permissions-to-top-contributors)”。
{% data reusables.discussions.github-recognizes-members %} These members appear in a list of the most helpful contributors to the project's discussions. As your project grows, you can grant higher access permissions to active members of your community. For more information, see "[Granting higher permissions to top contributors](/discussions/guides/granting-higher-permissions-to-top-contributors)"
![对项目讨论最有帮助的贡献者](/assets/images/help/discussions/most-helpful.png)
![Most helpful contributors to discussions for a project](/assets/images/help/discussions/most-helpful.png)
有关参与讨论的详细信息,请参阅“[参与讨论](/discussions/collaborating-with-your-community-using-discussions/participating-in-a-discussion)”。
Community members can upvote discussions and top-level comments inside discussions to communicate with maintainers about ideas that matter to them. Project maintainers can then sort discussions and comments based on upvotes to gain insight into what community members value.
## 先决条件
For more information about participation in discussions, see "[Participating in a discussion](/discussions/collaborating-with-your-community-using-discussions/participating-in-a-discussion)."
要在存储库讨论中与维护者合作,存储库管理员或项目维护者必须启用存储库的 {% data variables.product.prodname_discussions %}。 有关详细信息,请参阅“[启用或禁用存储库的 {% data variables.product.prodname_discussions %}](/github/administering-a-repository/enabling-or-disabling-github-discussions-for-a-repository)”。
## Prerequisites
若要与组织讨论中的维护者开展协作,必须启用组织的 {% data variables.product.prodname_discussions %}。 有关详细信息,请参阅“[启用或禁用组织的 {% data variables.product.prodname_discussions %}](/organizations/managing-organization-settings/enabling-or-disabling-github-discussions-for-an-organization)”。
To collaborate with maintainers in repository discussions, a repository administrator or project maintainer must enable {% data variables.product.prodname_discussions %} for the repository. For more information, see "[Enabling or disabling {% data variables.product.prodname_discussions %} for a repository](/github/administering-a-repository/enabling-or-disabling-github-discussions-for-a-repository)."
## 开始讨论
To collaborate with maintainers in organization discussions, {% data variables.product.prodname_discussions %} must be enabled for the organization. For more information, see "[Enabling or disabling {% data variables.product.prodname_discussions %} for an organization](/organizations/managing-organization-settings/enabling-or-disabling-github-discussions-for-an-organization)."
## Starting a discussion
{% data reusables.discussions.starting-a-discussion %}
## 启动投票
## Starting a poll
{% data reusables.discussions.starting-a-poll %}
## 过滤讨论列表
## Filtering the list of discussions
你可以在存储库或组织中搜索讨论并筛选讨论列表。 有关详细信息,请参阅“[搜索讨论](/search-github/searching-on-github/searching-discussions)”。
You can search for discussions and filter the list of discussions in a repository or organization. For more information, see "[Searching discussions](/search-github/searching-on-github/searching-discussions)."
{% data reusables.discussions.navigate-to-repo-or-org %} {% data reusables.discussions.discussions-tab %}
1. 在“搜索所有讨论”字段中,键入搜索查询。 (可选)在搜索字段右侧,单击按钮以进一步过滤结果。
![用于筛选讨论的搜索栏和按钮](/assets/images/help/discussions/search-and-filter-controls.png)
1. 在讨论列表中,单击要查看的讨论。
![讨论搜索结果](/assets/images/help/discussions/search-result.png)
{% data reusables.discussions.navigate-to-repo-or-org %}
{% data reusables.discussions.discussions-tab %}
1. In the **Search all discussions** field, type a search query. Optionally, to the right of the search field, click a button to further filter the results.
![Search bar and buttons for filtering discussions](/assets/images/help/discussions/search-and-filter-controls.png)
1. In the list of discussions, click the discussion you want to view.
![Discussion search results](/assets/images/help/discussions/search-result.png)
## 将议题转换为讨论
## Sorting the list of discussions
{% data reusables.discussions.you-can-convert-an-issue %} 有关详细信息,请参阅“[主持讨论](/discussions/managing-discussions-for-your-community/moderating-discussions#converting-an-issue-to-a-discussion)”。
You can choose how to sort the list of discussions.
## 延伸阅读
{% data reusables.discussions.navigate-to-repo-or-org %}
{% data reusables.discussions.discussions-tab %}
1. To the right of the **Search all discussions** field, select **New**, or select **Top** and choose a time period from the drop down menu.
- [关于在 {% data variables.product.prodname_dotcom %} 上编写和设置格式](/github/writing-on-github/about-writing-and-formatting-on-github){%- ifversion fpt or ghec %}
- [维护 {% data variables.product.prodname_dotcom %} 上的安全](/communities/maintaining-your-safety-on-github){%- endif %}
![Buttons for sorting discussions](/assets/images/help/discussions/sort-discussions-buttons.png)
- Sort by **New** to display the discussions with the most recent activity at the top of the list.
- Sort by **Top** to display the discussions with the most upvotes at the top of the list. You can limit the list to only display discussions from a specific time period.
## Sorting top-level comments in discussions
You can choose how to sort top-level comments in discussions. Comment threads do not impact the order comments are sorted in.
{% data reusables.discussions.navigate-to-repo-or-org %}
{% data reusables.discussions.discussions-tab %}
{% data reusables.discussions.click-discussion-in-list %}
1. Under the main discussion post, select **Oldest**, **Newest**, or **Top**.
![Buttons for sorting comments in discussions](/assets/images/help/discussions/sort-comments-buttons.png)
- Sort by **Oldest** to display the oldest top-level comments first.
- Sort by **Newest** to display the newest top-level comments first.
- Sort by **Top** to display the most upvoted top-level comments first.
## Converting an issue to a discussion
{% data reusables.discussions.you-can-convert-an-issue %} For more information, see "[Moderating discussions](/discussions/managing-discussions-for-your-community/moderating-discussions#converting-an-issue-to-a-discussion)."
## Further reading
- "[About writing and formatting on {% data variables.product.prodname_dotcom %}](/github/writing-on-github/about-writing-and-formatting-on-github)"
{%- ifversion fpt or ghec %}
- "[Maintaining your safety on {% data variables.product.prodname_dotcom %}](/communities/maintaining-your-safety-on-github)"
{%- endif %}

Просмотреть файл

@ -1,40 +1,66 @@
---
title: 参与讨论
intro: '您可以在仓库的论坛中与社区和维护者交流 {% data variables.product.product_name %} 上的项目。'
title: Participating in a discussion
intro: 'You can converse with the community and maintainers in a forum within the repository for a project on {% data variables.product.product_name %}.'
permissions: 'People with read access to a repository can participate in discussions and polls in the repository. People with read access to the source repository for organization discussions can participate in discussions and polls in that organization. {% data reusables.enterprise-accounts.emu-permission-interact %}'
versions:
feature: discussions
shortTitle: Participate in discussion
ms.openlocfilehash: 07db8d3583c218e592ca1b68171292e52fcfc12f
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147410233'
---
## 关于参与讨论
{% data reusables.discussions.about-discussions %} 有关详细信息,请参阅“[关于讨论](/discussions/collaborating-with-your-community-using-discussions/about-discussions)”。
除了开始或查看讨论和投票之外,还可以对讨论作者的原始评论做出响应。 您还可以通过回复其他社区成员在讨论中进行的个人评论,以及使用表情符号对评论做出反应来创建评论线程。
## About participation in a discussion
{% ifversion fpt or ghec %}你可以阻止用户并报告破坏性内容,以便自己在 {% data variables.product.product_name %} 上保持一个安全愉快的环境。 有关详细信息,请参阅“[维护 {% data variables.product.prodname_dotcom %} 上的安全](/communities/maintaining-your-safety-on-github)”。{% endif %}
{% data reusables.discussions.about-discussions %} For more information, see "[About discussions](/discussions/collaborating-with-your-community-using-discussions/about-discussions)."
## 先决条件
In addition to starting or viewing discussions and polls, you can:
必须对存储库或组织启用 {% data variables.product.prodname_discussions %},才可以参与存储库或组织中的讨论。 有关更多信息,请参阅“[为存储库启用或禁用 {% data variables.product.prodname_discussions %}](/github/administering-a-repository/enabling-or-disabling-github-discussions-for-a-repository)”或“[为组织启用或禁用 GitHub Discussions](/organizations/managing-organization-settings/enabling-or-disabling-github-discussions-for-an-organization)”。
- Comment in response to the original comment from the author of the discussion
- Create a comment thread by replying to an individual comment that another community member made within the discussion
- React to comments with emoji
- Upvote discussions and top-level comments to give them more visibility
## 创建讨论
{% ifversion fpt or ghec %}You can block users and report disruptive content to maintain a safe and pleasant environment for yourself on {% data variables.product.product_name %}. For more information, see "[Maintaining your safety on {% data variables.product.prodname_dotcom %}](/communities/maintaining-your-safety-on-github)."{% endif %}
## Prerequisites
{% data variables.product.prodname_discussions %} must be enabled for the repository or organization for you to participate in a discussion in the repository or organization. For more information, see "[Enabling or disabling {% data variables.product.prodname_discussions %} for a repository](/github/administering-a-repository/enabling-or-disabling-github-discussions-for-a-repository)" and "[Enabling or disabling GitHub Discussions for an organization](/organizations/managing-organization-settings/enabling-or-disabling-github-discussions-for-an-organization)."
## Creating a discussion
{% data reusables.discussions.starting-a-discussion %}
## 创建投票
## Creating a poll
{% data reusables.discussions.starting-a-poll %}
## 将评论标记为答案
## Marking a comment as an answer
对于仓库具有分类角色或更高角色的讨论作者和用户可以将评论标记为仓库中讨论的答案。
同样,对于组织讨论的源存储库,具有会审角色或更高权限的讨论作者和用户可将评论标记为组织中讨论的答案。
Discussion authors and users with the triage role or greater for a repository can mark a comment as the answer to a discussion in the repository.
Similarly, discussion authors and users with the triage role or greater for the source repository for organization discussions can mark a comment as the answer to a discussion in the organization.
{% data reusables.discussions.marking-a-comment-as-an-answer %}
## Upvoting a discussion
You can upvote discussions to give more visibility to the topics that matter to you, and sort discussions to see which have been upvoted the most. For more information on sorting discussions, see "[Sorting the list of discussions](/discussions/collaborating-with-your-community-using-discussions/collaborating-with-maintainers-using-discussions#sorting-the-list-of-discussions)."
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.discussions.discussions-tab %}
1. In the list of discussions, find the discussion you want to upvote.
1. To the left of the discussion, click the upvote arrow.
![Discussion list and upvote button for upvoting discussions](/assets/images/help/discussions/upvote-discussion-button.png)
1. Optionally, click the upvote arrow again to remove your upvote.
## Upvoting a comment
You can upvote top-level comments in discussions, and sort top-level comments to see which comments have been upvoted the most. For more information on sorting comments, see "[Sorting top-level comments in discussions](/discussions/collaborating-with-your-community-using-discussions/collaborating-with-maintainers-using-discussions#sorting-top-level-comments-in-discussions)."
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.discussions.discussions-tab %}
{% data reusables.discussions.click-discussion-in-list %}
1. In the discussion, find a top-level comment you want to upvote.
1. Click on the upvote arrow at the bottom left of the comment.
![Top-level comment and upvote button for upvoting comments](/assets/images/help/discussions/upvote-comment-button.png)
1. Optionally, click the upvote arrow again to remove your upvote.

Просмотреть файл

@ -1,6 +1,6 @@
---
title: 禁用或限制组织的 GitHub Actions
intro: 组织所有者可禁用、启用和限制组织的 GitHub Actions。
title: Disabling or limiting GitHub Actions for your organization
intro: 'Organization owners can disable, enable, and limit GitHub Actions for an organization.'
redirect_from:
- /github/setting-up-and-managing-organizations-and-teams/disabling-or-limiting-github-actions-for-your-organization
versions:
@ -13,103 +13,144 @@ topics:
- Teams
shortTitle: Disable or limit actions
miniTocMaxHeadingLevel: 3
ms.openlocfilehash: b72b1e412906b1a2ec7520a9c939d5adefee7dd7
ms.sourcegitcommit: 1309b46201604c190c63bfee47dce559003899bf
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/10/2022
ms.locfileid: '147064680'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
## 关于组织的 {% data variables.product.prodname_actions %} 权限
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.disabling-github-actions %} 有关 {% data variables.product.prodname_actions %} 的详细信息,请参阅“[关于 {% data variables.product.prodname_actions %}](/actions/getting-started-with-github-actions/about-github-actions)”。
## About {% data variables.product.prodname_actions %} permissions for your organization
您可以对组织中的所有仓库启用 {% data variables.product.prodname_actions %}。 {% data reusables.actions.enabled-actions-description %} 你可以对组织中的所有存储库禁用 {% data variables.product.prodname_actions %}。 {% data reusables.actions.disabled-actions-description %}
{% data reusables.actions.disabling-github-actions %} For more information about {% data variables.product.prodname_actions %}, see "[About {% data variables.product.prodname_actions %}](/actions/getting-started-with-github-actions/about-github-actions)."
或者,可以对组织中的所有存储库启用 {% data variables.product.prodname_actions %},但限制工作流可以运行的操作{% ifversion actions-workflow-policy %}和可重用工作流{% endif %}。
You can enable {% data variables.product.prodname_actions %} for all repositories in your organization. {% data reusables.actions.enabled-actions-description %} You can disable {% data variables.product.prodname_actions %} for all repositories in your organization. {% data reusables.actions.disabled-actions-description %}
## 管理组织的 {% data variables.product.prodname_actions %} 权限
Alternatively, you can enable {% data variables.product.prodname_actions %} for all repositories in your organization but limit the actions {% ifversion actions-workflow-policy %}and reusable workflows{% endif %} a workflow can run.
可以选择对组织中的所有存储库禁用 {% data variables.product.prodname_actions %},或仅允许特定存储库。 还可以限制公共操作{% ifversion actions-workflow-policy %} 和可重用工作流{% endif %}的使用,让用户只能使用{% ifversion ghec or ghes or ghae %}企业{% else %}组织{% endif %}中现有的本地操作{% ifversion actions-workflow-policy %}和可重用工作流{% endif %}。
## Managing {% data variables.product.prodname_actions %} permissions for your organization
You can choose to disable {% data variables.product.prodname_actions %} for all repositories in your organization, or only allow specific repositories. You can also limit the use of public actions{% ifversion actions-workflow-policy %} and reusable workflows{% endif %}, so that people can only use local actions {% ifversion actions-workflow-policy %}and reusable workflows{% endif %} that exist in your {% ifversion ghec or ghes or ghae %}enterprise{% else %}organization{% endif %}.
{% note %}
注意:如果组织由具有替代策略的企业管理,则可能无法管理这些设置。 有关详细信息,请参阅“[在企业中强制实施 {% data variables.product.prodname_actions %} 的策略](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-github-actions-policies-for-your-enterprise)”。
**Note:** You might not be able to manage these settings if your organization is managed by an enterprise that has overriding policy. For more information, see "[Enforcing policies for {% data variables.product.prodname_actions %} in your enterprise](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-github-actions-policies-for-your-enterprise)."
{% endnote %}
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.organizations.settings-sidebar-actions-general %}
1. 在“Policies策略”下选择一个选项。
{% data reusables.profile.access_org %}
{% data reusables.profile.org_settings %}
{% data reusables.organizations.settings-sidebar-actions-general %}
1. Under "Policies", select an option.
{% indented_data_reference reusables.actions.actions-use-policy-settings spaces=3 %}
{% ifversion actions-workflow-policy %} ![为此组织设置操作策略](/assets/images/help/organizations/actions-policy-with-workflows.png) {%- else %} ![为此组织设置操作策略](/assets/images/help/organizations/actions-policy.png) {%- endif %}
1. 单击“ **保存**”。
{% ifversion actions-workflow-policy %}
![Set actions policy for this organization](/assets/images/help/organizations/actions-policy-with-workflows.png)
{%- else %}
![Set actions policy for this organization](/assets/images/help/organizations/actions-policy.png)
{%- endif %}
1. Click **Save**.
{% data reusables.actions.allow-specific-actions-intro %}
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.organizations.settings-sidebar-actions-general %}
1. 在“策略”下,选择 {% data reusables.actions.policy-label-for-select-actions-workflows %} 并向列表添加所需操作 {% ifversion actions-workflow-policy %} 和可重用工作流 {% endif %}。
{% data reusables.profile.access_org %}
{% data reusables.profile.org_settings %}
{% data reusables.organizations.settings-sidebar-actions-general %}
1. Under "Policies", select {% data reusables.actions.policy-label-for-select-actions-workflows %} and add your required actions{% ifversion actions-workflow-policy %} and reusable workflows{% endif %} to the list.
{% ifversion actions-workflow-policy %} ![将操作和可重用工作流添加到允许列表](/assets/images/help/organizations/actions-policy-allow-list-with-workflows.png) {%- elsif ghes %} ![将操作添加到允许列表](/assets/images/help/organizations/actions-policy-allow-list.png) {%- else %} ![将操作添加到允许列表](/assets/images/enterprise/github-ae/organizations/actions-policy-allow-list.png) {%- endif %}
1. 单击“ **保存**”。
{% ifversion actions-workflow-policy %}
![Add actions and reusable workflows to the allow list](/assets/images/help/organizations/actions-policy-allow-list-with-workflows.png)
{%- elsif ghes %}
![Add actions to the allow list](/assets/images/help/organizations/actions-policy-allow-list.png)
{%- else %}
![Add actions to the allow list](/assets/images/enterprise/github-ae/organizations/actions-policy-allow-list.png)
{%- endif %}
1. Click **Save**.
{% ifversion fpt or ghec %}
## 配置公共复刻工作流程所需的批准
## Configuring required approval for workflows from public forks
{% data reusables.actions.workflow-run-approve-public-fork %}
您可以使用以下程序为组织配置此行为。 修改此设置会覆盖企业级别的配置集。
You can configure this behavior for an organization using the procedure below. Modifying this setting overrides the configuration set at the enterprise level.
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.organizations.settings-sidebar-actions-general %} {% data reusables.actions.workflows-from-public-fork-setting %}
{% data reusables.profile.access_org %}
{% data reusables.profile.org_settings %}
{% data reusables.organizations.settings-sidebar-actions-general %}
{% data reusables.actions.workflows-from-public-fork-setting %}
{% data reusables.actions.workflow-run-approve-link %} {% endif %}
{% data reusables.actions.workflow-run-approve-link %}
{% endif %}
{% ifversion fpt or ghes or ghec %}
## 为私有仓库复刻启用工作流程
## Enabling workflows for private repository forks
{% data reusables.actions.private-repository-forks-overview %}
{% ifversion ghec or ghae or ghes %}如果对企业禁用了某个策略,则无法对组织启用该策略。{% endif %} 如果对组织禁用了某个策略,则无法对仓库启用该策略。 如果组织启用了某个策略,则可以对个别仓库禁用该策略。
{% ifversion ghec or ghae or ghes %}If a policy is disabled for an enterprise, it cannot be enabled for organizations.{% endif %} If a policy is disabled for an organization, it cannot be enabled for repositories. If an organization enables a policy, the policy can be disabled for individual repositories.
{% data reusables.actions.private-repository-forks-options %}
### 为组织配置私有复刻策略
### Configuring the private fork policy for an organization
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.organizations.settings-sidebar-actions-general %} {% data reusables.actions.private-repository-forks-configure %} {% endif %}
{% data reusables.profile.access_org %}
{% data reusables.profile.org_settings %}
{% data reusables.organizations.settings-sidebar-actions-general %}
{% data reusables.actions.private-repository-forks-configure %}
{% endif %}
## 为组织设置 `GITHUB_TOKEN` 的权限
## Setting the permissions of the `GITHUB_TOKEN` for your organization
{% data reusables.actions.workflow-permissions-intro %}
可以在组织或存储库的设置中为 `GITHUB_TOKEN` 设置默认权限。 如果你在组织设置中选择受限制的选项为默认值,那么在组织内的存储库设置中也会选择相同选项,并禁用允许选项。 如果你的组织属于 {% data variables.product.prodname_enterprise %} 帐户,并且在企业设置中选择了更受限制的默认值,则你将无法在组织设置中选择更宽松的默认值。
You can set the default permissions for the `GITHUB_TOKEN` in the settings for your organization or your repositories. If you select a restrictive option as the default in your organization settings, the same option is selected in the settings for repositories within your organization, and the permissive option is disabled. If your organization belongs to a {% data variables.product.prodname_enterprise %} account and a more restrictive default has been selected in the enterprise settings, you won't be able to select the more permissive default in your organization settings.
{% data reusables.actions.workflow-permissions-modifying %}
### 配置默认 `GITHUB_TOKEN` 权限
### Configuring the default `GITHUB_TOKEN` permissions
{% ifversion allow-actions-to-approve-pr-with-ent-repo %} 默认情况下,当你创建新组织时,`GITHUB_TOKEN` 仅对 `contents` 范围具有读取权限。
{% ifversion allow-actions-to-approve-pr-with-ent-repo %}
By default, when you create a new organization, `GITHUB_TOKEN` only has read access for the `contents` scope.
{% endif %}
{% data reusables.profile.access_profile %} {% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.organizations.settings-sidebar-actions-general %}
1. 在“工作流权限”下,选择是要让 `GITHUB_TOKEN` 对所有范围具有读写访问权限,还是仅对 `contents` 范围具有读取访问。
{% data reusables.profile.access_profile %}
{% data reusables.profile.access_org %}
{% data reusables.profile.org_settings %}
{% data reusables.organizations.settings-sidebar-actions-general %}
1. Under "Workflow permissions", choose whether you want the `GITHUB_TOKEN` to have read and write access for all scopes, or just read access for the `contents` scope.
![为此组织设置 GITHUB_TOKENN 权限](/assets/images/help/settings/actions-workflow-permissions-organization{% ifversion allow-actions-to-approve-pr %}-with-pr-{% ifversion allow-actions-to-approve-pr-with-ent-repo %}creation-{% endif %}approval{% endif %}.png)
1. 单击“保存”以应用设置。
{% ifversion allow-actions-to-approve-pr %}
{% ifversion allow-actions-to-approve-pr-with-ent-repo %}
![Set GITHUB_TOKEN permissions for this organization](/assets/images/help/settings/actions-workflow-permissions-organization-with-pr-creation-approval.png)
{% else %}
![Set GITHUB_TOKEN permissions for this organization](/assets/images/help/settings/actions-workflow-permissions-organization-with-pr-approval.png)
{% endif %}
{% else %}
![Set GITHUB_TOKEN permissions for this organization](/assets/images/help/settings/actions-workflow-permissions-organization-with-pr-approval.png)
{% endif %}
1. Click **Save** to apply the settings.
{% ifversion allow-actions-to-approve-pr %}
### 防止 {% data variables.product.prodname_actions %} {% ifversion allow-actions-to-approve-pr-with-ent-repo %}创建或{% endif %}审批拉取请求
### Preventing {% data variables.product.prodname_actions %} from {% ifversion allow-actions-to-approve-pr-with-ent-repo %}creating or {% endif %}approving pull requests
{% data reusables.actions.workflow-pr-approval-permissions-intro %}
默认情况下,创建新组织时,不允许工作流{% ifversion allow-actions-to-approve-pr-with-ent-repo %}创建或{% endif %}审批拉取请求。
By default, when you create a new organization, workflows are not allowed to {% ifversion allow-actions-to-approve-pr-with-ent-repo %}create or {% endif %}approve pull requests.
{% data reusables.profile.access_profile %} {% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.organizations.settings-sidebar-actions-general %}
1. 在“工作流权限”下,使用“允许 GitHub Actions {% ifversion allow-actions-to-approve-pr-with-ent-repo %}创建和{% endif %}审批拉取请求”设置,以配置 `GITHUB_TOKEN` 是否可以{% ifversion allow-actions-to-approve-pr-with-ent-repo %}创建和{% endif %}审批拉取请求。
{% data reusables.profile.access_profile %}
{% data reusables.profile.access_org %}
{% data reusables.profile.org_settings %}
{% data reusables.organizations.settings-sidebar-actions-general %}
1. Under "Workflow permissions", use the **Allow GitHub Actions to {% ifversion allow-actions-to-approve-pr-with-ent-repo %}create and {% endif %}approve pull requests** setting to configure whether `GITHUB_TOKEN` can {% ifversion allow-actions-to-approve-pr-with-ent-repo %}create and {% endif %}approve pull requests.
![为此组织设置 GITHUB_TOKEN 拉取请求审批权限](/assets/images/help/settings/actions-workflow-permissions-organization{% ifversion allow-actions-to-approve-pr %}-with-pr-{% ifversion allow-actions-to-approve-pr-with-ent-repo %}creation-{% endif %}approval{% endif %}.png)
1. 单击“保存”以应用设置。
{% ifversion allow-actions-to-approve-pr %}
{% ifversion allow-actions-to-approve-pr-with-ent-repo %}
![Set GITHUB_TOKEN pull request approval permission for this organization](/assets/images/help/settings/actions-workflow-permissions-organization-with-pr-creation-approval.png)
{% else %}
![Set GITHUB_TOKEN pull request approval permission for this organization](/assets/images/help/settings/actions-workflow-permissions-organization-with-pr-approval.png)
{% endif %}
{% else %}
![Set GITHUB_TOKEN pull request approval permission for this organization](/assets/images/help/settings/actions-workflow-permissions-organization.png)
{% endif %}
1. Click **Save** to apply the settings.
{% endif %}

Просмотреть файл

@ -1,6 +1,6 @@
---
title: 管理组织的复刻政策
intro: '可以允许或阻止对组织拥有的任何私有{% ifversion ghes or ghae or ghec %}和内部{% endif %}存储库进行复刻。'
title: Managing the forking policy for your organization
intro: 'You can allow or prevent the forking of any private{% ifversion ghes or ghae or ghec %} and internal{% endif %} repositories owned by your organization.'
redirect_from:
- /articles/allowing-people-to-fork-private-repositories-in-your-organization
- /github/setting-up-and-managing-organizations-and-teams/allowing-people-to-fork-private-repositories-in-your-organization
@ -15,24 +15,30 @@ topics:
- Organizations
- Teams
shortTitle: Manage forking policy
ms.openlocfilehash: 11aad8ee3c08b62f6bc352f91b6d804f35eee6e6
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/10/2022
ms.locfileid: '145099717'
---
默认情况下,新组织被配置为禁止对专用 {% ifversion ghes or ghec or ghae %} 和内部 {% endif %} 存储库创建分支。
如果允许在组织级别对专用 {% ifversion ghes or ghec or ghae %} 和内部 {% endif %} 存储库进行分支,还可以配置对特定专用 {% ifversion ghes or ghec or ghae %} 或内部 {% endif %} 存储库进行分支的功能。 有关详细信息,请参阅“[管理存储库的分支策略](/github/administering-a-repository/managing-the-forking-policy-for-your-repository)”。
By default, new organizations are configured to disallow the forking of private{% ifversion ghes or ghec or ghae %} and internal{% endif %} repositories.
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.profile.org_member_privileges %}
1. 在“存储库分支”下,选择“允许对专用 {% ifversion ghec or ghes or ghae %} 和内部 {% endif %} 存储库创建分支”。
If you allow forking of private{% ifversion ghes or ghec or ghae %} and internal{% endif %} repositories at the organization level, you can also configure the ability to fork a specific private{% ifversion ghes or ghec or ghae %} or internal{% endif %} repository. For more information, see "[Managing the forking policy for your repository](/github/administering-a-repository/managing-the-forking-policy-for-your-repository)."
{%- ifversion fpt %} ![允许或禁止在组织中创建分支的复选框](/assets/images/help/repository/allow-disable-forking-fpt.png) {%- elsif ghes or ghec or ghae %} ![允许或禁止在组织中创建分支的复选框](/assets/images/help/repository/allow-disable-forking-organization.png) {%- endif %}
6. 单击“ **保存**”。
{% ifversion org-owners-limit-forks-creation %}
{% ifversion ghec %}If your organization is owned by an enterprise account, you{% else %}You{% endif %} may not be able to configure this setting for your organization, if an enterprise owner has set a policy at the enterprise level. For more information, see "[Enforcing repository management policies in your enterprise](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise#enforcing-a-policy-for-forking-private-or-internal-repositories)."{% endif %}
## 延伸阅读
{% data reusables.profile.access_org %}
{% data reusables.profile.org_settings %}
{% data reusables.profile.org_member_privileges %}
1. Under "Repository forking", select **Allow forking of private {% ifversion ghec or ghes or ghae %}and internal {% endif %}repositories**.
- [关于分支](/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks)
- [组织的存储库角色](/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization)
{%- ifversion fpt %}
![Checkbox to allow or disallow forking in the organization](/assets/images/help/repository/allow-disable-forking-fpt.png)
{%- elsif ghes or ghec or ghae %}
![Checkbox to allow or disallow forking in the organization](/assets/images/help/repository/allow-disable-forking-organization.png)
{%- endif %}{% ifversion org-owners-limit-forks-creation %}
2. Optionally, if forking is enabled, you can specify where users are allowed to fork repositories. If your organization belongs to a {% data variables.product.prodname_enterprise %} account and a more restrictive default has been selected in the enterprise settings, you won't be able to select the more permissive default in your organization settings. Review the information about changing the setting and choose a policy.
![Screenshot showing the list of repository forking policy options](/assets/images/help/business-accounts/org-repository-forking-policy-settings.png){%- endif %}
3. Click **Save**.
## Further reading
- "[About forks](/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks)"
- "[Repository roles for an organization](/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization)"

Просмотреть файл

@ -47,7 +47,16 @@ To reduce the size of your CODEOWNERS file, consider using wildcard patterns to
## CODEOWNERS syntax
A CODEOWNERS file uses a pattern that follows most of the same rules used in [gitignore](https://git-scm.com/docs/gitignore#_pattern_format) files, with [some exceptions](#syntax-exceptions). The pattern is followed by one or more {% data variables.product.prodname_dotcom %} usernames or team names using the standard `@username` or `@org/team-name` format. Users and teams must have explicit `write` access to the repository, even if the team's members already have access.
{% warning %}
**Warning:** There are some syntax rules for gitignore files that *do not work* in CODEOWNERS files:
- Escaping a pattern starting with `#` using `\` so it is treated as a pattern and not a comment
- Using `!` to negate a pattern
- Using `[ ]` to define a character range
{% endwarning %}
A CODEOWNERS file uses a pattern that follows most of the same rules used in [gitignore](https://git-scm.com/docs/gitignore#_pattern_format) files. The pattern is followed by one or more {% data variables.product.prodname_dotcom %} usernames or team names using the standard `@username` or `@org/team-name` format. Users and teams must have explicit `write` access to the repository, even if the team's members already have access.
{% ifversion fpt or ghec%}In most cases, you{% else %}You{% endif %} can also refer to a user by an email address that has been added to their account on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.product.product_location %}{% endif %}, for example `user@example.com`. {% ifversion fpt or ghec %} You cannot use an email address to refer to a {% data variables.product.prodname_managed_user %}. For more information about {% data variables.product.prodname_managed_users %}, see "[About {% data variables.product.prodname_emus %}](/enterprise-cloud@latest/admin/identity-and-access-management/managing-iam-with-enterprise-managed-users/about-enterprise-managed-users){% ifversion fpt %}" in the {% data variables.product.prodname_ghe_cloud %} documentation.{% else %}."{% endif %}{% endif %}
@ -117,15 +126,6 @@ apps/ @octocat
/apps/github
```
{% warning %}
**Warning:** There are some syntax rules for gitignore files that *do not work* in CODEOWNERS files:
- Escaping a pattern starting with `#` using `\` so it is treated as a pattern and not a comment
- Using `!` to negate a pattern
- Using `[ ]` to define a character range
{% endwarning %}
## CODEOWNERS and branch protection
Repository owners can add branch protection rules to ensure that changed code is reviewed by the owners of the changed files. For more information, see "[About protected branches](/github/administering-a-repository/defining-the-mergeability-of-pull-requests/about-protected-branches)."

Просмотреть файл

@ -120,7 +120,11 @@ By default, when you create a new repository in your personal account, `GITHUB_T
{% data reusables.repositories.settings-sidebar-actions-general %}
1. Under "Workflow permissions", choose whether you want the `GITHUB_TOKEN` to have read and write access for all scopes, or just read access for the `contents` scope.
![Set GITHUB_TOKEN permissions for this repository](/assets/images/help/settings/actions-workflow-permissions-repository{% ifversion allow-actions-to-approve-pr-with-ent-repo %}-with-pr-approval{% endif %}.png)
{% ifversion allow-actions-to-approve-pr-with-ent-repo %}
![Set GITHUB_TOKEN permissions for this repository](/assets/images/help/settings/actions-workflow-permissions-repository-with-pr-approval.png)
{% else %}
![Set GITHUB_TOKEN permissions for this repository](/assets/images/help/settings/actions-workflow-permissions-repository.png)
{% endif %}
1. Click **Save** to apply the settings.

Просмотреть файл

@ -1,17 +1,11 @@
---
ms.openlocfilehash: bd2ea7e2ff0c8e9f60c3d011ee30573e3702cbed
ms.sourcegitcommit: 5b1461b419dbef60ae9dbdf8e905a4df30fc91b7
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/10/2022
ms.locfileid: "147876116"
---
{% ifversion ghae %} 要允许自托管运行器与 {% data variables.product.prodname_dotcom %} 通信,请将自托管运行器的 IP 地址或 IP 地址范围添加到 IP 允许列表。 有关详细信息,请参阅“[添加允许的 IP 地址](#adding-an-allowed-ip-address)”。
{% else %} {% warning %}
{% ifversion ghae %}
To allow your self-hosted runners to communicate with {% data variables.product.prodname_dotcom %}, add the IP address or IP address range of your self-hosted runners to the IP allow list. For more information, see "[Adding an allowed IP address](#adding-an-allowed-ip-address)."
{% else %}
{% warning %}
警告:如果使用 IP 允许列表,并且还希望使用 {% data variables.product.prodname_actions %},则必须使用自托管运行器。 有关详细信息,请参阅“[托管自己的运行器](/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners)”。
**Warning**: If you use an IP allow list and would also like to use {% data variables.product.prodname_actions %}, you must use self-hosted runners{% ifversion actions-hosted-runners %} or {% data variables.product.prodname_dotcom %}-hosted larger runners with a static IP address range{% endif %}. For more information, see "[Hosting your own runners](/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners)" {% ifversion actions-hosted-runners %} or "[Using larger runners](/actions/using-github-hosted-runners/using-larger-runners)"{% endif %}.
{% endwarning %}
要允许自托管运行器与 {% data variables.product.prodname_dotcom %} 通信,请将自托管运行器的 IP 地址或 IP 地址范围添加到 IP 允许列表。 有关详细信息,请参阅“[添加允许的 IP 地址](#adding-an-allowed-ip-address)”。
To allow your self-hosted {% ifversion actions-hosted-runners %}or larger hosted{% endif %} runners to communicate with {% data variables.product.prodname_dotcom %}, add the IP address or IP address range of your runners to the IP allow list. For more information, see "[Adding an allowed IP address](#adding-an-allowed-ip-address)."
{% endif %}

Просмотреть файл

@ -1,7 +1,7 @@
1. Under "{% data variables.product.prodname_secret_scanning_caps %}", under "Push protection", click **Enable all**.
![Screenshot showing how to enable push protection for {% data variables.product.prodname_secret_scanning %} for an organization](/assets/images/help/organizations/secret-scanning-enable-push-protection.png)
1. Optionally, click "Automatically enable for private repositories added to {% data variables.product.prodname_secret_scanning %}."{% ifversion push-protection-custom-link-orgs %}
{% ifversion ghec %}![Screenshot showing how to enable push protection for {% data variables.product.prodname_secret_scanning %} for an organization](/assets/images/help/organizations/secret-scanning-enable-push-protection-org.png){% elsif ghes > 3.4 or ghae > 3.4 %} ![Screenshot showing how to enable push protection for {% data variables.product.prodname_secret_scanning %} for an organization](/assets/images/help/organizations/secret-scanning-enable-push-protection-org-ghes.png){% endif %}
1. Optionally, click "Automatically enable for repositories added to {% data variables.product.prodname_secret_scanning %}."{% ifversion push-protection-custom-link-orgs %}
1. Optionally, to include a custom link in the message that members will see when they attempt to push a secret, select **Add a resource link in the CLI and web UI when a commit is blocked**, then type a URL, and click **Save link**.
{% ifversion push-protection-custom-link-orgs-beta %}{% indented_data_reference reusables.advanced-security.custom-link-beta spaces=3 %}{% endif %}
![Screenshot showing checkbox and text field for enabling a custom link](/assets/images/help/organizations/secret-scanning-custom-link.png){% endif %}
![Screenshot showing checkbox and text field for enabling a custom link](/assets/images/help/organizations/secret-scanning-custom-link.png){% endif %}

Просмотреть файл

@ -1,10 +1,2 @@
---
ms.openlocfilehash: af420b118bb0fcb0bdad8e2c88f02e5b546fa4f1
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: "147065224"
---
1. 在存储库的主页上,单击提交以导航到提交页面。
![突出显示了提交的存储库主页的屏幕截图](/assets/images/help/commits/commits-page.png)
1. On the main page of the repository, click {% octicon "history" aria-label="The history icon" %} **commits** to navigate to the commits page.
![Screenshot of the repository main page with the commits emphasized](/assets/images/help/commits/commits-page.png)