New translation batch for cn (#31088)
This commit is contained in:
@@ -174,10 +174,7 @@ translations/zh-CN/content/site-policy/github-terms/github-community-forum-code-
|
||||
translations/zh-CN/content/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-user-account.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/glossaries/internal.yml,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/graphql/ghes-3.1/graphql_previews.enterprise.yml,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/actions/self-hosted-runner-configure-runner-group-access.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/actions/self-hosted-runner-configure-runner-group.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/actions/self-hosted-runner-create-group.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/actions/self-hosted-runner-groups-add-to-enterprise-first-steps.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/actions/self-hosted-runner-groups-navigate-to-repo-org-enterprise.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/codespaces/about-billing-for-codespaces.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/codespaces/availability.md,file deleted because it no longer exists in main
|
||||
@@ -194,7 +191,6 @@ translations/zh-CN/data/reusables/education/upgrade-organization.md,file deleted
|
||||
translations/zh-CN/data/reusables/education/upgrade-page.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/enterprise-accounts/repository-visibility-policy.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/enterprise-licensing/you-can-sync-for-a-combined-view.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/enterprise_installation/upgrade-hardware-requirements.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/enterprise_management_console/username_normalization_sample.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/gated-features/advanced-security.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/gated-features/discussions.md,file deleted because it no longer exists in main
|
||||
@@ -202,8 +198,6 @@ translations/zh-CN/data/reusables/gated-features/security-center.md,file deleted
|
||||
translations/zh-CN/data/reusables/getting-started/learning-lab-enterprise.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/getting-started/learning-lab.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/open-source/open-source-learning-lab.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/organizations/organizations_include.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/package_registry/authenticate_with_pat_for_container_registry.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/pages/pages-builds-with-github-actions-public-beta.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/repositories/squash-and-rebase-linear-commit-hisitory.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/rest-reference/apps/oauth-applications.md,file deleted because it no longer exists in main
|
||||
@@ -232,71 +226,90 @@ translations/zh-CN/data/reusables/rest-reference/users/followers.md,file deleted
|
||||
translations/zh-CN/data/reusables/rest-reference/users/keys.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/rest-reference/webhooks/repos.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/security-center/beta.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/security-center/permissions.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/data/reusables/server-statistics/release-phase.md,file deleted because it no longer exists in main
|
||||
translations/zh-CN/content/account-and-profile/managing-subscriptions-and-notifications-on-github/managing-subscriptions-for-activity-on-github/managing-your-subscriptions.md,broken liquid tags
|
||||
translations/zh-CN/content/account-and-profile/managing-subscriptions-and-notifications-on-github/setting-up-notifications/configuring-notifications.md,rendering error
|
||||
translations/zh-CN/content/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/about-your-organizations-profile.md,broken liquid tags
|
||||
translations/zh-CN/content/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/about-your-organizations-profile.md,rendering error
|
||||
translations/zh-CN/content/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-settings-on-your-profile/showing-your-private-contributions-and-achievements-on-your-profile.md,rendering error
|
||||
translations/zh-CN/content/account-and-profile/setting-up-and-managing-your-personal-account-on-github/index.md,broken liquid tags
|
||||
translations/zh-CN/content/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-access-to-your-personal-repositories/inviting-collaborators-to-a-personal-repository.md,broken liquid tags
|
||||
translations/zh-CN/content/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-access-to-your-personal-repositories/removing-a-collaborator-from-a-personal-repository.md,broken liquid tags
|
||||
translations/zh-CN/content/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-access-to-your-personal-repositories/removing-yourself-from-a-collaborators-repository.md,broken liquid tags
|
||||
translations/zh-CN/content/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-personal-account-settings/changing-your-github-username.md,rendering error
|
||||
translations/zh-CN/content/actions/deployment/about-deployments/about-continuous-deployment.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-amazon-elastic-container-service.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-docker-to-azure-app-service.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-java-to-azure-app-service.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-net-to-azure-app-service.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-nodejs-to-azure-app-service.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-php-to-azure-app-service.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-python-to-azure-app-service.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-to-azure-kubernetes-service.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-to-azure-static-web-app.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-google-kubernetes-engine.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/creating-actions/creating-a-javascript-action.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/creating-actions/metadata-syntax-for-github-actions.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/deployment/about-deployments/about-continuous-deployment.md,rendering error
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-amazon-elastic-container-service.md,rendering error
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-docker-to-azure-app-service.md,rendering error
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-java-to-azure-app-service.md,rendering error
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-net-to-azure-app-service.md,rendering error
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-nodejs-to-azure-app-service.md,rendering error
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-php-to-azure-app-service.md,rendering error
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-python-to-azure-app-service.md,rendering error
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-to-azure-kubernetes-service.md,rendering error
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-to-azure-static-web-app.md,rendering error
|
||||
translations/zh-CN/content/actions/deployment/deploying-to-your-cloud-provider/deploying-to-google-kubernetes-engine.md,rendering error
|
||||
translations/zh-CN/content/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-hashicorp-vault.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/hosting-your-own-runners/about-self-hosted-runners.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/hosting-your-own-runners/adding-self-hosted-runners.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/hosting-your-own-runners/autoscaling-with-self-hosted-runners.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/hosting-your-own-runners/about-self-hosted-runners.md,rendering error
|
||||
translations/zh-CN/content/actions/hosting-your-own-runners/adding-self-hosted-runners.md,rendering error
|
||||
translations/zh-CN/content/actions/hosting-your-own-runners/autoscaling-with-self-hosted-runners.md,rendering error
|
||||
translations/zh-CN/content/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/learn-github-actions/contexts.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/learn-github-actions/understanding-github-actions.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/managing-workflow-runs/re-running-workflows-and-jobs.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/publishing-packages/publishing-docker-images.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups.md,rendering error
|
||||
translations/zh-CN/content/actions/hosting-your-own-runners/removing-self-hosted-runners.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/hosting-your-own-runners/using-labels-with-self-hosted-runners.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/learn-github-actions/contexts.md,rendering error
|
||||
translations/zh-CN/content/actions/learn-github-actions/environment-variables.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/learn-github-actions/expressions.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/learn-github-actions/finding-and-customizing-actions.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/learn-github-actions/understanding-github-actions.md,rendering error
|
||||
translations/zh-CN/content/actions/managing-workflow-runs/re-running-workflows-and-jobs.md,rendering error
|
||||
translations/zh-CN/content/actions/publishing-packages/publishing-docker-images.md,rendering error
|
||||
translations/zh-CN/content/actions/publishing-packages/publishing-nodejs-packages.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/quickstart.md,rendering error
|
||||
translations/zh-CN/content/actions/security-guides/automatic-token-authentication.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/security-guides/encrypted-secrets.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/security-guides/security-hardening-for-github-actions.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/using-github-hosted-runners/about-github-hosted-runners.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/using-github-hosted-runners/using-larger-runners.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/security-guides/automatic-token-authentication.md,rendering error
|
||||
translations/zh-CN/content/actions/security-guides/encrypted-secrets.md,rendering error
|
||||
translations/zh-CN/content/actions/security-guides/security-hardening-for-github-actions.md,rendering error
|
||||
translations/zh-CN/content/actions/using-github-hosted-runners/about-github-hosted-runners.md,rendering error
|
||||
translations/zh-CN/content/actions/using-github-hosted-runners/using-larger-runners.md,rendering error
|
||||
translations/zh-CN/content/actions/using-workflows/about-workflows.md,rendering error
|
||||
translations/zh-CN/content/actions/using-workflows/creating-starter-workflows-for-your-organization.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/using-workflows/events-that-trigger-workflows.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/using-workflows/reusing-workflows.md,rendering error
|
||||
translations/zh-CN/content/actions/using-workflows/workflow-commands-for-github-actions.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/using-workflows/sharing-workflows-secrets-and-runners-with-your-organization.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/using-workflows/triggering-a-workflow.md,broken liquid tags
|
||||
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,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-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,broken liquid tags
|
||||
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/restricting-network-traffic-to-your-enterprise.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/site-admin-dashboard.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/about-github-actions-for-enterprises.md,rendering error
|
||||
translations/zh-CN/content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-self-hosted-runners-for-your-enterprise.md,rendering error
|
||||
translations/zh-CN/content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/introducing-github-actions-to-your-enterprise.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/identity-and-access-management/managing-iam-for-your-enterprise/about-authentication-for-your-enterprise.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/about-enterprise-managed-users.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/about-support-for-your-idps-conditional-access-policy.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/migrating-from-saml-to-oidc.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/identity-and-access-management/using-saml-for-enterprise-iam/about-saml-for-enterprise-iam.md,rendering error
|
||||
translations/zh-CN/content/admin/identity-and-access-management/using-saml-for-enterprise-iam/saml-configuration-reference.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/about-the-audit-log-for-your-enterprise.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/about-the-audit-log-for-your-enterprise.md,rendering error
|
||||
translations/zh-CN/content/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise.md,rendering error
|
||||
translations/zh-CN/content/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/streaming-the-audit-log-for-your-enterprise.md,broken liquid tags
|
||||
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,broken liquid tags
|
||||
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-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
|
||||
translations/zh-CN/content/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account.md,broken liquid tags
|
||||
translations/zh-CN/content/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent.md,broken liquid tags
|
||||
translations/zh-CN/content/authentication/managing-commit-signature-verification/about-commit-signature-verification.md,broken liquid tags
|
||||
translations/zh-CN/content/authentication/managing-commit-signature-verification/displaying-verification-statuses-for-all-of-your-commits.md,broken liquid tags
|
||||
translations/zh-CN/content/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account.md,rendering error
|
||||
translations/zh-CN/content/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent.md,rendering error
|
||||
translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/reviewing-your-deploy-keys.md,broken liquid tags
|
||||
translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/reviewing-your-security-log.md,broken liquid tags
|
||||
translations/zh-CN/content/authentication/managing-commit-signature-verification/about-commit-signature-verification.md,rendering error
|
||||
translations/zh-CN/content/authentication/managing-commit-signature-verification/displaying-verification-statuses-for-all-of-your-commits.md,rendering error
|
||||
translations/zh-CN/content/authentication/managing-commit-signature-verification/index.md,broken liquid tags
|
||||
translations/zh-CN/content/authentication/managing-commit-signature-verification/signing-commits.md,broken liquid tags
|
||||
translations/zh-CN/content/authentication/managing-commit-signature-verification/signing-tags.md,broken liquid tags
|
||||
@@ -304,7 +317,7 @@ translations/zh-CN/content/authentication/managing-commit-signature-verification
|
||||
translations/zh-CN/content/authentication/troubleshooting-commit-signature-verification/checking-your-commit-and-tag-signature-verification-status.md,broken liquid tags
|
||||
translations/zh-CN/content/billing/managing-billing-for-github-actions/about-billing-for-github-actions.md,broken liquid tags
|
||||
translations/zh-CN/content/billing/managing-billing-for-github-advanced-security/about-billing-for-github-advanced-security.md,broken liquid tags
|
||||
translations/zh-CN/content/billing/managing-billing-for-github-advanced-security/viewing-your-github-advanced-security-usage.md,broken liquid tags
|
||||
translations/zh-CN/content/billing/managing-billing-for-github-advanced-security/viewing-your-github-advanced-security-usage.md,rendering error
|
||||
translations/zh-CN/content/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces.md,broken liquid tags
|
||||
translations/zh-CN/content/billing/managing-billing-for-github-codespaces/index.md,broken liquid tags
|
||||
translations/zh-CN/content/billing/managing-billing-for-github-codespaces/managing-spending-limits-for-github-codespaces.md,broken liquid tags
|
||||
@@ -314,25 +327,40 @@ translations/zh-CN/content/billing/managing-billing-for-github-copilot/managing-
|
||||
translations/zh-CN/content/billing/managing-billing-for-your-github-account/about-per-user-pricing.md,rendering error
|
||||
translations/zh-CN/content/billing/managing-billing-for-your-github-account/connecting-an-azure-subscription-to-your-enterprise.md,broken liquid tags
|
||||
translations/zh-CN/content/billing/managing-billing-for-your-github-account/viewing-the-subscription-and-usage-for-your-enterprise-account.md,rendering error
|
||||
translations/zh-CN/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-with-codeql.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-alerts.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-with-codeql.md,rendering error
|
||||
translations/zh-CN/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning.md,rendering error
|
||||
translations/zh-CN/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/managing-code-scanning-alerts-for-your-repository.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/running-codeql-code-scanning-in-a-container.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/setting-up-code-scanning-for-a-repository.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/setting-up-code-scanning-for-a-repository.md,rendering error
|
||||
translations/zh-CN/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/tracking-code-scanning-alerts-in-issues-using-task-lists.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/triaging-code-scanning-alerts-in-pull-requests.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/troubleshooting-the-codeql-workflow.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/code-scanning/integrating-with-code-scanning/about-integration-with-code-scanning.md,broken liquid tags
|
||||
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/configuring-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,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,broken liquid tags
|
||||
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/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,broken liquid tags
|
||||
translations/zh-CN/content/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/secret-scanning/about-secret-scanning.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/secret-scanning/managing-alerts-from-secret-scanning.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/secret-scanning/protecting-pushes-with-secret-scanning.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/secret-scanning/pushing-a-branch-blocked-by-push-protection.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,broken liquid tags
|
||||
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/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
|
||||
translations/zh-CN/content/code-security/getting-started/github-security-features.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/getting-started/securing-your-repository.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/secret-scanning/about-secret-scanning.md,rendering error
|
||||
translations/zh-CN/content/code-security/secret-scanning/defining-custom-patterns-for-secret-scanning.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/secret-scanning/managing-alerts-from-secret-scanning.md,rendering error
|
||||
translations/zh-CN/content/code-security/secret-scanning/protecting-pushes-with-secret-scanning.md,rendering error
|
||||
translations/zh-CN/content/code-security/secret-scanning/pushing-a-branch-blocked-by-push-protection.md,rendering error
|
||||
translations/zh-CN/content/code-security/security-overview/about-the-security-overview.md,broken liquid tags
|
||||
translations/zh-CN/content/code-security/security-overview/viewing-the-security-overview.md,rendering error
|
||||
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,broken liquid tags
|
||||
translations/zh-CN/content/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph.md,broken liquid tags
|
||||
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,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
|
||||
translations/zh-CN/content/codespaces/codespaces-reference/security-in-github-codespaces.md,broken liquid tags
|
||||
@@ -385,48 +413,90 @@ translations/zh-CN/content/codespaces/troubleshooting/troubleshooting-dotfiles-f
|
||||
translations/zh-CN/content/codespaces/troubleshooting/troubleshooting-prebuilds.md,broken liquid tags
|
||||
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/developers/apps/building-github-apps/authenticating-with-github-apps.md,broken liquid tags
|
||||
translations/zh-CN/content/communities/documenting-your-project-with-wikis/editing-wiki-content.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,broken liquid tags
|
||||
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,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
|
||||
translations/zh-CN/content/get-started/exploring-projects-on-github/following-organizations.md,broken liquid tags
|
||||
translations/zh-CN/content/get-started/learning-about-github/about-github-advanced-security.md,broken liquid tags
|
||||
translations/zh-CN/content/get-started/learning-about-github/about-github-advanced-security.md,rendering error
|
||||
translations/zh-CN/content/get-started/quickstart/be-social.md,broken liquid tags
|
||||
translations/zh-CN/content/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax.md,broken liquid tags
|
||||
translations/zh-CN/content/get-started/using-github/keyboard-shortcuts.md,broken liquid tags
|
||||
translations/zh-CN/content/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax.md,rendering error
|
||||
translations/zh-CN/content/get-started/writing-on-github/working-with-advanced-formatting/attaching-files.md,broken liquid tags
|
||||
translations/zh-CN/content/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions.md,broken liquid tags
|
||||
translations/zh-CN/content/graphql/guides/migrating-from-rest-to-graphql.md,broken liquid tags
|
||||
translations/zh-CN/content/graphql/overview/about-the-graphql-api.md,broken liquid tags
|
||||
translations/zh-CN/content/issues/planning-and-tracking-with-projects/automating-your-project/using-the-api-to-manage-projects.md,broken liquid tags
|
||||
translations/zh-CN/content/issues/planning-and-tracking-with-projects/managing-your-project/managing-visibility-of-your-projects.md,broken liquid tags
|
||||
translations/zh-CN/content/issues/tracking-your-work-with-issues/filtering-and-searching-issues-and-pull-requests.md,broken liquid tags
|
||||
translations/zh-CN/content/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue.md,broken liquid tags
|
||||
translations/zh-CN/content/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/reviewing-the-audit-log-for-your-organization.md,broken liquid tags
|
||||
translations/zh-CN/content/issues/tracking-your-work-with-issues/filtering-and-searching-issues-and-pull-requests.md,rendering error
|
||||
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,broken liquid tags
|
||||
translations/zh-CN/content/organizations/managing-access-to-your-organizations-repositories/adding-outside-collaborators-to-repositories-in-your-organization.md,broken liquid tags
|
||||
translations/zh-CN/content/organizations/managing-access-to-your-organizations-repositories/managing-an-individuals-access-to-an-organization-repository.md,broken liquid tags
|
||||
translations/zh-CN/content/organizations/managing-access-to-your-organizations-repositories/managing-team-access-to-an-organization-repository.md,broken liquid tags
|
||||
translations/zh-CN/content/organizations/managing-access-to-your-organizations-repositories/removing-an-outside-collaborator-from-an-organization-repository.md,broken liquid tags
|
||||
translations/zh-CN/content/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization.md,broken liquid tags
|
||||
translations/zh-CN/content/organizations/managing-access-to-your-organizations-repositories/viewing-people-with-access-to-your-repository.md,broken liquid tags
|
||||
translations/zh-CN/content/organizations/managing-organization-settings/allowing-project-visibility-changes-in-your-organization.md,broken liquid tags
|
||||
translations/zh-CN/content/packages/learn-github-packages/about-permissions-for-github-packages.md,broken liquid tags
|
||||
translations/zh-CN/content/packages/learn-github-packages/configuring-a-packages-access-control-and-visibility.md,broken liquid tags
|
||||
translations/zh-CN/content/packages/learn-github-packages/deleting-and-restoring-a-package.md,broken liquid tags
|
||||
translations/zh-CN/content/packages/learn-github-packages/introduction-to-github-packages.md,broken liquid tags
|
||||
translations/zh-CN/content/packages/learn-github-packages/viewing-packages.md,broken liquid tags
|
||||
translations/zh-CN/content/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions.md,broken liquid tags
|
||||
translations/zh-CN/content/packages/working-with-a-github-packages-registry/working-with-the-container-registry.md,broken liquid tags
|
||||
translations/zh-CN/content/packages/working-with-a-github-packages-registry/working-with-the-npm-registry.md,broken liquid tags
|
||||
translations/zh-CN/content/pages/getting-started-with-github-pages/creating-a-github-pages-site.md,broken liquid tags
|
||||
translations/zh-CN/content/organizations/managing-organization-settings/disabling-project-boards-in-your-organization.md,broken liquid tags
|
||||
translations/zh-CN/content/organizations/managing-organization-settings/integrating-jira-with-your-organization-project-board.md,broken liquid tags
|
||||
translations/zh-CN/content/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization.md,broken liquid tags
|
||||
translations/zh-CN/content/organizations/organizing-members-into-teams/managing-code-review-settings-for-your-team.md,broken liquid tags
|
||||
translations/zh-CN/content/packages/learn-github-packages/about-permissions-for-github-packages.md,rendering error
|
||||
translations/zh-CN/content/packages/learn-github-packages/configuring-a-packages-access-control-and-visibility.md,rendering error
|
||||
translations/zh-CN/content/packages/learn-github-packages/deleting-and-restoring-a-package.md,rendering error
|
||||
translations/zh-CN/content/packages/learn-github-packages/introduction-to-github-packages.md,rendering error
|
||||
translations/zh-CN/content/packages/learn-github-packages/viewing-packages.md,rendering error
|
||||
translations/zh-CN/content/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions.md,rendering error
|
||||
translations/zh-CN/content/packages/working-with-a-github-packages-registry/working-with-the-container-registry.md,rendering error
|
||||
translations/zh-CN/content/packages/working-with-a-github-packages-registry/working-with-the-npm-registry.md,rendering error
|
||||
translations/zh-CN/content/pages/getting-started-with-github-pages/creating-a-github-pages-site.md,rendering error
|
||||
translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request.md,broken liquid tags
|
||||
translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/configuring-autolinks-to-reference-external-resources.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/releasing-projects-on-github/managing-releases-in-a-repository.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/working-with-files/using-files/working-with-non-code-files.md,broken liquid tags
|
||||
translations/zh-CN/content/rest/guides/getting-started-with-the-rest-api.md,broken liquid tags
|
||||
translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-and-deleting-branches-within-your-repository.md,broken liquid tags
|
||||
translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch.md,broken liquid tags
|
||||
translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-dependency-changes-in-a-pull-request.md,broken liquid tags
|
||||
translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request.md,rendering error
|
||||
translations/zh-CN/content/repositories/archiving-a-github-repository/archiving-repositories.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-merging-for-pull-requests.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-rebasing-for-pull-requests.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-auto-merge-for-pull-requests-in-your-repository.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-suggestions-to-update-pull-request-branches.md,rendering error
|
||||
translations/zh-CN/content/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-the-automatic-deletion-of-branches.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners.md,rendering error
|
||||
translations/zh-CN/content/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes.md,rendering error
|
||||
translations/zh-CN/content/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-security-and-analysis-settings-for-your-repository.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/configuring-autolinks-to-reference-external-resources.md,rendering error
|
||||
translations/zh-CN/content/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository.md,rendering error
|
||||
translations/zh-CN/content/repositories/releasing-projects-on-github/about-releases.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/releasing-projects-on-github/comparing-releases.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/releasing-projects-on-github/linking-to-releases.md,broken liquid tags
|
||||
translations/zh-CN/content/repositories/releasing-projects-on-github/managing-releases-in-a-repository.md,rendering error
|
||||
translations/zh-CN/content/repositories/working-with-files/using-files/working-with-non-code-files.md,rendering error
|
||||
translations/zh-CN/content/rest/dependabot/index.md,broken liquid tags
|
||||
translations/zh-CN/content/rest/guides/getting-started-with-the-rest-api.md,rendering error
|
||||
translations/zh-CN/content/rest/overview/other-authentication-methods.md,broken liquid tags
|
||||
translations/zh-CN/content/rest/overview/permissions-required-for-github-apps.md,broken liquid tags
|
||||
translations/zh-CN/content/rest/overview/resources-in-the-rest-api.md,broken liquid tags
|
||||
translations/zh-CN/content/rest/repos/lfs.md,broken liquid tags
|
||||
translations/zh-CN/content/search-github/getting-started-with-searching-on-github/enabling-githubcom-repository-search-from-your-private-enterprise-environment.md,rendering error
|
||||
translations/zh-CN/content/search-github/searching-on-github/searching-issues-and-pull-requests.md,broken liquid tags
|
||||
translations/zh-CN/content/search-github/searching-on-github/searching-issues-and-pull-requests.md,rendering error
|
||||
translations/zh-CN/content/site-policy/privacy-policies/github-subprocessors-and-cookies.md,broken liquid tags
|
||||
translations/zh-CN/content/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-organization.md,broken liquid tags
|
||||
translations/zh-CN/content/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-personal-account.md,broken liquid tags
|
||||
translations/zh-CN/content/support/learning-about-github-support/about-github-support.md,broken liquid tags
|
||||
translations/zh-CN/content/support/learning-about-github-support/about-github-support.md,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/2-20/15.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/2-21/17.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/2-21/6.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/2-22/0.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/2-22/1.yml,rendering error
|
||||
@@ -440,24 +510,55 @@ translations/zh-CN/data/release-notes/enterprise-server/3-0/0.yml,rendering erro
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-0/1.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-0/2.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-0/3.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-1/0.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-1/1.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-1/2.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-1/4.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-2/0-rc1.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-2/0.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-2/17.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-3/0-rc1.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-3/0.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-3/12.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-4/0-rc1.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/github-ae/2021-03/2021-03-03.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/github-ae/2021-06/2021-12-06.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-4/0.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-4/1.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-4/2.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-4/3.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-4/4.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-4/5.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-4/6.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-4/7.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-4/8.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-5/0-rc1.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-5/4.yml,rendering error
|
||||
translations/zh-CN/data/release-notes/enterprise-server/3-6/0-rc1.yml,rendering error
|
||||
translations/zh-CN/data/reusables/actions/about-actions-for-enterprises.md,rendering error
|
||||
translations/zh-CN/data/reusables/actions/actions-audit-events-workflow.md,broken liquid tags
|
||||
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,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/self-hosted-runner-add-to-enterprise.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/actions/usage-workflow-run-time.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/actions/reusable-workflow-artifacts.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/actions/reusable-workflow-calling-syntax.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/actions/reusable-workflows.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/actions/runner-groups-add-to-enterprise-first-steps.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/actions/self-hosted-runner-add-to-enterprise.md,rendering error
|
||||
translations/zh-CN/data/reusables/actions/settings-ui/settings-actions-general.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/actions/settings-ui/settings-actions-runner-groups.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/actions/settings-ui/settings-actions-runners.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/actions/sidebar-secret.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/actions/usage-workflow-run-time.md,rendering error
|
||||
translations/zh-CN/data/reusables/actions/workflow-dispatch-inputs.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/actions/workflow-template-overview.md,rendering error
|
||||
translations/zh-CN/data/reusables/advanced-security/secret-scanning-add-custom-pattern-details.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/advanced-security/secret-scanning-create-custom-pattern.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/advanced-security/secret-scanning-push-protection-org.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/audit_log/audit-log-events-workflows.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/audit_log/audit-log-events-workflows.md,rendering error
|
||||
translations/zh-CN/data/reusables/audit_log/audit_log_sidebar_for_org_admins.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/audit_log/audit_log_sidebar_for_site_admins.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/code-scanning/codeql-languages-bullets.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/code-scanning/codeql-languages-keywords.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/code-scanning/example-configuration-files.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/code-scanning/licensing-note.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/code-scanning/run-additional-queries.md,broken liquid tags
|
||||
@@ -473,7 +574,10 @@ translations/zh-CN/data/reusables/codespaces/rebuild-command.md,broken liquid ta
|
||||
translations/zh-CN/data/reusables/codespaces/secrets-on-start.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/codespaces/use-chrome.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/codespaces/your-codespaces-procedure-step.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/dependabot/beta-security-and-version-updates.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/dependabot/default-dependencies-allow-ignore.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/dependabot/dependabot-secrets-button.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/dependabot/enabling-disabling-dependency-graph-private-repo.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/dotcom_billing/actions-packages-report-download-org-account.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/enterprise-accounts/actions-packages-report-download-enterprise-accounts.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/enterprise-accounts/billing-microsoft-ea-overview.md,broken liquid tags
|
||||
@@ -482,14 +586,41 @@ translations/zh-CN/data/reusables/enterprise-accounts/security-tab.md,broken liq
|
||||
translations/zh-CN/data/reusables/enterprise_enterprise_support/installing-releases.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/gated-features/code-scanning.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/gated-features/codespaces-classroom-articles.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/gated-features/secret-scanning-partner.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/gated-features/secret-scanning.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/gated-features/dependency-vulnerable-calls.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/gated-features/secret-scanning-partner.md,rendering error
|
||||
translations/zh-CN/data/reusables/gated-features/secret-scanning.md,rendering error
|
||||
translations/zh-CN/data/reusables/identity-and-permissions/ip-allow-lists-enable.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/notifications-v2/custom-notification-types.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/notifications/shared_state.md,rendering error
|
||||
translations/zh-CN/data/reusables/organizations/billing_plans.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/organizations/github-apps-settings-sidebar.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/organizations/member-privileges.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/organizations/repository-defaults.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/organizations/security-and-analysis.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/organizations/security.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/organizations/teams_sidebar.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/organizations/verified-domains.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/pages/sidebar-pages.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/pull_requests/resolving-conversations.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/release-notes/ghas-3.4-secret-scanning-known-issue.md,broken liquid tags
|
||||
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,broken liquid tags
|
||||
translations/zh-CN/data/reusables/repositories/repository-branches.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/repositories/sidebar-notifications.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/repositories/suggest-changes.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/saml/you-must-periodically-authenticate.md,rendering error
|
||||
translations/zh-CN/data/reusables/secret-scanning/partner-secret-list-private-repo.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/secret-scanning/partner-secret-list-private-repo.md,rendering error
|
||||
translations/zh-CN/data/reusables/secret-scanning/push-protection-web-ui-choice.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/secret-scanning/secret-list-private-push-protection.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/secret-scanning/secret-list-private-push-protection.md,rendering error
|
||||
translations/zh-CN/data/reusables/security-overview/permissions.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/user-settings/access_applications.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/user-settings/account_settings.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/user-settings/appearance-settings.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/user-settings/developer_settings.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/user-settings/emails.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/user-settings/organizations.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/user-settings/repo-tab.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/user-settings/saved_replies.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/user-settings/security-analysis.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/user-settings/security.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/user-settings/ssh.md,broken liquid tags
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 管理订阅
|
||||
intro: 为帮助您有效地管理通知,提供了多种取消订阅的方法。
|
||||
title: Managing your subscriptions
|
||||
intro: 'To help you manage your notifications efficiently, there are several ways to unsubscribe.'
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghes: '*'
|
||||
@@ -12,79 +12,73 @@ redirect_from:
|
||||
- /github/managing-subscriptions-and-notifications-on-github/managing-your-subscriptions
|
||||
- /github/managing-subscriptions-and-notifications-on-github/managing-subscriptions-for-activity-on-github/managing-your-subscriptions
|
||||
shortTitle: Manage your subscriptions
|
||||
ms.openlocfilehash: 750a3a9ad87ff9aa709b84a98f548d85d53072ee
|
||||
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/10/2022
|
||||
ms.locfileid: '145087363'
|
||||
---
|
||||
为了帮助了解订阅并决定是否取消订阅,请参阅“[查看订阅](/github/managing-subscriptions-and-notifications-on-github/viewing-your-subscriptions)”。
|
||||
To help you understand your subscriptions and decide whether to unsubscribe, see "[Viewing your subscriptions](/github/managing-subscriptions-and-notifications-on-github/viewing-your-subscriptions)."
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:可以选择忽略存储库,而不是取消订阅。 如果忽略仓库,将不会收到任何通知。 不建议忽略存储库,因为如果你被 @mentioned,你将不会收到通知。 {% ifversion fpt or ghec %} 如果遇到滥用行为并想要忽略存储库,请联系 {% data variables.contact.contact_support %} 以获取帮助。 {% data reusables.policies.abuse %}{% endif %}
|
||||
**Note:** Instead of unsubscribing, you have the option to ignore a repository. If you ignore a repository, you won't receive any notifications. We don't recommend ignoring repositories as you won't be notified if you're @mentioned. {% ifversion fpt or ghec %}If you're experiencing abuse and want to ignore a repository, please contact {% data variables.contact.contact_support %} so we can help. {% data reusables.policies.abuse %}{% endif %}
|
||||
|
||||
{% endnote %}
|
||||
|
||||
## 选择如何取消订阅
|
||||
## Choosing how to unsubscribe
|
||||
|
||||
若要快速取消关注(或取消订阅)存储库,请导航至 [github.com/watching](https://github.com/watching)查看你所关注的所有存储库。 有关详细信息,请参阅“[取消关注存储库](#unwatching-repositories)”。
|
||||
To unwatch (or unsubscribe from) repositories quickly, navigate to [github.com/watching](https://github.com/watching) to see all the repositories you're following. For more information, see "[Unwatching repositories](#unwatching-repositories)."
|
||||
|
||||
要同时取消订阅多个通知,您可以使用收件箱或订阅页面上取消订阅。 相比“Watched repositories(已关注仓库)”页面,这两个选项可提供有关您的订阅的更多上下文。
|
||||
To unsubscribe from multiple notifications at the same time, you can unsubscribe using your inbox or on the subscriptions page. Both of these options offer more context about your subscriptions than the "Watched repositories" page.
|
||||
|
||||
### 从收件箱中取消订阅的优点
|
||||
### Benefits of unsubscribing from your inbox
|
||||
|
||||
在收件箱中取消订阅通知时,您还有其他一些分类选项,并且可以按自定义过滤器和讨论类型来过滤通知。 有关详细信息,请参阅“[管理收件箱中的通知](/github/managing-subscriptions-and-notifications-on-github/managing-notifications-from-your-inbox)”。
|
||||
When you unsubscribe from notifications in your inbox, you have several other triaging options and can filter your notifications by custom filters and discussion types. For more information, see "[Managing notifications from your inbox](/github/managing-subscriptions-and-notifications-on-github/managing-notifications-from-your-inbox)."
|
||||
|
||||
### 从订阅页面取消订阅的优点
|
||||
### Benefits of unsubscribing from the subscriptions page
|
||||
|
||||
在订阅页面上取消订阅通知时,您可以查看更多已订阅的通知,并且可以按“最多最近订阅”或“最少最近订阅”对它们进行排序。
|
||||
When you unsubscribe from notifications on the subscriptions page, you can see more of the notifications you're subscribed to and sort them by "Most recently subscribed" or "Least recently subscribed".
|
||||
|
||||
订阅页将显示当前订阅的所有通知,包括在收件箱中标记为“完成”的通知。
|
||||
The subscriptions page shows you all of the notifications that you're currently subscribed to, including notifications that you have marked as **Done** in your inbox.
|
||||
|
||||
您只能按仓库和接收通知的原因过滤订阅。
|
||||
You can only filter your subscriptions by repository and the reason you're receiving the notification.
|
||||
|
||||
## 在收件箱中取消订阅通知
|
||||
## Unsubscribing from notifications in your inbox
|
||||
|
||||
当您取消订阅收件箱中的通知时,它们将自动从您的收件箱中消失。
|
||||
When you unsubscribe from notifications in your inbox, they will automatically disappear from your inbox.
|
||||
|
||||
{% data reusables.notifications.access_notifications %}
|
||||
1. 从通知收件箱中选择您想要取消订阅的通知。
|
||||
2. 单击“取消订阅”。
|
||||

|
||||
1. From the notifications inbox, select the notifications you want to unsubscribe to.
|
||||
2. Click **Unsubscribe.**
|
||||

|
||||
|
||||
## 从订阅页面取消订阅通知
|
||||
## Unsubscribing from notifications on the subscriptions page
|
||||
|
||||
{% data reusables.notifications.access_notifications %}
|
||||
1. 在左侧边栏存储库列表下的“管理通知”下拉菜单中单击“订阅”。
|
||||

|
||||
1. In the left sidebar, under the list of repositories, use the "Manage notifications" drop-down to click **Subscriptions**.
|
||||

|
||||
|
||||
2. 选择要取消订阅的通知。 单击右上角的“取消订阅”。
|
||||

|
||||
2. Select the notifications you want to unsubscribe to. In the top right, click **Unsubscribe.**
|
||||

|
||||
|
||||
## 取消关注仓库
|
||||
## Unwatching repositories
|
||||
|
||||
如果取消关注存储库,将取消订阅该存储库的未来更新,除非参与对话或被 @mentioned。
|
||||
When you unwatch a repository, you unsubscribe from future updates from that repository unless you participate in a conversation or are @mentioned.
|
||||
|
||||
{% data reusables.notifications.access_notifications %}
|
||||
1. 在左侧边栏存储库列表下的“管理通知”下拉菜单中单击“已关注的存储库”。
|
||||
1. In the left sidebar, under the list of repositories, use the "Manage notifications" drop-down to click **Watched repositories**.
|
||||
|
||||

|
||||

|
||||
|
||||
2. 在关注的仓库页面上,评估您关注的仓库后,选择是否:
|
||||
2. On the watched repositories page, after you've evaluated the repositories you're watching, choose whether to:
|
||||
|
||||
- 取消关注仓库
|
||||
- 忽略某仓库的所有通知
|
||||
- 如有启用,请自定义接收通知的事件类型({% data reusables.notifications-v2.custom-notification-types %})
|
||||
- Unwatch a repository
|
||||
- Ignore all notifications for a repository
|
||||
- If enabled, customize the types of event you receive notifications for ({% data reusables.notifications-v2.custom-notification-types %})
|
||||
|
||||
{%- ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5819 %}
|
||||
1. (可选)要取消订阅指定用户或组织拥有的所有存储库,请选择“全部取消关注”下拉列表,然后单击要取消订阅其存储库的组织 ****。 取消关注所有存储库的按钮仅在您正在关注超过 10 个存储库上的所有活动或自定义通知时才可用。
|
||||
{%- ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
1. Optionally, to unsubscribe from all repositories owned by a given user or organization, select the **Unwatch all** dropdown and click the organization whose repositories you'd like to unsubscribe from. The button to unwatch all repositories is only available if you are watching all activity or custom notifications on over 10 repositories.
|
||||
|
||||

|
||||

|
||||
|
||||
- 单击“取消关注”以确认要取消关注所选用户或组织拥有的存储库,或单击“取消”以取消关注 。
|
||||
- Click **Unwatch** to confirm that you want to unwatch the repositories owned by the selected user or organization, or click **Cancel** to cancel.
|
||||
|
||||

|
||||

|
||||
|
||||
{% endif %}
|
||||
|
||||
@@ -141,7 +141,7 @@ Email notifications from {% data variables.product.product_location %} contain t
|
||||
- There are updates in repositories or team discussions you're watching or in a conversation you're participating in. For more information, see "[About participating and watching notifications](#about-participating-and-watching-notifications)."
|
||||
- You gain access to a new repository or you've joined a new team. For more information, see "[Automatic watching](#automatic-watching)."
|
||||
- There are new {% data variables.product.prodname_dependabot_alerts %} in your repository. For more information, see "[{% data variables.product.prodname_dependabot_alerts %} notification options](#dependabot-alerts-notification-options)." {% ifversion fpt or ghec %}
|
||||
- There are workflow runs updates on repositories set up with {% data variables.product.prodname_actions %}. For more information, see "[{% data variables.product.prodname_actions %} notification options](#github-actions-notification-options)."{% endif %}{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5668 %}
|
||||
- There are workflow runs updates on repositories set up with {% data variables.product.prodname_actions %}. For more information, see "[{% data variables.product.prodname_actions %} notification options](#github-actions-notification-options)."{% endif %}{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
- There are new deploy keys added to repositories that belong to organizations that you're an owner of. For more information, see "[Organization alerts notification options](#organization-alerts-notification-options)."{% endif %}
|
||||
|
||||
## Automatic watching
|
||||
@@ -206,7 +206,7 @@ Choose how you want to receive workflow run updates for repositories that you ar
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5668 %}
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
## Organization alerts notification options
|
||||
|
||||
If you're an organization owner, you'll receive email notifications by default when organization members add new deploy keys to repositories within the organization. You can unsubscribe from these notifications. On the notification settings page, under "Organization alerts", unselect **Email**.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 邀请协作者参加个人仓库
|
||||
intro: '你可以{% ifversion fpt or ghec %}邀请用户成为{% else %}添加用户作为{% endif %}个人存储库的协作者。'
|
||||
title: Inviting collaborators to a personal repository
|
||||
intro: 'You can {% ifversion fpt or ghec %}invite users to become{% else %}add users as{% endif %} collaborators to your personal repository.'
|
||||
redirect_from:
|
||||
- /articles/how-do-i-add-a-collaborator
|
||||
- /articles/adding-collaborators-to-a-personal-repository
|
||||
@@ -18,49 +18,50 @@ topics:
|
||||
- Accounts
|
||||
- Repositories
|
||||
shortTitle: Invite collaborators
|
||||
ms.openlocfilehash: b8cf147e94d4dd0a76d0bebcb07a58d03d7cbc9e
|
||||
ms.sourcegitcommit: fb047f9450b41b24afc43d9512a5db2a2b750a2a
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/11/2022
|
||||
ms.locfileid: '145164797'
|
||||
---
|
||||
组织拥有的仓库可授予更细致的访问权限。 有关详细信息,请参阅“[对 {% data variables.product.prodname_dotcom %} 的访问权限](/articles/access-permissions-on-github)”。
|
||||
Repositories owned by an organization can grant more granular access. For more information, see "[Access permissions on {% data variables.product.prodname_dotcom %}](/articles/access-permissions-on-github)."
|
||||
|
||||
{% data reusables.organizations.org-invite-expiration %}
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
|
||||
如果您是 {% data variables.product.prodname_emu_enterprise %} 的成员,则只能邀请企业的其他成员与您协作。 {% data reusables.enterprise-accounts.emu-more-info-account %}
|
||||
If you're a member of an {% data variables.product.prodname_emu_enterprise %}, you can only invite other members of your enterprise to collaborate with you. {% data reusables.enterprise-accounts.emu-more-info-account %}
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:{% data variables.product.company_short %} 会限制在 24 小时内可受邀加入存储库的人数。 如果您超过此限制,请等待 24 小时后再邀请,或者创建一个组织以与更多的人协作。
|
||||
**Note:** {% data variables.product.company_short %} limits the number of people who can be invited to a repository within a 24-hour period. If you exceed this limit, either wait 24 hours or create an organization to collaborate with more people.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
1. 询问你邀请作为协助者的用户名。{% ifversion fpt or ghec %} 如果他们还没有用户名,他们可以注册 {% data variables.product.prodname_dotcom %}。有关详细信息,请参阅“[注册新的 {% data variables.product.prodname_dotcom %} 帐户](/articles/signing-up-for-a-new-github-account)”。{% endif %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5658%} {% data reusables.repositories.click-collaborators-teams %}
|
||||
1. 单击“邀请协作者”。
|
||||

|
||||
2. 在搜索字段中,开始键入您想邀请的人员的姓名,然后单击匹配列表中的姓名。
|
||||

|
||||
3. 单击“将 <NAME> 添加到存储库”。
|
||||
 {% else %}
|
||||
5. 在左侧边栏中,单击“协作者”。
|
||||

|
||||
6. 在 "Collaborators"(协作者)下,开始输入协作者的用户名。
|
||||
7. 从下拉菜单中选择协作者的用户名。
|
||||

|
||||
8. 单击“添加协作者”。
|
||||
 {% endif %} {% ifversion fpt or ghec %}
|
||||
9. 用户将会收到一封邀请他们参加仓库的电子邮件。 在接受邀请后,他们便对仓库具有协作者访问权限。
|
||||
1. Ask for the username of the person you're inviting as a collaborator.{% ifversion fpt or ghec %} If they don't have a username yet, they can sign up for {% data variables.product.prodname_dotcom %} For more information, see "[Signing up for a new {% data variables.product.prodname_dotcom %} account](/articles/signing-up-for-a-new-github-account)".{% endif %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4%}
|
||||
{% data reusables.repositories.click-collaborators-teams %}
|
||||
1. Click **Invite a collaborator**.
|
||||

|
||||
2. In the search field, start typing the name of person you want to invite, then click a name in the list of matches.
|
||||

|
||||
3. Click **Add NAME to REPOSITORY**.
|
||||

|
||||
{% else %}
|
||||
5. In the left sidebar, click **Collaborators**.
|
||||

|
||||
6. Under "Collaborators", start typing the collaborator's username.
|
||||
7. Select the collaborator's username from the drop-down menu.
|
||||

|
||||
8. Click **Add collaborator**.
|
||||

|
||||
{% endif %}
|
||||
{% ifversion fpt or ghec %}
|
||||
9. The user will receive an email inviting them to the repository. Once they accept your invitation, they will have collaborator access to your repository.
|
||||
{% endif %}
|
||||
|
||||
## 延伸阅读
|
||||
## Further reading
|
||||
|
||||
- “[个人帐户存储库的权限级别](/articles/permission-levels-for-a-user-account-repository/#collaborator-access-for-a-repository-owned-by-a-personal-account)”
|
||||
- [从个人存储库中删除协作者](/articles/removing-a-collaborator-from-a-personal-repository)
|
||||
- [从协作者的存储库中删除你自己](/articles/removing-yourself-from-a-collaborator-s-repository)
|
||||
- [将成员组织为团队](/organizations/organizing-members-into-teams)
|
||||
- "[Permission levels for a personal account repository](/articles/permission-levels-for-a-user-account-repository/#collaborator-access-for-a-repository-owned-by-a-personal-account)"
|
||||
- "[Removing a collaborator from a personal repository](/articles/removing-a-collaborator-from-a-personal-repository)"
|
||||
- "[Removing yourself from a collaborator's repository](/articles/removing-yourself-from-a-collaborator-s-repository)"
|
||||
- "[Organizing members into teams](/organizations/organizing-members-into-teams)"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 从个人仓库中删除协作者
|
||||
intro: 当您从项目中删除协作者时,他们将失去对您仓库的读取/写入权限。 如果仓库为私有并且该人员已创建复刻,则该复刻也将删除。
|
||||
title: Removing a collaborator from a personal repository
|
||||
intro: 'When you remove a collaborator from your project, they lose read/write access to your repository. If the repository is private and the person has created a fork, then that fork is also deleted.'
|
||||
redirect_from:
|
||||
- /articles/how-do-i-remove-a-collaborator
|
||||
- /articles/what-happens-when-i-remove-a-collaborator-from-my-private-repository
|
||||
@@ -21,28 +21,27 @@ topics:
|
||||
- Accounts
|
||||
- Repositories
|
||||
shortTitle: Remove a collaborator
|
||||
ms.openlocfilehash: 24b128b5858c695b0e559302fac05812d3218b8c
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '145164728'
|
||||
---
|
||||
## 删除私有仓库的复刻
|
||||
## Deleting forks of private repositories
|
||||
|
||||
尽管删除协作者时将删除私有仓库的复刻,但此人员将仍保留您仓库的任何本地克隆。
|
||||
While forks of private repositories are deleted when a collaborator is removed, the person will still retain any local clones of your repository.
|
||||
|
||||
## 删除为仓库做出贡献的人员的协作者权限
|
||||
## Removing collaborator permissions from a person contributing to a repository
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5658 %} {% data reusables.repositories.click-collaborators-teams %}
|
||||
4. 在要移除的协作者的右侧,单击 {% octicon "trash" aria-label="The trash icon" %}。
|
||||
 {% else %}
|
||||
3. 在左侧边栏中,单击“协作者和团队”。
|
||||

|
||||
4. 在要移除的协作者旁边,单击“X”图标。
|
||||
 {% endif %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
{% data reusables.repositories.click-collaborators-teams %}
|
||||
4. To the right of the collaborator you want to remove, click {% octicon "trash" aria-label="The trash icon" %}.
|
||||

|
||||
{% else %}
|
||||
3. In the left sidebar, click **Collaborators & teams**.
|
||||

|
||||
4. Next to the collaborator you want to remove, click the **X** icon.
|
||||

|
||||
{% endif %}
|
||||
|
||||
## 延伸阅读
|
||||
## Further reading
|
||||
|
||||
- [从团队中移除组织成员](/articles/removing-organization-members-from-a-team)
|
||||
- [从组织存储库中移除外部协作者](/articles/removing-an-outside-collaborator-from-an-organization-repository)
|
||||
- "[Removing organization members from a team](/articles/removing-organization-members-from-a-team)"
|
||||
- "[Removing an outside collaborator from an organization repository](/articles/removing-an-outside-collaborator-from-an-organization-repository)"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 从协作者的仓库中删除您自己
|
||||
intro: 如果您不再想要成为其他人仓库中的协作者,您可以删除自己。
|
||||
title: Removing yourself from a collaborator's repository
|
||||
intro: 'If you no longer want to be a collaborator on someone else''s repository, you can remove yourself.'
|
||||
redirect_from:
|
||||
- /leave-a-collaborative-repo
|
||||
- /leave-a-repo
|
||||
@@ -19,19 +19,15 @@ topics:
|
||||
- Accounts
|
||||
- Repositories
|
||||
shortTitle: Remove yourself
|
||||
ms.openlocfilehash: 3b760d7947d734d8fa6e1e366795ce698f9c0b7f
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '145164723'
|
||||
---
|
||||
{% data reusables.user-settings.access_settings %} {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5658 %}
|
||||
2. 在边栏的“代码、规划和自动化”部分,单击“{% octicon "repo" aria-label="The repo icon" %} 存储库”。
|
||||
{% data reusables.user-settings.access_settings %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
2. In the "Code, planning, and automation" section of the sidebar, click **{% octicon "repo" aria-label="The repo icon" %} Repositories**.
|
||||
{% else %}
|
||||
2. 在左侧边栏中,单击“存储库”。
|
||||
 {% endif %}
|
||||
3. 在要离开的存储库旁边,单击“离开”。
|
||||

|
||||
4. 仔细阅读警告,然后单击“I understand, leave this repository(我已了解,离开此仓库)”。
|
||||

|
||||
2. In the left sidebar, click **Repositories**.
|
||||

|
||||
{% endif %}
|
||||
3. Next to the repository you want to leave, click **Leave**.
|
||||

|
||||
4. Read the warning carefully, then click "I understand, leave this repository."
|
||||

|
||||
|
||||
@@ -3,7 +3,7 @@ title: 管理选项卡大小呈现首选项
|
||||
intro: 可以管理选项卡占个人帐户的空间数。
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghae: issue-5083
|
||||
ghae: '>= 3.4'
|
||||
ghes: '>=3.4'
|
||||
ghec: '*'
|
||||
topics:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 创建 JavaScript 操作
|
||||
intro: 在本指南中,您将了解如何使用操作工具包构建 JavaScript 操作。
|
||||
title: Creating a JavaScript action
|
||||
intro: 'In this guide, you''ll learn how to build a JavaScript action using the actions toolkit.'
|
||||
redirect_from:
|
||||
- /articles/creating-a-javascript-action
|
||||
- /github/automating-your-workflow-with-github-actions/creating-a-javascript-action
|
||||
@@ -16,54 +16,50 @@ topics:
|
||||
- Action development
|
||||
- JavaScript
|
||||
shortTitle: JavaScript action
|
||||
ms.openlocfilehash: c42dca4205519f6799d7f92b254b75696853b7f9
|
||||
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/10/2022
|
||||
ms.locfileid: '145084709'
|
||||
---
|
||||
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
## 简介
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
{% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
在本指南中,您将了解创建和使用打包的 JavaScript 操作所需的基本组件。 本指南的重点是打包操作所需的组件,因此很少讲操作代码的功能。 操作将在日志文件中打印“Hello World”或“Hello [who-to-greet]”(如果您提供自定义名称)。
|
||||
## Introduction
|
||||
|
||||
本指南使用 {% data variables.product.prodname_actions %} 工具包 Node.js 模块来加快开发速度。 有关详细信息,请参阅 [actions/toolkit](https://github.com/actions/toolkit) 存储库。
|
||||
In this guide, you'll learn about the basic components needed to create and use a packaged JavaScript action. To focus this guide on the components needed to package the action, the functionality of the action's code is minimal. The action prints "Hello World" in the logs or "Hello [who-to-greet]" if you provide a custom name.
|
||||
|
||||
完成此项目后,您应了解如何构建自己的 JavaScript 操作和在工作流程测试该操作。
|
||||
This guide uses the {% data variables.product.prodname_actions %} Toolkit Node.js module to speed up development. For more information, see the [actions/toolkit](https://github.com/actions/toolkit) repository.
|
||||
|
||||
Once you complete this project, you should understand how to build your own JavaScript action and test it in a workflow.
|
||||
|
||||
{% data reusables.actions.pure-javascript %}
|
||||
|
||||
{% data reusables.actions.context-injection-warning %}
|
||||
|
||||
## 先决条件
|
||||
## Prerequisites
|
||||
|
||||
在开始之前,您需要下载 Node.js 并创建公共 {% data variables.product.prodname_dotcom %} 仓库。
|
||||
Before you begin, you'll need to download Node.js and create a public {% data variables.product.prodname_dotcom %} repository.
|
||||
|
||||
1. 下载并安装 Node.js {% ifversion fpt or ghes > 3.3 or ghae-issue-5504 or ghec %}16.x{% else %}12.x{% endif %},其中包含 npm。
|
||||
1. Download and install Node.js {% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}16.x{% else %}12.x{% endif %}, which includes npm.
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-5504 or ghec %} https://nodejs.org/en/download/{% else %} https://nodejs.org/en/download/releases/{% endif %}
|
||||
{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}https://nodejs.org/en/download/{% else %}https://nodejs.org/en/download/releases/{% endif %}
|
||||
|
||||
1. 在 {% data variables.product.product_location %} 上创建一个新的公共仓库,并将其称为 "hello-world-javascript-action"。 有关详细信息,请参阅“[创建新存储库](/articles/creating-a-new-repository)”。
|
||||
1. Create a new public repository on {% data variables.product.product_location %} and call it "hello-world-javascript-action". For more information, see "[Create a new repository](/articles/creating-a-new-repository)."
|
||||
|
||||
1. 将仓库克隆到计算机。 有关详细信息,请参阅“[克隆存储库](/articles/cloning-a-repository)”。
|
||||
1. Clone your repository to your computer. For more information, see "[Cloning a repository](/articles/cloning-a-repository)."
|
||||
|
||||
1. 从您的终端,将目录更改为新仓库。
|
||||
1. From your terminal, change directories into your new repository.
|
||||
|
||||
```shell{:copy}
|
||||
cd hello-world-javascript-action
|
||||
```
|
||||
|
||||
1. 从你的终端,使用 npm 初始化目录以生成 `package.json` 文件。
|
||||
1. From your terminal, initialize the directory with npm to generate a `package.json` file.
|
||||
|
||||
```shell{:copy}
|
||||
npm init -y
|
||||
```
|
||||
|
||||
## 创建操作元数据文件
|
||||
## Creating an action metadata file
|
||||
|
||||
使用以下示例代码在 `hello-world-javascript-action` 目录中创建一个名为 `action.yml` 的新文件。 有关详细信息,请参阅“[{% data variables.product.prodname_actions %} 的元数据语法](/actions/creating-actions/metadata-syntax-for-github-actions)”。
|
||||
Create a new file named `action.yml` in the `hello-world-javascript-action` directory with the following example code. For more information, see "[Metadata syntax for {% data variables.product.prodname_actions %}](/actions/creating-actions/metadata-syntax-for-github-actions)."
|
||||
|
||||
```yaml{:copy}
|
||||
name: 'Hello World'
|
||||
@@ -77,38 +73,38 @@ outputs:
|
||||
time: # id of output
|
||||
description: 'The time we greeted you'
|
||||
runs:
|
||||
using: {% ifversion fpt or ghes > 3.3 or ghae-issue-5504 or ghec %}'node16'{% else %}'node12'{% endif %}
|
||||
using: {% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}'node16'{% else %}'node12'{% endif %}
|
||||
main: 'index.js'
|
||||
```
|
||||
|
||||
此文件定义 `who-to-greet` 输入和 `time` 输出。 它还告知操作运行程序如何开始运行此 JavaScript 操作。
|
||||
This file defines the `who-to-greet` input and `time` output. It also tells the action runner how to start running this JavaScript action.
|
||||
|
||||
## 添加操作工具包
|
||||
## Adding actions toolkit packages
|
||||
|
||||
操作工具包是 Node.js 包的集合,可让您以更高的一致性快速构建 JavaScript 操作。
|
||||
The actions toolkit is a collection of Node.js packages that allow you to quickly build JavaScript actions with more consistency.
|
||||
|
||||
工具包 [`@actions/core`](https://github.com/actions/toolkit/tree/main/packages/core) 包为工作流命令、输入和输出变量、退出状态和调试消息提供了一个接口。
|
||||
The toolkit [`@actions/core`](https://github.com/actions/toolkit/tree/main/packages/core) package provides an interface to the workflow commands, input and output variables, exit statuses, and debug messages.
|
||||
|
||||
工具包还提供了一个 [`@actions/github`](https://github.com/actions/toolkit/tree/main/packages/github) 包,用于返回经验证的 Octokit REST 客户端和访问 GitHub Actions 上下文。
|
||||
The toolkit also offers a [`@actions/github`](https://github.com/actions/toolkit/tree/main/packages/github) package that returns an authenticated Octokit REST client and access to GitHub Actions contexts.
|
||||
|
||||
该工具包提供的不仅仅是 `core` 和 `github` 包。 有关详细信息,请参阅 [actions/toolkit](https://github.com/actions/toolkit) 存储库。
|
||||
The toolkit offers more than the `core` and `github` packages. For more information, see the [actions/toolkit](https://github.com/actions/toolkit) repository.
|
||||
|
||||
在终端上,安装操作工具包 `core` 和 `github` 包。
|
||||
At your terminal, install the actions toolkit `core` and `github` packages.
|
||||
|
||||
```shell{:copy}
|
||||
npm install @actions/core
|
||||
npm install @actions/github
|
||||
```
|
||||
|
||||
现在,应会看到 `node_modules` 目录(包含你刚安装的模块)和 `package-lock.json` 文件(包含已安装模块的依赖项和每个已安装模块的版本)。
|
||||
Now you should see a `node_modules` directory with the modules you just installed and a `package-lock.json` file with the installed module dependencies and the versions of each installed module.
|
||||
|
||||
## 编写操作代码
|
||||
## Writing the action code
|
||||
|
||||
此操作使用工具包获取操作元数据文件中所需的 `who-to-greet` 输入变量,然后在日志的调试消息中打印“Hello [who-to-greet]”。 接下来,该脚本会获取当前时间并将其设置为作业中稍后运行的操作可以使用的输出变量。
|
||||
This action uses the toolkit to get the `who-to-greet` input variable required in the action's metadata file and prints "Hello [who-to-greet]" in a debug message in the log. Next, the script gets the current time and sets it as an output variable that actions running later in a job can use.
|
||||
|
||||
GitHub Actions 提供有关 web 挂钩实践、Git 引用、工作流程、操作和触发工作流程的人员的上下文信息。 要访问上下文信息,你可以使用 `github` 包。 您将编写的操作将打印 web 挂钩事件有效负载日志。
|
||||
GitHub Actions provide context information about the webhook event, Git refs, workflow, action, and the person who triggered the workflow. To access the context information, you can use the `github` package. The action you'll write will print the webhook event payload to the log.
|
||||
|
||||
使用以下代码添加名为 `index.js` 的新文件。
|
||||
Add a new file called `index.js`, with the following code.
|
||||
|
||||
{% raw %}
|
||||
```javascript{:copy}
|
||||
@@ -130,20 +126,20 @@ try {
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
如果在上述 `index.js` 示例中引发错误,`core.setFailed(error.message);` 将使用操作工具包 [`@actions/core`](https://github.com/actions/toolkit/tree/main/packages/core) 包记录消息并设置失败退出代码。 有关详细信息,请参阅“[为操作设置退出代码](/actions/creating-actions/setting-exit-codes-for-actions)”。
|
||||
If an error is thrown in the above `index.js` example, `core.setFailed(error.message);` uses the actions toolkit [`@actions/core`](https://github.com/actions/toolkit/tree/main/packages/core) package to log a message and set a failing exit code. For more information, see "[Setting exit codes for actions](/actions/creating-actions/setting-exit-codes-for-actions)."
|
||||
|
||||
## 创建自述文件
|
||||
## Creating a README
|
||||
|
||||
要让人们了解如何使用您的操作,您可以创建自述文件。 自述文件在您计划公开分享操作时最有用,但也是提醒您或您的团队如何使用该操作的绝佳方式。
|
||||
To let people know how to use your action, you can create a README file. A README is most helpful when you plan to share your action publicly, but is also a great way to remind you or your team how to use the action.
|
||||
|
||||
在 `hello-world-javascript-action` 目录中,创建一个用于指定以下信息的 `README.md` 文件:
|
||||
In your `hello-world-javascript-action` directory, create a `README.md` file that specifies the following information:
|
||||
|
||||
- 操作用途的详细说明。
|
||||
- 必需的输入和输出参数。
|
||||
- 可选输入和输出参数。
|
||||
- 操作使用的密钥。
|
||||
- 操作使用的环境变量。
|
||||
- 如何在工作流中使用操作的示例。
|
||||
- A detailed description of what the action does.
|
||||
- Required input and output arguments.
|
||||
- Optional input and output arguments.
|
||||
- Secrets the action uses.
|
||||
- Environment variables the action uses.
|
||||
- An example of how to use your action in a workflow.
|
||||
|
||||
```markdown{:copy}
|
||||
# Hello world javascript action
|
||||
@@ -169,13 +165,13 @@ with:
|
||||
who-to-greet: 'Mona the Octocat'
|
||||
```
|
||||
|
||||
## 提交、标记和推送操作到 GitHub
|
||||
## Commit, tag, and push your action to GitHub
|
||||
|
||||
{% data variables.product.product_name %} 下载运行时在工作流中运行的每个操作,并将其作为完整的代码包执行,然后才能使用 `run` 等工作流命令与运行器机器交互。 这意味着您必须包含运行 JavaScript 代码所需的所有包依赖项。 需要将工具包 `core` 和 `github` 包签入操作存储库。
|
||||
{% data variables.product.product_name %} downloads each action run in a workflow during runtime and executes it as a complete package of code before you can use workflow commands like `run` to interact with the runner machine. This means you must include any package dependencies required to run the JavaScript code. You'll need to check in the toolkit `core` and `github` packages to your action's repository.
|
||||
|
||||
从终端提交 `action.yml`、`index.js`、`node_modules`、`package.json`、`package-lock.json` 和 `README.md` 文件。 如果添加了列出 `node_modules` 的 `.gitignore` 文件,则需要删除该行以提交 `node_modules` 目录。
|
||||
From your terminal, commit your `action.yml`, `index.js`, `node_modules`, `package.json`, `package-lock.json`, and `README.md` files. If you added a `.gitignore` file that lists `node_modules`, you'll need to remove that line to commit the `node_modules` directory.
|
||||
|
||||
最佳做法是同时为操作版本添加版本标记。 有关对操作进行版本控制的详细信息,请参阅“[关于操作](/actions/automating-your-workflow-with-github-actions/about-actions#using-release-management-for-actions)”。
|
||||
It's best practice to also add a version tag for releases of your action. For more information on versioning your action, see "[About actions](/actions/automating-your-workflow-with-github-actions/about-actions#using-release-management-for-actions)."
|
||||
|
||||
```shell{:copy}
|
||||
git add action.yml index.js node_modules/* package.json package-lock.json README.md
|
||||
@@ -184,24 +180,24 @@ git tag -a -m "My first action release" v1.1
|
||||
git push --follow-tags
|
||||
```
|
||||
|
||||
签入 `node_modules` 目录可能会导致问题。 作为替代方法,可以使用名为 [`@vercel/ncc`](https://github.com/vercel/ncc) 的工具将代码和模块编译到一个用于分发的文件中。
|
||||
Checking in your `node_modules` directory can cause problems. As an alternative, you can use a tool called [`@vercel/ncc`](https://github.com/vercel/ncc) to compile your code and modules into one file used for distribution.
|
||||
|
||||
1. 通过在终端中运行此命令来安装 `vercel/ncc`。
|
||||
1. Install `vercel/ncc` by running this command in your terminal.
|
||||
`npm i -g @vercel/ncc`
|
||||
|
||||
1. 编译 `index.js` 文件。
|
||||
1. Compile your `index.js` file.
|
||||
`ncc build index.js --license licenses.txt`
|
||||
|
||||
你会看到一个包含代码和已编译模块的新 `dist/index.js` 文件。
|
||||
你还将看到随附的 `dist/licenses.txt` 文件,其中包含所用 `node_modules` 的所有许可证。
|
||||
You'll see a new `dist/index.js` file with your code and the compiled modules.
|
||||
You will also see an accompanying `dist/licenses.txt` file containing all the licenses of the `node_modules` you are using.
|
||||
|
||||
1. 更改 `action.yml` 文件中的 `main` 关键字以使用新的 `dist/index.js` 文件。
|
||||
1. Change the `main` keyword in your `action.yml` file to use the new `dist/index.js` file.
|
||||
`main: 'dist/index.js'`
|
||||
|
||||
1. 如果已签入 `node_modules` 目录,请将其删除。
|
||||
1. If you already checked in your `node_modules` directory, remove it.
|
||||
`rm -rf node_modules/*`
|
||||
|
||||
1. 从终端提交对 `action.yml`、`dist/index.js` 和 `node_modules` 文件的更新。
|
||||
1. From your terminal, commit the updates to your `action.yml`, `dist/index.js`, and `node_modules` files.
|
||||
```shell{:copy}
|
||||
git add action.yml dist/index.js node_modules/*
|
||||
git commit -m "Use vercel/ncc"
|
||||
@@ -209,17 +205,17 @@ git tag -a -m "My first action release" v1.1
|
||||
git push --follow-tags
|
||||
```
|
||||
|
||||
## 在工作流程中测试您的操作
|
||||
## Testing out your action in a workflow
|
||||
|
||||
现在,您已准备好在工作流程中测试您的操作。 当某项操作位于专用存储库中时,该操作只能在同一存储库的工作流中使用。 位于任何存储库内的工作流均可使用公共操作。
|
||||
Now you're ready to test your action out in a workflow. When an action is in a private repository, the action can only be used in workflows in the same repository. Public actions can be used by workflows in any repository.
|
||||
|
||||
{% data reusables.actions.enterprise-marketplace-actions %}
|
||||
|
||||
### 使用公共操作的示例
|
||||
### Example using a public action
|
||||
|
||||
此示例显示您的新公共操作如何从外部仓库中运行。
|
||||
This example demonstrates how your new public action can be run from within an external repository.
|
||||
|
||||
将以下 YAML 复制到 `.github/workflows/main.yml` 处的新文件中,并使用你的用户名和你在上面创建的公共存储库的名称更新 `uses: octocat/hello-world-javascript-action@v1.1` 行。 还可以将 `who-to-greet` 输入替换为你的名称。
|
||||
Copy the following YAML into a new file at `.github/workflows/main.yml`, and update the `uses: octocat/hello-world-javascript-action@v1.1` line with your username and the name of the public repository you created above. You can also replace the `who-to-greet` input with your name.
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
@@ -241,13 +237,13 @@ jobs:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
当触发此工作流时,运行器将从你的公共存储库下载 `hello-world-javascript-action` 操作,然后执行它。
|
||||
When this workflow is triggered, the runner will download the `hello-world-javascript-action` action from your public repository and then execute it.
|
||||
|
||||
### 使用私有操作的示例
|
||||
### Example using a private action
|
||||
|
||||
将工作流代码复制到操作存储库中的 `.github/workflows/main.yml` 文件中。 还可以将 `who-to-greet` 输入替换为你的名称。
|
||||
Copy the workflow code into a `.github/workflows/main.yml` file in your action's repository. You can also replace the `who-to-greet` input with your name.
|
||||
|
||||
.github/workflows/main.yml
|
||||
**.github/workflows/main.yml**
|
||||
```yaml{:copy}
|
||||
on: [push]
|
||||
|
||||
@@ -270,6 +266,6 @@ jobs:
|
||||
run: echo "The time was {% raw %}${{ steps.hello.outputs.time }}{% endraw %}"
|
||||
```
|
||||
|
||||
从存储库中,单击“操作”选项卡,然后选择最新的工作流运行。 在“作业”下或可视化图中,单击“表示问候的作业” 。 应会看到“Hello Mona the Octocat”或你用于 `who-to-greet` 输入的名称以及日志中打印的时间戳。
|
||||
From your repository, click the **Actions** tab, and select the latest workflow run. Under **Jobs** or in the visualization graph, click **A job to say hello**. You should see "Hello Mona the Octocat" or the name you used for the `who-to-greet` input and the timestamp printed in the log.
|
||||
|
||||

|
||||

|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: GitHub Actions 的元数据语法
|
||||
title: Metadata syntax for GitHub Actions
|
||||
shortTitle: Metadata syntax
|
||||
intro: 可创建操作来执行存储库中的任务。 操作需要使用 YAML 语法的元数据文件。
|
||||
intro: You can create actions to perform tasks in your repository. Actions require a metadata file that uses YAML syntax.
|
||||
redirect_from:
|
||||
- /articles/metadata-syntax-for-github-actions
|
||||
- /github/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions
|
||||
@@ -14,40 +14,36 @@ versions:
|
||||
ghec: '*'
|
||||
type: reference
|
||||
miniTocMaxHeadingLevel: 4
|
||||
ms.openlocfilehash: b475c4066ae79836184f3136cfb06585fa761960
|
||||
ms.sourcegitcommit: b0323777cfe4324a09552d0ea268d1afacc3da37
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 08/17/2022
|
||||
ms.locfileid: '147580549'
|
||||
---
|
||||
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
## <a name="about-yaml-syntax-for--data-variablesproductprodname_actions-"></a>关于 {% data variables.product.prodname_actions %} 的 YAML 语法
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
{% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
所有操作都需要元数据文件。 元数据文件名必须为 `action.yml` 或 `action.yaml`。 元数据文件中的数据定义操作的输入、输出和运行配置。
|
||||
## About YAML syntax for {% data variables.product.prodname_actions %}
|
||||
|
||||
操作元数据文件使用 YAML 语法。 如果不熟悉 YAML,可以阅读“[用五分钟的时间来了解 YAML](https://www.codeproject.com/Articles/1214409/Learn-YAML-in-five-minutes)”。
|
||||
All actions require a metadata file. The metadata filename must be either `action.yml` or `action.yaml`. The data in the metadata file defines the inputs, outputs, and runs configuration for your action.
|
||||
|
||||
Action metadata files use YAML syntax. If you're new to YAML, you can read "[Learn YAML in five minutes](https://www.codeproject.com/Articles/1214409/Learn-YAML-in-five-minutes)."
|
||||
|
||||
## `name`
|
||||
|
||||
(必需)操作的名称。 {% data variables.product.prodname_dotcom %} 在“操作”选项卡中显示 `name`,以帮助直观地识别每个作业中的操作。
|
||||
**Required** The name of your action. {% data variables.product.prodname_dotcom %} displays the `name` in the **Actions** tab to help visually identify actions in each job.
|
||||
|
||||
## `author`
|
||||
|
||||
(可选)操作创建者的姓名。
|
||||
**Optional** The name of the action's author.
|
||||
|
||||
## `description`
|
||||
|
||||
(必需)操作的简短说明。
|
||||
**Required** A short description of the action.
|
||||
|
||||
## `inputs`
|
||||
|
||||
(可选)可通过输入参数指定操作预期在运行时使用的数据。 {% data variables.product.prodname_dotcom %} 将输入参数存储为环境变量。 大写的输入 ID 在运行时转换为小写。 建议使用小写输入 ID。
|
||||
**Optional** Input parameters allow you to specify data that the action expects to use during runtime. {% data variables.product.prodname_dotcom %} stores input parameters as environment variables. Input ids with uppercase letters are converted to lowercase during runtime. We recommended using lowercase input ids.
|
||||
|
||||
### <a name="example-specifying-inputs"></a>示例:指定输入
|
||||
### Example: Specifying inputs
|
||||
|
||||
此示例配置两个输入:numOctocats 和 octocatEyeColor。 numOctocats 输入不是必要的,默认值为 '1'。 octocatEyeColor 输入是必要的,没有默认值。 使用此操作的工作流文件必须使用 `with` 关键字来设置 octocatEyeColor 的输入值。 有关 `with` 语法的详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流语法](/articles/workflow-syntax-for-github-actions/#jobsjob_idstepswith)”。
|
||||
This example configures two inputs: numOctocats and octocatEyeColor. The numOctocats input is not required and will default to a value of '1'. The octocatEyeColor input is required and has no default value. Workflow files that use this action must use the `with` keyword to set an input value for octocatEyeColor. For more information about the `with` syntax, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/articles/workflow-syntax-for-github-actions/#jobsjob_idstepswith)."
|
||||
|
||||
```yaml
|
||||
inputs:
|
||||
@@ -60,43 +56,43 @@ inputs:
|
||||
required: true
|
||||
```
|
||||
|
||||
当在工作流文件中指定输入或使用默认输入值时,{% data variables.product.prodname_dotcom %} 将为输入创建一个名为 `INPUT_<VARIABLE_NAME>` 的环境变量。 创建的环境变量将输入名称转换为大写字母并将空格替换为 `_` 字符。
|
||||
When you specify an input in a workflow file or use a default input value, {% data variables.product.prodname_dotcom %} creates an environment variable for the input with the name `INPUT_<VARIABLE_NAME>`. The environment variable created converts input names to uppercase letters and replaces spaces with `_` characters.
|
||||
|
||||
如果操作是使用 [composite](/actions/creating-actions/creating-a-composite-action) 编写的,则不会自动获得 `INPUT_<VARIABLE_NAME>`。 如果不进行转换,您可以手动更改这些输入。
|
||||
If the action is written using a [composite](/actions/creating-actions/creating-a-composite-action), then it will not automatically get `INPUT_<VARIABLE_NAME>`. If the conversion doesn't occur, you can change these inputs manually.
|
||||
|
||||
若要访问 Docker 容器操作中的环境变量,必须使用操作元数据文件中的关键字 `args` 传递输入。 有关 Docker 容器操作的操作元数据文件的详细信息,请参阅“[创建 Docker 容器操作](/articles/creating-a-docker-container-action#creating-an-action-metadata-file)”。
|
||||
To access the environment variable in a Docker container action, you must pass the input using the `args` keyword in the action metadata file. For more information about the action metadata file for Docker container actions, see "[Creating a Docker container action](/articles/creating-a-docker-container-action#creating-an-action-metadata-file)."
|
||||
|
||||
例如,如果工作流定义了 `numOctocats` 和 `octocatEyeColor` 输入,则操作代码可以使用 `INPUT_NUMOCTOCATS` 和 `INPUT_OCTOCATEYECOLOR` 环境变量读取输入的值。
|
||||
For example, if a workflow defined the `numOctocats` and `octocatEyeColor` inputs, the action code could read the values of the inputs using the `INPUT_NUMOCTOCATS` and `INPUT_OCTOCATEYECOLOR` environment variables.
|
||||
|
||||
### `inputs.<input_id>`
|
||||
|
||||
(必需)与输入关联的 `string` 标识符。 `<input_id>` 的值为输入元数据的映射。 `<input_id>` 必须是 `inputs` 对象中的唯一标识符。 `<input_id>` 必须以字母或 `_` 开头,并且只能包含字母数字字符、`-` 或 `_`。
|
||||
**Required** A `string` identifier to associate with the input. The value of `<input_id>` is a map of the input's metadata. The `<input_id>` must be a unique identifier within the `inputs` object. The `<input_id>` must start with a letter or `_` and contain only alphanumeric characters, `-`, or `_`.
|
||||
|
||||
### `inputs.<input_id>.description`
|
||||
|
||||
(必需)输入参数的 `string` 说明。
|
||||
**Required** A `string` description of the input parameter.
|
||||
|
||||
### `inputs.<input_id>.required`
|
||||
|
||||
(可选)一个 `boolean`,用于指示操作是否需要输入参数。 如果需要参数,则将其设置为 `true`。
|
||||
**Optional** A `boolean` to indicate whether the action requires the input parameter. Set to `true` when the parameter is required.
|
||||
|
||||
### `inputs.<input_id>.default`
|
||||
|
||||
(可选)表示默认值的 `string`。 当工作流程文件中未指定输入参数时使用默认值。
|
||||
**Optional** A `string` representing the default value. The default value is used when an input parameter isn't specified in a workflow file.
|
||||
|
||||
### `inputs.<input_id>.deprecationMessage`
|
||||
|
||||
(可选)如果使用了输入参数,则会将此 `string` 记录为警告消息。 您可以使用此警告通知用户输入已被弃用,并提及任何其他替代方式。
|
||||
**Optional** If the input parameter is used, this `string` is logged as a warning message. You can use this warning to notify users that the input is deprecated and mention any alternatives.
|
||||
|
||||
## <a name="outputs-for-docker-container-and-javascript-actions"></a>用于 Docker 容器和 JavaScript 操作的 `outputs`
|
||||
## `outputs` for Docker container and JavaScript actions
|
||||
|
||||
(可选)可通过输出参数声明操作设置的数据。 稍后在工作流程中运行的操作可以使用以前运行操作中的输出数据集。 例如,如果有操作执行两个输入的相加 (x + y = z),则该操作可能输出总和 (z),用作其他操作的输入。
|
||||
**Optional** Output parameters allow you to declare data that an action sets. Actions that run later in a workflow can use the output data set in previously run actions. For example, if you had an action that performed the addition of two inputs (x + y = z), the action could output the sum (z) for other actions to use as an input.
|
||||
|
||||
{% data reusables.actions.output-limitations %}
|
||||
|
||||
如果不在操作元数据文件中声明输出,您仍然可以设置输出并在工作流程中使用它们。 有关在操作中设置输出的详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流命令](/actions/reference/workflow-commands-for-github-actions/#setting-an-output-parameter)”。
|
||||
If you don't declare an output in your action metadata file, you can still set outputs and use them in a workflow. For more information on setting outputs in an action, see "[Workflow commands for {% data variables.product.prodname_actions %}](/actions/reference/workflow-commands-for-github-actions/#setting-an-output-parameter)."
|
||||
|
||||
### <a name="example-declaring-outputs-for-docker-container-and-javascript-actions"></a>示例:声明 Docker 容器和 JavaScript 操作的输出
|
||||
### Example: Declaring outputs for Docker container and JavaScript actions
|
||||
|
||||
```yaml
|
||||
outputs:
|
||||
@@ -106,19 +102,19 @@ outputs:
|
||||
|
||||
### `outputs.<output_id>`
|
||||
|
||||
(必需)与输出关联的 `string` 标识符。 `<output_id>` 的值为输出元数据的映射。 `<output_id>` 必须是 `outputs` 对象中的唯一标识符。 `<output_id>` 必须以字母或 `_` 开头,并且只能包含字母数字字符、`-` 或 `_`。
|
||||
**Required** A `string` identifier to associate with the output. The value of `<output_id>` is a map of the output's metadata. The `<output_id>` must be a unique identifier within the `outputs` object. The `<output_id>` must start with a letter or `_` and contain only alphanumeric characters, `-`, or `_`.
|
||||
|
||||
### `outputs.<output_id>.description`
|
||||
|
||||
(必需)输出参数的 `string` 说明。
|
||||
**Required** A `string` description of the output parameter.
|
||||
|
||||
## <a name="outputs-for-composite-actions"></a>用于组合操作的 `outputs`
|
||||
## `outputs` for composite actions
|
||||
|
||||
(可选)`outputs` 使用与 `outputs.<output_id>` 和 `outputs.<output_id>.description` 相同的参数(请参阅“[用于 Docker 容器和 JavaScript 操作的 `outputs`](#outputs-for-docker-container-and-javascript-actions)”),但也包括 `value` 令牌。
|
||||
**Optional** `outputs` use the same parameters as `outputs.<output_id>` and `outputs.<output_id>.description` (see "[`outputs` for Docker container and JavaScript actions](#outputs-for-docker-container-and-javascript-actions)"), but also includes the `value` token.
|
||||
|
||||
{% data reusables.actions.output-limitations %}
|
||||
|
||||
### <a name="example-declaring-outputs-for-composite-actions"></a>示例:声明复合操作的 outputs
|
||||
### Example: Declaring outputs for composite actions
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -137,46 +133,46 @@ runs:
|
||||
|
||||
### `outputs.<output_id>.value`
|
||||
|
||||
(必需)输出参数将映射到的值。 可以将此项设置为 `string` 或带有上下文的表达式。 例如,可以使用 `steps` 上下文将输出的 `value` 设置为步骤的输出值。
|
||||
**Required** The value that the output parameter will be mapped to. You can set this to a `string` or an expression with context. For example, you can use the `steps` context to set the `value` of an output to the output value of a step.
|
||||
|
||||
有关如何使用上下文语法的详细信息,请参阅“[上下文](/actions/learn-github-actions/contexts)”。
|
||||
For more information on how to use context syntax, see "[Contexts](/actions/learn-github-actions/contexts)."
|
||||
|
||||
## `runs`
|
||||
|
||||
(必需)指定该操作是 JavaScript 操作、组合操作还是 Docker 容器操作,以及操作的执行方式。
|
||||
**Required** Specifies whether this is a JavaScript action, a composite action, or a Docker container action and how the action is executed.
|
||||
|
||||
## <a name="runs-for-javascript-actions"></a>JavaScript 操作的 `runs`
|
||||
## `runs` for JavaScript actions
|
||||
|
||||
(必需)配置操作代码的路径和用于执行代码的运行时。
|
||||
**Required** Configures the path to the action's code and the runtime used to execute the code.
|
||||
|
||||
### <a name="example-using-nodejs--ifversion-fpt-or-ghes--33-or-ghae-issue-5504-or-ghec-v16-else-v12-endif-"></a>示例:使用 Node.js {% ifversion fpt or ghes > 3.3 or ghae-issue-5504 or ghec %}v16{% else %}v12{% endif %}
|
||||
### Example: Using Node.js {% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}v16{% else %}v12{% endif %}
|
||||
|
||||
```yaml
|
||||
runs:
|
||||
using: {% ifversion fpt or ghes > 3.3 or ghae-issue-5504 or ghec %}'node16'{% else %}'node12'{% endif %}
|
||||
using: {% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}'node16'{% else %}'node12'{% endif %}
|
||||
main: 'main.js'
|
||||
```
|
||||
|
||||
### `runs.using`
|
||||
|
||||
(必需)用于执行 [`main`](#runsmain) 中指定的代码的运行时。
|
||||
**Required** The runtime used to execute the code specified in [`main`](#runsmain).
|
||||
|
||||
- 对于 Node.js v12.{% ifversion fpt or ghes > 3.3 or ghae-issue-5504 or ghec %},请使用 `node12`。
|
||||
- 对 Node.js v16.{% endif %},请使用 `node16`
|
||||
- Use `node12` for Node.js v12.{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}
|
||||
- Use `node16` for Node.js v16.{% endif %}
|
||||
|
||||
### `runs.main`
|
||||
|
||||
(必需)包含操作代码的文件。 [`using`](#runsusing) 中指定的运行时执行此文件。
|
||||
**Required** The file that contains your action code. The runtime specified in [`using`](#runsusing) executes this file.
|
||||
|
||||
### `runs.pre`
|
||||
|
||||
(可选)允许在 `main:` 操作开始之前在作业启动时运行脚本。 例如,可以使用 `pre:` 运行先决条件安装脚本。 使用 [`using`](#runsusing) 语法指定的运行时将执行此文件。 `pre:` 操作始终默认运行,但你也可使用 [`runs.pre-if`](#runspre-if) 替代该操作。
|
||||
**Optional** Allows you to run a script at the start of a job, before the `main:` action begins. For example, you can use `pre:` to run a prerequisite setup script. The runtime specified with the [`using`](#runsusing) syntax will execute this file. The `pre:` action always runs by default but you can override this using [`runs.pre-if`](#runspre-if).
|
||||
|
||||
在此示例中,`pre:` 操作运行名为 `setup.js` 的脚本:
|
||||
In this example, the `pre:` action runs a script called `setup.js`:
|
||||
|
||||
```yaml
|
||||
runs:
|
||||
using: {% ifversion fpt or ghes > 3.3 or ghae-issue-5504 or ghec %}'node16'{% else %}'node12'{% endif %}
|
||||
using: {% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}'node16'{% else %}'node12'{% endif %}
|
||||
pre: 'setup.js'
|
||||
main: 'index.js'
|
||||
post: 'cleanup.js'
|
||||
@@ -184,11 +180,11 @@ runs:
|
||||
|
||||
### `runs.pre-if`
|
||||
|
||||
(可选)允许定义 `pre:` 操作执行的条件。 仅当满足 `pre-if` 中的条件时,才会运行 `pre:` 操作。 如果未设置此项,则 `pre-if` 默认为 `always()`。 在 `pre-if` 中,状态检查函数根据作业的状态(而不是操作的状态)进行评估。
|
||||
**Optional** Allows you to define conditions for the `pre:` action execution. The `pre:` action will only run if the conditions in `pre-if` are met. If not set, then `pre-if` defaults to `always()`. In `pre-if`, status check functions evaluate against the job's status, not the action's own status.
|
||||
|
||||
请注意,`step` 上下文不可用,因为尚未运行任何步骤。
|
||||
Note that the `step` context is unavailable, as no steps have run yet.
|
||||
|
||||
在此示例中,`cleanup.js` 仅在基于 Linux 的运行器上运行:
|
||||
In this example, `cleanup.js` only runs on Linux-based runners:
|
||||
|
||||
```yaml
|
||||
pre: 'cleanup.js'
|
||||
@@ -197,47 +193,53 @@ runs:
|
||||
|
||||
### `runs.post`
|
||||
|
||||
(可选)允许在 `main:` 操作完成后在作业结束时运行脚本。 例如,可使用 `post:` 终止某些进程或删除不需要的文件。 使用 [`using`](#runsusing) 语法指定的运行时将执行此文件。
|
||||
**Optional** Allows you to run a script at the end of a job, once the `main:` action has completed. For example, you can use `post:` to terminate certain processes or remove unneeded files. The runtime specified with the [`using`](#runsusing) syntax will execute this file.
|
||||
|
||||
在此示例中,`post:` 操作运行名为 `cleanup.js` 的脚本:
|
||||
In this example, the `post:` action runs a script called `cleanup.js`:
|
||||
|
||||
```yaml
|
||||
runs:
|
||||
using: {% ifversion fpt or ghes > 3.3 or ghae-issue-5504 or ghec %}'node16'{% else %}'node12'{% endif %}
|
||||
using: {% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}'node16'{% else %}'node12'{% endif %}
|
||||
main: 'index.js'
|
||||
post: 'cleanup.js'
|
||||
```
|
||||
|
||||
`post:` 操作始终默认运行,但你也可使用 `post-if` 替代该操作。
|
||||
The `post:` action always runs by default but you can override this using `post-if`.
|
||||
|
||||
### `runs.post-if`
|
||||
|
||||
(可选)允许定义 `post:` 操作执行的条件。 仅当满足 `post-if` 中的条件时,才会运行 `post:` 操作。 如果未设置此项,则 `post-if` 默认为 `always()`。 在 `post-if` 中,状态检查函数根据作业的状态(而不是操作的状态)进行评估。
|
||||
**Optional** Allows you to define conditions for the `post:` action execution. The `post:` action will only run if the conditions in `post-if` are met. If not set, then `post-if` defaults to `always()`. In `post-if`, status check functions evaluate against the job's status, not the action's own status.
|
||||
|
||||
例如,此 `cleanup.js` 将仅在基于 Linux 的运行器上运行:
|
||||
For example, this `cleanup.js` will only run on Linux-based runners:
|
||||
|
||||
```yaml
|
||||
post: 'cleanup.js'
|
||||
post-if: runner.os == 'linux'
|
||||
```
|
||||
|
||||
## <a name="runs-for-composite-actions"></a>用于组合操作的 `runs`
|
||||
## `runs` for composite actions
|
||||
|
||||
(必需)配置组合操作的路径。
|
||||
**Required** Configures the path to the composite action.
|
||||
|
||||
### `runs.using`
|
||||
|
||||
(必需)必须将此值设置为 `'composite'`。
|
||||
**Required** You must set this value to `'composite'`.
|
||||
|
||||
### `runs.steps`
|
||||
|
||||
{% ifversion fpt or ghes > 3.2 or ghae or ghec %}“必需”计划在此操作中运行的步骤。 这些步骤可以是 `run` 步骤,也可以是 `uses` 步骤。
|
||||
{% else %}(必需)计划在此操作中运行的步骤。
|
||||
{% ifversion fpt or ghes > 3.2 or ghae or ghec %}
|
||||
**Required** The steps that you plan to run in this action. These can be either `run` steps or `uses` steps.
|
||||
{% else %}
|
||||
**Required** The steps that you plan to run in this action.
|
||||
{% endif %}
|
||||
|
||||
#### `runs.steps[*].run`
|
||||
|
||||
{% ifversion fpt or ghes > 3.2 or ghae or ghec %}“可选”要运行的命令。 此命令可以是内联命令,也可以是操作存储库中的脚本:{% else %}(必需)要运行的命令。 此命令可以是内联命令,也可以是操作存储库中的脚本:{% endif %}
|
||||
{% ifversion fpt or ghes > 3.2 or ghae or ghec %}
|
||||
**Optional** The command you want to run. This can be inline or a script in your action repository:
|
||||
{% else %}
|
||||
**Required** The command you want to run. This can be inline or a script in your action repository:
|
||||
{% endif %}
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -249,7 +251,7 @@ runs:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
也可使用 `$GITHUB_ACTION_PATH`:
|
||||
Alternatively, you can use `$GITHUB_ACTION_PATH`:
|
||||
|
||||
```yaml
|
||||
runs:
|
||||
@@ -259,24 +261,26 @@ runs:
|
||||
shell: bash
|
||||
```
|
||||
|
||||
有关详细信息,请参阅“[`github context`](/actions/reference/context-and-expression-syntax-for-github-actions#github-context)”。
|
||||
For more information, see "[`github context`](/actions/reference/context-and-expression-syntax-for-github-actions#github-context)".
|
||||
|
||||
#### `runs.steps[*].shell`
|
||||
|
||||
{% ifversion fpt or ghes > 3.2 or ghae or ghec %}“可选”要在其中运行命令的 shell。 可以使用[此处](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsshell)列出的任何 shell。 如果设置了 `run`,则为必需项。
|
||||
{% else %}(必需)要在其中运行命令的 shell。 可以使用[此处](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsshell)列出的任何 shell。 如果设置了 `run`,则为必需项。
|
||||
{% ifversion fpt or ghes > 3.2 or ghae or ghec %}
|
||||
**Optional** The shell where you want to run the command. You can use any of the shells listed [here](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsshell). Required if `run` is set.
|
||||
{% else %}
|
||||
**Required** The shell where you want to run the command. You can use any of the shells listed [here](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsshell). Required if `run` is set.
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-5504 or ghec %}
|
||||
{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}
|
||||
#### `runs.steps[*].if`
|
||||
|
||||
(可选)可以使用 `if` 条件来阻止步骤运行,除非满足条件。 您可以使用任何支持上下文和表达式来创建条件。
|
||||
**Optional** You can use the `if` conditional to prevent a step from running unless a condition is met. You can use any supported context and expression to create a conditional.
|
||||
|
||||
{% data reusables.actions.expression-syntax-if %} 有关详细信息,请参阅“[表达式](/actions/learn-github-actions/expressions)”。
|
||||
{% data reusables.actions.expression-syntax-if %} For more information, see "[Expressions](/actions/learn-github-actions/expressions)."
|
||||
|
||||
示例:使用上下文
|
||||
**Example: Using contexts**
|
||||
|
||||
此步骤仅在事件类型为 `pull_request` 且事件操作为 `unassigned` 时运行。
|
||||
This step only runs when the event type is a `pull_request` and the event action is `unassigned`.
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -284,9 +288,9 @@ steps:
|
||||
if: {% raw %}${{ github.event_name == 'pull_request' && github.event.action == 'unassigned' }}{% endraw %}
|
||||
```
|
||||
|
||||
示例:使用状态检查函数
|
||||
**Example: Using status check functions**
|
||||
|
||||
`my backup step` 仅在组合操作的上一步失败时运行。 有关详细信息,请参阅“[表达式](/actions/learn-github-actions/expressions#status-check-functions)”。
|
||||
The `my backup step` only runs when the previous step of a composite action fails. For more information, see "[Expressions](/actions/learn-github-actions/expressions#status-check-functions)."
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -300,31 +304,31 @@ steps:
|
||||
|
||||
#### `runs.steps[*].name`
|
||||
|
||||
(可选)组合步骤的名称。
|
||||
**Optional** The name of the composite step.
|
||||
|
||||
#### `runs.steps[*].id`
|
||||
|
||||
(可选)步骤的唯一标识符。 可以使用 `id` 在上下文中引用该步骤。 有关详细信息,请参阅“[上下文](/actions/learn-github-actions/contexts)”。
|
||||
**Optional** A unique identifier for the step. You can use the `id` to reference the step in contexts. For more information, see "[Contexts](/actions/learn-github-actions/contexts)."
|
||||
|
||||
#### `runs.steps[*].env`
|
||||
|
||||
(可选)仅为该步骤设置环境变量的 `map`。 如果要修改存储在工作流中的环境变量,请在组合步骤中使用 `echo "{name}={value}" >> $GITHUB_ENV`。
|
||||
**Optional** Sets a `map` of environment variables for only that step. If you want to modify the environment variable stored in the workflow, use `echo "{name}={value}" >> $GITHUB_ENV` in a composite step.
|
||||
|
||||
#### `runs.steps[*].working-directory`
|
||||
|
||||
(可选)指定在其中运行命令的工作目录。
|
||||
**Optional** Specifies the working directory where the command is run.
|
||||
|
||||
{% ifversion fpt or ghes > 3.2 or ghae or ghec %}
|
||||
#### `runs.steps[*].uses`
|
||||
|
||||
(可选)选择要作为作业中步骤的一部分运行的操作。 操作是一种可重复使用的代码单位。 可以使用在与工作流、公共存储库或[已发布的 Docker 容器映像](https://hub.docker.com/)相同的存储库中定义的操作。
|
||||
**Optional** Selects an action to run as part of a step in your job. An action is a reusable unit of code. You can use an action defined in the same repository as the workflow, a public repository, or in a [published Docker container image](https://hub.docker.com/).
|
||||
|
||||
强烈建议指定 Git ref、SHA 或 Docker 标记编号来包含所用操作的版本。 如果不指定版本,在操作所有者发布更新时可能会中断您的工作流程或造成非预期的行为。
|
||||
- 使用已发行操作版本的 SHA 对于稳定性和安全性是最安全的。
|
||||
- 使用特定主要操作版本可在保持兼容性的同时接收关键修复和安全补丁。 还可确保您的工作流程继续工作。
|
||||
- 使用操作的默认分支可能很方便,但如果有人新发布具有突破性更改的主要版本,您的工作流程可能会中断。
|
||||
We strongly recommend that you include the version of the action you are using by specifying a Git ref, SHA, or Docker tag number. If you don't specify a version, it could break your workflows or cause unexpected behavior when the action owner publishes an update.
|
||||
- Using the commit SHA of a released action version is the safest for stability and security.
|
||||
- Using the specific major action version allows you to receive critical fixes and security patches while still maintaining compatibility. It also assures that your workflow should still work.
|
||||
- Using the default branch of an action may be convenient, but if someone releases a new major version with a breaking change, your workflow could break.
|
||||
|
||||
某些操作需要必须使用 [`with`](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepswith) 关键字设置的输入。 请查阅操作的自述文件,确定所需的输入。
|
||||
Some actions require inputs that you must set using the [`with`](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepswith) keyword. Review the action's README file to determine the inputs required.
|
||||
|
||||
```yaml
|
||||
runs:
|
||||
@@ -350,7 +354,7 @@ runs:
|
||||
|
||||
#### `runs.steps[*].with`
|
||||
|
||||
(可选)由操作定义的输入参数的 `map`。 每个输入参数都是一个键/值对。 输入参数被设置为环境变量。 该变量的前缀为 INPUT_,并转换为大写。
|
||||
**Optional** A `map` of the input parameters defined by the action. Each input parameter is a key/value pair. For more information, see [Example: Specifying inputs](#example-specifying-inputs).
|
||||
|
||||
```yaml
|
||||
runs:
|
||||
@@ -365,19 +369,19 @@ runs:
|
||||
```
|
||||
{% endif %}
|
||||
|
||||
{% ifversion ghes > 3.5 or ghae-issue-6573 %}
|
||||
{% ifversion ghes > 3.5 or ghae > 3.5 %}
|
||||
|
||||
#### `runs.steps[*].continue-on-error`
|
||||
|
||||
可选 步骤失败时,防止操作失败。 设置为 `true` 以在此步骤失败时让操作能够通过。
|
||||
**Optional** Prevents the action from failing when a step fails. Set to `true` to allow the action to pass when this step fails.
|
||||
|
||||
{% endif %}
|
||||
|
||||
## <a name="runs-for-docker-container-actions"></a>用于 Docker 容器操作的 `runs`
|
||||
## `runs` for Docker container actions
|
||||
|
||||
(必需)配置用于 Docker 容器操作的映像。
|
||||
**Required** Configures the image used for the Docker container action.
|
||||
|
||||
### <a name="example-using-a-dockerfile-in-your-repository"></a>示例:在仓库中使用 Dockerfile
|
||||
### Example: Using a Dockerfile in your repository
|
||||
|
||||
```yaml
|
||||
runs:
|
||||
@@ -385,7 +389,7 @@ runs:
|
||||
image: 'Dockerfile'
|
||||
```
|
||||
|
||||
### <a name="example-using-public-docker-registry-container"></a>示例:使用公共 Docker 注册表容器
|
||||
### Example: Using public Docker registry container
|
||||
|
||||
```yaml
|
||||
runs:
|
||||
@@ -395,15 +399,15 @@ runs:
|
||||
|
||||
### `runs.using`
|
||||
|
||||
(必需)必须将此值设置为 `'docker'`。
|
||||
**Required** You must set this value to `'docker'`.
|
||||
|
||||
### `runs.pre-entrypoint`
|
||||
|
||||
(可选)允许在 `entrypoint` 操作开始之前运行脚本。 例如,可以使用 `pre-entrypoint:` 运行先决条件安装脚本。 {% data variables.product.prodname_actions %} 使用 `docker run` 启动此操作,并在使用相同基础映像的新容器中运行脚本。 这意味着运行时状态与主 `entrypoint` 容器不同,所需的任何状态都必须在工作区、`HOME` 中或作为 `STATE_` 变量可供访问。 `pre-entrypoint:` 操作始终默认运行,但你也可使用 [`runs.pre-if`](#runspre-if) 替代该操作。
|
||||
**Optional** Allows you to run a script before the `entrypoint` action begins. For example, you can use `pre-entrypoint:` to run a prerequisite setup script. {% data variables.product.prodname_actions %} uses `docker run` to launch this action, and runs the script inside a new container that uses the same base image. This means that the runtime state is different from the main `entrypoint` container, and any states you require must be accessed in either the workspace, `HOME`, or as a `STATE_` variable. The `pre-entrypoint:` action always runs by default but you can override this using [`runs.pre-if`](#runspre-if).
|
||||
|
||||
使用 [`using`](#runsusing) 语法指定的运行时将执行此文件。
|
||||
The runtime specified with the [`using`](#runsusing) syntax will execute this file.
|
||||
|
||||
在此示例中,`pre-entrypoint:` 操作运行名为 `setup.sh` 的脚本:
|
||||
In this example, the `pre-entrypoint:` action runs a script called `setup.sh`:
|
||||
|
||||
```yaml
|
||||
runs:
|
||||
@@ -417,21 +421,21 @@ runs:
|
||||
|
||||
### `runs.image`
|
||||
|
||||
(必需)要用作运行操作的容器的 Docker 映像。 该值可以是 Docker 基础映像名称、存储库中的本地 `Dockerfile`,也可以是 Docker Hub 或其他注册表中的公共映像。 若要引用存储库本地的 `Dockerfile`,文件必须命名为 `Dockerfile`,并且必须使用操作元数据文件的相对路径。 `docker` 应用程序将执行此文件。
|
||||
**Required** The Docker image to use as the container to run the action. The value can be the Docker base image name, a local `Dockerfile` in your repository, or a public image in Docker Hub or another registry. To reference a `Dockerfile` local to your repository, the file must be named `Dockerfile` and you must use a path relative to your action metadata file. The `docker` application will execute this file.
|
||||
|
||||
### `runs.env`
|
||||
|
||||
(可选)指定要在容器环境中设置的环境变量的键/值映射。
|
||||
**Optional** Specifies a key/value map of environment variables to set in the container environment.
|
||||
|
||||
### `runs.entrypoint`
|
||||
|
||||
(可选)如果已指定该项,则替代 `Dockerfile` 中的 Docker `ENTRYPOINT`,否则对其进行设置。 如果 `Dockerfile` 未指定 `ENTRYPOINT` 或要替代 `ENTRYPOINT` 指令,请使用 `entrypoint`。 如果省略 `entrypoint`,将执行在 Docker `ENTRYPOINT` 指令中指定的命令。 Docker `ENTRYPOINT` 指令具有 shell 形式和 exec 形式 。 Docker `ENTRYPOINT` 文档建议使用 `ENTRYPOINT` 指令的 exec 形式。
|
||||
**Optional** Overrides the Docker `ENTRYPOINT` in the `Dockerfile`, or sets it if one wasn't already specified. Use `entrypoint` when the `Dockerfile` does not specify an `ENTRYPOINT` or you want to override the `ENTRYPOINT` instruction. If you omit `entrypoint`, the commands you specify in the Docker `ENTRYPOINT` instruction will execute. The Docker `ENTRYPOINT` instruction has a _shell_ form and _exec_ form. The Docker `ENTRYPOINT` documentation recommends using the _exec_ form of the `ENTRYPOINT` instruction.
|
||||
|
||||
有关 `entrypoint` 如何执行的详细信息,请参阅“[{% data variables.product.prodname_actions %} 的Dockerfile 支持](/actions/creating-actions/dockerfile-support-for-github-actions/#entrypoint)”。
|
||||
For more information about how the `entrypoint` executes, see "[Dockerfile support for {% data variables.product.prodname_actions %}](/actions/creating-actions/dockerfile-support-for-github-actions/#entrypoint)."
|
||||
|
||||
### `runs.post-entrypoint`
|
||||
|
||||
(可选)允许在 `runs.entrypoint` 操作完成后运行清理脚本。 {% data variables.product.prodname_actions %} 使用 `docker run` 启动此操作。 由于 {% data variables.product.prodname_actions %} 使用相同的基础映像在新容器内运行脚本,因此运行时状态与主 `entrypoint` 容器不同。 可以在工作区、`HOME` 或 `STATE_` 变量中访问所需的任何状态。 `post-entrypoint:` 操作始终默认运行,但你也可使用 [`runs.post-if`](#runspost-if) 替代该操作。
|
||||
**Optional** Allows you to run a cleanup script once the `runs.entrypoint` action has completed. {% data variables.product.prodname_actions %} uses `docker run` to launch this action. Because {% data variables.product.prodname_actions %} runs the script inside a new container using the same base image, the runtime state is different from the main `entrypoint` container. You can access any state you need in either the workspace, `HOME`, or as a `STATE_` variable. The `post-entrypoint:` action always runs by default but you can override this using [`runs.post-if`](#runspost-if).
|
||||
|
||||
```yaml
|
||||
runs:
|
||||
@@ -445,17 +449,17 @@ runs:
|
||||
|
||||
### `runs.args`
|
||||
|
||||
(可选)用于定义 Docker 容器的输入的字符串数组。 输入可包含硬编码的字符串。 {% data variables.product.prodname_dotcom %} 在容器启动时将 `args` 传递到容器的 `ENTRYPOINT`。
|
||||
**Optional** An array of strings that define the inputs for a Docker container. Inputs can include hardcoded strings. {% data variables.product.prodname_dotcom %} passes the `args` to the container's `ENTRYPOINT` when the container starts up.
|
||||
|
||||
`args` 用于代替 `Dockerfile` 中的 `CMD` 指令。 如果在 `Dockerfile` 中使用 `CMD`,请使用按偏好排序的指南:
|
||||
The `args` are used in place of the `CMD` instruction in a `Dockerfile`. If you use `CMD` in your `Dockerfile`, use the guidelines ordered by preference:
|
||||
|
||||
{% data reusables.actions.dockerfile-guidelines %}
|
||||
|
||||
如果需要将环境变量传递到操作中,请确保操作运行命令 shell 以执行变量替换。 例如,如果 `entrypoint` 属性设置为 `"sh -c"`,则 `args` 将在命令 shell 中运行。 此外,如果 `Dockerfile` 使用 `ENTRYPOINT` 运行相同的命令 (`"sh -c"`),则 `args` 也将在命令 shell 中执行。
|
||||
If you need to pass environment variables into an action, make sure your action runs a command shell to perform variable substitution. For example, if your `entrypoint` attribute is set to `"sh -c"`, `args` will be run in a command shell. Alternatively, if your `Dockerfile` uses an `ENTRYPOINT` to run the same command (`"sh -c"`), `args` will execute in a command shell.
|
||||
|
||||
有关将 `CMD` 指令与 {% data variables.product.prodname_actions %} 结合使用的详细信息,请参阅“[{% data variables.product.prodname_actions %} 的 Dockerfile 支持](/actions/creating-actions/dockerfile-support-for-github-actions/#cmd)”。
|
||||
For more information about using the `CMD` instruction with {% data variables.product.prodname_actions %}, see "[Dockerfile support for {% data variables.product.prodname_actions %}](/actions/creating-actions/dockerfile-support-for-github-actions/#cmd)."
|
||||
|
||||
#### <a name="example-defining-arguments-for-the-docker-container"></a>示例:为 Docker 容器定义参数
|
||||
#### Example: Defining arguments for the Docker container
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -471,9 +475,9 @@ runs:
|
||||
|
||||
## `branding`
|
||||
|
||||
**可选** 可使用颜色和 [Feather](https://feathericons.com/) 图标来创建徽章,以个性化设置和区分操作。 在 [{% data variables.product.prodname_marketplace %}](https://github.com/marketplace?type=actions) 中,操作名称旁边会显示徽章。
|
||||
**Optional** You can use a color and [Feather](https://feathericons.com/) icon to create a badge to personalize and distinguish your action. Badges are shown next to your action name in [{% data variables.product.prodname_marketplace %}](https://github.com/marketplace?type=actions).
|
||||
|
||||
### <a name="example-configuring-branding-for-an-action"></a>示例:为操作配置品牌宣传
|
||||
### Example: Configuring branding for an action
|
||||
|
||||
```yaml
|
||||
branding:
|
||||
@@ -483,30 +487,30 @@ branding:
|
||||
|
||||
### `branding.color`
|
||||
|
||||
徽章的背景颜色。 可以是以下选项之一:`white`、`yellow`、`blue`、`green`、`orange`、`red`、`purple` 或 `gray-dark`。
|
||||
The background color of the badge. Can be one of: `white`, `yellow`, `blue`, `green`, `orange`, `red`, `purple`, or `gray-dark`.
|
||||
|
||||
### `branding.icon`
|
||||
|
||||
要使用的 v4.28.0 [Feather](https://feathericons.com/) 图标的名称。 省略了品牌图标以及以下内容:
|
||||
The name of the v4.28.0 [Feather](https://feathericons.com/) icon to use. Brand icons are omitted as well as the following:
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>咖啡</td>
|
||||
<td>列</td>
|
||||
<td>coffee</td>
|
||||
<td>columns</td>
|
||||
<td>divide-circle</td>
|
||||
<td>divide-square</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>divide</td>
|
||||
<td>frown</td>
|
||||
<td>六边形</td>
|
||||
<td>hexagon</td>
|
||||
<td>key</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>meh</td>
|
||||
<td>mouse-pointer</td>
|
||||
<td>smile</td>
|
||||
<td>工具 (tool)</td>
|
||||
<td>tool</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>x-octagon</td>
|
||||
@@ -516,7 +520,7 @@ branding:
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
以下是当前支持的所有图标的详尽列表:
|
||||
Here is an exhaustive list of all currently supported icons:
|
||||
|
||||
<!--
|
||||
This table should match the icon list in `app/models/repository_actions/icons.rb` in the internal github repo.
|
||||
@@ -538,9 +542,9 @@ branding:
|
||||
</tr>
|
||||
<tr>
|
||||
<td>align-right</td>
|
||||
<td>定位点</td>
|
||||
<td>anchor</td>
|
||||
<td>aperture</td>
|
||||
<td>存档</td>
|
||||
<td>archive</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>arrow-down-circle</td>
|
||||
@@ -558,7 +562,7 @@ branding:
|
||||
<td>arrow-up-circle</td>
|
||||
<td>arrow-up-left</td>
|
||||
<td>arrow-up-right</td>
|
||||
<td>向上箭头</td>
|
||||
<td>arrow-up</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>at-sign</td>
|
||||
@@ -568,31 +572,31 @@ branding:
|
||||
</tr>
|
||||
<tr>
|
||||
<td>battery-charging</td>
|
||||
<td>电池</td>
|
||||
<td>battery</td>
|
||||
<td>bell-off</td>
|
||||
<td>响铃</td>
|
||||
<td>bell</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>蓝牙</td>
|
||||
<td>粗体</td>
|
||||
<td>bluetooth</td>
|
||||
<td>bold</td>
|
||||
<td>book-open</td>
|
||||
<td>book</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>书签 (bookmark)</td>
|
||||
<td>bookmark</td>
|
||||
<td>box</td>
|
||||
<td>briefcase</td>
|
||||
<td>日历</td>
|
||||
<td>calendar</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>camera-off</td>
|
||||
<td>照相机</td>
|
||||
<td>强制转换</td>
|
||||
<td>camera</td>
|
||||
<td>cast</td>
|
||||
<td>check-circle</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>check-square</td>
|
||||
<td>选中</td>
|
||||
<td>check</td>
|
||||
<td>chevron-down</td>
|
||||
<td>chevron-left</td>
|
||||
</tr>
|
||||
@@ -606,7 +610,7 @@ branding:
|
||||
<td>chevrons-right</td>
|
||||
<td>chevrons-up</td>
|
||||
<td>circle</td>
|
||||
<td>剪贴板</td>
|
||||
<td>clipboard</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>clock</td>
|
||||
@@ -621,8 +625,8 @@ branding:
|
||||
<td>code</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>命令</td>
|
||||
<td>指南针</td>
|
||||
<td>command</td>
|
||||
<td>compass</td>
|
||||
<td>copy</td>
|
||||
<td>corner-down-left</td>
|
||||
</tr>
|
||||
@@ -640,7 +644,7 @@ branding:
|
||||
</tr>
|
||||
<tr>
|
||||
<td>credit-card</td>
|
||||
<td>裁剪</td>
|
||||
<td>crop</td>
|
||||
<td>crosshair</td>
|
||||
<td>database</td>
|
||||
</tr>
|
||||
@@ -651,13 +655,13 @@ branding:
|
||||
<td>download-cloud</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>下载</td>
|
||||
<td>download</td>
|
||||
<td>droplet</td>
|
||||
<td>edit-2</td>
|
||||
<td>edit-3</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>编辑</td>
|
||||
<td>edit</td>
|
||||
<td>external-link</td>
|
||||
<td>eye-off</td>
|
||||
<td>eye</td>
|
||||
@@ -675,15 +679,15 @@ branding:
|
||||
<td>filter</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>标志</td>
|
||||
<td>flag</td>
|
||||
<td>folder-minus</td>
|
||||
<td>folder-plus</td>
|
||||
<td>文件夹</td>
|
||||
<td>folder</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>gift</td>
|
||||
<td>git-branch</td>
|
||||
<td> git-commit</td>
|
||||
<td>git-commit</td>
|
||||
<td>git-merge</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -699,25 +703,25 @@ branding:
|
||||
<td>help-circle</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>主页</td>
|
||||
<td>home</td>
|
||||
<td>image</td>
|
||||
<td>inbox</td>
|
||||
<td>info</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>斜体</td>
|
||||
<td>图层</td>
|
||||
<td>布局</td>
|
||||
<td>italic</td>
|
||||
<td>layers</td>
|
||||
<td>layout</td>
|
||||
<td>life-buoy</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>link-2</td>
|
||||
<td>链接</td>
|
||||
<td>link</td>
|
||||
<td>list</td>
|
||||
<td>loader</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>锁 (lock)</td>
|
||||
<td>lock</td>
|
||||
<td>log-in</td>
|
||||
<td>log-out</td>
|
||||
<td>mail</td>
|
||||
@@ -729,7 +733,7 @@ branding:
|
||||
<td>maximize</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>“菜单”</td>
|
||||
<td>menu</td>
|
||||
<td>message-circle</td>
|
||||
<td>message-square</td>
|
||||
<td>mic-off</td>
|
||||
@@ -737,32 +741,32 @@ branding:
|
||||
<tr>
|
||||
<td>mic</td>
|
||||
<td>minimize-2</td>
|
||||
<td>最小化</td>
|
||||
<td>minimize</td>
|
||||
<td>minus-circle</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>minus-square</td>
|
||||
<td>minus</td>
|
||||
<td>监视</td>
|
||||
<td>monitor</td>
|
||||
<td>moon</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>more-horizontal</td>
|
||||
<td>more-vertical</td>
|
||||
<td>移动</td>
|
||||
<td>move</td>
|
||||
<td>music</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>navigation-2</td>
|
||||
<td>导航</td>
|
||||
<td>navigation</td>
|
||||
<td>octagon</td>
|
||||
<td>包</td>
|
||||
<td>package</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>paperclip</td>
|
||||
<td>pause-circle</td>
|
||||
<td>pause</td>
|
||||
<td>%</td>
|
||||
<td>percent</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>phone-call</td>
|
||||
@@ -778,7 +782,7 @@ branding:
|
||||
</tr>
|
||||
<tr>
|
||||
<td>play-circle</td>
|
||||
<td>玩游戏</td>
|
||||
<td>play</td>
|
||||
<td>plus-circle</td>
|
||||
<td>plus-square</td>
|
||||
</tr>
|
||||
@@ -786,7 +790,7 @@ branding:
|
||||
<td>plus</td>
|
||||
<td>pocket</td>
|
||||
<td>power</td>
|
||||
<td>打印机</td>
|
||||
<td>printer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>radio</td>
|
||||
@@ -801,16 +805,16 @@ branding:
|
||||
<td>rss</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>保存</td>
|
||||
<td>save</td>
|
||||
<td>scissors</td>
|
||||
<td>search</td>
|
||||
<td>发送</td>
|
||||
<td>send</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>server</td>
|
||||
<td>设置</td>
|
||||
<td>settings</td>
|
||||
<td>share-2</td>
|
||||
<td>共享</td>
|
||||
<td>share</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>shield-off</td>
|
||||
@@ -819,31 +823,31 @@ branding:
|
||||
<td>shopping-cart</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>随机选择</td>
|
||||
<td>边栏</td>
|
||||
<td>shuffle</td>
|
||||
<td>sidebar</td>
|
||||
<td>skip-back</td>
|
||||
<td>skip-forward</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>slash</td>
|
||||
<td>滑块</td>
|
||||
<td>智能手机</td>
|
||||
<td>扬声器</td>
|
||||
<td>sliders</td>
|
||||
<td>smartphone</td>
|
||||
<td>speaker</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>square</td>
|
||||
<td>星号键</td>
|
||||
<td>star</td>
|
||||
<td>stop-circle</td>
|
||||
<td>周六</td>
|
||||
<td>sun</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>sunrise</td>
|
||||
<td>日落</td>
|
||||
<td>平板电脑</td>
|
||||
<td>标记</td>
|
||||
<td>sunset</td>
|
||||
<td>tablet</td>
|
||||
<td>tag</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>目标</td>
|
||||
<td>target</td>
|
||||
<td>terminal</td>
|
||||
<td>thermometer</td>
|
||||
<td>thumbs-down</td>
|
||||
@@ -858,17 +862,17 @@ branding:
|
||||
<td>trash</td>
|
||||
<td>trending-down</td>
|
||||
<td>trending-up</td>
|
||||
<td>三角形</td>
|
||||
<td>triangle</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>卡车</td>
|
||||
<td>电视</td>
|
||||
<td>类型</td>
|
||||
<td>雨伞</td>
|
||||
<td>truck</td>
|
||||
<td>tv</td>
|
||||
<td>type</td>
|
||||
<td>umbrella</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>下划线</td>
|
||||
<td>解锁</td>
|
||||
<td>underline</td>
|
||||
<td>unlock</td>
|
||||
<td>upload-cloud</td>
|
||||
<td>upload</td>
|
||||
</tr>
|
||||
@@ -882,7 +886,7 @@ branding:
|
||||
<td>user</td>
|
||||
<td>users</td>
|
||||
<td>video-off</td>
|
||||
<td>视频</td>
|
||||
<td>video</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>voicemail</td>
|
||||
@@ -891,8 +895,8 @@ branding:
|
||||
<td>volume-x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>卷</td>
|
||||
<td>查看</td>
|
||||
<td>volume</td>
|
||||
<td>watch</td>
|
||||
<td>wifi-off</td>
|
||||
<td>wifi</td>
|
||||
</tr>
|
||||
|
||||
@@ -7,7 +7,6 @@ redirect_from:
|
||||
- /actions/deployment/security-hardening-your-deployments/using-oidc-with-your-reusable-workflows
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghae: issue-4757
|
||||
ghec: '*'
|
||||
ghes: '>=3.5'
|
||||
type: how_to
|
||||
|
||||
@@ -5,7 +5,7 @@ intro: '如何使用高级 {% data variables.product.prodname_actions %} 功能
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghes: '>= 3.5'
|
||||
ghae: issue-4925
|
||||
ghae: '>= 3.5'
|
||||
ghec: '*'
|
||||
type: how_to
|
||||
topics:
|
||||
|
||||
@@ -46,7 +46,7 @@ You can set up automation to scale the number of self-hosted runners. For more i
|
||||
|
||||
You can add self-hosted runners to a single repository. To add a self-hosted runner to a user repository, you must be the repository owner. For an organization repository, you must be an organization owner or have admin access to the repository. For information about how to add a self-hosted runner with the REST API, see "[Self-hosted runners](/rest/reference/actions#self-hosted-runners)."
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5091 %}
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.settings-sidebar-actions-runners %}
|
||||
@@ -67,7 +67,7 @@ For more information, see "[Monitoring and troubleshooting self-hosted runners](
|
||||
|
||||
You can add self-hosted runners at the organization level, where they can be used to process jobs for multiple repositories in an organization. To add a self-hosted runner to an organization, you must be an organization owner. For information about how to add a self-hosted runner with the REST API, see "[Self-hosted runners](/rest/reference/actions#self-hosted-runners)."
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5091 %}
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
{% data reusables.organizations.navigate-to-org %}
|
||||
{% data reusables.organizations.org_settings %}
|
||||
{% data reusables.organizations.settings-sidebar-actions-runners %}
|
||||
@@ -93,7 +93,7 @@ For more information, see "[Monitoring and troubleshooting self-hosted runners](
|
||||
{% ifversion ghec or ghes or ghae %}
|
||||
New runners are assigned to the default group. You can modify the runner's group after you've registered the runner. For more information, see "[Managing access to self-hosted runners](/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups#moving-a-self-hosted-runner-to-a-group)."
|
||||
|
||||
{% ifversion ghec or ghes > 3.3 or ghae-issue-5091 %}
|
||||
{% ifversion ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
|
||||
To add a self-hosted runner to an enterprise, you must be an enterprise owner. For information about how to add a self-hosted runner with the REST API, see the enterprise endpoints in the [{% data variables.product.prodname_actions %} REST API](/rest/reference/actions#self-hosted-runners).
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 删除自托管的运行器
|
||||
intro: '您可以从仓库{% ifversion fpt %} 或组织{% elsif ghec or ghes or gahe %}、 组织或{% endif %} 企业永久删除自托管运行器。'
|
||||
title: Removing self-hosted runners
|
||||
intro: 'You can permanently remove a self-hosted runner from a repository{% ifversion fpt %} or organization{% elsif ghec or ghes or gahe %}, an organization, or an enterprise{% endif %}.'
|
||||
redirect_from:
|
||||
- /github/automating-your-workflow-with-github-actions/removing-self-hosted-runners
|
||||
- /actions/automating-your-workflow-with-github-actions/removing-self-hosted-runners
|
||||
@@ -11,54 +11,92 @@ versions:
|
||||
ghec: '*'
|
||||
type: tutorial
|
||||
shortTitle: Remove self-hosted runners
|
||||
ms.openlocfilehash: d47a2e348f2d1a79342934e70115314d9e62f6f0
|
||||
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/10/2022
|
||||
ms.locfileid: '145086684'
|
||||
---
|
||||
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
## 从仓库中删除运行器
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
{% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
## Removing a runner from a repository
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:{% data reusables.actions.self-hosted-runner-removal-impact %}
|
||||
**Note:** {% data reusables.actions.self-hosted-runner-removal-impact %}
|
||||
|
||||
{% data reusables.actions.self-hosted-runner-auto-removal %}
|
||||
|
||||
{% endnote %}
|
||||
|
||||
要从用户仓库删除自托管的运行器,您必须是仓库所有者。 对于组织仓库,您必须是组织所有者或拥有该仓库管理员的权限。 建议您也访问自托管的运行器机器。 有关如何使用 REST API 删除自承载运行器的信息,请参阅“[自承载运行器](/rest/reference/actions#self-hosted-runners)”。
|
||||
To remove a self-hosted runner from a user repository you must be the repository owner. For an organization repository, you must be an organization owner or have admin access to the repository. We recommend that you also have access to the self-hosted runner machine. For information about how to remove a self-hosted runner with the REST API, see "[Self-hosted runners](/rest/reference/actions#self-hosted-runners)."
|
||||
|
||||
{% data reusables.actions.self-hosted-runner-reusing %} {% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5091 %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.settings-sidebar-actions-runners %} {% data reusables.actions.settings-sidebar-actions-runner-selection %} {% data reusables.actions.self-hosted-runner-removing-a-runner-updated %} {% elsif ghae or ghes < 3.4 %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.settings-sidebar-actions-runners %} {% data reusables.actions.self-hosted-runner-removing-a-runner %} {% endif %}
|
||||
{% data reusables.actions.self-hosted-runner-reusing %}
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.settings-sidebar-actions-runners %}
|
||||
{% data reusables.actions.settings-sidebar-actions-runner-selection %}
|
||||
{% data reusables.actions.self-hosted-runner-removing-a-runner-updated %}
|
||||
{% elsif ghae or ghes < 3.4 %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.settings-sidebar-actions-runners %}
|
||||
{% data reusables.actions.self-hosted-runner-removing-a-runner %}
|
||||
{% endif %}
|
||||
|
||||
## 从组织中删除运行器
|
||||
## Removing a runner from an organization
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:{% data reusables.actions.self-hosted-runner-removal-impact %}
|
||||
**Note:** {% data reusables.actions.self-hosted-runner-removal-impact %}
|
||||
|
||||
{% data reusables.actions.self-hosted-runner-auto-removal %}
|
||||
|
||||
{% endnote %}
|
||||
|
||||
要从组织删除自托管的运行器,您必须是组织所有者。 建议您也访问自托管的运行器机器。 有关如何使用 REST API 删除自承载运行器的信息,请参阅“[自承载运行器](/rest/reference/actions#self-hosted-runners)”。
|
||||
To remove a self-hosted runner from an organization, you must be an organization owner. We recommend that you also have access to the self-hosted runner machine. For information about how to remove a self-hosted runner with the REST API, see "[Self-hosted runners](/rest/reference/actions#self-hosted-runners)."
|
||||
|
||||
{% data reusables.actions.self-hosted-runner-reusing %} {% ifversion fpt or ghes > 3.3 or ghec %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org_settings %} {% data reusables.organizations.settings-sidebar-actions-runners %} {% data reusables.actions.settings-sidebar-actions-runner-selection %} {% data reusables.actions.self-hosted-runner-removing-a-runner-updated %} {% elsif ghes < 3.4 or ghae %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org_settings %} {% data reusables.organizations.settings-sidebar-actions-runners %} {% data reusables.actions.self-hosted-runner-removing-a-runner %} {% endif %}
|
||||
{% data reusables.actions.self-hosted-runner-reusing %}
|
||||
{% ifversion fpt or ghes > 3.3 or ghec %}
|
||||
{% data reusables.organizations.navigate-to-org %}
|
||||
{% data reusables.organizations.org_settings %}
|
||||
{% data reusables.organizations.settings-sidebar-actions-runners %}
|
||||
{% data reusables.actions.settings-sidebar-actions-runner-selection %}
|
||||
{% data reusables.actions.self-hosted-runner-removing-a-runner-updated %}
|
||||
{% elsif ghes < 3.4 or ghae %}
|
||||
{% data reusables.organizations.navigate-to-org %}
|
||||
{% data reusables.organizations.org_settings %}
|
||||
{% data reusables.organizations.settings-sidebar-actions-runners %}
|
||||
{% data reusables.actions.self-hosted-runner-removing-a-runner %}
|
||||
{% endif %}
|
||||
|
||||
## 从企业中删除运行器
|
||||
## Removing a runner from an enterprise
|
||||
|
||||
{% ifversion fpt %} 如果使用 {% data variables.product.prodname_ghe_cloud %},还可以从企业中删除运行器。 有关详细信息,请参阅 [{% data variables.product.prodname_ghe_cloud %} 文档](/enterprise-cloud@latest/actions/hosting-your-own-runners/removing-self-hosted-runners#removing-a-runner-from-an-enterprise)。
|
||||
{% endif %} {% ifversion ghec or ghes or ghae %} {% note %}
|
||||
{% ifversion fpt %}
|
||||
If you use {% data variables.product.prodname_ghe_cloud %}, you can also remove runners from an enterprise. For more information, see the [{% data variables.product.prodname_ghe_cloud %} documentation](/enterprise-cloud@latest/actions/hosting-your-own-runners/removing-self-hosted-runners#removing-a-runner-from-an-enterprise).
|
||||
{% endif %}
|
||||
{% ifversion ghec or ghes or ghae %}
|
||||
{% note %}
|
||||
|
||||
注意:{% data reusables.actions.self-hosted-runner-removal-impact %}
|
||||
**Note:** {% data reusables.actions.self-hosted-runner-removal-impact %}
|
||||
|
||||
{% data reusables.actions.self-hosted-runner-auto-removal %}
|
||||
|
||||
{% endnote %}
|
||||
|
||||
要从企业帐户删除自托管运行器,您必须是企业所有者。 建议您也访问自托管的运行器机器。 有关如何使用 REST API 删除自承载运行器的信息,请参阅 [{% data variables.product.prodname_actions %} REST API](/rest/reference/actions#self-hosted-runners) 中的企业终结点。
|
||||
To remove a self-hosted runner from an enterprise, you must be an enterprise owner. We recommend that you also have access to the self-hosted runner machine. For information about how to remove a self-hosted runner with the REST API, see the enterprise endpoints in the [{% data variables.product.prodname_actions %} REST API](/rest/reference/actions#self-hosted-runners).
|
||||
|
||||
{% data reusables.actions.self-hosted-runner-reusing %} {% ifversion ghec or ghes > 3.3 or ghae-issue-5091 %} {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.enterprise-accounts.actions-runners-tab %} {% data reusables.actions.settings-sidebar-actions-runner-selection %} {% data reusables.actions.self-hosted-runner-removing-a-runner-updated %} {% elsif ghae or ghes < 3.4 %} {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.enterprise-accounts.actions-runners-tab %} {% data reusables.actions.self-hosted-runner-removing-a-runner %} {% endif %} {% endif %}
|
||||
{% data reusables.actions.self-hosted-runner-reusing %}
|
||||
{% ifversion ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
{% data reusables.enterprise-accounts.access-enterprise %}
|
||||
{% data reusables.enterprise-accounts.policies-tab %}
|
||||
{% data reusables.enterprise-accounts.actions-tab %}
|
||||
{% data reusables.enterprise-accounts.actions-runners-tab %}
|
||||
{% data reusables.actions.settings-sidebar-actions-runner-selection %}
|
||||
{% data reusables.actions.self-hosted-runner-removing-a-runner-updated %}
|
||||
{% elsif ghae or ghes < 3.4 %}
|
||||
{% data reusables.enterprise-accounts.access-enterprise %}
|
||||
{% data reusables.enterprise-accounts.policies-tab %}
|
||||
{% data reusables.enterprise-accounts.actions-tab %}
|
||||
{% data reusables.enterprise-accounts.actions-runners-tab %}
|
||||
{% data reusables.actions.self-hosted-runner-removing-a-runner %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 将标签与自托管运行程序结合使用
|
||||
intro: 您可以使用标签以基于其特性来组织自托管运行器。
|
||||
title: Using labels with self-hosted runners
|
||||
intro: You can use labels to organize your self-hosted runners based on their characteristics.
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghes: '*'
|
||||
@@ -8,53 +8,75 @@ versions:
|
||||
ghec: '*'
|
||||
type: tutorial
|
||||
shortTitle: Label runners
|
||||
ms.openlocfilehash: 7808c49e29b0d89db747f185545c273a6a78f403
|
||||
ms.sourcegitcommit: fb047f9450b41b24afc43d9512a5db2a2b750a2a
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/11/2022
|
||||
ms.locfileid: '145066826'
|
||||
---
|
||||
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
有关如何使用标签将作业路由到特定类型的自托管运行器的信息,请参阅“[在工作流中使用自托管运行器](/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow)”。
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
{% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
For information on how to use labels to route jobs to specific types of self-hosted runners, see "[Using self-hosted runners in a workflow](/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow)."
|
||||
|
||||
{% data reusables.actions.self-hosted-runner-management-permissions-required %}
|
||||
|
||||
## 创建自定义标签
|
||||
## Creating a custom label
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5091 %} {% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %} {% data reusables.actions.settings-sidebar-actions-runner-selection %}
|
||||
1. 在“Labels(标签)”部分,单击 {% octicon "gear" aria-label="The Gear icon" %}。
|
||||
1. 在“查找或创建标签”字段中,键入新标签的名称,然后单击“创建新标签”。
|
||||
将创建自定义标签并分配给自托管运行器。 可以从自托管的运行器中删除自定义标签,但当前无法手动删除。 {% data reusables.actions.actions-unused-labels %} {% elsif ghae or ghes < 3.4 %} {% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %} {% data reusables.actions.self-hosted-runner-list %} {% data reusables.actions.self-hosted-runner-list-group %} {% data reusables.actions.self-hosted-runner-labels-view-assigned-labels %}
|
||||
1. 在“筛选器标签”字段中,键入新标签的名称,然后单击“创建新标签”。
|
||||

|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
{% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %}
|
||||
{% data reusables.actions.settings-sidebar-actions-runner-selection %}
|
||||
1. In the "Labels" section, click {% octicon "gear" aria-label="The Gear icon" %}.
|
||||
1. In the "Find or create a label" field, type the name of your new label and click **Create new label**.
|
||||
The custom label is created and assigned to the self-hosted runner. Custom labels can be removed from self-hosted runners, but they currently can't be manually deleted. {% data reusables.actions.actions-unused-labels %}
|
||||
{% elsif ghae or ghes < 3.4 %}
|
||||
{% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %}
|
||||
{% data reusables.actions.self-hosted-runner-list %}
|
||||
{% data reusables.actions.self-hosted-runner-list-group %}
|
||||
{% data reusables.actions.self-hosted-runner-labels-view-assigned-labels %}
|
||||
1. In the "Filter labels" field, type the name of your new label, and click **Create new label**.
|
||||

|
||||
|
||||
将创建自定义标签并分配给自托管运行器。 可以从自托管的运行器中删除自定义标签,但当前无法手动删除。 {% data reusables.actions.actions-unused-labels %} {% endif %}
|
||||
The custom label is created and assigned to the self-hosted runner. Custom labels can be removed from self-hosted runners, but they currently can't be manually deleted. {% data reusables.actions.actions-unused-labels %}
|
||||
{% endif %}
|
||||
|
||||
## 分配标签给自托管的运行器
|
||||
## Assigning a label to a self-hosted runner
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5091 %} {% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %} {% data reusables.actions.settings-sidebar-actions-runner-selection %} {% data reusables.actions.runner-label-settings %}
|
||||
1. 要将标签分配给您的自托管运行器,在“Find or create a label(查找或创建标签)”字段中单击标签。 {% elsif ghae or ghes < 3.4 %} {% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %} {% data reusables.actions.self-hosted-runner-list %} {% data reusables.actions.self-hosted-runner-list-group %} {% data reusables.actions.self-hosted-runner-labels-view-assigned-labels %}
|
||||
1. 单击标签以将其分配给您的自托管运行器。 {% endif %}
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
{% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %}
|
||||
{% data reusables.actions.settings-sidebar-actions-runner-selection %}
|
||||
{% data reusables.actions.runner-label-settings %}
|
||||
1. To assign a label to your self-hosted runner, in the "Find or create a label" field, click the label.
|
||||
{% elsif ghae or ghes < 3.4 %}
|
||||
{% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %}
|
||||
{% data reusables.actions.self-hosted-runner-list %}
|
||||
{% data reusables.actions.self-hosted-runner-list-group %}
|
||||
{% data reusables.actions.self-hosted-runner-labels-view-assigned-labels %}
|
||||
1. Click on a label to assign it to your self-hosted runner.
|
||||
{% endif %}
|
||||
|
||||
## 删除自托管运行器中的自定义标签
|
||||
## Removing a custom label from a self-hosted runner
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5091 %} {% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %} {% data reusables.actions.settings-sidebar-actions-runner-selection %} {% data reusables.actions.runner-label-settings %}
|
||||
1. 在“查找或创建标签”字段中,分配的标签标有 {% octicon "check" aria-label="The Check icon" %} 图标。 单击标记的标签以将其从您的自托管运行器取消分配。 {% elsif ghae or ghes < 3.4 %} {% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %} {% data reusables.actions.self-hosted-runner-list %} {% data reusables.actions.self-hosted-runner-list-group %} {% data reusables.actions.self-hosted-runner-labels-view-assigned-labels %}
|
||||
1. 单击分配的标签以将其从您的自托管运行器中删除。 {% data reusables.actions.actions-unused-labels %} {% endif %}
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
{% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %}
|
||||
{% data reusables.actions.settings-sidebar-actions-runner-selection %}
|
||||
{% data reusables.actions.runner-label-settings %}
|
||||
1. In the "Find or create a label" field, assigned labels are marked with the {% octicon "check" aria-label="The Check icon" %} icon. Click on a marked label to unassign it from your self-hosted runner.
|
||||
{% elsif ghae or ghes < 3.4 %}
|
||||
{% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %}
|
||||
{% data reusables.actions.self-hosted-runner-list %}
|
||||
{% data reusables.actions.self-hosted-runner-list-group %}
|
||||
{% data reusables.actions.self-hosted-runner-labels-view-assigned-labels %}
|
||||
1. Click on the assigned label to remove it from your self-hosted runner. {% data reusables.actions.actions-unused-labels %}
|
||||
{% endif %}
|
||||
|
||||
## 使用配置脚本创建和分配标签
|
||||
## Using the configuration script to create and assign labels
|
||||
|
||||
您可以使用自托管运行器上的配置脚本创建和分配自定义标签。 例如,此命令将名为 `gpu` 的标签分配给自托管运行器。
|
||||
You can use the configuration script on the self-hosted runner to create and assign custom labels. For example, this command assigns a label named `gpu` to the self-hosted runner.
|
||||
|
||||
```shell
|
||||
./config.sh --labels gpu
|
||||
```
|
||||
|
||||
如果标签不存在,则创建该标签。 还可使用此方法为运行器(例如 `x64` 或 `linux`)分配默认标签。 使用配置脚本分配默认标签后, {% data variables.product.prodname_actions %} 会接受它们,而不验证运行器是否实际使用该操作系统或架构。
|
||||
The label is created if it does not already exist. You can also use this approach to assign the default labels to runners, such as `x64` or `linux`. When default labels are assigned using the configuration script, {% data variables.product.prodname_actions %} accepts them as given and does not validate that the runner is actually using that operating system or architecture.
|
||||
|
||||
您可以使用逗号分隔来分配多个标签。 例如:
|
||||
You can use comma separation to assign multiple labels. For example:
|
||||
|
||||
```shell
|
||||
./config.sh --labels gpu,x64,linux
|
||||
@@ -62,6 +84,6 @@ ms.locfileid: '145066826'
|
||||
|
||||
{% note %}
|
||||
|
||||
** 注:** 如果替换现有的运行器,则必须重新分配任何自定义标签。
|
||||
** Note:** If you replace an existing runner, then you must reassign any custom labels.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
@@ -38,7 +38,7 @@ You can access contexts using the expression syntax. For more information, see "
|
||||
| `github` | `object` | Information about the workflow run. For more information, see [`github` context](#github-context). |
|
||||
| `env` | `object` | Contains environment variables set in a workflow, job, or step. For more information, see [`env` context](#env-context). |
|
||||
| `job` | `object` | Information about the currently running job. For more information, see [`job` context](#job-context). |
|
||||
{%- ifversion fpt or ghes > 3.3 or ghae-issue-4757 or ghec %}
|
||||
{%- ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}
|
||||
| `jobs` | `object` | For reusable workflows only, contains outputs of jobs from the reusable workflow. For more information, see [`jobs` context](#jobs-context). |{% endif %}
|
||||
| `steps` | `object` | Information about the steps that have been run in the current job. For more information, see [`steps` context](#steps-context). |
|
||||
| `runner` | `object` | Information about the runner that is running the current job. For more information, see [`runner` context](#runner-context). |
|
||||
@@ -46,7 +46,7 @@ You can access contexts using the expression syntax. For more information, see "
|
||||
| `strategy` | `object` | Information about the matrix execution strategy for the current job. For more information, see [`strategy` context](#strategy-context). |
|
||||
| `matrix` | `object` | Contains the matrix properties defined in the workflow that apply to the current job. For more information, see [`matrix` context](#matrix-context). |
|
||||
| `needs` | `object` | Contains the outputs of all jobs that are defined as a dependency of the current job. For more information, see [`needs` context](#needs-context). |
|
||||
{%- ifversion fpt or ghec or ghes > 3.3 or ghae-issue-4757 %}
|
||||
{%- ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
| `inputs` | `object` | Contains the inputs of a reusable {% ifversion actions-unified-inputs %}or manually triggered {% endif %}workflow. For more information, see [`inputs` context](#inputs-context). |{% endif %}
|
||||
|
||||
As part of an expression, you can access context information using one of two syntaxes.
|
||||
@@ -70,7 +70,7 @@ In addition, some functions may only be used in certain places. For example, the
|
||||
|
||||
The following table indicates where each context and special function can be used within a workflow. Unless listed below, a function can be used anywhere.
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 or ghec %}
|
||||
{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}
|
||||
|
||||
| Workflow key | Context | Special functions |
|
||||
| ---- | ------- | ----------------- |
|
||||
@@ -196,7 +196,7 @@ The `github` context contains information about the workflow run and the event t
|
||||
| `github.head_ref` | `string` | The `head_ref` or source branch of the pull request in a workflow run. This property is only available when the event that triggers a workflow run is either `pull_request` or `pull_request_target`. |
|
||||
| `github.job` | `string` | The [`job_id`](/actions/reference/workflow-syntax-for-github-actions#jobsjob_id) of the current job. <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`. |
|
||||
| `github.ref` | `string` | {% data reusables.actions.ref-description %} |
|
||||
{%- ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5338 %}
|
||||
{%- ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
| `github.ref_name` | `string` | {% data reusables.actions.ref_name-description %} |
|
||||
| `github.ref_protected` | `string` | {% data reusables.actions.ref_protected-description %} |
|
||||
| `github.ref_type` | `string` | {% data reusables.actions.ref_type-description %} |
|
||||
@@ -208,7 +208,7 @@ The `github` context contains information about the workflow run and the event t
|
||||
| `github.retention_days` | `string` | The number of days that workflow run logs and artifacts are kept. |
|
||||
| `github.run_id` | `string` | {% data reusables.actions.run_id_description %} |
|
||||
| `github.run_number` | `string` | {% data reusables.actions.run_number_description %} |
|
||||
{%- ifversion fpt or ghec or ghes > 3.5 or ghae-issue-4722 %}
|
||||
{%- 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 %}
|
||||
| `github.server_url` | `string` | The URL of the GitHub server. For example: `https://github.com`. |
|
||||
@@ -406,7 +406,7 @@ jobs:
|
||||
- run: ./run-tests
|
||||
```
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 or ghec %}
|
||||
{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}
|
||||
|
||||
## `jobs` context
|
||||
|
||||
@@ -782,7 +782,7 @@ jobs:
|
||||
- run: ./debug
|
||||
```
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-4757 %}
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
## `inputs` context
|
||||
|
||||
The `inputs` context contains input properties passed to a reusable workflow{% ifversion actions-unified-inputs %} or to a manually triggered workflow{% endif %}. {% ifversion actions-unified-inputs %}For reusable workflows, the{% else %}The{% endif %} input names and types are defined in the [`workflow_call` event configuration](/actions/learn-github-actions/events-that-trigger-workflows#workflow-reuse-events) of a reusable workflow, and the input values are passed from [`jobs.<job_id>.with`](/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idwith) in an external workflow that calls the reusable workflow. {% ifversion actions-unified-inputs %}For manually triggered workflows, the inputs are defined in the [`workflow_dispatch` event configuration](/actions/learn-github-actions/events-that-trigger-workflows#workflow_dispatch) of a workflow.{% endif %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 环境变量
|
||||
intro: '{% data variables.product.prodname_dotcom %} 为每个 {% data variables.product.prodname_actions %} 工作流程运行设置默认环境变量。 您也可以在工作流程文件中设置自定义环境变量。'
|
||||
title: Environment variables
|
||||
intro: '{% data variables.product.prodname_dotcom %} sets default environment variables for each {% data variables.product.prodname_actions %} workflow run. You can also set custom environment variables in your workflow file.'
|
||||
redirect_from:
|
||||
- /github/automating-your-workflow-with-github-actions/using-environment-variables
|
||||
- /actions/automating-your-workflow-with-github-actions/using-environment-variables
|
||||
@@ -11,26 +11,22 @@ versions:
|
||||
ghes: '*'
|
||||
ghae: '*'
|
||||
ghec: '*'
|
||||
ms.openlocfilehash: 84a159b12c61ca85c8b370de4ac26fa8f0c0e315
|
||||
ms.sourcegitcommit: 478f2931167988096ae6478a257f492ecaa11794
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/09/2022
|
||||
ms.locfileid: '147614413'
|
||||
---
|
||||
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
## 关于环境变量
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
{% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
您可以使用环境变量来存储要在工作流程中引用的信息。 您可以在工作流程步骤或操作中引用环境变量,这些变量将在运行工作流程的运行器计算机上插值。 在操作或工作流程步骤中运行的命令可以创建、读取和修改环境变量。
|
||||
## About environment variables
|
||||
|
||||
您可以设置自己的自定义环境变量,可以使用 {% data variables.product.prodname_dotcom %} 自动设置的默认环境变量,还可以使用在运行器上的工作环境中设置的任何其他环境变量。 环境变量区分大小写。
|
||||
You can use environment variables to store information that you want to reference in your workflow. You reference environment variables within a workflow step or an action, and the variables are interpolated on the runner machine that runs your workflow. Commands that run in actions or workflow steps can create, read, and modify environment variables.
|
||||
|
||||
要设置自定义环境变量,必须在工作流程文件中定义它。 自定义环境变量的作用域仅限于在其中定义它的元素。 您可以定义作用域如下的环境变量:
|
||||
You can set your own custom environment variables, you can use the default environment variables that {% data variables.product.prodname_dotcom %} sets automatically, and you can also use any other environment variables that are set in the working environment on the runner. Environment variables are case-sensitive.
|
||||
|
||||
* 整个工作流,方法是在工作流文件的顶层使用 [`env`](/actions/using-workflows/workflow-syntax-for-github-actions#env)。
|
||||
* 工作流中的作业内容,方法是使用 [`jobs.<job_id>.env`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idenv)。
|
||||
* 作业中的特定步骤,方法是使用 [`jobs.<job_id>.steps[*].env`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsenv)。
|
||||
To set a custom environment variable, you must define it in the workflow file. The scope of a custom environment variable is limited to the element in which it is defined. You can define environment variables that are scoped for:
|
||||
|
||||
* The entire workflow, by using [`env`](/actions/using-workflows/workflow-syntax-for-github-actions#env) at the top level of the workflow file.
|
||||
* The contents of a job within a workflow, by using [`jobs.<job_id>.env`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idenv).
|
||||
* A specific step within a job, by using [`jobs.<job_id>.steps[*].env`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsenv).
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -55,21 +51,21 @@ jobs:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
上面的示例显示在 `echo` 命令中使用的三个自定义环境变量:`$DAY_OF_WEEK`、`$Greeting` 和 `$First_Name`。 这些环境变量的值分别在工作流程、作业和步骤级别设置和定义作用域。
|
||||
The example above shows three custom environment variables being used in an `echo` command: `$DAY_OF_WEEK`, `$Greeting`, and `$First_Name`. The values for these environment variables are set, and scoped, at the workflow, job, and step level respectively.
|
||||
|
||||
由于环境变量插值是在将工作流作业发送到运行器计算机后完成的,因此必须对运行器上使用的 shell 使用适当的语法。 在此示例中,工作流指定 `ubuntu-latest`。 默认情况下,Linux 运行器使用 bash shell,因此你需要使用语法 `$NAME`。 如果工作流指定了 Windows 运行器,那么你应使用 PowerShell 的语法 `$env:NAME`。 有关 shell 的详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流语法](/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsshell)”。
|
||||
Because environment variable interpolation is done after a workflow job is sent to a runner machine, you must use the appropriate syntax for the shell that's used on the runner. In this example, the workflow specifies `ubuntu-latest`. By default, Linux runners use the bash shell, so you must use the syntax `$NAME`. If the workflow specified a Windows runner, you would use the syntax for PowerShell, `$env:NAME`. For more information about shells, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsshell)."
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:通过在步骤中使用 <span style="white-space: nowrap;">`run: env`</span> 并检查此步骤的输出,可以列出可用于工作流步骤的整个环境变量集。
|
||||
**Note**: You can list the entire set of environment variables that are available to a workflow step by using <span style="white-space: nowrap;">`run: env`</span> in a step and then examining the output for the step.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
## 使用上下文访问环境变量值
|
||||
## Using contexts to access environment variable values
|
||||
|
||||
除了环境变量之外,{% data variables.product.prodname_actions %} 还允许您使用上下文设置和读取值。 环境变量和上下文旨在用于工作流程中的不同点。
|
||||
In addition to environment variables, {% data variables.product.prodname_actions %} also allows you to set and read values using contexts. Environment variables and contexts are intended for use at different points in the workflow.
|
||||
|
||||
环境变量始终在虚拟机运行器上插值。 但是,工作流程的某些部分由 {% data variables.product.prodname_actions %} 处理,不会发送到运行器。 不能在工作流程文件的这些部分中使用环境变量。 相反,您可以使用上下文。 例如,`if` 条件(用于确定作业或步骤是否发送到运行器)始终由 {% data variables.product.prodname_actions %} 处理。 可以在 `if` 条件语句中使用上下文访问环境变量的值。
|
||||
Environment variables are always interpolated on the virtual machine runner. However, parts of a workflow are processed by {% data variables.product.prodname_actions %} and are not sent to the runner. You cannot use environment variables in these parts of a workflow file. Instead, you can use contexts. For example, an `if` conditional, which determines whether a job or step is sent to the runner, is always processed by {% data variables.product.prodname_actions %}. You can use a context in an `if` conditional statement to access the value of an environment variable.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -90,79 +86,103 @@ jobs:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
在第一个示例的此修改中,我们引入了 `if` 条件。 工作流步骤现在仅当 `DAYS_OF_WEEK` 设置为“Monday”时才运行。 我们使用 [`env` 上下文](/actions/learn-github-actions/contexts#env-context)从 `if` 条件语句中访问此值。
|
||||
In this modification of the first example, we've introduced an `if` conditional. The workflow step is now only run if `DAYS_OF_WEEK` is set to "Monday". We access this value from the `if` conditional statement by using the [`env` context](/actions/learn-github-actions/contexts#env-context).
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:上下文通常使用美元符号和大括号表示,例如 {% raw %}`${{ context.property }}`{% endraw %}。 在 `if` 条件中,{% raw %}`${{` 和 `}}`{% endraw %} 是可选的,但如果使用它们,它们必须括住整个比较语句,如上所示。
|
||||
**Note**: Contexts are usually denoted using the dollar sign and curly braces, as {% raw %}`${{ context.property }}`{% endraw %}. In an `if` conditional, the {% raw %}`${{` and `}}`{% endraw %} are optional, but if you use them they must enclose the entire comparison statement, as shown above.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
你通常将使用 `env` 或 `github` 上下文来访问工作流部分中的环境变量值,这些值是在作业发送给运行器之前处理的。
|
||||
You will commonly use either the `env` or `github` context to access environment variable values in parts of the workflow that are processed before jobs are sent to runners.
|
||||
|
||||
|
||||
| 上下文 | 使用案例 | 示例 |
|
||||
| Context | Use case | Example |
|
||||
| --- | --- | --- |
|
||||
| `env` | 引用工作流中定义的自定义环境变量。 | <span style="white-space: nowrap;">{% raw %}`${{ env.MY_VARIABLE }}`{% endraw %}</span> |
|
||||
| `github` | 引用有关工作流程运行的信息和触发运行的事件。 | <span style="white-space: nowrap;">{% raw %}`${{ github.repository }}`{% endraw %}</span> |
|
||||
| `env` | Reference custom environment variables defined in the workflow. | <span style="white-space: nowrap;">{% raw %}`${{ env.MY_VARIABLE }}`{% endraw %}</span> |
|
||||
| `github` | Reference information about the workflow run and the event that triggered the run. | <span style="white-space: nowrap;">{% raw %}`${{ github.repository }}`{% endraw %}</span> |
|
||||
|
||||
|
||||
|
||||
在工作流程中,还有许多其他上下文可用于各种目的。 有关详细信息,请参阅“[上下文](/actions/learn-github-actions/contexts)”。 有关可在工作流中使用特定上下文的位置的详细信息,请参阅“[上下文可用性](/actions/learn-github-actions/contexts#context-availability)”。
|
||||
There are many other contexts that you can use for a variety of purposes in your workflows. For more information, see "[Contexts](/actions/learn-github-actions/contexts)." For details of where you can use specific contexts within a workflow, see "[Context availability](/actions/learn-github-actions/contexts#context-availability)."
|
||||
|
||||
### 其他类型的变量
|
||||
### Other types of variables
|
||||
|
||||
在工作流的大部分位置中,唯一可以使用的变量类型是环境变量(例如 `$MY_VARIABLE`),或等效的上下文属性(例如 <span style="white-space: nowrap;">{% raw %}`${{ env.MY_VARIABLE }}`{% endraw %}</span>)。 例外情况包括:
|
||||
In most places in a workflow, the only types of variables that you can use are either environment variables, such as `$MY_VARIABLE`, or the equivalent context property, such as <span style="white-space: nowrap;">{% raw %}`${{ env.MY_VARIABLE }}`{% endraw %}</span>. Exceptions are:
|
||||
|
||||
* `workflow_call` 和 `workflow_dispatch` 事件的输入,这使你能够将值传递给工作流。 有关详细信息,请参阅 [`on.workflow_call.inputs`](/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_callinputs) 和 [`on.workflow_dispatch.inputs`](/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_dispatchinputs)。
|
||||
* 作业输出,允许您在工作流程中的作业之间传递值。 有关详细信息,请参阅 [`jobs.<job_id>.outputs`](/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idoutputs)。
|
||||
* 格式表达式中的变量,允许您替换字符串的某些部分。 有关详细信息,请参阅 [`format`](/actions/learn-github-actions/expressions#format)。
|
||||
* Inputs for the `workflow_call` and `workflow_dispatch` events, which allow you to pass values to a workflow. For more information, see [`on.workflow_call.inputs`](/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_callinputs) and [`on.workflow_dispatch.inputs`](/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_dispatchinputs).
|
||||
* Job outputs, which allow you to pass values between jobs in a workflow. For more information, see [`jobs.<job_id>.outputs`](/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idoutputs).
|
||||
* The variables in a format expression, which allow you to replace parts of a string. For more information, see [`format`](/actions/learn-github-actions/expressions#format).
|
||||
|
||||
## 环境变量命名约定
|
||||
## Naming conventions for environment variables
|
||||
|
||||
设置自定义环境变量时,不能使用任何默认环境变量名称。 有关这些内容的完整列表,请参阅下面的“[默认环境变量](#default-environment-variables)”。 如果尝试重写其中一个默认环境变量的值,则会忽略赋值。
|
||||
When you set a custom environment variable, you cannot use any of the default environment variable names. For a complete list of these, see "[Default environment variables](#default-environment-variables)" below. If you attempt to override the value of one of these default environment variables, the assignment is ignored.
|
||||
|
||||
你设置的指向文件系统上某个位置的任何新环境变量都应该有 `_PATH` 后缀。 `HOME`、`GITHUB_ENV` 和 `GITHUB_WORKSPACE` 默认环境变量是此约定的例外情况。
|
||||
Any new environment variables you set that point to a location on the filesystem should have a `_PATH` suffix. The `HOME`, `GITHUB_ENV`, and `GITHUB_WORKSPACE` default environment variables are exceptions to this convention.
|
||||
|
||||
## 默认环境变量
|
||||
## Default environment variables
|
||||
|
||||
{% data variables.product.prodname_dotcom %} 设置的默认环境变量可用于工作流程中的每个步骤。
|
||||
The default environment variables that {% data variables.product.prodname_dotcom %} sets are available to every step in a workflow.
|
||||
|
||||
强烈建议操作使用环境变量访问文件系统,而非使用硬编码的文件路径。 {% data variables.product.prodname_dotcom %} 设置供操作用于所有运行器环境中的环境变量。
|
||||
We strongly recommend that actions use environment variables to access the filesystem rather than using hardcoded file paths. {% data variables.product.prodname_dotcom %} sets environment variables for actions to use in all runner environments.
|
||||
|
||||
| 环境变量 | 说明 |
|
||||
| Environment variable | Description |
|
||||
| ---------------------|------------ |
|
||||
| `CI` | 始终设置为 `true`。 |
|
||||
| `GITHUB_ACTION` | 正在运行的操作的名称,或步骤的 [`id`](/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsid)。 例如,对于操作,为 `__repo-owner_name-of-action-repo`。<br><br>在当前步骤运行不带 `id` 的脚本时,{% data variables.product.prodname_dotcom %} 会删除特殊字符并使用名称 `__run`。 如果在同一作业中多次使用相同的脚本或操作,则名称将包含一个由序号前跟下划线组成的后缀。 例如,运行的第一个脚本的名称将为 `__run`,第二个脚本的名称将为 `__run_2`。 同样,`actions/checkout` 的第二次调用将为 `actionscheckout2`。 |
|
||||
| `GITHUB_ACTION_PATH` | 操作所在的路径。 此属性仅在复合操作中受支持。 您可以使用此路径访问与操作位于同一存储库中的文件。 例如 `/home/runner/work/_actions/repo-owner/name-of-action-repo/v1`。 |
|
||||
| `GITHUB_ACTION_REPOSITORY` | 对于执行操作的步骤,这是操作的所有者和存储库名称。 例如 `actions/checkout`。 |
|
||||
| `GITHUB_ACTIONS` | 当 {% data variables.product.prodname_actions %} 运行工作流时,始终设置为 `true`。 您可以使用此变量来区分测试是在本地运行还是通过 {% data variables.product.prodname_actions %} 运行。
|
||||
| `GITHUB_ACTOR` | 发起工作流程的个人或应用程序的名称。 例如 `octocat`。 |
|
||||
| `GITHUB_API_URL` | 返回 API URL。 例如:`{% data variables.product.api_url_code %}`。
|
||||
| `GITHUB_BASE_REF` | 工作流程运行中拉取请求的基本引用或目标分支的名称。 仅当触发工作流运行的事件是 `pull_request` 或 `pull_request_target` 时才设置此属性。 例如 `main`。 |
|
||||
| `GITHUB_ENV` | 运行器上从工作流程命令到设置环境变量的文件路径。 此文件对于当前步骤是唯一的,并且会针对作业中的每个步骤进行更改。 例如 `/home/runner/work/_temp/_runner_file_commands/set_env_87406d6e-4979-4d42-98e1-3dab1f48b13a`。 有关详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流命令](/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable)”。 |
|
||||
| `GITHUB_EVENT_NAME` | 触发工作流程的事件的名称。 例如 `workflow_dispatch`。 |
|
||||
| `GITHUB_EVENT_PATH` | 运行器上包含完整事件 web 挂钩负载的文件的路径。 例如 `/github/workflow/event.json`。 |
|
||||
| `GITHUB_GRAPHQL_URL` | 返回 GraphQL API URL。 例如:`{% data variables.product.graphql_url_code %}`。
|
||||
| `GITHUB_HEAD_REF` | 工作流程运行中拉取请求的头部引用或来源分支。 仅当触发工作流运行的事件是 `pull_request` 或 `pull_request_target` 时才设置此属性。 例如 `feature-branch-1`。 |
|
||||
| `GITHUB_JOB` | 当前作业的 [job_id](/actions/reference/workflow-syntax-for-github-actions#jobsjob_id)。 例如 `greeting_job`。 |
|
||||
| `GITHUB_PATH` | 运行器上从工作流命令设置系统 `PATH` 变量的文件的路径。 此文件对于当前步骤是唯一的,并且会针对作业中的每个步骤进行更改。 例如 `/home/runner/work/_temp/_runner_file_commands/add_path_899b9445-ad4a-400c-aa89-249f18632cf5`。 有关详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流命令](/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path)”。 |
|
||||
| `CI` | Always set to `true`. |
|
||||
| `GITHUB_ACTION` | The name of the action currently running, or the [`id`](/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsid) of a step. For example, for an action, `__repo-owner_name-of-action-repo`.<br><br>{% data variables.product.prodname_dotcom %} removes special characters, and uses the name `__run` when the current step runs a script without an `id`. If you use the same script or action more than once in the same job, the name will include a suffix that consists of the sequence number preceded by an underscore. For example, the first script you run will have the name `__run`, and the second script will be named `__run_2`. Similarly, the second invocation of `actions/checkout` will be `actionscheckout2`. |
|
||||
| `GITHUB_ACTION_PATH` | The path where an action is located. This property is only supported in composite actions. You can use this path to access files located in the same repository as the action. For example, `/home/runner/work/_actions/repo-owner/name-of-action-repo/v1`. |
|
||||
| `GITHUB_ACTION_REPOSITORY` | For a step executing an action, this is the owner and repository name of the action. For example, `actions/checkout`. |
|
||||
| `GITHUB_ACTIONS` | Always set to `true` when {% data variables.product.prodname_actions %} is running the workflow. You can use this variable to differentiate when tests are being run locally or by {% data variables.product.prodname_actions %}.
|
||||
| `GITHUB_ACTOR` | The name of the person or app that initiated the workflow. For example, `octocat`. |
|
||||
| `GITHUB_API_URL` | Returns the API URL. For example: `{% data variables.product.api_url_code %}`.
|
||||
| `GITHUB_BASE_REF` | The name of the base ref or target branch of the pull request in a workflow run. This is only set when the event that triggers a workflow run is either `pull_request` or `pull_request_target`. For example, `main`. |
|
||||
| `GITHUB_ENV` | The path on the runner to the file that sets environment variables from workflow commands. This file is unique to the current step and changes for each step in a job. For example, `/home/runner/work/_temp/_runner_file_commands/set_env_87406d6e-4979-4d42-98e1-3dab1f48b13a`. For more information, see "[Workflow commands for {% data variables.product.prodname_actions %}](/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable)." |
|
||||
| `GITHUB_EVENT_NAME` | The name of the event that triggered the workflow. For example, `workflow_dispatch`. |
|
||||
| `GITHUB_EVENT_PATH` | The path to the file on the runner that contains the full event webhook payload. For example, `/github/workflow/event.json`. |
|
||||
| `GITHUB_GRAPHQL_URL` | Returns the GraphQL API URL. For example: `{% data variables.product.graphql_url_code %}`.
|
||||
| `GITHUB_HEAD_REF` | The head ref or source branch of the pull request in a workflow run. This property is only set when the event that triggers a workflow run is either `pull_request` or `pull_request_target`. For example, `feature-branch-1`. |
|
||||
| `GITHUB_JOB` | The [job_id](/actions/reference/workflow-syntax-for-github-actions#jobsjob_id) of the current job. For example, `greeting_job`. |
|
||||
| `GITHUB_PATH` | The path on the runner to the file that sets system `PATH` variables from workflow commands. This file is unique to the current step and changes for each step in a job. For example, `/home/runner/work/_temp/_runner_file_commands/add_path_899b9445-ad4a-400c-aa89-249f18632cf5`. For more information, see "[Workflow commands for {% data variables.product.prodname_actions %}](/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path)." |
|
||||
| `GITHUB_REF` | {% data reusables.actions.ref-description %} |
|
||||
{%- ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5338 %} | `GITHUB_REF_NAME` | {% data reusables.actions.ref_name-description %} 例如 `feature-branch-1`。| | `GITHUB_REF_PROTECTED` | {% data reusables.actions.ref_protected-description %} | | `GITHUB_REF_TYPE` | {% data reusables.actions.ref_type-description %} | {%- endif %} | `GITHUB_REPOSITORY` | 所有者和存储库名称。 例如 `octocat/Hello-World`。 | | `GITHUB_REPOSITORY_OWNER` | 存储库所有者的名称。 例如 `octocat`。 | | `GITHUB_RETENTION_DAYS` | 工作流运行日志和工件的保留天数。 例如 `90`。 | | `GITHUB_RUN_ATTEMPT` | 存储库中每次尝试运行特定工作流的唯一编号。 对于工作流程运行的第一次尝试,此数字从 1 开始,并随着每次重新运行而递增。 例如 `3`。 | | `GITHUB_RUN_ID` | {% data reusables.actions.run_id_description %} 例如 `1658821493`。 | | `GITHUB_RUN_NUMBER` | {% data reusables.actions.run_number_description %} 例如 `3`。 | | `GITHUB_SERVER_URL`| {% data variables.product.product_name %} 服务器的 URL。 例如:`https://{% data variables.product.product_url %}`。
|
||||
| `GITHUB_SHA` | {% data reusables.actions.github_sha_description %} | {%- ifversion actions-job-summaries %} | `GITHUB_STEP_SUMMARY` | 运行器上包含来自工作流命令的作业摘要的文件的路径。 此文件对于当前步骤是唯一的,并且会针对作业中的每个步骤进行更改。 例如 `/home/rob/runner/_layout/_work/_temp/_runner_file_commands/step_summary_1cb22d7f-5663-41a8-9ffc-13472605c76c`。 有关详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流命令](/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary)”。 | {%- endif %} | `GITHUB_WORKFLOW` | 工作流的名称。 例如 `My test workflow`。 如果工作流文件未指定 `name`,则此变量的值是存储库中工作流文件的完整路径。 | | `GITHUB_WORKSPACE` | 运行器上步骤的默认工作目录,以及使用 [`checkout`](https://github.com/actions/checkout) 操作时存储库的默认位置。 例如 `/home/runner/work/my-repo-name/my-repo-name`。 | {%- ifversion actions-runner-arch-envvars %} | `RUNNER_ARCH` | {% data reusables.actions.runner-arch-description %} {%- endif %} | | `RUNNER_DEBUG` | {% data reusables.actions.runner-debug-description %} | | `RUNNER_NAME` | {% data reusables.actions.runner-name-description %} 例如 `Hosted Agent` | | `RUNNER_OS` | {% data reusables.actions.runner-os-description %} 例如 `Windows` | | `RUNNER_TEMP` | {% data reusables.actions.runner-temp-directory-description %} 例如 `D:\a\_temp` | {% ifversion not ghae %}| `RUNNER_TOOL_CACHE` | {% data reusables.actions.runner-tool-cache-description %} 例如 `C:\hostedtoolcache\windows` |{% endif %}
|
||||
{%- ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
| `GITHUB_REF_NAME` | {% data reusables.actions.ref_name-description %} |
|
||||
| `GITHUB_REF_PROTECTED` | {% data reusables.actions.ref_protected-description %} |
|
||||
| `GITHUB_REF_TYPE` | {% data reusables.actions.ref_type-description %} |
|
||||
{%- endif %}
|
||||
| `GITHUB_REPOSITORY` | The owner and repository name. For example, `octocat/Hello-World`. |
|
||||
| `GITHUB_REPOSITORY_OWNER` | The repository owner's name. For example, `octocat`. |
|
||||
| `GITHUB_RETENTION_DAYS` | The number of days that workflow run logs and artifacts are kept. For example, `90`. |
|
||||
| `GITHUB_RUN_ATTEMPT` | 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. For example, `3`. |
|
||||
| `GITHUB_RUN_ID` | {% data reusables.actions.run_id_description %} For example, `1658821493`. |
|
||||
| `GITHUB_RUN_NUMBER` | {% data reusables.actions.run_number_description %} For example, `3`. |
|
||||
| `GITHUB_SERVER_URL`| The URL of the {% data variables.product.product_name %} server. For example: `https://{% data variables.product.product_url %}`.
|
||||
| `GITHUB_SHA` | {% data reusables.actions.github_sha_description %} |
|
||||
{%- ifversion actions-job-summaries %}
|
||||
| `GITHUB_STEP_SUMMARY` | The path on the runner to the file that contains job summaries from workflow commands. This file is unique to the current step and changes for each step in a job. For example, `/home/rob/runner/_layout/_work/_temp/_runner_file_commands/step_summary_1cb22d7f-5663-41a8-9ffc-13472605c76c`. For more information, see "[Workflow commands for {% data variables.product.prodname_actions %}](/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary)." |
|
||||
{%- endif %}
|
||||
| `GITHUB_WORKFLOW` | The name of the workflow. For example, `My test workflow`. If the workflow file doesn't specify a `name`, the value of this variable is the full path of the workflow file in the repository. |
|
||||
| `GITHUB_WORKSPACE` | The default working directory on the runner for steps, and the default location of your repository when using the [`checkout`](https://github.com/actions/checkout) action. For example, `/home/runner/work/my-repo-name/my-repo-name`. |
|
||||
{%- ifversion actions-runner-arch-envvars %}
|
||||
| `RUNNER_ARCH` | {% data reusables.actions.runner-arch-description %}
|
||||
{%- endif %} |
|
||||
| `RUNNER_DEBUG` | {% data reusables.actions.runner-debug-description %} |
|
||||
| `RUNNER_NAME` | {% data reusables.actions.runner-name-description %} For example, `Hosted Agent` |
|
||||
| `RUNNER_OS` | {% data reusables.actions.runner-os-description %} For example, `Windows` |
|
||||
| `RUNNER_TEMP` | {% data reusables.actions.runner-temp-directory-description %} For example, `D:\a\_temp` |
|
||||
{% ifversion not ghae %}| `RUNNER_TOOL_CACHE` | {% data reusables.actions.runner-tool-cache-description %} For example, `C:\hostedtoolcache\windows` |{% endif %}
|
||||
|
||||
{% note %}
|
||||
|
||||
**注意:**
|
||||
**Note:**
|
||||
|
||||
* 如果需要在作业中使用工作流运行的 URL,可以组合以下环境变量:`$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID`
|
||||
* 大多数默认环境变量都有一个对应且名称类似的上下文属性。 例如,在工作流处理期间,可以使用 {% raw %}`${{ github.ref }}`{% endraw %} 上下文属性读取 `GITHUB_REF` 环境变量的值。
|
||||
* If you need to use a workflow run's URL from within a job, you can combine these environment variables: `$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID`
|
||||
* Most of the default environment variables have a corresponding, and similarly named, context property. For example, the value of the `GITHUB_REF` environment variable can be read during workflow processing using the {% raw %}`${{ github.ref }}`{% endraw %} context property.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
## 检测操作系统
|
||||
## Detecting the operating system
|
||||
|
||||
通过使用 `RUNNER_OS` 默认环境变量和相应的上下文属性 <span style="white-space: nowrap;">{% raw %}`${{ runner.os }}`{% endraw %}</span>,可以编写可用于不同操作系统的单个工作流文件。 例如,如果将操作系统从 `macos-latest` 更改为 `windows-latest`,以下工作流可以成功运行,而不必更改环境变量的语法,这会根据运行器使用的 shell 而有所不同。
|
||||
You can write a single workflow file that can be used for different operating systems by using the `RUNNER_OS` default environment variable and the corresponding context property <span style="white-space: nowrap;">{% raw %}`${{ runner.os }}`{% endraw %}</span>. For example, the following workflow could be run successfully if you changed the operating system from `macos-latest` to `windows-latest` without having to alter the syntax of the environment variables, which differs depending on the shell being used by the runner.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -179,11 +199,11 @@ jobs:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
在此示例中,两个 `if` 语句会检查 `runner` 上下文的 `os` 属性以确定运行器的操作系统。 `if` 条件由 {% data variables.product.prodname_actions %} 处理,并且只有检查解析为 `true` 的步骤才会发送到运行器。 这里其中一个检查将始终为 `true`,而另一个检查为 `false`,因此只有其中一个步骤会发送到运行器。 在作业发送到运行器后,将执行该步骤,并使用适当的语法(在 Windows 上针对 PowerShell 使用 `$env:NAME`,在 Linux 和 MacOS 上针对 bash 和 sh 使用 `$NAME`)对 `echo` 命令中的环境变量进行内插。 在此示例中,语句 `runs-on: macos-latest` 表示将运行第二个步骤。
|
||||
In this example, the two `if` statements check the `os` property of the `runner` context to determine the operating system of the runner. `if` conditionals are processed by {% data variables.product.prodname_actions %}, and only steps where the check resolves as `true` are sent to the runner. Here one of the checks will always be `true` and the other `false`, so only one of these steps is sent to the runner. Once the job is sent to the runner, the step is executed and the environment variable in the `echo` command is interpolated using the appropriate syntax (`$env:NAME` for PowerShell on Windows, and `$NAME` for bash and sh on Linux and MacOS). In this example, the statement `runs-on: macos-latest` means that the second step will be run.
|
||||
|
||||
## 在工作流程中的步骤和作业之间传递值
|
||||
## Passing values between steps and jobs in a workflow
|
||||
|
||||
如果在作业的某个步骤中生成值,则可以在同一作业的后续步骤中使用该值,方法是将该值分配给现有或新的环境变量,然后将其写入 `GITHUB_ENV` 环境文件。 环境文件可由操作直接使用,也可以通过使用 `run` 关键字在工作流文件中通过 shell 命令使用。 有关详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流命令](/actions/reference/workflow-commands-for-github-actions/#setting-an-environment-variable)”。
|
||||
If you generate a value in one step of a job, you can use the value in subsequent steps of the same job by assigning the value to an existing or new environment variable and then writing this to the `GITHUB_ENV` environment file. The environment file can be used directly by an action, or from a shell command in the workflow file by using the `run` keyword. For more information, see "[Workflow commands for {% data variables.product.prodname_actions %}](/actions/reference/workflow-commands-for-github-actions/#setting-an-environment-variable)."
|
||||
|
||||
如果要将工作流程中一个作业的某个步骤中的值传递到工作流程中另一作业的某个步骤,可以将该值定义为作业输出。 然后,可以从另一个作业中的步骤引用此作业输出。 有关详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流语法](/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idoutputs)”。
|
||||
If you want to pass a value from a step in one job in a workflow to a step in another job in the workflow, you can define the value as a job output. You can then reference this job output from a step in another job. For more information, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idoutputs)."
|
||||
|
||||
|
||||
@@ -1,38 +1,35 @@
|
||||
---
|
||||
title: 表达式
|
||||
title: Expressions
|
||||
shortTitle: Expressions
|
||||
intro: 你可以对工作流和操作中的表达式求值。
|
||||
intro: You can evaluate expressions in workflows and actions.
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghes: '*'
|
||||
ghae: '*'
|
||||
ghec: '*'
|
||||
miniTocMaxHeadingLevel: 3
|
||||
ms.openlocfilehash: 94bd9f7a43d4325e497a776357711adf64c0d7ba
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147614221'
|
||||
---
|
||||
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
## 关于表达式
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
{% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
您可以使用表达式程序化设置工作流程文件中的环境变量和访问上下文。 表达式可以是文字值、上下文引用或函数的任意组合。 您可以使用运算符组合文字、上下文引用和函数。 有关上下文的详细信息,请参阅“[上下文](/actions/learn-github-actions/contexts)”。
|
||||
## About expressions
|
||||
|
||||
表达式通常与工作流文件中的条件 `if` 关键字一起使用,以确定是否应运行步骤。 如果 `if` 条件为 `true`,该步骤将运行。
|
||||
You can use expressions to programmatically set environment variables in workflow files and access contexts. An expression can be any combination of literal values, references to a context, or functions. You can combine literals, context references, and functions using operators. For more information about contexts, see "[Contexts](/actions/learn-github-actions/contexts)."
|
||||
|
||||
您需要使用特定语法指示 {% data variables.product.prodname_dotcom %} 对表达式求值,而不是将其视为字符串。
|
||||
Expressions are commonly used with the conditional `if` keyword in a workflow file to determine whether a step should run. When an `if` conditional is `true`, the step will run.
|
||||
|
||||
{% raw %} `${{ <expression> }}`
|
||||
You need to use specific syntax to tell {% data variables.product.prodname_dotcom %} to evaluate an expression rather than treat it as a string.
|
||||
|
||||
{% raw %}
|
||||
`${{ <expression> }}`
|
||||
{% endraw %}
|
||||
|
||||
{% data reusables.actions.expression-syntax-if %} 有关 `if` 条件的详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流语法](/articles/workflow-syntax-for-github-actions/#jobsjob_idif)”。
|
||||
{% data reusables.actions.expression-syntax-if %} For more information about `if` conditionals, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/articles/workflow-syntax-for-github-actions/#jobsjob_idif)."
|
||||
|
||||
{% data reusables.actions.context-injection-warning %}
|
||||
|
||||
#### `if` 条件中的示例表达式
|
||||
#### Example expression in an `if` conditional
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -40,7 +37,7 @@ steps:
|
||||
if: {% raw %}${{ <expression> }}{% endraw %}
|
||||
```
|
||||
|
||||
#### 设置环境变量的示例
|
||||
#### Example setting an environment variable
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -49,18 +46,18 @@ env:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 文本
|
||||
## Literals
|
||||
|
||||
作为表达式的一部分,可使用 `boolean`、`null`、`number` 或 `string` 数据类型。
|
||||
As part of an expression, you can use `boolean`, `null`, `number`, or `string` data types.
|
||||
|
||||
| 数据类型 | 文本值 |
|
||||
| Data type | Literal value |
|
||||
|-----------|---------------|
|
||||
| `boolean` | `true` 或 `false` |
|
||||
| `boolean` | `true` or `false` |
|
||||
| `null` | `null` |
|
||||
| `number` | JSON 支持的任何数字格式。 |
|
||||
| `string` | 无需将字符串括在 `{% raw %}${{{% endraw %}` 和 `{% raw %}}}{% endraw %}` 中。 但是,如果这样做,则必须在字符串两边使用单引号 (`'`)。 若要使用文本单引号,请使用额外的单引号 (`''`) 转义文本单引号。 用双引号 (`"`) 括起来会引发错误。 |
|
||||
| `number` | Any number format supported by JSON. |
|
||||
| `string` | You don't need to enclose strings in `{% raw %}${{{% endraw %}` and `{% raw %}}}{% endraw %}`. However, if you do, you must use single quotes (`'`) around the string. To use a literal single quote, escape the literal single quote using an additional single quote (`''`). Wrapping with double quotes (`"`) will throw an error. |
|
||||
|
||||
#### 示例
|
||||
#### Example
|
||||
|
||||
{% raw %}
|
||||
|
||||
@@ -78,105 +75,105 @@ env:
|
||||
|
||||
{% endraw %}
|
||||
|
||||
## 运算符
|
||||
## Operators
|
||||
|
||||
| 运算符 | 说明 |
|
||||
| Operator | Description |
|
||||
| --- | --- |
|
||||
| `( )` | 逻辑分组 |
|
||||
| `[ ]` | 索引
|
||||
| `.` | 属性取消引用 |
|
||||
| `( )` | Logical grouping |
|
||||
| `[ ]` | Index
|
||||
| `.` | Property de-reference |
|
||||
| `!` | Not |
|
||||
| `<` | 小于 |
|
||||
| `<=` | 小于或等于 |
|
||||
| `>` | 大于 |
|
||||
| `>=` | 大于或等于 |
|
||||
| `==` | 等于 |
|
||||
| `!=` | 不等于 |
|
||||
| `&&` | 且 |
|
||||
| <code>\|\|</code> | 或 |
|
||||
| `<` | Less than |
|
||||
| `<=` | Less than or equal |
|
||||
| `>` | Greater than |
|
||||
| `>=` | Greater than or equal |
|
||||
| `==` | Equal |
|
||||
| `!=` | Not equal |
|
||||
| `&&` | And |
|
||||
| <code>\|\|</code> | Or |
|
||||
|
||||
{% data variables.product.prodname_dotcom %} 进行宽松的等式比较。
|
||||
{% data variables.product.prodname_dotcom %} performs loose equality comparisons.
|
||||
|
||||
* 如果类型不匹配,{% data variables.product.prodname_dotcom %} 强制转换类型为数字。 {% data variables.product.prodname_dotcom %} 使用这些转换将数据类型转换为数字:
|
||||
* If the types do not match, {% data variables.product.prodname_dotcom %} coerces the type to a number. {% data variables.product.prodname_dotcom %} casts data types to a number using these conversions:
|
||||
|
||||
| 类型 | 结果 |
|
||||
| Type | Result |
|
||||
| --- | --- |
|
||||
| Null | `0` |
|
||||
| 布尔 | `true` 返回 `1` <br /> `false` 返回 `0` |
|
||||
| String | 从任何合法的 JSON 数字格式进行分析,否则为 `NaN`。 <br /> 注意:空字符串返回 `0`。 |
|
||||
| 数组 | `NaN` |
|
||||
| 对象 | `NaN` |
|
||||
* 一个 `NaN` 与另一个 `NaN` 的比较不会生成 `true`。 有关详细信息,请参阅“[NaN Mozilla 文档](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN)”。
|
||||
* {% data variables.product.prodname_dotcom %} 在比较字符串时忽略大小写。
|
||||
* 对象和数组仅在为同一实例时才视为相等。
|
||||
| Boolean | `true` returns `1` <br /> `false` returns `0` |
|
||||
| String | Parsed from any legal JSON number format, otherwise `NaN`. <br /> Note: empty string returns `0`. |
|
||||
| Array | `NaN` |
|
||||
| Object | `NaN` |
|
||||
* A comparison of one `NaN` to another `NaN` does not result in `true`. For more information, see the "[NaN Mozilla docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN)."
|
||||
* {% data variables.product.prodname_dotcom %} ignores case when comparing strings.
|
||||
* Objects and arrays are only considered equal when they are the same instance.
|
||||
|
||||
## 函数
|
||||
## Functions
|
||||
|
||||
{% data variables.product.prodname_dotcom %} 提供一组内置的函数,可用于表达式。 有些函数抛出值到字符串以进行比较。 {% data variables.product.prodname_dotcom %} 使用这些转换将数据类型转换为字符串:
|
||||
{% data variables.product.prodname_dotcom %} offers a set of built-in functions that you can use in expressions. Some functions cast values to a string to perform comparisons. {% data variables.product.prodname_dotcom %} casts data types to a string using these conversions:
|
||||
|
||||
| 类型 | 结果 |
|
||||
| Type | Result |
|
||||
| --- | --- |
|
||||
| Null | `''` |
|
||||
| 布尔 | `'true'` 或 `'false'` |
|
||||
| 数字 | 十进制格式,对大数字使用指数 |
|
||||
| 数组 | 数组不转换为字符串 |
|
||||
| 对象 | 对象不转换为字符串 |
|
||||
| Boolean | `'true'` or `'false'` |
|
||||
| Number | Decimal format, exponential for large numbers |
|
||||
| Array | Arrays are not converted to a string |
|
||||
| Object | Objects are not converted to a string |
|
||||
|
||||
### contains
|
||||
|
||||
`contains( search, item )`
|
||||
|
||||
如果 `search` 包含 `item`,则返回 `true`。 如果 `search` 是一个数组,`item` 是数组中的一个元素,此函数将返回 `true`。 如果 `search` 是一个字符串,`item` 是 `search` 的 substring,此函数将返回 `true`。 此函数不区分大小写。 抛出值到字符串。
|
||||
Returns `true` if `search` contains `item`. If `search` is an array, this function returns `true` if the `item` is an element in the array. If `search` is a string, this function returns `true` if the `item` is a substring of `search`. This function is not case sensitive. Casts values to a string.
|
||||
|
||||
#### 使用字符串的示例
|
||||
#### Example using a string
|
||||
|
||||
`contains('Hello world', 'llo')` 返回 `true`。
|
||||
`contains('Hello world', 'llo')` returns `true`.
|
||||
|
||||
#### 使用对象筛选器的示例
|
||||
#### Example using an object filter
|
||||
|
||||
如果与事件相关的问题具有标签“bug”,`contains(github.event.issue.labels.*.name, 'bug')` 便会返回 `true`。
|
||||
`contains(github.event.issue.labels.*.name, 'bug')` returns `true` if the issue related to the event has a label "bug".
|
||||
|
||||
有关详细信息,请参阅“[对象筛选器](#object-filters)”。
|
||||
For more information, see "[Object filters](#object-filters)."
|
||||
|
||||
#### 匹配字符串数组的示例
|
||||
#### Example matching an array of strings
|
||||
|
||||
可以将 `contains()` 与 `fromJson()` 配合使用来检查字符串数组是否包含 `item`,而不是编写 `github.event_name == "push" || github.event_name == "pull_request"`。
|
||||
Instead of writing `github.event_name == "push" || github.event_name == "pull_request"`, you can use `contains()` with `fromJson()` to check if an array of strings contains an `item`.
|
||||
|
||||
例如,如果 `github.event_name` 是“push”或“pull_request”,`contains(fromJson('["push", "pull_request"]'), github.event_name)` 便会返回 `true`。
|
||||
For example, `contains(fromJson('["push", "pull_request"]'), github.event_name)` returns `true` if `github.event_name` is "push" or "pull_request".
|
||||
|
||||
### startsWith
|
||||
|
||||
`startsWith( searchString, searchValue )`
|
||||
|
||||
如果 `searchString` 以 `searchValue` 开头,将返回 `true`。 此函数不区分大小写。 抛出值到字符串。
|
||||
Returns `true` when `searchString` starts with `searchValue`. This function is not case sensitive. Casts values to a string.
|
||||
|
||||
#### 示例
|
||||
#### Example
|
||||
|
||||
`startsWith('Hello world', 'He')` 返回 `true`。
|
||||
`startsWith('Hello world', 'He')` returns `true`.
|
||||
|
||||
### endsWith
|
||||
|
||||
`endsWith( searchString, searchValue )`
|
||||
|
||||
如果 `true` 以 `searchString` 结尾,则返回 `searchValue`。 此函数不区分大小写。 抛出值到字符串。
|
||||
Returns `true` if `searchString` ends with `searchValue`. This function is not case sensitive. Casts values to a string.
|
||||
|
||||
#### 示例
|
||||
#### Example
|
||||
|
||||
`endsWith('Hello world', 'ld')` 返回 `true`。
|
||||
`endsWith('Hello world', 'ld')` returns `true`.
|
||||
|
||||
### format
|
||||
|
||||
`format( string, replaceValue0, replaceValue1, ..., replaceValueN)`
|
||||
|
||||
将 `string` 中的值替换为变量 `replaceValueN`。 `string` 中的变量是使用 `{N}` 语法指定的,其中 `N` 是一个整数。 必须至少指定一个 `replaceValue` 和 `string`。 可使用的变量 (`replaceValueN`) 的数量没有上限。 使用双小括号逸出大括号。
|
||||
Replaces values in the `string`, with the variable `replaceValueN`. Variables in the `string` are specified using the `{N}` syntax, where `N` is an integer. You must specify at least one `replaceValue` and `string`. There is no maximum for the number of variables (`replaceValueN`) you can use. Escape curly braces using double braces.
|
||||
|
||||
#### 示例
|
||||
#### Example
|
||||
|
||||
`format('Hello {0} {1} {2}', 'Mona', 'the', 'Octocat')`
|
||||
|
||||
返回“Hello Mona the Octocat”。
|
||||
Returns 'Hello Mona the Octocat'.
|
||||
|
||||
#### 逸出括号示例
|
||||
#### Example escaping braces
|
||||
|
||||
{% raw %}
|
||||
```js
|
||||
@@ -184,37 +181,37 @@ format('{{Hello {0} {1} {2}!}}', 'Mona', 'the', 'Octocat')
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
返回“{Hello Mona the Octocat!}”。
|
||||
Returns '{Hello Mona the Octocat!}'.
|
||||
|
||||
### join
|
||||
|
||||
`join( array, optionalSeparator )`
|
||||
|
||||
`array` 的值可以是数组,也可以是字符串。 `array` 中的所有值都连接成一个字符串。 如果提供 `optionalSeparator`,则它将插入到连接的值之间, 否则使用默认分隔符 `,`。 抛出值到字符串。
|
||||
The value for `array` can be an array or a string. All values in `array` are concatenated into a string. If you provide `optionalSeparator`, it is inserted between the concatenated values. Otherwise, the default separator `,` is used. Casts values to a string.
|
||||
|
||||
#### 示例
|
||||
#### Example
|
||||
|
||||
`join(github.event.issue.labels.*.name, ', ')` 可能会返回“出现 bug,需要帮助”
|
||||
`join(github.event.issue.labels.*.name, ', ')` may return 'bug, help wanted'
|
||||
|
||||
### toJSON
|
||||
|
||||
`toJSON(value)`
|
||||
|
||||
对 `value` 返回适合打印的 JSON 表示形式。 您可以使用此函数调试上下文中提供的信息。
|
||||
Returns a pretty-print JSON representation of `value`. You can use this function to debug the information provided in contexts.
|
||||
|
||||
#### 示例
|
||||
#### Example
|
||||
|
||||
`toJSON(job)` 可能会返回 `{ "status": "Success" }`
|
||||
`toJSON(job)` might return `{ "status": "Success" }`
|
||||
|
||||
### fromJSON
|
||||
|
||||
`fromJSON(value)`
|
||||
|
||||
返回 `value` 的 JSON 对象或 JSON 数据类型。 您可以使用此函数来提供 JSON 对象作为评估表达式或从字符串转换环境变量。
|
||||
Returns a JSON object or JSON data type for `value`. You can use this function to provide a JSON object as an evaluated expression or to convert environment variables from a string.
|
||||
|
||||
#### 返回 JSON 对象的示例
|
||||
#### Example returning a JSON object
|
||||
|
||||
此工作流在一个作业中设置 JSON 矩阵,并使用输出和 `fromJSON` 将其传递给下一个作业。
|
||||
This workflow sets a JSON matrix in one job, and passes it to the next job using an output and `fromJSON`.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -238,9 +235,9 @@ jobs:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
#### 返回 JSON 数据类型的示例
|
||||
#### Example returning a JSON data type
|
||||
|
||||
此工作流使用 `fromJSON` 将环境变量从字符串转换为布尔值或整数。
|
||||
This workflow uses `fromJSON` to convert environment variables from a string to a Boolean or integer.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -263,37 +260,37 @@ jobs:
|
||||
|
||||
`hashFiles(path)`
|
||||
|
||||
返回与 `path` 模式匹配的文件集的单个哈希。 可以提供用逗号分隔的单个 `path` 模式或多个 `path` 模式。 `path` 与 `GITHUB_WORKSPACE` 目录相关,且仅包含 `GITHUB_WORKSPACE` 内的文件。 此函数为每个匹配的文件计算单独的 SHA-256 哈希, 然后使用这些哈希来计算文件集的最终 SHA-256 哈希。 如果 `path` 模式与任何文件都不匹配,则返回空字符串。 有关 SHA-256 的详细信息,请参阅“[SHA-2](https://en.wikipedia.org/wiki/SHA-2)”。
|
||||
Returns a single hash for the set of files that matches the `path` pattern. You can provide a single `path` pattern or multiple `path` patterns separated by commas. The `path` is relative to the `GITHUB_WORKSPACE` directory and can only include files inside of the `GITHUB_WORKSPACE`. This function calculates an individual SHA-256 hash for each matched file, and then uses those hashes to calculate a final SHA-256 hash for the set of files. If the `path` pattern does not match any files, this returns an empty string. For more information about SHA-256, see "[SHA-2](https://en.wikipedia.org/wiki/SHA-2)."
|
||||
|
||||
您可以使用模式匹配字符来匹配文件名。 模式匹配在 Windows 上不区分大小写。 有关受支持的模式匹配字符的详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流语法](/actions/using-workflows/workflow-syntax-for-github-actions/#filter-pattern-cheat-sheet)”。
|
||||
You can use pattern matching characters to match file names. Pattern matching is case-insensitive on Windows. For more information about supported pattern matching characters, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/using-workflows/workflow-syntax-for-github-actions/#filter-pattern-cheat-sheet)."
|
||||
|
||||
#### 单一模式示例
|
||||
#### Example with a single pattern
|
||||
|
||||
匹配存储库中的任何 `package-lock.json` 文件。
|
||||
Matches any `package-lock.json` file in the repository.
|
||||
|
||||
`hashFiles('**/package-lock.json')`
|
||||
|
||||
#### 多个模式示例
|
||||
#### Example with multiple patterns
|
||||
|
||||
为存储库中的任何 `package-lock.json` 和 `Gemfile.lock` 文件创建哈希。
|
||||
Creates a hash for any `package-lock.json` and `Gemfile.lock` files in the repository.
|
||||
|
||||
`hashFiles('**/package-lock.json', '**/Gemfile.lock')`
|
||||
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-5504 or ghec %}
|
||||
## 状态检查函数
|
||||
{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}
|
||||
## Status check functions
|
||||
|
||||
可以将以下状态检查函数用作 `if` 条件中的表达式。 除非包含这些函数之一,否则将应用 `success()` 的默认状态检查。 有关 `if` 条件的详细信息,请参阅“[GitHub Actions 的工作流语法](/articles/workflow-syntax-for-github-actions/#jobsjob_idif)”和“[GitHub Composite Actions 的元数据语法](/actions/creating-actions/metadata-syntax-for-github-actions/#runsstepsif)”。
|
||||
You can use the following status check functions as expressions in `if` conditionals. A default status check of `success()` is applied unless you include one of these functions. For more information about `if` conditionals, see "[Workflow syntax for GitHub Actions](/articles/workflow-syntax-for-github-actions/#jobsjob_idif)" and "[Metadata syntax for GitHub Composite Actions](/actions/creating-actions/metadata-syntax-for-github-actions/#runsstepsif)".
|
||||
{% else %}
|
||||
## 检查函数
|
||||
可以将以下状态检查函数用作 `if` 条件中的表达式。 除非包含这些函数之一,否则将应用 `success()` 的默认状态检查。 有关 `if` 条件的详细信息,请参阅“[GitHub Actions 的工作流语法](/articles/workflow-syntax-for-github-actions/#jobsjob_idif)”。
|
||||
## Check Functions
|
||||
You can use the following status check functions as expressions in `if` conditionals. A default status check of `success()` is applied unless you include one of these functions. For more information about `if` conditionals, see "[Workflow syntax for GitHub Actions](/articles/workflow-syntax-for-github-actions/#jobsjob_idif)".
|
||||
{% endif %}
|
||||
|
||||
### success
|
||||
|
||||
如果前面的步骤都没有失败或被取消,则返回 `true`。
|
||||
Returns `true` when none of the previous steps have failed or been canceled.
|
||||
|
||||
#### 示例
|
||||
#### Example
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -302,11 +299,11 @@ steps:
|
||||
if: {% raw %}${{ success() }}{% endraw %}
|
||||
```
|
||||
|
||||
### 通用
|
||||
### always
|
||||
|
||||
导致步骤始终执行,并返回 `true`,即使取消也一样。 作业或步骤在重大故障阻止任务运行时不会运行。 例如,如果获取来源失败。
|
||||
Causes the step to always execute, and returns `true`, even when canceled. A job or step will not run when a critical failure prevents the task from running. For example, if getting sources failed.
|
||||
|
||||
#### 示例
|
||||
#### Example
|
||||
|
||||
```yaml
|
||||
if: {% raw %}${{ always() }}{% endraw %}
|
||||
@@ -314,19 +311,19 @@ if: {% raw %}${{ always() }}{% endraw %}
|
||||
|
||||
### cancelled
|
||||
|
||||
如果工作流被取消,则返回 `true`。
|
||||
Returns `true` if the workflow was canceled.
|
||||
|
||||
#### 示例
|
||||
#### Example
|
||||
|
||||
```yaml
|
||||
if: {% raw %}${{ cancelled() }}{% endraw %}
|
||||
```
|
||||
|
||||
### 失败
|
||||
### failure
|
||||
|
||||
如果作业的任何先前步骤失败,将返回 `true`。 如果有一系列依赖项作业,则 `failure()` 在任何上级作业失败时返回 `true`。
|
||||
Returns `true` when any previous step of a job fails. If you have a chain of dependent jobs, `failure()` returns `true` if any ancestor job fails.
|
||||
|
||||
#### 示例
|
||||
#### Example
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -335,11 +332,11 @@ steps:
|
||||
if: {% raw %}${{ failure() }}{% endraw %}
|
||||
```
|
||||
|
||||
#### 有条件的失败
|
||||
#### failure with conditions
|
||||
|
||||
可以包含一个在失败后运行的步骤的额外条件,但仍必须包含 `failure()` 以覆盖自动应用于不包含状态检查函数的 `if` 条件的默认 `success()` 状态检查。
|
||||
You can include extra conditions for a step to run after a failure, but you must still include `failure()` to override the default status check of `success()` that is automatically applied to `if` conditions that don't contain a status check function.
|
||||
|
||||
##### 示例
|
||||
##### Example
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -351,11 +348,11 @@ steps:
|
||||
if: {% raw %}${{ failure() && steps.demo.conclusion == 'failure' }}{% endraw %}
|
||||
```
|
||||
|
||||
## 对象过滤器
|
||||
## Object filters
|
||||
|
||||
可使用 `*` 语法来应用筛选器并选择集合中的匹配项。
|
||||
You can use the `*` syntax to apply a filter and select matching items in a collection.
|
||||
|
||||
例如,考虑名为 `fruits` 的对象数组。
|
||||
For example, consider an array of objects named `fruits`.
|
||||
|
||||
```json
|
||||
[
|
||||
@@ -365,9 +362,9 @@ steps:
|
||||
]
|
||||
```
|
||||
|
||||
筛选器 `fruits.*.name` 返回数组 `[ "apple", "orange", "pear" ]`。
|
||||
The filter `fruits.*.name` returns the array `[ "apple", "orange", "pear" ]`.
|
||||
|
||||
还可以对某个对象使用 `*` 语法。 例如,假设有一个名为 `vegetables` 的对象。
|
||||
You may also use the `*` syntax on an object. For example, suppose you have an object named `vegetables`.
|
||||
|
||||
```json
|
||||
|
||||
@@ -390,7 +387,7 @@ steps:
|
||||
}
|
||||
```
|
||||
|
||||
筛选器 `vegetables.*.ediblePortions` 的计算结果如下:
|
||||
The filter `vegetables.*.ediblePortions` could evaluate to:
|
||||
|
||||
```json
|
||||
|
||||
@@ -401,4 +398,4 @@ steps:
|
||||
]
|
||||
```
|
||||
|
||||
由于对象不保留顺序,因此无法保证输出的顺序。
|
||||
Since objects don't preserve order, the order of the output can not be guaranteed.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: 查找和自定义操作
|
||||
title: Finding and customizing actions
|
||||
shortTitle: Finding and customizing actions
|
||||
intro: 操作是支持工作流程的构建块。 工作流程可以包含社区创建的操作,您也可以直接在应用程序的仓库中创建您自己的操作。 本指南说明如何发现、使用和自定义操作。
|
||||
intro: 'Actions are the building blocks that power your workflow. A workflow can contain actions created by the community, or you can create your own actions directly within your application''s repository. This guide will show you how to discover, use, and customize actions.'
|
||||
redirect_from:
|
||||
- /actions/automating-your-workflow-with-github-actions/using-github-marketplace-actions
|
||||
- /actions/automating-your-workflow-with-github-actions/using-actions-from-github-marketplace-in-your-workflow
|
||||
@@ -15,75 +15,71 @@ versions:
|
||||
type: how_to
|
||||
topics:
|
||||
- Fundamentals
|
||||
ms.openlocfilehash: cb2b8bb24e044bd559b0823ec7b0e4be7be1becb
|
||||
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/11/2022
|
||||
ms.locfileid: '147063792'
|
||||
---
|
||||
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
## 概述
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
{% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
在工作流程中使用的操作可以定义于:
|
||||
## Overview
|
||||
|
||||
- 与工作流文件相同的存储库{% ifversion internal-actions %}
|
||||
- 在同一企业帐户中被配置为允许访问工作流程的内部仓库{% endif %}
|
||||
- 任何公共仓库
|
||||
- Docker Hub 上发布的 Docker 容器图像
|
||||
The actions you use in your workflow can be defined in:
|
||||
|
||||
{% data variables.product.prodname_marketplace %} 是你用来查找 {% data variables.product.prodname_dotcom %} 社区创建的操作的中心位置。{% ifversion fpt or ghec %} 利用[{% data variables.product.prodname_marketplace %} 页面](https://github.com/marketplace/actions/)页面可按类别筛选操作。 {% endif %}
|
||||
- The same repository as your workflow file{% ifversion internal-actions %}
|
||||
- An internal repository within the same enterprise account that is configured to allow access to workflows{% endif %}
|
||||
- Any public repository
|
||||
- A published Docker container image on Docker Hub
|
||||
|
||||
{% data variables.product.prodname_marketplace %} is a central location for you to find actions created by the {% data variables.product.prodname_dotcom %} community.{% ifversion fpt or ghec %} [{% data variables.product.prodname_marketplace %} page](https://github.com/marketplace/actions/) enables you to filter for actions by category. {% endif %}
|
||||
|
||||
{% data reusables.actions.enterprise-marketplace-actions %}
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
|
||||
## 在工作流程编辑器中浏览 Marketplace 操作
|
||||
## Browsing Marketplace actions in the workflow editor
|
||||
|
||||
您可以直接在仓库的工作流程编辑器中搜索和浏览操作。 从边栏可以搜索特定的操作、查看特色操作和浏览特色类别。 您也可以查看操作从 {% data variables.product.prodname_dotcom %} 社区获得的星标数。
|
||||
You can search and browse actions directly in your repository's workflow editor. From the sidebar, you can search for a specific action, view featured actions, and browse featured categories. You can also view the number of stars an action has received from the {% data variables.product.prodname_dotcom %} community.
|
||||
|
||||
1. 在仓库中,浏览至要编辑的工作流程文件。
|
||||
1. 要打开工作流编辑器,在文件视图右上角单击 {% octicon "pencil" aria-label="The edit icon" %}。
|
||||

|
||||
1. 在编辑器右侧,使用 {% data variables.product.prodname_marketplace %} 边栏浏览操作。 带有 {% octicon "verified" aria-label="The verified badge" %} 徽章的操作表示 {% data variables.product.prodname_dotcom %} 已验证操作的创建者为合作伙伴组织。
|
||||

|
||||
1. In your repository, browse to the workflow file you want to edit.
|
||||
1. In the upper right corner of the file view, to open the workflow editor, click {% octicon "pencil" aria-label="The edit icon" %}.
|
||||

|
||||
1. To the right of the editor, use the {% data variables.product.prodname_marketplace %} sidebar to browse actions. Actions with the {% octicon "verified" aria-label="The verified badge" %} badge indicate {% data variables.product.prodname_dotcom %} has verified the creator of the action as a partner organization.
|
||||

|
||||
|
||||
## 添加操作到工作流程
|
||||
## Adding an action to your workflow
|
||||
|
||||
您可以通过在工作流程文件中引用操作来向工作流程添加操作。
|
||||
You can add an action to your workflow by referencing the action in your workflow file.
|
||||
|
||||
您可以将 {% data variables.product.prodname_actions %} 工作流程中引用的操作视为包含工作流程的仓库依赖图中的依赖项。 有关详细信息,请参阅“[关于依赖项关系图](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph)”。
|
||||
You can view the actions referenced in your {% data variables.product.prodname_actions %} workflows as dependencies in the dependency graph of the repository containing your workflows. For more information, see “[About the dependency graph](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph).”
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6269 %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:为了增强安全性,{% data variables.product.prodname_actions %} 弃用了操作的重定向。 这意味着,当操作存储库的所有者或名称发生更改时,使用该操作并具有先前名称的任何工作流程都将失败。
|
||||
**Note:** To enhance security, {% data variables.product.prodname_actions %} is deprecating redirects for actions. This means that when the owner or name of an action's repository is changed, any workflows using that action with the previous name will fail.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
### 从 {% data variables.product.prodname_marketplace %} 添加操作
|
||||
### Adding an action from {% data variables.product.prodname_marketplace %}
|
||||
|
||||
操作的列表页包括操作的版本以及使用操作所需的工作流程语法。 为使工作流程在操作有更新时也保持稳定,您可以在工作流程文件中指定 Git 或 Docker 标记号以引用所用操作的版本。
|
||||
An action's listing page includes the action's version and the workflow syntax required to use the action. To keep your workflow stable even when updates are made to an action, you can reference the version of the action to use by specifying the Git or Docker tag number in your workflow file.
|
||||
|
||||
1. 导航到要在工作流程中使用的操作。
|
||||
1. 在“安装”下,单击 {% octicon "clippy" aria-label="The edit icon" %} 复制工作流语法。
|
||||

|
||||
1. 将语法粘贴为工作流程中的新步骤。 有关详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流语法](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idsteps)”。
|
||||
1. 如果操作要求您提供输入,请将其设置在工作流程中。 有关操作可能需要的输入的信息,请参阅“[对操作使用输入和输出](/actions/learn-github-actions/finding-and-customizing-actions#using-inputs-and-outputs-with-an-action)”。
|
||||
1. Navigate to the action you want to use in your workflow.
|
||||
1. Under "Installation", click {% octicon "clippy" aria-label="The edit icon" %} to copy the workflow syntax.
|
||||

|
||||
1. Paste the syntax as a new step in your workflow. For more information, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idsteps)."
|
||||
1. If the action requires you to provide inputs, set them in your workflow. For information on inputs an action might require, see "[Using inputs and outputs with an action](/actions/learn-github-actions/finding-and-customizing-actions#using-inputs-and-outputs-with-an-action)."
|
||||
|
||||
{% data reusables.dependabot.version-updates-for-actions %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
### 从相同仓库添加操作
|
||||
### Adding an action from the same repository
|
||||
|
||||
如果操作在工作流文件使用该操作的同一存储库中定义,你可以在工作流文件中通过 `{owner}/{repo}@{ref}` 或 `./path/to/dir` 语法引用操作。
|
||||
If an action is defined in the same repository where your workflow file uses the action, you can reference the action with either the `{owner}/{repo}@{ref}` or `./path/to/dir` syntax in your workflow file.
|
||||
|
||||
示例仓库文件结构:
|
||||
Example repository file structure:
|
||||
|
||||
```
|
||||
|-- hello-world (repository)
|
||||
@@ -95,7 +91,7 @@ ms.locfileid: '147063792'
|
||||
| └── action.yml
|
||||
```
|
||||
|
||||
示例工作流程文件:
|
||||
Example workflow file:
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@@ -108,13 +104,13 @@ jobs:
|
||||
- uses: ./.github/actions/hello-world-action
|
||||
```
|
||||
|
||||
`action.yml` 文件用于提供操作的元数据。 要了解此文件的内容,请参阅“[GitHub Actions 的元数据语法](/actions/creating-actions/metadata-syntax-for-github-actions)”。
|
||||
The `action.yml` file is used to provide metadata for the action. Learn about the content of this file in "[Metadata syntax for GitHub Actions](/actions/creating-actions/metadata-syntax-for-github-actions)."
|
||||
|
||||
### 从不同仓库添加操作
|
||||
### Adding an action from a different repository
|
||||
|
||||
如果操作在与工作流文件不同的存储库中定义,可在工作流文件中通过 `{owner}/{repo}@{ref}` 语法引用该操作。
|
||||
If an action is defined in a different repository than your workflow file, you can reference the action with the `{owner}/{repo}@{ref}` syntax in your workflow file.
|
||||
|
||||
该操作必须存储在公共存储库{% ifversion internal-actions %} 或存储在配置为允许访问工作流的内部存储库中。 有关详细信息,请参阅“[与企业共享操作和工作流](/actions/creating-actions/sharing-actions-and-workflows-with-your-enterprise)”。{% else %}。{% endif %}
|
||||
The action must be stored in a public repository{% ifversion internal-actions %} or an internal repository that is configured to allow access to workflows. For more information, see "[Sharing actions and workflows with your enterprise](/actions/creating-actions/sharing-actions-and-workflows-with-your-enterprise)."{% else %}.{% endif %}
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@@ -124,9 +120,9 @@ jobs:
|
||||
uses: {% data reusables.actions.action-setup-node %}
|
||||
```
|
||||
|
||||
### 引用 Docker Hub 上的容器
|
||||
### Referencing a container on Docker Hub
|
||||
|
||||
如果操作在 Docker Hub 上发布的 Docker 容器图像中定义,必须在工作流文件中通过 `docker://{image}:{tag}` 语法引用该操作。 为保护代码和数据,强烈建议先验证 Docker Hub 中 Docker 容器图像的完整性后再将其用于工作流程。
|
||||
If an action is defined in a published Docker container image on Docker Hub, you must reference the action with the `docker://{image}:{tag}` syntax in your workflow file. To protect your code and data, we strongly recommend you verify the integrity of the Docker container image from Docker Hub before using it in your workflow.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@@ -136,57 +132,57 @@ jobs:
|
||||
uses: docker://alpine:3.8
|
||||
```
|
||||
|
||||
有关 Docker 操作的一些示例,请参阅 [Docker-image.yml 工作流](https://github.com/actions/starter-workflows/blob/main/ci/docker-image.yml)和“[创建 Docker 容器操作](/articles/creating-a-docker-container-action)”。
|
||||
For some examples of Docker actions, see the [Docker-image.yml workflow](https://github.com/actions/starter-workflows/blob/main/ci/docker-image.yml) and "[Creating a Docker container action](/articles/creating-a-docker-container-action)."
|
||||
|
||||
|
||||
## 对自定义操作使用发行版管理
|
||||
## Using release management for your custom actions
|
||||
|
||||
社区操作的创建者可以选择使用标记、分支或 SHA 值来管理操作的版本。 与任何依赖项类似,您应该根据自动接受操作更新的舒适程度来指示要使用的操作版本。
|
||||
The creators of a community action have the option to use tags, branches, or SHA values to manage releases of the action. Similar to any dependency, you should indicate the version of the action you'd like to use based on your comfort with automatically accepting updates to the action.
|
||||
|
||||
您将在工作流程文件中指定操作的版本。 检查操作的文档,了解其发行版管理方法的信息,并查看要使用的标记、分支或 SHA 值。
|
||||
You will designate the version of the action in your workflow file. Check the action's documentation for information on their approach to release management, and to see which tag, branch, or SHA value to use.
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:建议在使用第三方操作时使用 SHA 值。 有关详细信息,请参阅“[GitHub Actions 的安全强化](/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions)”。
|
||||
**Note:** We recommend that you use a SHA value when using third-party actions. For more information, see [Security hardening for GitHub Actions](/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions)
|
||||
|
||||
{% endnote %}
|
||||
|
||||
### 使用标记
|
||||
### Using tags
|
||||
|
||||
标记可用于让您决定何时在主要版本和次要版本之间切换,但这只是临时的,可能被维护员移动或删除。 此示例演示如何定位已标记为 `v1.0.1` 的操作:
|
||||
Tags are useful for letting you decide when to switch between major and minor versions, but these are more ephemeral and can be moved or deleted by the maintainer. This example demonstrates how to target an action that's been tagged as `v1.0.1`:
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/javascript-action@v1.0.1
|
||||
```
|
||||
|
||||
### 使用 SHA
|
||||
### Using SHAs
|
||||
|
||||
如果需要更可靠的版本控制,应使用与操作版本关联的 SHA 值。 SHA 是不可变的,因此比标记或分支更可靠。 但是,此方法意味着您不会自动接收操作的更新,包括重要的 Bug 修复和安全更新。 必须使用提交的完整 SHA 值,而不是缩写值。 此示例针对操作的 SHA:
|
||||
If you need more reliable versioning, you should use the SHA value associated with the version of the action. SHAs are immutable and therefore more reliable than tags or branches. However this approach means you will not automatically receive updates for an action, including important bug fixes and security updates. You must use a commit's full SHA value, and not an abbreviated value. This example targets an action's SHA:
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/javascript-action@172239021f7ba04fe7327647b213799853a9eb89
|
||||
```
|
||||
|
||||
### 使用分支
|
||||
### Using branches
|
||||
|
||||
为操作指定目标分支意味着它将始终在该分支上运行当前的版本。 如果对分支的更新包含重大更改,此方法可能会造成问题。 此示例针对名为 `@main` 的分支:
|
||||
Specifying a target branch for the action means it will always run the version currently on that branch. This approach can create problems if an update to the branch includes breaking changes. This example targets a branch named `@main`:
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/javascript-action@main
|
||||
```
|
||||
|
||||
有关详细信息,请参阅“[针对操作使用发布管理](/actions/creating-actions/about-actions#using-release-management-for-actions)”。
|
||||
For more information, see "[Using release management for actions](/actions/creating-actions/about-actions#using-release-management-for-actions)."
|
||||
|
||||
## 对操作使用输入和输出
|
||||
## Using inputs and outputs with an action
|
||||
|
||||
操作通常接受或需要输入并生成可以使用的输出。 例如,操作可能要求您指定文件的路径、标签的名称或它将用作操作处理一部分的其他数据。
|
||||
An action often accepts or requires inputs and generates outputs that you can use. For example, an action might require you to specify a path to a file, the name of a label, or other data it will use as part of the action processing.
|
||||
|
||||
若要查看操作的输入和输出,请检查存储库根目录中的 `action.yml` 或 `action.yaml`。
|
||||
To see the inputs and outputs of an action, check the `action.yml` or `action.yaml` in the root directory of the repository.
|
||||
|
||||
在示例 `action.yml` 中,`inputs` 关键字定义名为 `file-path` 的必需输入,并且包括在未指定任何输入时使用的默认值。 `outputs` 关键字定义名为 `results-file` 的输出,指示在何处查找结果。
|
||||
In this example `action.yml`, the `inputs` keyword defines a required input called `file-path`, and includes a default value that will be used if none is specified. The `outputs` keyword defines an output called `results-file`, which tells you where to locate the results.
|
||||
|
||||
```yaml
|
||||
name: "Example"
|
||||
@@ -203,11 +199,11 @@ outputs:
|
||||
|
||||
{% ifversion ghae %}
|
||||
|
||||
## 使用 {% data variables.product.prodname_ghe_managed %} 随附的操作
|
||||
## Using the actions included with {% data variables.product.prodname_ghe_managed %}
|
||||
|
||||
默认情况下,可以在 {% data variables.product.prodname_ghe_managed %} 中使用大多数官方 {% data variables.product.prodname_dotcom %} 编写的操作。 有关详细信息,请参阅“[使用 {% data variables.product.prodname_ghe_managed %} 中的操作](/admin/github-actions/using-actions-in-github-ae)”。
|
||||
By default, you can use most of the official {% data variables.product.prodname_dotcom %}-authored actions in {% data variables.product.prodname_ghe_managed %}. For more information, see "[Using actions in {% data variables.product.prodname_ghe_managed %}](/admin/github-actions/using-actions-in-github-ae)."
|
||||
{% endif %}
|
||||
|
||||
## 后续步骤
|
||||
## Next steps
|
||||
|
||||
若要继续了解 {% data variables.product.prodname_actions %},请参阅“[{% data variables.product.prodname_actions %} 的基本功能](/actions/learn-github-actions/essential-features-of-github-actions)”。
|
||||
To continue learning about {% data variables.product.prodname_actions %}, see "[Essential features of {% data variables.product.prodname_actions %}](/actions/learn-github-actions/essential-features-of-github-actions)."
|
||||
|
||||
@@ -53,7 +53,7 @@ You can configure a {% data variables.product.prodname_actions %} _workflow_ to
|
||||
|
||||
{% data reusables.actions.about-workflows-long %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 or ghec %}You can reference a workflow within another workflow, see "[Reusing workflows](/actions/learn-github-actions/reusing-workflows)."{% endif %}
|
||||
{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}You can reference a workflow within another workflow, see "[Reusing workflows](/actions/learn-github-actions/reusing-workflows)."{% endif %}
|
||||
|
||||
For more information about workflows, see "[Using workflows](/actions/using-workflows)."
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ You can help mitigate this risk by following these good practices:
|
||||
|
||||
Although pinning to a commit SHA is the most secure option, specifying a tag is more convenient and is widely used. If you’d like to specify a tag, then be sure that you trust the action's creators. The ‘Verified creator’ badge on {% data variables.product.prodname_marketplace %} is a useful signal, as it indicates that the action was written by a team whose identity has been verified by {% data variables.product.prodname_dotcom %}. Note that there is risk to this approach even if you trust the author, because a tag can be moved or deleted if a bad actor gains access to the repository storing the action.
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 or ghec %}
|
||||
{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}
|
||||
## Reusing third-party workflows
|
||||
|
||||
The same principles described above for using third-party actions also apply to using third-party workflows. You can help mitigate the risks associated with reusing workflows by following the same good practices outlined above. For more information, see "[Reusing workflows](/actions/learn-github-actions/reusing-workflows)."
|
||||
|
||||
@@ -195,7 +195,7 @@ To learn more about self-hosted runner labels, see "[Using labels with self-host
|
||||
To learn more about {% data variables.product.prodname_dotcom %}-hosted runner labels, see "[Supported runners and hardware resources](/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources)."
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 or ghec %}
|
||||
{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}
|
||||
### Reusing workflows
|
||||
{% data reusables.actions.reusable-workflows %}
|
||||
{% endif %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: 为组织创建入门工作流程
|
||||
title: Creating starter workflows for your organization
|
||||
shortTitle: Creating starter workflows
|
||||
intro: 了解如何创建入门工作流程,以帮助团队中的人员更轻松地添加新工作流程。
|
||||
intro: Learn how you can create starter workflows to help people in your team add new workflows more easily.
|
||||
redirect_from:
|
||||
- /actions/configuring-and-managing-workflows/sharing-workflow-templates-within-your-organization
|
||||
- /actions/learn-github-actions/creating-workflow-templates
|
||||
@@ -15,43 +15,42 @@ type: tutorial
|
||||
topics:
|
||||
- Workflows
|
||||
- CI
|
||||
ms.openlocfilehash: cbaecefc90f3593b8883c7ccad5256b4addf972c
|
||||
ms.sourcegitcommit: 5f9527483381cfb1e41f2322f67c80554750a47d
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/11/2022
|
||||
ms.locfileid: '147884187'
|
||||
---
|
||||
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
## 概述
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
{% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
## Overview
|
||||
|
||||
{% data reusables.actions.workflow-organization-templates %}
|
||||
|
||||
{% data reusables.actions.starter-workflow-categories %}
|
||||
|
||||
## 创建入门工作流程
|
||||
## Creating a starter workflow
|
||||
|
||||
入门工作流程可由对组织的 `.github` 存储库具有写入访问权限的用户创建。 然后,有权限创建工作流程的组织成员便可使用它们。
|
||||
Starter workflows can be created by users with write access to the organization's `.github` repository. These can then be used by organization members who have permission to create workflows.
|
||||
|
||||
{% ifversion fpt %} 用户创建的入门工作流程只能用于在公共存储库中创建工作流程。 使用 {% data variables.product.prodname_ghe_cloud %} 的组织还可以使用入门工作流程在私有仓库中创建工作流程。 有关详细信息,请参阅 [{% data variables.product.prodname_ghe_cloud %} 文档](/enterprise-cloud@latest/actions/learn-github-actions/creating-starter-workflows-for-your-organization)。
|
||||
{% ifversion fpt %}
|
||||
Starter workflows created by users can only be used to create workflows in public repositories. Organizations using {% data variables.product.prodname_ghe_cloud %} can also use starter workflows to create workflows in private repositories. For more information, see the [{% data variables.product.prodname_ghe_cloud %} documentation](/enterprise-cloud@latest/actions/learn-github-actions/creating-starter-workflows-for-your-organization).
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 or ghec %} {% note %}
|
||||
{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}
|
||||
{% note %}
|
||||
|
||||
**注意:** 为避免入门工作流程之间的重复,可以从工作流程中调用可重用工作流程。 这有助于使您的工作流程更易于维护。 有关详细信息,请参阅“[重用工作流](/actions/learn-github-actions/reusing-workflows)”。
|
||||
**Note:** To avoid duplication among starter workflows you can call reusable workflows from within a workflow. This can help make your workflows easier to maintain. For more information, see "[Reusing workflows](/actions/learn-github-actions/reusing-workflows)."
|
||||
|
||||
{% endnote %} {% endif %}
|
||||
{% endnote %}
|
||||
{% endif %}
|
||||
|
||||
此过程演示如何创建入门工作流程和元数据文件。 元数据文件描述了在用户创建新工作流程时如何向用户显示入门工作流程。
|
||||
This procedure demonstrates how to create a starter workflow and metadata file. The metadata file describes how the starter workflows will be presented to users when they are creating a new workflow.
|
||||
|
||||
1. 如果组织中没有名为 `.github` 的公共存储库,请新建一个。
|
||||
2. 创建名为 `workflow-templates` 的目录。
|
||||
3. 在 `workflow-templates` 目录中创建新的工作流文件。
|
||||
1. If it doesn't already exist, create a new public repository named `.github` in your organization.
|
||||
2. Create a directory named `workflow-templates`.
|
||||
3. Create your new workflow file inside the `workflow-templates` directory.
|
||||
|
||||
如果需要引用存储库的默认分支,可以使用 `$default-branch` 占位符。 创建工作流程时,占位符将自动替换为仓库默认分支的名称。
|
||||
If you need to refer to a repository's default branch, you can use the `$default-branch` placeholder. When a workflow is created the placeholder will be automatically replaced with the name of the repository's default branch.
|
||||
|
||||
例如,名为 `octo-organization-ci.yml` 的文件演示基本工作流。
|
||||
For example, this file named `octo-organization-ci.yml` demonstrates a basic workflow.
|
||||
|
||||
```yaml
|
||||
name: Octo Organization CI
|
||||
@@ -72,7 +71,7 @@ ms.locfileid: '147884187'
|
||||
- name: Run a one-line script
|
||||
run: echo Hello from Octo Organization
|
||||
```
|
||||
4. 在 `workflow-templates` 目录中创建元数据文件。 元数据文件必须与工作流程文件同名,但扩展名不是 `.yml`,而必须附加 `.properties.json`。 例如,名为 `octo-organization-ci.properties.json` 的文件包含名为 `octo-organization-ci.yml` 的工作流文件的元数据:
|
||||
4. Create a metadata file inside the `workflow-templates` directory. The metadata file must have the same name as the workflow file, but instead of the `.yml` extension, it must be appended with `.properties.json`. For example, this file named `octo-organization-ci.properties.json` contains the metadata for a workflow file named `octo-organization-ci.yml`:
|
||||
```yaml
|
||||
{
|
||||
"name": "Octo Organization Workflow",
|
||||
@@ -88,16 +87,16 @@ ms.locfileid: '147884187'
|
||||
]
|
||||
}
|
||||
```
|
||||
* `name` - **必选。** 工作流的名称。 这会显示在可用工作流程列表中。
|
||||
* `description` - **必选。** 工作流的说明。 这会显示在可用工作流程列表中。
|
||||
* `iconName` - **可选。** 指定工作流列表中显示的工作流的图标。 `iconName` 必须是 SVG 文件的名称,而不使用文件扩展名,且存储在 `workflow-templates` 目录中。 例如,名为 `example-icon.svg` 的 SVG 文件被引用为 `example-icon`。
|
||||
* `categories` - **可选。** 定义工作流的语言类别。 当用户查看存储库的可用入门工作流程时,与项目已识别语言匹配的工作流程将更加突出。 有关可用语言类别的信息,请参阅 https://github.com/github/linguist/blob/master/lib/linguist/languages.yml 。
|
||||
* `filePatterns` - **可选。** 如果用户的存储库在其根目录中具有与定义的正则表达式匹配的文件,则允许使用工作流。
|
||||
* `name` - **Required.** The name of the workflow. This is displayed in the list of available workflows.
|
||||
* `description` - **Required.** The description of the workflow. This is displayed in the list of available workflows.
|
||||
* `iconName` - **Optional.** Specifies an icon for the workflow that's displayed in the list of workflows. The `iconName` must be the name of an SVG file, without the file name extension, stored in the `workflow-templates` directory. For example, an SVG file named `example-icon.svg` is referenced as `example-icon`.
|
||||
* `categories` - **Optional.** Defines the language category of the workflow. When a user views the available starter workflows for a repository, the workflows that match the identified language for the project are featured more prominently. For information on the available language categories, see https://github.com/github/linguist/blob/master/lib/linguist/languages.yml.
|
||||
* `filePatterns` - **Optional.** Allows the workflow to be used if the user's repository has a file in its root directory that matches a defined regular expression.
|
||||
|
||||
若要添加另一个入门工作流程,请将文件添加到相同的 `workflow-templates` 目录。 例如:
|
||||
To add another starter workflow, add your files to the same `workflow-templates` directory. For example:
|
||||
|
||||

|
||||

|
||||
|
||||
## 后续步骤
|
||||
## Next steps
|
||||
|
||||
若要继续了解 {% data variables.product.prodname_actions %},请参阅“[使用入门工作流程](/actions/using-workflows/using-starter-workflows)”。
|
||||
To continue learning about {% data variables.product.prodname_actions %}, see "[Using starter workflows](/actions/using-workflows/using-starter-workflows)."
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@ versions:
|
||||
fpt: '*'
|
||||
ghec: '*'
|
||||
ghes: '>=3.4'
|
||||
ghae: issue-4757
|
||||
ghae: '>= 3.4'
|
||||
type: how_to
|
||||
topics:
|
||||
- Workflows
|
||||
@@ -217,7 +217,7 @@ You call a reusable workflow by using the `uses` keyword. Unlike when you are us
|
||||
|
||||
[`jobs.<job_id>.uses`](/actions/reference/workflow-syntax-for-github-actions#jobsjob_iduses)
|
||||
|
||||
You reference reusable workflow files using {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6000 %}one of the following syntaxes:{% else %}the syntax:{% endif %}
|
||||
You reference reusable workflow files using {% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}one of the following syntaxes:{% else %}the syntax:{% endif %}
|
||||
|
||||
{% data reusables.actions.reusable-workflow-calling-syntax %}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: 与组织共享工作流程、机密和运行器
|
||||
title: 'Sharing workflows, secrets, and runners with your organization'
|
||||
shortTitle: Sharing workflows with your organization
|
||||
intro: 了解如何通过共享入门工作流程、机密和自托管运行器,使用组织功能与团队协作。
|
||||
intro: 'Learn how you can use organization features to collaborate with your team, by sharing starter workflows, secrets, and self-hosted runners.'
|
||||
redirect_from:
|
||||
- /actions/learn-github-actions/sharing-workflows-with-your-organization
|
||||
- /actions/learn-github-actions/sharing-workflows-secrets-and-runners-with-your-organization
|
||||
@@ -11,61 +11,63 @@ versions:
|
||||
ghae: '*'
|
||||
ghec: '*'
|
||||
type: how_to
|
||||
ms.openlocfilehash: bf80624fe1118d424a57f7c22efab6368c914819
|
||||
ms.sourcegitcommit: 5f9527483381cfb1e41f2322f67c80554750a47d
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/11/2022
|
||||
ms.locfileid: '147884259'
|
||||
---
|
||||
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
## 概述
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
{% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
如果需要与您的团队共享工作流程和其他 {% data variables.product.prodname_actions %} 功能,则考虑在 {% data variables.product.prodname_dotcom %} 组织内协作。 组织允许您集中存储和管理机密、构件和自托管运行器。 还可以在 `.github` 存储库中创建入门工作流,并与组织中的其他用户共享这些工作流。
|
||||
## Overview
|
||||
|
||||
## 共享 {% ifversion internal-actions %}操作和 {% endif %}工作流
|
||||
If you need to share workflows and other {% data variables.product.prodname_actions %} features with your team, then consider collaborating within a {% data variables.product.prodname_dotcom %} organization. An organization allows you to centrally store and manage secrets, artifacts, and self-hosted runners. You can also create starter workflows in the `.github` repository and share them with other users in your organization.
|
||||
|
||||
{% ifversion internal-actions %} 无论是否公开发布操作或工作流,都可以与组织共享各个操作和整个工作流。 您可以通过在工作流程文件中引用操作和工作流程来精确地重复使用它们,并且可以创建为新工作流程提供模板的起始工作流程。
|
||||
{% else %} 你的组织可以通过完全重用工作流或创建为新工作流提供模板的初始工作流来共享工作流。
|
||||
## Sharing {% ifversion internal-actions %}actions and {% endif %}workflows
|
||||
|
||||
{% ifversion internal-actions %}
|
||||
You can share both individual actions and entire workflows with your organization, with or without publishing the actions or workflows publicly. You can reuse actions and workflows exactly by referencing them in your workflow file, and you can create starter workflows that provide templates for new workflows.
|
||||
{% else %}
|
||||
Your organization can share workflows by reusing the workflows exactly or by creating starter workflows that provide templates for new workflows.
|
||||
{% endif %}
|
||||
|
||||
{% ifversion internal-actions %}
|
||||
### 与企业共享操作
|
||||
### Sharing actions with your enterprise
|
||||
|
||||
{% data reusables.actions.internal-actions-summary %} {% endif %}
|
||||
{% data reusables.actions.internal-actions-summary %}
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 or ghec %}
|
||||
### 重新使用工作流
|
||||
{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}
|
||||
### Reusing workflows
|
||||
|
||||
{% data reusables.actions.reusable-workflows %} {% endif %}
|
||||
{% data reusables.actions.reusable-workflows %}
|
||||
{% endif %}
|
||||
|
||||
### 使用入门工作流程
|
||||
### Using starter workflows
|
||||
|
||||
{% data reusables.actions.workflow-organization-templates %} 有关详细信息,请参阅“[为组织创建入门工作流](/actions/using-workflows/creating-starter-workflows-for-your-organization)”。
|
||||
{% data reusables.actions.workflow-organization-templates %} For more information, see "[Creating starter workflows for your organization](/actions/using-workflows/creating-starter-workflows-for-your-organization)."
|
||||
|
||||
## 在组织内共享机密
|
||||
## Sharing secrets within an organization
|
||||
|
||||
您可以在组织内集中管理您的机密,然后将其提供给选定的仓库。 这也意味着您可以在一个位置更新机密,并且将更改应用于使用该机密的所有仓库工作流程。
|
||||
You can centrally manage your secrets within an organization, and then make them available to selected repositories. This also means that you can update a secret in one location, and have the change apply to all repository workflows that use the secret.
|
||||
|
||||
在组织中创建密码时,可以使用策略来限制可以访问该密码的仓库。 例如,您可以将访问权限授予所有仓库,也可以限制仅私有仓库或指定的仓库列表拥有访问权限。
|
||||
When creating a secret in an organization, you can use a policy to limit which repositories can access that secret. For example, you can grant access to all repositories, or limit access to only private repositories or a specified list of repositories.
|
||||
|
||||
{% data reusables.actions.permissions-statement-secrets-organization %}
|
||||
|
||||
{% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org_settings %} {% data reusables.actions.sidebar-secret %}
|
||||
1. 单击“新建机密”。
|
||||
1. 在“名称”输入框中键入机密名称。
|
||||
1. 输入“机密”的值。
|
||||
1. 从“存储库访问”下拉列表中,选择访问策略。
|
||||
1. 单击“添加机密”。
|
||||
{% data reusables.organizations.navigate-to-org %}
|
||||
{% data reusables.organizations.org_settings %}
|
||||
{% data reusables.actions.sidebar-secret %}
|
||||
1. Click **New secret**.
|
||||
1. Type a name for your secret in the **Name** input box.
|
||||
1. Enter the **Value** for your secret.
|
||||
1. From the **Repository access** dropdown list, choose an access policy.
|
||||
1. Click **Add secret**.
|
||||
|
||||
## 在组织内共享自托管运行器
|
||||
## Share self-hosted runners within an organization
|
||||
|
||||
组织管理员可以将其自托管的运行器添加到组,然后创建控制哪些仓库可访问该组的策略。
|
||||
Organization admins can add their self-hosted runners to groups, and then create policies that control which repositories can access the group.
|
||||
|
||||
有关详细信息,请参阅“[使用组管理对自托管运行器的访问权限](/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups)”。
|
||||
For more information, see "[Managing access to self-hosted runners using groups](/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups)."
|
||||
|
||||
|
||||
## 后续步骤
|
||||
## Next steps
|
||||
|
||||
若要继续了解 {% data variables.product.prodname_actions %},请参阅“[为组织创建入门工作流](/actions/using-workflows/creating-starter-workflows-for-your-organization)”。
|
||||
To continue learning about {% data variables.product.prodname_actions %}, see "[Creating starter workflows for your organization](/actions/using-workflows/creating-starter-workflows-for-your-organization)."
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: 触发工作流程
|
||||
title: Triggering a workflow
|
||||
shortTitle: Triggering a workflow
|
||||
intro: '如何自动触发 {% data variables.product.prodname_actions %} 工作流程'
|
||||
intro: 'How to automatically trigger {% data variables.product.prodname_actions %} workflows'
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghes: '*'
|
||||
@@ -13,36 +13,32 @@ topics:
|
||||
- CI
|
||||
- CD
|
||||
miniTocMaxHeadingLevel: 3
|
||||
ms.openlocfilehash: 7fde72e2e4138b15eae1288a1467ff8b102c3a7d
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147062288'
|
||||
---
|
||||
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
## 关于工作流程触发器
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
{% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
## About workflow triggers
|
||||
|
||||
{% data reusables.actions.about-triggers %}
|
||||
|
||||
工作流触发器使用 `on` 键定义。 有关详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流语法](/articles/workflow-syntax-for-github-actions#on)”。
|
||||
Workflow triggers are defined with the `on` key. For more information, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/articles/workflow-syntax-for-github-actions#on)."
|
||||
|
||||
以下步骤将触发工作流程运行:
|
||||
The following steps occur to trigger a workflow run:
|
||||
|
||||
1. 存储库上发生事件。 该事件具有关联的提交 SHA 和 Git 引用。
|
||||
1. {% data variables.product.product_name %} 在存储库的 `.github/workflows` 目录中搜索事件的关联提交 SHA 或 Git 引用中存在的工作流文件。
|
||||
1. 对于具有与触发事件匹配的 `on:` 值的任何工作流,触发工作流运行。 某些事件还要求工作流程文件位于存储库的默认分支上才能运行。
|
||||
1. An event occurs on your repository. The event has an associated commit SHA and Git ref.
|
||||
1. {% data variables.product.product_name %} searches the `.github/workflows` directory in your repository for workflow files that are present in the associated commit SHA or Git ref of the event.
|
||||
1. A workflow run is triggered for any workflows that have `on:` values that match the triggering event. Some events also require the workflow file to be present on the default branch of the repository in order to run.
|
||||
|
||||
每个工作流程运行都将使用事件的关联提交 SHA 或 Git ref 中存在的工作流程版本。 当工作流运行时,{% data variables.product.product_name %} 会在运行器环境中设置 `GITHUB_SHA`(提交 SHA)和 `GITHUB_REF`(Git 引用)环境变量。 有关详细信息,请参阅“[使用环境变量](/actions/automating-your-workflow-with-github-actions/using-environment-variables)”。
|
||||
Each workflow run will use the version of the workflow that is present in the associated commit SHA or Git ref of the event. When a workflow runs, {% data variables.product.product_name %} sets the `GITHUB_SHA` (commit SHA) and `GITHUB_REF` (Git ref) environment variables in the runner environment. For more information, see "[Using environment variables](/actions/automating-your-workflow-with-github-actions/using-environment-variables)."
|
||||
|
||||
### 从工作流程触发工作流程
|
||||
### Triggering a workflow from a workflow
|
||||
|
||||
{% data reusables.actions.actions-do-not-trigger-workflows %} 有关详细信息,请参阅“[使用 GITHUB_TOKEN 进行身份验证](/actions/configuring-and-managing-workflows/authenticating-with-the-github_token)”。
|
||||
{% data reusables.actions.actions-do-not-trigger-workflows %} For more information, see "[Authenticating with the GITHUB_TOKEN](/actions/configuring-and-managing-workflows/authenticating-with-the-github_token)."
|
||||
|
||||
如果确实要从工作流运行中触发工作流,则可以使用个人访问令牌而不是 `GITHUB_TOKEN` 来触发需要令牌的事件。 您需要创建个人访问令牌并将其存储为密码。 为了最大限度地降低 {% data variables.product.prodname_actions %} 使用成本,请确保不要创建递归或意外的工作流程。 有关创建个人访问令牌的详细信息,请参阅“[创建个人访问令牌](/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)”。 有关将个人访问令牌存储为机密的详细信息,请参阅“[创建和存储加密机密](/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets)”。
|
||||
If you do want to trigger a workflow from within a workflow run, you can use a personal access token instead of `GITHUB_TOKEN` to trigger events that require a token. You'll need to create a personal access token and store it as a secret. To minimize your {% data variables.product.prodname_actions %} usage costs, ensure that you don't create recursive or unintended workflow runs. For more information about creating a personal access token, see "[Creating a personal access token](/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)." For more information about storing a personal access token as a secret, see "[Creating and storing encrypted secrets](/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets)."
|
||||
|
||||
例如,以下工作流使用个人访问令牌(存储为称为 `MY_TOKEN` 的机密)通过 {% data variables.product.prodname_cli %} 向问题添加标签。 添加标签时运行的任何工作流程都将在执行此步骤后运行。
|
||||
For example, the following workflow uses a personal access token (stored as a secret called `MY_TOKEN`) to add a label to an issue via {% data variables.product.prodname_cli %}. Any workflows that run when a label is added will run once this step is performed.
|
||||
|
||||
```yaml
|
||||
on:
|
||||
@@ -61,7 +57,7 @@ jobs:
|
||||
gh issue edit $ISSUE_URL --add-label "triage"
|
||||
```
|
||||
|
||||
相反,以下工作流使用 `GITHUB_TOKEN` 向问题添加标签。 它不会触发在添加标签时运行的任何工作流程。
|
||||
Conversely, the following workflow uses `GITHUB_TOKEN` to add a label to an issue. It will not trigger any workflows that run when a label is added.
|
||||
|
||||
```yaml
|
||||
on:
|
||||
@@ -80,68 +76,68 @@ jobs:
|
||||
gh issue edit $ISSUE_URL --add-label "triage"
|
||||
```
|
||||
|
||||
## 使用事件触发工作流程
|
||||
## Using events to trigger workflows
|
||||
|
||||
使用 `on` 键指定触发工作流的事件。 有关可以使用的事件的详细信息,请参阅“[触发工作流的事件](/actions/using-workflows/events-that-trigger-workflows)”。
|
||||
Use the `on` key to specify what events trigger your workflow. For more information about events you can use, see "[Events that trigger workflows](/actions/using-workflows/events-that-trigger-workflows)."
|
||||
|
||||
### 使用单个事件
|
||||
### Using a single event
|
||||
|
||||
{% data reusables.actions.on-single-example %}
|
||||
|
||||
### 使用多个事件
|
||||
### Using multiple events
|
||||
|
||||
{% data reusables.actions.on-multiple-example %}
|
||||
|
||||
### 将活动类型和筛选器用于多个事件
|
||||
### Using activity types and filters with multiple events
|
||||
|
||||
您可以使用活动类型和筛选器进一步控制工作流程的运行时间。 有关详细信息,请参阅[使用事件活动类型](#using-event-activity-types)和[使用筛选器](#using-filters)。 {% data reusables.actions.actions-multiple-types %}
|
||||
You can use activity types and filters to further control when your workflow will run. For more information, see [Using event activity types](#using-event-activity-types) and [Using filters](#using-filters). {% data reusables.actions.actions-multiple-types %}
|
||||
|
||||
## 使用事件活动类型
|
||||
## Using event activity types
|
||||
|
||||
{% data reusables.actions.actions-activity-types %}
|
||||
|
||||
## 使用筛选器
|
||||
## Using filters
|
||||
|
||||
{% data reusables.actions.actions-filters %}
|
||||
|
||||
### 使用筛选器定位拉取请求事件的特定分支
|
||||
### Using filters to target specific branches for pull request events
|
||||
|
||||
{% data reusables.actions.workflows.section-triggering-a-workflow-branches %}
|
||||
|
||||
### 使用筛选器定位推送事件的特定分支或标记
|
||||
### Using filters to target specific branches or tags for push events
|
||||
|
||||
{% data reusables.actions.workflows.section-run-on-specific-branches-or-tags %}
|
||||
|
||||
### 使用筛选器定位拉取请求或推送事件的特定路径
|
||||
### Using filters to target specific paths for pull request or push events
|
||||
|
||||
{% data reusables.actions.workflows.section-triggering-a-workflow-paths %}
|
||||
|
||||
### 使用筛选器定位工作流程运行事件的特定分支
|
||||
### Using filters to target specific branches for workflow run events
|
||||
|
||||
{% data reusables.actions.workflows.section-specifying-branches %}
|
||||
|
||||
## 定义手动触发的工作流程的输入
|
||||
## Defining inputs for manually triggered workflows
|
||||
|
||||
{% data reusables.actions.workflow-dispatch-inputs %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 or ghec %}
|
||||
## 定义可重复使用的工作流程的输入、输出和机密
|
||||
{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}
|
||||
## Defining inputs, outputs, and secrets for reusable workflows
|
||||
|
||||
{% data reusables.actions.reusable-workflows-ghes-beta %}
|
||||
|
||||
您可以定义可重用工作流程应从调用工作流程接收的输入和机密。 您还可以指定可重用工作流程将提供给调用工作流程的输出。 有关详细信息,请参阅“[重用工作流](/actions/using-workflows/reusing-workflows)”。
|
||||
You can define inputs and secrets that a reusable workflow should receive from a calling workflow. You can also specify outputs that a reusable workflow will make available to a calling workflow. For more information, see "[Reusing workflows](/actions/using-workflows/reusing-workflows)."
|
||||
|
||||
{% endif %}
|
||||
|
||||
## 使用事件信息
|
||||
## Using event information
|
||||
|
||||
有关触发工作流运行的事件的信息可在 `github.event` 上下文中找到。 上下文中的 `github.event` 属性取决于触发工作流的事件的类型。 例如,在标记议题时触发的工作流程将包含有关议题和标签的信息。
|
||||
Information about the event that triggered a workflow run is available in the `github.event` context. The properties in the `github.event` context depend on the type of event that triggered the workflow. For example, a workflow triggered when an issue is labeled would have information about the issue and label.
|
||||
|
||||
### 查看事件的所有属性
|
||||
### Viewing all properties of an event
|
||||
|
||||
有关常见属性和示例负载,请参阅 web 挂钩事件文档。 有关详细信息,请参阅“[Webhook 事件和有效负载](/developers/webhooks-and-events/webhooks/webhook-events-and-payloads)”。
|
||||
Reference the webhook event documentation for common properties and example payloads. For more information, see "[Webhook events and payloads](/developers/webhooks-and-events/webhooks/webhook-events-and-payloads)."
|
||||
|
||||
你还可以将整个 `github.event` 上下文打印出来,以查看哪些属性可用于触发工作流的事件:
|
||||
You can also print the entire `github.event` context to see what properties are available for the event that triggered your workflow:
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@@ -154,9 +150,9 @@ jobs:
|
||||
echo $EVENT_CONTEXT
|
||||
```
|
||||
|
||||
### 访问和使用事件属性
|
||||
### Accessing and using event properties
|
||||
|
||||
你可以在工作流中使用 `github.event` 上下文。 例如,以下工作流在打开更改 `package*.json`、`.github/CODEOWNERS` 或 `.github/workflows/**` 的拉取请求时运行。 如果拉取请求作者 (`github.event.pull_request.user.login`) 不是 `octobot` 或 `dependabot[bot]`,则工作流使用 {% data variables.product.prodname_cli %} 来标记和注释拉取请求 (`github.event.pull_request.number`)。
|
||||
You can use the `github.event` context in your workflow. For example, the following workflow runs when a pull request that changes `package*.json`, `.github/CODEOWNERS`, or `.github/workflows/**` is opened. If the pull request author (`github.event.pull_request.user.login`) is not `octobot` or `dependabot[bot]`, then the workflow uses the {% data variables.product.prodname_cli %} to label and comment on the pull request (`github.event.pull_request.number`).
|
||||
|
||||
```yaml
|
||||
on:
|
||||
@@ -184,19 +180,19 @@ jobs:
|
||||
gh pr comment $PR --body 'It looks like you edited `package*.json`, `.github/CODEOWNERS`, or `.github/workflows/**`. We do not allow contributions to these files. Please review our [contributing guidelines](https://github.com/octo-org/octo-repo/blob/main/CONTRIBUTING.md) for what contributions are accepted.'
|
||||
```
|
||||
|
||||
有关上下文的详细信息,请参阅“[上下文](/actions/learn-github-actions/contexts)”。 有关事件负载的详细信息,请参阅“[Webhook 事件和负载](/developers/webhooks-and-events/webhooks/webhook-events-and-payloads)”。
|
||||
For more information about contexts, see "[Contexts](/actions/learn-github-actions/contexts)." For more information about event payloads, see "[Webhook events and payloads](/developers/webhooks-and-events/webhooks/webhook-events-and-payloads)."
|
||||
|
||||
## 进一步控制工作流程的运行方式
|
||||
## Further controlling how your workflow will run
|
||||
|
||||
如果需要比事件、事件活动类型或事件筛选器更精细的控制,则可以使用条件和环境来控制工作流中的单个作业或步骤是否运行。
|
||||
If you want more granular control than events, event activity types, or event filters provide, you can use conditionals and environments to control whether individual jobs or steps in your workflow will run.
|
||||
|
||||
### 使用条件
|
||||
### Using conditionals
|
||||
|
||||
您可以使用条件进一步控制工作流程中的作业或步骤是否运行。
|
||||
You can use conditionals to further control whether jobs or steps in your workflow will run.
|
||||
|
||||
#### 在事件负载中使用值的示例
|
||||
#### Example using a value in the event payload
|
||||
|
||||
例如,如果希望在向问题添加特定标签时运行工作流,则可以在 `issues labeled` 事件活动类型上触发,并使用条件来检查触发工作流的标签。 将任何标签添加到工作流的存储库中的问题时,将运行以下工作流,但仅当标签命名为 `bug` 时,才会执行 `run_if_label_matches` 作业。
|
||||
For example, if you want the workflow to run when a specific label is added to an issue, you can trigger on the `issues labeled` event activity type and use a conditional to check what label triggered the workflow. The following workflow will run when any label is added to an issue in the workflow's repository, but the `run_if_label_matches` job will only execute if the label is named `bug`.
|
||||
|
||||
```yaml
|
||||
on:
|
||||
@@ -212,9 +208,9 @@ jobs:
|
||||
- run: echo 'The label was bug'
|
||||
```
|
||||
|
||||
#### 使用事件类型的示例
|
||||
#### Example using event type
|
||||
|
||||
例如,如果要根据触发工作流程的事件运行不同的作业或步骤,则可以使用条件来检查事件上下文中是否存在特定的事件类型。 每当议题或拉取请求关闭时,将运行以下工作流程。 如果工作流因问题已关闭而运行,则 `github.event` 上下文将包含 `issue` 的值,但不包含 `pull_request` 的值。 因此,`if_issue` 步骤将运行,但 `if_pr` 步骤不会运行。 相反,如果工作流因拉取请求关闭而运行,则 `if_pr` 步骤将运行,但 `if_issue` 步骤不会运行。
|
||||
For example, if you want to run different jobs or steps depending on what event triggered the workflow, you can use a conditional to check whether a specific event type exists in the event context. The following workflow will run whenever an issue or pull request is closed. If the workflow ran because an issue was closed, the `github.event` context will contain a value for `issue` but not for `pull_request`. Therefore, the `if_issue` step will run but the `if_pr` step will not run. Conversely, if the workflow ran because a pull request was closed, the `if_pr` step will run but the `if_issue` step will not run.
|
||||
|
||||
```yaml
|
||||
on:
|
||||
@@ -239,13 +235,13 @@ jobs:
|
||||
echo A pull request was closed
|
||||
```
|
||||
|
||||
有关事件上下文中可用信息的详细信息,请参阅“[使用事件信息](#using-event-information)”。 有关如何使用条件的详细信息,请参阅“[表达式](/actions/learn-github-actions/expressions)”。
|
||||
For more information about what information is available in the event context, see "[Using event information](#using-event-information)." For more information about how to use conditionals, see "[Expressions](/actions/learn-github-actions/expressions)."
|
||||
|
||||
### 使用环境手动触发工作流程作业
|
||||
### Using environments to manually trigger workflow jobs
|
||||
|
||||
如果要手动触发工作流程中的特定作业,可以使用需要特定团队或用户批准的环境。 首先,使用所需的审阅者配置环境。 有关详细信息,请参阅“[使用环境进行部署](/actions/deployment/targeting-different-environments/using-environments-for-deployment)”。 然后,使用`environment:` 键在工作流的作业中引用环境名称。 在至少有一个审阅者批准该作业之前,引用环境的任何作业都不会运行。
|
||||
If you want to manually trigger a specific job in a workflow, you can use an environment that requires approval from a specific team or user. First, configure an environment with required reviewers. For more information, see "[Using environments for deployment](/actions/deployment/targeting-different-environments/using-environments-for-deployment)." Then, reference the environment name in a job in your workflow using the `environment:` key. Any job referencing the environment will not run until at least one reviewer approves the job.
|
||||
|
||||
例如,只要有推送到 main 分支,以下工作流程就会运行。 `build` 作业将始终运行。 只有在 `build` 作业成功完成(由于 `needs: [build]`)并且称为 `production` 的环境的所有规则(包括必需的审阅者)通过(由于 `environment: production`)之后,`publish` 作业才会运行。
|
||||
For example, the following workflow will run whenever there is a push to main. The `build` job will always run. The `publish` job will only run after the `build` job successfully completes (due to `needs: [build]`) and after all of the rules (including required reviewers) for the environment called `production` pass (due to `environment: production`).
|
||||
|
||||
```yaml
|
||||
on:
|
||||
@@ -275,6 +271,6 @@ jobs:
|
||||
|
||||
{% endnote %}
|
||||
|
||||
## 可用事件
|
||||
## Available events
|
||||
|
||||
有关可用事件的完整列表,请参阅“[触发工作流的事件](/actions/using-workflows/events-that-trigger-workflows)”。
|
||||
For a full list of available events, see "[Events that trigger workflows](/actions/using-workflows/events-that-trigger-workflows)."
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: GitHub Actions 的工作流语法
|
||||
title: Workflow syntax for GitHub Actions
|
||||
shortTitle: Workflow syntax
|
||||
intro: 工作流程是可配置的自动化过程,由一个或多个作业组成。 您必须创建 YAML 文件来定义工作流程配置。
|
||||
intro: A workflow is a configurable automated process made up of one or more jobs. You must create a YAML file to define your workflow configuration.
|
||||
redirect_from:
|
||||
- /articles/workflow-syntax-for-github-actions
|
||||
- /github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
|
||||
@@ -14,24 +14,20 @@ versions:
|
||||
ghae: '*'
|
||||
ghec: '*'
|
||||
miniTocMaxHeadingLevel: 4
|
||||
ms.openlocfilehash: dff224ca488c6cd695546926ab5264377bdfcf0a
|
||||
ms.sourcegitcommit: b98a79b01967b159f740a942286edae2792fe826
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 08/10/2022
|
||||
ms.locfileid: '147541075'
|
||||
---
|
||||
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
## <a name="about-yaml-syntax-for-workflows"></a>关于工作流程的 YAML 语法
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
{% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
工作流文件使用 YAML 语法,并且必须具有 `.yml` 或 `.yaml` 文件扩展名。 {% data reusables.actions.learn-more-about-yaml %}
|
||||
## About YAML syntax for workflows
|
||||
|
||||
必须将工作流文件存储在存储库的 `.github/workflows` 目录中。
|
||||
Workflow files use YAML syntax, and must have either a `.yml` or `.yaml` file extension. {% data reusables.actions.learn-more-about-yaml %}
|
||||
|
||||
You must store workflow files in the `.github/workflows` directory of your repository.
|
||||
|
||||
## `name`
|
||||
|
||||
工作流的名称。 {% data variables.product.prodname_dotcom %} 在仓库的操作页面上显示工作流程的名称。 如果省略 `name`,{% data variables.product.prodname_dotcom %} 会将其设置为相对于存储库根目录的工作流文件路径。
|
||||
The name of your workflow. {% data variables.product.prodname_dotcom %} displays the names of your workflows on your repository's actions page. If you omit `name`, {% data variables.product.prodname_dotcom %} sets it to the workflow file path relative to the root of the repository.
|
||||
|
||||
## `on`
|
||||
|
||||
@@ -57,26 +53,26 @@ ms.locfileid: '147541075'
|
||||
|
||||
{% data reusables.actions.workflows.section-triggering-a-workflow-schedule %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 or ghec %}
|
||||
{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}
|
||||
## `on.workflow_call`
|
||||
|
||||
{% data reusables.actions.reusable-workflows-ghes-beta %}
|
||||
|
||||
使用 `on.workflow_call` 定义可重用工作流的输入和输出。 您还可以映射可用于被调用工作流程的机密。 有关可重用工作流的详细信息,请参阅“[重用工作流](/actions/using-workflows/reusing-workflows)”。
|
||||
Use `on.workflow_call` to define the inputs and outputs for a reusable workflow. You can also map the secrets that are available to the called workflow. For more information on reusable workflows, see "[Reusing workflows](/actions/using-workflows/reusing-workflows)."
|
||||
|
||||
### `on.workflow_call.inputs`
|
||||
|
||||
使用 `workflow_call` 关键字时,可以选择指定从调用方工作流传递到被调用工作流的输入。 有关 `workflow_call` 关键字的详细信息,请参阅“[触发工作流的事件](/actions/learn-github-actions/events-that-trigger-workflows#workflow-reuse-events)”。
|
||||
When using the `workflow_call` keyword, you can optionally specify inputs that are passed to the called workflow from the caller workflow. For more information about the `workflow_call` keyword, see "[Events that trigger workflows](/actions/learn-github-actions/events-that-trigger-workflows#workflow-reuse-events)."
|
||||
|
||||
除了可用的标准输入参数外,`on.workflow_call.inputs` 还需要一个 `type` 参数。 有关详细信息,请参阅 [`on.workflow_call.inputs.<input_id>.type`](#onworkflow_callinputsinput_idtype)。
|
||||
In addition to the standard input parameters that are available, `on.workflow_call.inputs` requires a `type` parameter. For more information, see [`on.workflow_call.inputs.<input_id>.type`](#onworkflow_callinputsinput_idtype).
|
||||
|
||||
如果未设置 `default` 参数,则对布尔值、数字和字符串来说,输入的默认值依次为 `false`、`0` 和 `""`。
|
||||
If a `default` parameter is not set, the default value of the input is `false` for a boolean, `0` for a number, and `""` for a string.
|
||||
|
||||
在被调用的工作流中,可以使用 `inputs` 上下文来引用输入。
|
||||
Within the called workflow, you can use the `inputs` context to refer to an input.
|
||||
|
||||
如果调用方工作流程传递的输入未在被调用工作流程中指定,则会导致错误。
|
||||
If a caller workflow passes an input that is not specified in the called workflow, this results in an error.
|
||||
|
||||
#### <a name="example"></a>示例
|
||||
#### Example
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -99,19 +95,19 @@ jobs:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
有关详细信息,请参阅“[重用工作流](/actions/learn-github-actions/reusing-workflows)”。
|
||||
For more information, see "[Reusing workflows](/actions/learn-github-actions/reusing-workflows)."
|
||||
|
||||
#### `on.workflow_call.inputs.<input_id>.type`
|
||||
|
||||
如果为 `on.workflow_call` 关键字定义输入,则为必需项。 此参数的值是指定输入的数据类型的字符串。 其必须是 `boolean`、`number` 或 `string`。
|
||||
Required if input is defined for the `on.workflow_call` keyword. The value of this parameter is a string specifying the data type of the input. This must be one of: `boolean`, `number`, or `string`.
|
||||
|
||||
### `on.workflow_call.outputs`
|
||||
|
||||
被调用工作流程的输出映射。 调用的工作流程输出可用于调用方工作流程中的所有下游作业。 每个输出都有一个标识符、一个可选 `description,` 和一个 `value.`。必须将 `value` 设置为被调用工作流内作业中的输出值。
|
||||
A map of outputs for a called workflow. Called workflow outputs are available to all downstream jobs in the caller workflow. Each output has an identifier, an optional `description,` and a `value.` The `value` must be set to the value of an output from a job within the called workflow.
|
||||
|
||||
在下面的示例中,为此可重用工作流定义了两个输出:`workflow_output1` 和 `workflow_output2`。 这些是映射到称为 `job_output1` 和 `job_output2` 的输出,两者都来自称为 `my_job` 的作业。
|
||||
In the example below, two outputs are defined for this reusable workflow: `workflow_output1` and `workflow_output2`. These are mapped to outputs called `job_output1` and `job_output2`, both from a job called `my_job`.
|
||||
|
||||
#### <a name="example"></a>示例
|
||||
#### Example
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -128,17 +124,17 @@ on:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
有关如何引用作业输出的信息,请参阅 [`jobs.<job_id>.outputs`](#jobsjob_idoutputs)。 有关详细信息,请参阅“[重用工作流](/actions/learn-github-actions/reusing-workflows)”。
|
||||
For information on how to reference a job output, see [`jobs.<job_id>.outputs`](#jobsjob_idoutputs). For more information, see "[Reusing workflows](/actions/learn-github-actions/reusing-workflows)."
|
||||
|
||||
### `on.workflow_call.secrets`
|
||||
|
||||
可在被调用工作流程中使用的机密的映射。
|
||||
A map of the secrets that can be used in the called workflow.
|
||||
|
||||
在调用的工作流中,可以使用 `secrets` 上下文来引用机密。
|
||||
Within the called workflow, you can use the `secrets` context to refer to a secret.
|
||||
|
||||
如果调用方工作流程传递的机密未在被调用的工作流程中指定,则会导致错误。
|
||||
If a caller workflow passes a secret that is not specified in the called workflow, this results in an error.
|
||||
|
||||
#### <a name="example"></a>示例
|
||||
#### Example
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -163,11 +159,11 @@ jobs:
|
||||
|
||||
#### `on.workflow_call.secrets.<secret_id>`
|
||||
|
||||
要与机密关联的字符串标识符。
|
||||
A string identifier to associate with the secret.
|
||||
|
||||
#### `on.workflow_call.secrets.<secret_id>.required`
|
||||
|
||||
指定是否必须提供机密的布尔值。
|
||||
A boolean specifying whether the secret must be supplied.
|
||||
{% endif %}
|
||||
|
||||
## `on.workflow_run.<branches|branches-ignore>`
|
||||
@@ -184,13 +180,13 @@ jobs:
|
||||
|
||||
## `env`
|
||||
|
||||
环境变量的 `map` 可用于工作流中所有作业的步骤。 您还可以设置仅适用于单个作业的步骤或单个步骤的环境变量。 有关详细信息,请参阅 [`jobs.<job_id>.env`](#jobsjob_idenv) 和 [`jobs.<job_id>.steps[*].env`](#jobsjob_idstepsenv)。
|
||||
A `map` of environment variables that are available to the steps of all jobs in the workflow. You can also set environment variables that are only available to the steps of a single job or to a single step. For more information, see [`jobs.<job_id>.env`](#jobsjob_idenv) and [`jobs.<job_id>.steps[*].env`](#jobsjob_idstepsenv).
|
||||
|
||||
`env` 映射中的变量不能根据映射中的其他变量进行定义。
|
||||
Variables in the `env` map cannot be defined in terms of other variables in the map.
|
||||
|
||||
{% data reusables.repositories.actions-env-var-note %}
|
||||
|
||||
### <a name="example"></a>示例
|
||||
### Example
|
||||
|
||||
```yaml
|
||||
env:
|
||||
@@ -251,11 +247,11 @@ env:
|
||||
|
||||
## `jobs.<job_id>.env`
|
||||
|
||||
环境变量的 `map` 可用于作业中的所有步骤。 您也可以设置整个工作流程或单个步骤的环境变量。 有关详细信息,请参阅 [`env`](#env) 和 [`jobs.<job_id>.steps[*].env`](#jobsjob_idstepsenv)。
|
||||
A `map` of environment variables that are available to all steps in the job. You can also set environment variables for the entire workflow or an individual step. For more information, see [`env`](#env) and [`jobs.<job_id>.steps[*].env`](#jobsjob_idstepsenv).
|
||||
|
||||
{% data reusables.repositories.actions-env-var-note %}
|
||||
|
||||
### <a name="example"></a>示例
|
||||
### Example
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@@ -274,11 +270,11 @@ jobs:
|
||||
|
||||
## `jobs.<job_id>.steps`
|
||||
|
||||
作业包含一系列任务,称为 `steps`。 步骤可以运行命令、运行设置任务,或者运行您的仓库、公共仓库中的操作或 Docker 注册表中发布的操作。 并非所有步骤都会运行操作,但所有操作都会作为步骤运行。 每个步骤在运行器环境中以其自己的进程运行,且可以访问工作区和文件系统。 因为步骤以自己的进程运行,所以步骤之间不会保留环境变量的更改。 {% data variables.product.prodname_dotcom %} 提供内置的步骤来设置和完成作业。
|
||||
A job contains a sequence of tasks called `steps`. Steps can run commands, run setup tasks, or run an action in your repository, a public repository, or an action published in a Docker registry. Not all steps run actions, but all actions run as a step. Each step runs in its own process in the runner environment and has access to the workspace and filesystem. Because steps run in their own process, changes to environment variables are not preserved between steps. {% data variables.product.prodname_dotcom %} provides built-in steps to set up and complete a job.
|
||||
|
||||
在工作流程的使用限制之内可运行无限数量的步骤。 有关详细信息,请参阅 {% ifversion fpt or ghec or ghes %}“[使用情况限制和计费](/actions/reference/usage-limits-billing-and-administration),了解 {% data variables.product.prodname_dotcom %} 托管的运行程序,以及参阅 {% endif %}“[关于自托管运行程序](/actions/hosting-your-own-runners/about-self-hosted-runners/#usage-limits){% ifversion fpt or ghec or ghes %}”了解自托管运行程序使用限制。{% elsif ghae %}."{% endif %}
|
||||
You can run an unlimited number of steps as long as you are within the workflow usage limits. For more information, see {% ifversion fpt or ghec or ghes %}"[Usage limits and billing](/actions/reference/usage-limits-billing-and-administration)" for {% data variables.product.prodname_dotcom %}-hosted runners and {% endif %}"[About self-hosted runners](/actions/hosting-your-own-runners/about-self-hosted-runners/#usage-limits){% ifversion fpt or ghec or ghes %}" for self-hosted runner usage limits.{% elsif ghae %}."{% endif %}
|
||||
|
||||
### <a name="example"></a>示例
|
||||
### Example
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -304,17 +300,17 @@ jobs:
|
||||
|
||||
### `jobs.<job_id>.steps[*].id`
|
||||
|
||||
步骤的唯一标识符。 可以使用 `id` 在上下文中引用该步骤。 有关详细信息,请参阅“[上下文](/actions/learn-github-actions/contexts)”。
|
||||
A unique identifier for the step. You can use the `id` to reference the step in contexts. For more information, see "[Contexts](/actions/learn-github-actions/contexts)."
|
||||
|
||||
### `jobs.<job_id>.steps[*].if`
|
||||
|
||||
可以使用 `if` 条件来阻止步骤运行,除非满足条件。 您可以使用任何支持上下文和表达式来创建条件。
|
||||
You can use the `if` conditional to prevent a step from running unless a condition is met. You can use any supported context and expression to create a conditional.
|
||||
|
||||
{% data reusables.actions.expression-syntax-if %} 有关详细信息,请参阅“[表达式](/actions/learn-github-actions/expressions)”。
|
||||
{% data reusables.actions.expression-syntax-if %} For more information, see "[Expressions](/actions/learn-github-actions/expressions)."
|
||||
|
||||
#### <a name="example-using-contexts"></a>示例:使用上下文
|
||||
#### Example: Using contexts
|
||||
|
||||
此步骤仅在事件类型为 `pull_request` 且事件操作为 `unassigned` 时运行。
|
||||
This step only runs when the event type is a `pull_request` and the event action is `unassigned`.
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -323,9 +319,9 @@ steps:
|
||||
run: echo This event is a pull request that had an assignee removed.
|
||||
```
|
||||
|
||||
#### <a name="example-using-status-check-functions"></a>示例:使用状态检查功能
|
||||
#### Example: Using status check functions
|
||||
|
||||
`my backup step` 仅在作业的上一步失败时运行。 有关详细信息,请参阅“[表达式](/actions/learn-github-actions/expressions#status-check-functions)”。
|
||||
The `my backup step` only runs when the previous step of a job fails. For more information, see "[Expressions](/actions/learn-github-actions/expressions#status-check-functions)."
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -336,11 +332,11 @@ steps:
|
||||
uses: actions/heroku@1.0.0
|
||||
```
|
||||
|
||||
#### <a name="example-using-secrets"></a>示例:使用机密
|
||||
#### Example: Using secrets
|
||||
|
||||
无法直接在 `if:` 条件中引用机密。 而应考虑将机密设置为作业级环境变量,然后引用环境变量以有条件地运行作业中的步骤。
|
||||
Secrets cannot be directly referenced in `if:` conditionals. Instead, consider setting secrets as job-level environment variables, then referencing the environment variables to conditionally run steps in the job.
|
||||
|
||||
如果尚未设置机密,则引用该机密的表达式的返回值(例如示例中的 {% raw %}`${{ secrets.SuperSecret }}`{% endraw %})将为空字符串。
|
||||
If a secret has not been set, the return value of an expression referencing the secret (such as {% raw %}`${{ secrets.SuperSecret }}`{% endraw %} in the example) will be an empty string.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -359,26 +355,26 @@ jobs:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
有关详细信息,请参阅“[上下文可用性](/actions/learn-github-actions/contexts#context-availability)”和“[加密机密](/actions/security-guides/encrypted-secrets)”。
|
||||
For more information, see "[Context availability](/actions/learn-github-actions/contexts#context-availability)" and "[Encrypted secrets](/actions/security-guides/encrypted-secrets)."
|
||||
|
||||
### `jobs.<job_id>.steps[*].name`
|
||||
|
||||
步骤显示在 {% data variables.product.prodname_dotcom %} 上的名称。
|
||||
A name for your step to display on {% data variables.product.prodname_dotcom %}.
|
||||
|
||||
### `jobs.<job_id>.steps[*].uses`
|
||||
|
||||
选择要作为作业中步骤的一部分运行的操作。 操作是一种可重复使用的代码单位。 可以使用在与工作流、公共存储库或[已发布的 Docker 容器映像](https://hub.docker.com/)相同的存储库中定义的操作。
|
||||
Selects an action to run as part of a step in your job. An action is a reusable unit of code. You can use an action defined in the same repository as the workflow, a public repository, or in a [published Docker container image](https://hub.docker.com/).
|
||||
|
||||
强烈建议指定 Git ref、SHA 或 Docker 标记编号来包含所用操作的版本。 如果不指定版本,在操作所有者发布更新时可能会中断您的工作流程或造成非预期的行为。
|
||||
- 使用已发行操作版本的 SHA 对于稳定性和安全性是最安全的。
|
||||
- 使用特定主要操作版本可在保持兼容性的同时接收关键修复和安全补丁。 还可确保您的工作流程继续工作。
|
||||
- 使用操作的默认分支可能很方便,但如果有人新发布具有突破性更改的主要版本,您的工作流程可能会中断。
|
||||
We strongly recommend that you include the version of the action you are using by specifying a Git ref, SHA, or Docker tag. If you don't specify a version, it could break your workflows or cause unexpected behavior when the action owner publishes an update.
|
||||
- Using the commit SHA of a released action version is the safest for stability and security.
|
||||
- If the action publishes major version tags, you should expect to receive critical fixes and security patches while still retaining compatibility. Note that this behavior is at the discretion of the action's author.
|
||||
- Using the default branch of an action may be convenient, but if someone releases a new major version with a breaking change, your workflow could break.
|
||||
|
||||
某些操作需要必须使用 [`with`](#jobsjob_idstepswith) 关键字设置的输入。 请查阅操作的自述文件,确定所需的输入。
|
||||
Some actions require inputs that you must set using the [`with`](#jobsjob_idstepswith) keyword. Review the action's README file to determine the inputs required.
|
||||
|
||||
操作为 JavaScript 文件或 Docker 容器。 如果您使用的操作是 Docker 容器,则必须在 Linux 环境中运行作业。 有关详细信息,请参阅 [`runs-on`](#jobsjob_idruns-on)。
|
||||
Actions are either JavaScript files or Docker containers. If the action you're using is a Docker container you must run the job in a Linux environment. For more details, see [`runs-on`](#jobsjob_idruns-on).
|
||||
|
||||
#### <a name="example-using-versioned-actions"></a>示例:使用版本化操作
|
||||
#### Example: Using versioned actions
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -392,11 +388,11 @@ steps:
|
||||
- uses: actions/checkout@main
|
||||
```
|
||||
|
||||
#### <a name="example-using-a-public-action"></a>示例:使用公共操作
|
||||
#### Example: Using a public action
|
||||
|
||||
`{owner}/{repo}@{ref}`
|
||||
|
||||
您可以指定公共 {% data variables.product.prodname_dotcom %} 仓库中的分支、引用或 SHA。
|
||||
You can specify a branch, ref, or SHA in a public {% data variables.product.prodname_dotcom %} repository.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@@ -410,11 +406,11 @@ jobs:
|
||||
uses: actions/aws@v2.0.1
|
||||
```
|
||||
|
||||
#### <a name="example-using-a-public-action-in-a-subdirectory"></a>示例:在子目录中使用公共操作
|
||||
#### Example: Using a public action in a subdirectory
|
||||
|
||||
`{owner}/{repo}/{path}@{ref}`
|
||||
|
||||
公共 {% data variables.product.prodname_dotcom %} 仓库中特定分支、引用或 SHA 上的子目录。
|
||||
A subdirectory in a public {% data variables.product.prodname_dotcom %} repository at a specific branch, ref, or SHA.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@@ -424,11 +420,11 @@ jobs:
|
||||
uses: actions/aws/ec2@main
|
||||
```
|
||||
|
||||
#### <a name="example-using-an-action-in-the-same-repository-as-the-workflow"></a>示例:使用工作流程所在仓库中操作
|
||||
#### Example: Using an action in the same repository as the workflow
|
||||
|
||||
`./path/to/dir`
|
||||
|
||||
包含工作流程的仓库中操作的目录路径。 在使用操作之前,必须检出仓库。
|
||||
The path to the directory that contains the action in your workflow's repository. You must check out your repository before using the action.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@@ -440,11 +436,11 @@ jobs:
|
||||
uses: ./.github/actions/my-action
|
||||
```
|
||||
|
||||
#### <a name="example-using-a-docker-hub-action"></a>示例:使用 Docker 中枢操作
|
||||
#### Example: Using a Docker Hub action
|
||||
|
||||
`docker://{image}:{tag}`
|
||||
|
||||
发布于 [Docker 中心](https://hub.docker.com/)的 Docker 映像。
|
||||
A Docker image published on [Docker Hub](https://hub.docker.com/).
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@@ -455,11 +451,11 @@ jobs:
|
||||
```
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
#### <a name="example-using-the--data-variablesproductprodname_registry---data-variablesproductprodname_container_registry-"></a>示例:使用 {% data variables.product.prodname_registry %} {% data variables.product.prodname_container_registry %}
|
||||
#### Example: Using the {% data variables.product.prodname_registry %} {% data variables.product.prodname_container_registry %}
|
||||
|
||||
`docker://{host}/{image}:{tag}`
|
||||
|
||||
{% data variables.product.prodname_registry %} {% data variables.product.prodname_container_registry %} 中的 Docker 映像。
|
||||
A Docker image in the {% data variables.product.prodname_registry %} {% data variables.product.prodname_container_registry %}.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@@ -469,11 +465,11 @@ jobs:
|
||||
uses: docker://ghcr.io/OWNER/IMAGE_NAME
|
||||
```
|
||||
{% endif %}
|
||||
#### <a name="example-using-a-docker-public-registry-action"></a>示例:使用 Docker 公共注册表操作
|
||||
#### Example: Using a Docker public registry action
|
||||
|
||||
`docker://{host}/{image}:{tag}`
|
||||
|
||||
公共注册表中的 Docker 映像。 此示例在 `gcr.io` 使用 Google Container Registry。
|
||||
A Docker image in a public registry. This example uses the Google Container Registry at `gcr.io`.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@@ -483,11 +479,11 @@ jobs:
|
||||
uses: docker://gcr.io/cloud-builders/gradle
|
||||
```
|
||||
|
||||
#### <a name="example-using-an-action-inside-a-different-private-repository-than-the-workflow"></a>示例:在不同于工作流程的私有仓库中使用操作
|
||||
#### Example: Using an action inside a different private repository than the workflow
|
||||
|
||||
您的工作流程必须检出私有仓库,并在本地引用操作。 生成个人访问令牌并将该令牌添加为加密密钥。 有关详细信息,请参阅“[创建个人访问令牌](/github/authenticating-to-github/creating-a-personal-access-token)”和“[加密的机密](/actions/reference/encrypted-secrets)。”
|
||||
Your workflow must checkout the private repository and reference the action locally. Generate a personal access token and add the token as an encrypted secret. For more information, see "[Creating a personal access token](/github/authenticating-to-github/creating-a-personal-access-token)" and "[Encrypted secrets](/actions/reference/encrypted-secrets)."
|
||||
|
||||
将示例中 `PERSONAL_ACCESS_TOKEN` 替换为机密名称。
|
||||
Replace `PERSONAL_ACCESS_TOKEN` in the example with the name of your secret.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@@ -506,20 +502,20 @@ jobs:
|
||||
|
||||
### `jobs.<job_id>.steps[*].run`
|
||||
|
||||
使用操作系统 shell 运行命令行程序。 如果不提供 `name`,步骤名称将默认为 `run` 命令中指定的文本。
|
||||
Runs command-line programs using the operating system's shell. If you do not provide a `name`, the step name will default to the text specified in the `run` command.
|
||||
|
||||
命令默认使用非登录 shell 运行。 您可以选择不同的 shell,也可以自定义用于运行命令的 shell。 有关详细信息,请参阅 [`jobs.<job_id>.steps[*].shell`](#jobsjob_idstepsshell)。
|
||||
Commands run using non-login shells by default. You can choose a different shell and customize the shell used to run commands. For more information, see [`jobs.<job_id>.steps[*].shell`](#jobsjob_idstepsshell).
|
||||
|
||||
每个 `run` 关键字代表运行器环境中一个新的进程和 shell。 当您提供多行命令时,每行都在同一个 shell 中运行。 例如:
|
||||
Each `run` keyword represents a new process and shell in the runner environment. When you provide multi-line commands, each line runs in the same shell. For example:
|
||||
|
||||
* 单行命令:
|
||||
* A single-line command:
|
||||
|
||||
```yaml
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
```
|
||||
|
||||
* 多行命令:
|
||||
* A multi-line command:
|
||||
|
||||
```yaml
|
||||
- name: Clean install dependencies and build
|
||||
@@ -528,7 +524,7 @@ jobs:
|
||||
npm run build
|
||||
```
|
||||
|
||||
使用 `working-directory` 关键字,你可以指定运行命令的工作目录位置。
|
||||
Using the `working-directory` keyword, you can specify the working directory of where to run the command.
|
||||
|
||||
```yaml
|
||||
- name: Clean temp directory
|
||||
@@ -538,20 +534,20 @@ jobs:
|
||||
|
||||
### `jobs.<job_id>.steps[*].shell`
|
||||
|
||||
你可以使用 `shell` 关键字覆盖运行器操作系统中默认的 shell 设置。 你可以使用内置的 `shell` 关键字,也可以自定义 shell 选项集。 内部运行的 shell 命令执行一个临时文件,其中包含 `run` 关键字中指定的命令。
|
||||
You can override the default shell settings in the runner's operating system using the `shell` keyword. You can use built-in `shell` keywords, or you can define a custom set of shell options. The shell command that is run internally executes a temporary file that contains the commands specified in the `run` keyword.
|
||||
|
||||
| 支持的平台 | `shell` 参数 | 说明 | 内部运行命令 |
|
||||
| Supported platform | `shell` parameter | Description | Command run internally |
|
||||
|--------------------|-------------------|-------------|------------------------|
|
||||
| Linux/macOS | unspecified | 非 Windows 平台上的默认 shell。 请注意,这与显式指定 `bash` 时运行的命令不同。 如果在路径中找不到 `bash`,则将其视为 `sh`。 | `bash -e {0}` |
|
||||
| All | `bash` | 非 Windows 平台上回退到 `sh` 的默认 shell。 指定 Windows 上的 bash shell 时,将使用 Git for Windows 随附的 bash shel。 | `bash --noprofile --norc -eo pipefail {0}` |
|
||||
| 全部 | `pwsh` | PowerShell Core。 {% data variables.product.prodname_dotcom %} 将扩展名 `.ps1` 追加到你的脚本名称。 | `pwsh -command ". '{0}'"` |
|
||||
| All | `python` | 执行 python 命令。 | `python {0}` |
|
||||
| Linux/macOS | `sh` | 未提供 shell 且在路径中找不到 `bash` 时的非 Windows 平台的后退行为。 | `sh -e {0}` |
|
||||
| Windows | `cmd` | {% data variables.product.prodname_dotcom %} 将扩展名 `.cmd` 追加到你的脚本名称并替换 `{0}`。 | `%ComSpec% /D /E:ON /V:OFF /S /C "CALL "{0}""`. |
|
||||
| Windows | `pwsh` | 这是 Windows 上使用的默认 shell。 PowerShell Core。 {% data variables.product.prodname_dotcom %} 将扩展名 `.ps1` 追加到你的脚本名称。 如果自承载 Windows 运行器未安装 PowerShell Core,则改用 PowerShell Desktop。| `pwsh -command ". '{0}'"`. |
|
||||
| Windows | `powershell` | PowerShell 桌面。 {% data variables.product.prodname_dotcom %} 将扩展名 `.ps1` 追加到你的脚本名称。 | `powershell -command ". '{0}'"`. |
|
||||
| Linux / macOS | unspecified | The default shell on non-Windows platforms. Note that this runs a different command to when `bash` is specified explicitly. If `bash` is not found in the path, this is treated as `sh`. | `bash -e {0}` |
|
||||
| All | `bash` | The default shell on non-Windows platforms with a fallback to `sh`. When specifying a bash shell on Windows, the bash shell included with Git for Windows is used. | `bash --noprofile --norc -eo pipefail {0}` |
|
||||
| All | `pwsh` | The PowerShell Core. {% data variables.product.prodname_dotcom %} appends the extension `.ps1` to your script name. | `pwsh -command ". '{0}'"` |
|
||||
| All | `python` | Executes the python command. | `python {0}` |
|
||||
| Linux / macOS | `sh` | The fallback behavior for non-Windows platforms if no shell is provided and `bash` is not found in the path. | `sh -e {0}` |
|
||||
| Windows | `cmd` | {% data variables.product.prodname_dotcom %} appends the extension `.cmd` to your script name and substitutes for `{0}`. | `%ComSpec% /D /E:ON /V:OFF /S /C "CALL "{0}""`. |
|
||||
| Windows | `pwsh` | This is the default shell used on Windows. The PowerShell Core. {% data variables.product.prodname_dotcom %} appends the extension `.ps1` to your script name. If your self-hosted Windows runner does not have _PowerShell Core_ installed, then _PowerShell Desktop_ is used instead.| `pwsh -command ". '{0}'"`. |
|
||||
| Windows | `powershell` | The PowerShell Desktop. {% data variables.product.prodname_dotcom %} appends the extension `.ps1` to your script name. | `powershell -command ". '{0}'"`. |
|
||||
|
||||
#### <a name="example-running-a-script-using-bash"></a>示例:使用 bash 运行脚本
|
||||
#### Example: Running a script using bash
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -560,7 +556,7 @@ steps:
|
||||
shell: bash
|
||||
```
|
||||
|
||||
#### <a name="example-running-a-script-using-windows-cmd"></a>示例:使用 Windows `cmd` 运行脚本
|
||||
#### Example: Running a script using Windows `cmd`
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -569,7 +565,7 @@ steps:
|
||||
shell: cmd
|
||||
```
|
||||
|
||||
#### <a name="example-running-a-script-using-powershell-core"></a>示例:使用 PowerShell Core 运行脚本
|
||||
#### Example: Running a script using PowerShell Core
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -578,7 +574,7 @@ steps:
|
||||
shell: pwsh
|
||||
```
|
||||
|
||||
#### <a name="example-using-powershell-desktop-to-run-a-script"></a>示例:使用 PowerShell 桌面运行脚本
|
||||
#### Example: Using PowerShell Desktop to run a script
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -587,7 +583,7 @@ steps:
|
||||
shell: powershell
|
||||
```
|
||||
|
||||
#### <a name="example-running-a-python-script"></a>示例:运行 python 脚本
|
||||
#### Example: Running a python script
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -598,11 +594,11 @@ steps:
|
||||
shell: python
|
||||
```
|
||||
|
||||
#### <a name="custom-shell"></a>自定义 shell
|
||||
#### Custom shell
|
||||
|
||||
可以使用 `command […options] {0} [..more_options]` 将 `shell` 值设置为模板字符串。 {% data variables.product.prodname_dotcom %} 将字符串的第一个用空格分隔的词解释为命令,并在 `{0}` 处插入临时脚本的文件名。
|
||||
You can set the `shell` value to a template string using `command […options] {0} [..more_options]`. {% data variables.product.prodname_dotcom %} interprets the first whitespace-delimited word of the string as the command, and inserts the file name for the temporary script at `{0}`.
|
||||
|
||||
例如:
|
||||
For example:
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -612,36 +608,39 @@ steps:
|
||||
shell: perl {0}
|
||||
```
|
||||
|
||||
此示例中使用的命令 `perl` 必须安装在运行器上。
|
||||
The command used, `perl` in this example, must be installed on the runner.
|
||||
|
||||
{% ifversion ghae %} {% data reusables.actions.self-hosted-runners-software %} {% elsif fpt or ghec %} 有关 GitHub 托管的运行器所包含软件的信息,请参阅“[GitHub 托管运行器规范](/actions/reference/specifications-for-github-hosted-runners#supported-software)”。
|
||||
{% ifversion ghae %}
|
||||
{% data reusables.actions.self-hosted-runners-software %}
|
||||
{% elsif fpt or ghec %}
|
||||
For information about the software included on GitHub-hosted runners, see "[Specifications for GitHub-hosted runners](/actions/reference/specifications-for-github-hosted-runners#supported-software)."
|
||||
{% endif %}
|
||||
|
||||
#### <a name="exit-codes-and-error-action-preference"></a>退出代码和错误操作首选项
|
||||
#### Exit codes and error action preference
|
||||
|
||||
至于内置的 shell 关键词,我们提供由 {% data variables.product.prodname_dotcom %} 托管运行程序执行的以下默认值。 在运行 shell 脚本时,您应该使用这些指南。
|
||||
For built-in shell keywords, we provide the following defaults that are executed by {% data variables.product.prodname_dotcom %}-hosted runners. You should use these guidelines when running shell scripts.
|
||||
|
||||
- `bash`/`sh`:
|
||||
- 使用 `set -eo pipefail` 的快速失败行为:在显式指定 `shell: bash` 时设置此选项。 默认情况下不会应用它。
|
||||
- 你可以通过向 shell 选项提供模板字符串来完全控制 shell 参数。 例如,`bash {0}`。
|
||||
- sh 类 shell 使用脚本中最后执行的命令的退出代码退出,也是操作的默认行为。 运行程序将根据此退出代码将步骤的状态报告为失败/成功。
|
||||
- Fail-fast behavior using `set -eo pipefail`: This option is set when `shell: bash` is explicitly specified. It is not applied by default.
|
||||
- You can take full control over shell parameters by providing a template string to the shell options. For example, `bash {0}`.
|
||||
- sh-like shells exit with the exit code of the last command executed in a script, which is also the default behavior for actions. The runner will report the status of the step as fail/succeed based on this exit code.
|
||||
|
||||
- `powershell`/`pwsh`
|
||||
- 可能时的快速失败行为。 对于 `pwsh` 和 `powershell` 内置 shell,我们将在脚本内容前面追加 `$ErrorActionPreference = 'stop'`。
|
||||
- 我们追加 `if ((Test-Path -LiteralPath variable:\LASTEXITCODE)) { exit $LASTEXITCODE }` 到 Powershell 脚本,以便操作状态反映脚本的最后一个退出代码。
|
||||
- 用户始终可以选择退出,方法是不使用内置 shell,并按需提供 `pwsh -File {0}` 或 `powershell -Command "& '{0}'"` 等自定义 shell 选项。
|
||||
- Fail-fast behavior when possible. For `pwsh` and `powershell` built-in shell, we will prepend `$ErrorActionPreference = 'stop'` to script contents.
|
||||
- We append `if ((Test-Path -LiteralPath variable:\LASTEXITCODE)) { exit $LASTEXITCODE }` to powershell scripts so action statuses reflect the script's last exit code.
|
||||
- Users can always opt out by not using the built-in shell, and providing a custom shell option like: `pwsh -File {0}`, or `powershell -Command "& '{0}'"`, depending on need.
|
||||
|
||||
- `cmd`
|
||||
- 除了编写脚本来检查每个错误代码并相应地响应之外,似乎没有办法完全选择快速失败行为。 由于我们默认不能实际提供该行为,因此您需要将此行为写入脚本。
|
||||
- `cmd.exe` 在退出时带有其执行的最后一个程序的错误等级,并且会将错误代码返回到运行器。 此行为在内部与之前的 `sh` 和 `pwsh` 默认行为一致,并且是 `cmd.exe` 默认行为,因而此行为将保持不变。
|
||||
- There doesn't seem to be a way to fully opt into fail-fast behavior other than writing your script to check each error code and respond accordingly. Because we can't actually provide that behavior by default, you need to write this behavior into your script.
|
||||
- `cmd.exe` will exit with the error level of the last program it executed, and it will return the error code to the runner. This behavior is internally consistent with the previous `sh` and `pwsh` default behavior and is the `cmd.exe` default, so this behavior remains intact.
|
||||
|
||||
### `jobs.<job_id>.steps[*].with`
|
||||
|
||||
由操作定义的输入参数的 `map`。 每个输入参数都是一个键/值对。 输入参数被设置为环境变量。 该变量的前缀为 `INPUT_`,并转换为大写。
|
||||
A `map` of the input parameters defined by the action. Each input parameter is a key/value pair. Input parameters are set as environment variables. The variable is prefixed with `INPUT_` and converted to upper case.
|
||||
|
||||
#### <a name="example"></a>示例
|
||||
#### Example
|
||||
|
||||
定义由 `hello_world` 操作定义的三个输入参数(`first_name`、`middle_name` 和 `last_name`)。 这些输入变量将作为 `INPUT_FIRST_NAME`、`INPUT_MIDDLE_NAME` 和 `INPUT_LAST_NAME` 环境变量由 `hello-world` 操作访问。
|
||||
Defines the three input parameters (`first_name`, `middle_name`, and `last_name`) defined by the `hello_world` action. These input variables will be accessible to the `hello-world` action as `INPUT_FIRST_NAME`, `INPUT_MIDDLE_NAME`, and `INPUT_LAST_NAME` environment variables.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@@ -657,9 +656,9 @@ jobs:
|
||||
|
||||
### `jobs.<job_id>.steps[*].with.args`
|
||||
|
||||
`string` 定义 Docker 容器的输入。 {% data variables.product.prodname_dotcom %} 在容器启动时将 `args` 传递到容器的 `ENTRYPOINT`。 此参数不支持 `array of strings`。
|
||||
A `string` that defines the inputs for a Docker container. {% data variables.product.prodname_dotcom %} passes the `args` to the container's `ENTRYPOINT` when the container starts up. An `array of strings` is not supported by this parameter.
|
||||
|
||||
#### <a name="example"></a>示例
|
||||
#### Example
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -672,17 +671,17 @@ steps:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
`args` 用于代替 `Dockerfile` 中的 `CMD` 指令。 如果在 `Dockerfile` 中使用 `CMD`,请使用按偏好排序的指南:
|
||||
The `args` are used in place of the `CMD` instruction in a `Dockerfile`. If you use `CMD` in your `Dockerfile`, use the guidelines ordered by preference:
|
||||
|
||||
1. 在操作的自述文件中记录必要的参数,并在 `CMD` 指令的中忽略它们。
|
||||
1. 使用默认值,允许不指定任何 `args` 即可使用操作。
|
||||
1. 如果操作显示 `--help` 标记或类似项,请将其用作默认值,以便操作自行记录。
|
||||
1. Document required arguments in the action's README and omit them from the `CMD` instruction.
|
||||
1. Use defaults that allow using the action without specifying any `args`.
|
||||
1. If the action exposes a `--help` flag, or something similar, use that as the default to make your action self-documenting.
|
||||
|
||||
### `jobs.<job_id>.steps[*].with.entrypoint`
|
||||
|
||||
如果未指定该项,则替代 `Dockerfile` 中的 Docker `ENTRYPOINT`,否则对其进行设置。 与包含 shell 和 exec 表单的 Docker `ENTRYPOINT` 指令不同,`entrypoint` 关键字只接受定义要运行的可执行文件的单个字符串。
|
||||
Overrides the Docker `ENTRYPOINT` in the `Dockerfile`, or sets it if one wasn't already specified. Unlike the Docker `ENTRYPOINT` instruction which has a shell and exec form, `entrypoint` keyword accepts only a single string defining the executable to be run.
|
||||
|
||||
#### <a name="example"></a>示例
|
||||
#### Example
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -692,17 +691,17 @@ steps:
|
||||
entrypoint: /a/different/executable
|
||||
```
|
||||
|
||||
`entrypoint` 关键字旨在用于 Docker 容器操作,但你也可以将其用于未定义任何输入的 JavaScript 操作。
|
||||
The `entrypoint` keyword is meant to be used with Docker container actions, but you can also use it with JavaScript actions that don't define any inputs.
|
||||
|
||||
### `jobs.<job_id>.steps[*].env`
|
||||
|
||||
设置供步骤用于运行器环境的环境变量。 您也可以设置整个工作流程或某个作业的环境变量。 有关详细信息,请参阅 [`env`](#env) 和 [`jobs.<job_id>.env`](#jobsjob_idenv)。
|
||||
Sets environment variables for steps to use in the runner environment. You can also set environment variables for the entire workflow or a job. For more information, see [`env`](#env) and [`jobs.<job_id>.env`](#jobsjob_idenv).
|
||||
|
||||
{% data reusables.repositories.actions-env-var-note %}
|
||||
|
||||
公共操作可在自述文件中指定预期的环境变量。 如果要在环境变量中设置密码,必须使用 `secrets` 上下文进行设置。 有关详细信息,请参阅“[使用环境变量](/actions/automating-your-workflow-with-github-actions/using-environment-variables)”和“[上下文](/actions/learn-github-actions/contexts)”。
|
||||
Public actions may specify expected environment variables in the README file. If you are setting a secret in an environment variable, you must set secrets using the `secrets` context. For more information, see "[Using environment variables](/actions/automating-your-workflow-with-github-actions/using-environment-variables)" and "[Contexts](/actions/learn-github-actions/contexts)."
|
||||
|
||||
#### <a name="example"></a>示例
|
||||
#### Example
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -717,41 +716,41 @@ steps:
|
||||
|
||||
### `jobs.<job_id>.steps[*].continue-on-error`
|
||||
|
||||
防止步骤失败时作业也会失败。 设置为 `true` 以允许在此步骤失败时作业能够通过。
|
||||
Prevents a job from failing when a step fails. Set to `true` to allow a job to pass when this step fails.
|
||||
|
||||
### `jobs.<job_id>.steps[*].timeout-minutes`
|
||||
|
||||
终止进程之前运行该步骤的最大分钟数。
|
||||
The maximum number of minutes to run the step before killing the process.
|
||||
|
||||
## `jobs.<job_id>.timeout-minutes`
|
||||
|
||||
在 {% data variables.product.prodname_dotcom %} 自动取消运行之前可让作业运行的最大分钟数。 默认值:360
|
||||
The maximum number of minutes to let a job run before {% data variables.product.prodname_dotcom %} automatically cancels it. Default: 360
|
||||
|
||||
如果超时超过运行器的作业执行时限,作业将在达到执行时限时取消。 有关作业执行时间限制的详细信息,请参阅 {% ifversion fpt or ghec or ghes %}“[使用情况限制和计费](/actions/reference/usage-limits-billing-and-administration#usage-limits),了解 {% data variables.product.prodname_dotcom %} 托管的运行器,以及参阅 {% endif %}“[关于自承载运行器](/actions/hosting-your-own-runners/about-self-hosted-runners/#usage-limits){% ifversion fpt or ghec or ghes %}”了解自承载运行器使用限制。{% elsif ghae %}."{% endif %}
|
||||
If the timeout exceeds the job execution time limit for the runner, the job will be canceled when the execution time limit is met instead. For more information about job execution time limits, see {% ifversion fpt or ghec or ghes %}"[Usage limits and billing](/actions/reference/usage-limits-billing-and-administration#usage-limits)" for {% data variables.product.prodname_dotcom %}-hosted runners and {% endif %}"[About self-hosted runners](/actions/hosting-your-own-runners/about-self-hosted-runners/#usage-limits){% ifversion fpt or ghec or ghes %}" for self-hosted runner usage limits.{% elsif ghae %}."{% endif %}
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:{% data reusables.actions.github-token-expiration %} 对于自承载运行器,如果作业超时大于 24 小时,则令牌可能是限制因素。 有关 `GITHUB_TOKEN` 的详细信息,请参阅“[关于 `GITHUB_TOKEN` 机密](/actions/security-guides/automatic-token-authentication#about-the-github_token-secret)”。
|
||||
**Note:** {% data reusables.actions.github-token-expiration %} For self-hosted runners, the token may be the limiting factor if the job timeout is greater than 24 hours. For more information on the `GITHUB_TOKEN`, see "[About the `GITHUB_TOKEN` secret](/actions/security-guides/automatic-token-authentication#about-the-github_token-secret)."
|
||||
|
||||
{% endnote %}
|
||||
|
||||
## `jobs.<job_id>.strategy`
|
||||
|
||||
使用 `jobs.<job_id>.strategy` 对作业使用矩阵策略。 {% data reusables.actions.jobs.about-matrix-strategy %} 有关详细信息,请参阅“[为作业使用矩阵](/actions/using-jobs/using-a-matrix-for-your-jobs)”。
|
||||
Use `jobs.<job_id>.strategy` to use a matrix strategy for your jobs. {% data reusables.actions.jobs.about-matrix-strategy %} For more information, see "[Using a matrix for your jobs](/actions/using-jobs/using-a-matrix-for-your-jobs)."
|
||||
|
||||
### `jobs.<job_id>.strategy.matrix`
|
||||
|
||||
{% data reusables.actions.jobs.using-matrix-strategy %}
|
||||
|
||||
#### <a name="example-using-a-single-dimension-matrix"></a>示例:使用单维矩阵
|
||||
#### Example: Using a single-dimension matrix
|
||||
|
||||
{% data reusables.actions.jobs.single-dimension-matrix %}
|
||||
|
||||
#### <a name="example-using-a-multi-dimension-matrix"></a>示例:使用多维矩阵
|
||||
#### Example: Using a multi-dimension matrix
|
||||
|
||||
{% data reusables.actions.jobs.multi-dimension-matrix %}
|
||||
|
||||
#### <a name="example-using-contexts-to-create-matrices"></a>示例:使用上下文创建矩阵
|
||||
#### Example: Using contexts to create matrices
|
||||
|
||||
{% data reusables.actions.jobs.matrix-from-context %}
|
||||
|
||||
@@ -759,11 +758,11 @@ steps:
|
||||
|
||||
{% data reusables.actions.jobs.matrix-include %}
|
||||
|
||||
#### <a name="example-expanding-configurations"></a>示例:扩展配置
|
||||
#### Example: Expanding configurations
|
||||
|
||||
{% data reusables.actions.jobs.matrix-expand-with-include %}
|
||||
|
||||
#### <a name="example-adding-configurations"></a>示例:添加配置
|
||||
#### Example: Adding configurations
|
||||
|
||||
{% data reusables.actions.jobs.matrix-add-with-include %}
|
||||
|
||||
@@ -781,11 +780,11 @@ steps:
|
||||
|
||||
## `jobs.<job_id>.continue-on-error`
|
||||
|
||||
防止工作流程运行在作业失败时失败。 设置为 `true` 以允许工作流运行在此作业失败时通过。
|
||||
Prevents a workflow run from failing when a job fails. Set to `true` to allow a workflow run to pass when this job fails.
|
||||
|
||||
### <a name="example-preventing-a-specific-failing-matrix-job-from-failing-a-workflow-run"></a>示例:防止特定失败的矩阵作业无法运行工作流程
|
||||
### Example: Preventing a specific failing matrix job from failing a workflow run
|
||||
|
||||
您可以允许作业矩阵中的特定任务失败,但工作流程运行不失败。 例如,工作流运行不失败的情况下只允许在 `node` 设置为 `15` 的实验性作业失败。
|
||||
You can allow specific jobs in a job matrix to fail without failing the workflow run. For example, if you wanted to only allow an experimental job with `node` set to `15` to fail without failing the workflow run.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -838,17 +837,17 @@ strategy:
|
||||
|
||||
{% data reusables.actions.docker-container-os-support %}
|
||||
|
||||
用于为工作流程中的作业托管服务容器。 服务容器可用于创建数据库或缓存服务(如 Redis)。 运行器自动创建 Docker 网络并管理服务容器的生命周期。
|
||||
Used to host service containers for a job in a workflow. Service containers are useful for creating databases or cache services like Redis. The runner automatically creates a Docker network and manages the life cycle of the service containers.
|
||||
|
||||
如果将作业配置为在容器中运行,或者步骤使用容器操作,则无需映射端口来访问服务或操作。 Docker 会自动在同一个 Docker 用户定义的桥接网络上的容器之间显示所有端口。 您可以直接引用服务容器的主机名。 主机名自动映射到为工作流程中的服务配置的标签名称。
|
||||
If you configure your job to run in a container, or your step uses container actions, you don't need to map ports to access the service or action. Docker automatically exposes all ports between containers on the same Docker user-defined bridge network. You can directly reference the service container by its hostname. The hostname is automatically mapped to the label name you configure for the service in the workflow.
|
||||
|
||||
如果配置作业直接在运行器机器上运行,且您的步骤不使用容器操作,则必须将任何必需的 Docker 服务容器端口映射到 Docker 主机(运行器机器)。 您可以使用 localhost 和映射的端口访问服务容器。
|
||||
If you configure the job to run directly on the runner machine and your step doesn't use a container action, you must map any required Docker service container ports to the Docker host (the runner machine). You can access the service container using localhost and the mapped port.
|
||||
|
||||
有关网络服务容器之间的差异的详细信息,请参阅“[关于服务容器](/actions/automating-your-workflow-with-github-actions/about-service-containers)”。
|
||||
For more information about the differences between networking service containers, see "[About service containers](/actions/automating-your-workflow-with-github-actions/about-service-containers)."
|
||||
|
||||
### <a name="example-using-localhost"></a>示例:使用 localhost
|
||||
### Example: Using localhost
|
||||
|
||||
此示例创建分别用于 nginx 和 redis 的两项服务。 指定 Docker 主机端口但不指定容器端口时,容器端口将随机分配给空闲端口。 {% data variables.product.prodname_dotcom %} 在 {% raw %}`${{job.services.<service_name>.ports}}`{% endraw %} 上下文中设置分配的容器端口。 在此示例中,可以使用 {% raw %}`${{ job.services.nginx.ports['8080'] }}`{% endraw %} 和 {% raw %}`${{ job.services.redis.ports['6379'] }}`{% endraw %} 上下文访问服务容器端口。
|
||||
This example creates two services: nginx and redis. When you specify the Docker host port but not the container port, the container port is randomly assigned to a free port. {% data variables.product.prodname_dotcom %} sets the assigned container port in the {% raw %}`${{job.services.<service_name>.ports}}`{% endraw %} context. In this example, you can access the service container ports using the {% raw %}`${{ job.services.nginx.ports['8080'] }}`{% endraw %} and {% raw %}`${{ job.services.redis.ports['6379'] }}`{% endraw %} contexts.
|
||||
|
||||
```yaml
|
||||
services:
|
||||
@@ -866,13 +865,13 @@ services:
|
||||
|
||||
### `jobs.<job_id>.services.<service_id>.image`
|
||||
|
||||
要用作运行操作的服务容器的 Docker 镜像。 值可以是 Docker Hub 映像名称或注册表名称。
|
||||
The Docker image to use as the service container to run the action. The value can be the Docker Hub image name or a registry name.
|
||||
|
||||
### `jobs.<job_id>.services.<service_id>.credentials`
|
||||
|
||||
{% data reusables.actions.registry-credentials %}
|
||||
|
||||
#### <a name="example"></a>示例
|
||||
#### Example
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -892,23 +891,23 @@ services:
|
||||
|
||||
### `jobs.<job_id>.services.<service_id>.env`
|
||||
|
||||
在服务容器中设置环境变量 `map`。
|
||||
Sets a `map` of environment variables in the service container.
|
||||
|
||||
### `jobs.<job_id>.services.<service_id>.ports`
|
||||
|
||||
设置要在服务容器上显示的端口 `array`。
|
||||
Sets an `array` of ports to expose on the service container.
|
||||
|
||||
### `jobs.<job_id>.services.<service_id>.volumes`
|
||||
|
||||
设置服务容器要使用的卷 `array`。 您可以使用卷分享作业中服务或其他步骤之间的数据。 可以指定命名的 Docker 卷、匿名的 Docker 卷或主机上的绑定挂载。
|
||||
Sets an `array` of volumes for the service container to use. You can use volumes to share data between services or other steps in a job. You can specify named Docker volumes, anonymous Docker volumes, or bind mounts on the host.
|
||||
|
||||
要指定卷,需指定来源和目标路径:
|
||||
To specify a volume, you specify the source and destination path:
|
||||
|
||||
`<source>:<destinationPath>`.
|
||||
|
||||
`<source>` 是主机上的卷名称或绝对路径,`<destinationPath>` 是容器中的绝对路径。
|
||||
The `<source>` is a volume name or an absolute path on the host machine, and `<destinationPath>` is an absolute path in the container.
|
||||
|
||||
#### <a name="example"></a>示例
|
||||
#### Example
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
@@ -919,38 +918,38 @@ volumes:
|
||||
|
||||
### `jobs.<job_id>.services.<service_id>.options`
|
||||
|
||||
附加 Docker 容器资源选项。 有关选项列表,请参阅“[`docker create` 选项](https://docs.docker.com/engine/reference/commandline/create/#options)”。
|
||||
Additional Docker container resource options. For a list of options, see "[`docker create` options](https://docs.docker.com/engine/reference/commandline/create/#options)."
|
||||
|
||||
{% warning %}
|
||||
|
||||
**警告:** 不支持 `--network` 选项。
|
||||
**Warning:** The `--network` option is not supported.
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 or ghec %}
|
||||
{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}
|
||||
## `jobs.<job_id>.uses`
|
||||
|
||||
{% data reusables.actions.reusable-workflows-ghes-beta %}
|
||||
|
||||
要作为作业运行的可重用工作流程文件的位置和版本。 {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6000 %}使用下列语法之一:{% endif %}
|
||||
The location and version of a reusable workflow file to run as a job. {% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}Use one of the following syntaxes:{% endif %}
|
||||
|
||||
{% data reusables.actions.reusable-workflow-calling-syntax %}
|
||||
|
||||
### <a name="example"></a>示例
|
||||
### Example
|
||||
|
||||
{% data reusables.actions.uses-keyword-example %}
|
||||
|
||||
有关详细信息,请参阅“[重用工作流](/actions/learn-github-actions/reusing-workflows)”。
|
||||
For more information, see "[Reusing workflows](/actions/learn-github-actions/reusing-workflows)."
|
||||
|
||||
### `jobs.<job_id>.with`
|
||||
|
||||
当作业用于调用可重用工作流时,可以使用 `with` 来提供传递到被调用工作流的输入的映射。
|
||||
When a job is used to call a reusable workflow, you can use `with` to provide a map of inputs that are passed to the called workflow.
|
||||
|
||||
传递的任何输入都必须与被调用工作流程中定义的输入规范匹配。
|
||||
Any inputs that you pass must match the input specifications defined in the called workflow.
|
||||
|
||||
与 [`jobs.<job_id>.steps[*].with`](#jobsjob_idstepswith) 不同,你使用 `jobs.<job_id>.with` 传递的输入不可作为环境变量用于被调用工作流中。 但你可以通过使用 `inputs` 上下文来引用输入。
|
||||
Unlike [`jobs.<job_id>.steps[*].with`](#jobsjob_idstepswith), the inputs you pass with `jobs.<job_id>.with` are not be available as environment variables in the called workflow. Instead, you can reference the inputs by using the `inputs` context.
|
||||
|
||||
#### <a name="example"></a>示例
|
||||
#### Example
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@@ -962,17 +961,17 @@ jobs:
|
||||
|
||||
### `jobs.<job_id>.with.<input_id>`
|
||||
|
||||
由输入的字符串标识符和输入的值组成的对。 标识符必须与被调用工作流中由 [`on.workflow_call.inputs.<inputs_id>`](/actions/creating-actions/metadata-syntax-for-github-actions#inputsinput_id) 定义的输入名称匹配。 值的数据类型必须与被调用工作流中定义的 [`on.workflow_call.inputs.<input_id>.type`](#onworkflow_callinputsinput_idtype) 类型匹配。
|
||||
A pair consisting of a string identifier for the input and the value of the input. The identifier must match the name of an input defined by [`on.workflow_call.inputs.<inputs_id>`](/actions/creating-actions/metadata-syntax-for-github-actions#inputsinput_id) in the called workflow. The data type of the value must match the type defined by [`on.workflow_call.inputs.<input_id>.type`](#onworkflow_callinputsinput_idtype) in the called workflow.
|
||||
|
||||
允许的表达式上下文:`github` 和 `needs`。
|
||||
Allowed expression contexts: `github`, and `needs`.
|
||||
|
||||
### `jobs.<job_id>.secrets`
|
||||
|
||||
当作业用于调用可重用工作流时,可以使用 `secrets` 来提供传递到被调用工作流的机密的映射。
|
||||
When a job is used to call a reusable workflow, you can use `secrets` to provide a map of secrets that are passed to the called workflow.
|
||||
|
||||
传递的任何机密都必须与被调用工作流程中定义的名称匹配。
|
||||
Any secrets that you pass must match the names defined in the called workflow.
|
||||
|
||||
#### <a name="example"></a>示例
|
||||
#### Example
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -988,9 +987,9 @@ jobs:
|
||||
|
||||
### `jobs.<job_id>.secrets.inherit`
|
||||
|
||||
使用关键字 `inherit` 将所有调用工作流的机密传递给调用的工作流。 这包括调用工作流有权访问的所有机密,即组织、存储库和环境机密。 关键字 `inherit` 可用于在同一组织中跨存储库或在同一企业中跨组织传递机密。
|
||||
Use the `inherit` keyword to pass all the calling workflow's secrets to the called workflow. This includes all secrets the calling workflow has access to, namely organization, repository, and environment secrets. The `inherit` keyword can be used to pass secrets across repositories within the same organization, or across organizations within the same enterprise.
|
||||
|
||||
#### <a name="example"></a>示例
|
||||
#### Example
|
||||
|
||||
{% raw %}
|
||||
|
||||
@@ -1022,66 +1021,74 @@ jobs:
|
||||
|
||||
### `jobs.<job_id>.secrets.<secret_id>`
|
||||
|
||||
由机密的字符串标识符和机密的值组成的对。 标识符必须与被调用工作流中由 [`on.workflow_call.secrets.<secret_id>`](#onworkflow_callsecretssecret_id) 定义的机密名称匹配。
|
||||
A pair consisting of a string identifier for the secret and the value of the secret. The identifier must match the name of a secret defined by [`on.workflow_call.secrets.<secret_id>`](#onworkflow_callsecretssecret_id) in the called workflow.
|
||||
|
||||
允许的表达式上下文:`github`、`needs` 和 `secrets`。
|
||||
Allowed expression contexts: `github`, `needs`, and `secrets`.
|
||||
{% endif %}
|
||||
|
||||
## <a name="filter-pattern-cheat-sheet"></a>筛选器模式速查表
|
||||
## Filter pattern cheat sheet
|
||||
|
||||
您可以在路径、分支和标记过滤器中使用特殊字符。
|
||||
You can use special characters in path, branch, and tag filters.
|
||||
|
||||
- `*`:匹配零个或多个字符,但不匹配 `/` 字符。 例如,`Octo*` 匹配 `Octocat`。
|
||||
- `**`:匹配零个或多个任意字符。
|
||||
- `?`:匹配零个或一个前面的字符。
|
||||
- `+`:匹配一个或多个前面的字符。
|
||||
- `[]` 匹配列在括号中或包含在范围内的一个字符。 范围只能包括 `a-z`、`A-Z` 和 `0-9`。 例如,范围 `[0-9a-z]` 匹配任何数字或小写字母。 例如,`[CB]at` 匹配 `Cat` 或 `Bat`,而 `[1-2]00` 匹配 `100` 和 `200`。
|
||||
- `!`:在模式开始时,它将否定以前的正模式。 如果不是第一个字符,它就没有特殊的意义。
|
||||
- `*`: Matches zero or more characters, but does not match the `/` character. For example, `Octo*` matches `Octocat`.
|
||||
- `**`: Matches zero or more of any character.
|
||||
- `?`: Matches zero or one of the preceding character.
|
||||
- `+`: Matches one or more of the preceding character.
|
||||
- `[]` Matches one character listed in the brackets or included in ranges. Ranges can only include `a-z`, `A-Z`, and `0-9`. For example, the range`[0-9a-z]` matches any digit or lowercase letter. For example, `[CB]at` matches `Cat` or `Bat` and `[1-2]00` matches `100` and `200`.
|
||||
- `!`: At the start of a pattern makes it negate previous positive patterns. It has no special meaning if not the first character.
|
||||
|
||||
字符 `*`、`[` 和 `!` 是 YAML 中的特殊字符。 如果模式以 `*`、`[` 或 `!` 开头,则必须将模式括在引号中。
|
||||
The characters `*`, `[`, and `!` are special characters in YAML. If you start a pattern with `*`, `[`, or `!`, you must enclose the pattern in quotes. Also, if you use a [flow sequence](https://yaml.org/spec/1.2.2/#flow-sequences) with a pattern containing `[` and/or `]`, the pattern must be enclosed in quotes.
|
||||
|
||||
```yaml
|
||||
# Valid
|
||||
- '**/README.md'
|
||||
branches:
|
||||
- '**/README.md'
|
||||
|
||||
# Invalid - creates a parse error that
|
||||
# prevents your workflow from running.
|
||||
- **/README.md
|
||||
branches:
|
||||
- **/README.md
|
||||
|
||||
# Valid
|
||||
branches: [ main, 'release/v[0-9].[0-9]' ]
|
||||
|
||||
# Invalid - creates a parse error
|
||||
branches: [ main, release/v[0-9].[0-9] ]
|
||||
```
|
||||
|
||||
有关分支、标记和路径筛选器语法的详细信息,请参阅“[`on.<push>.<branches|tags>`](#onpushbranchestagsbranches-ignoretags-ignore)”、“[`on.<pull_request>.<branches|tags>`](#onpull_requestpull_request_targetbranchesbranches-ignore)”和“[`on.<push|pull_request>.paths`](#onpushpull_requestpull_request_targetpathspaths-ignore)”。
|
||||
For more information about branch, tag, and path filter syntax, see "[`on.<push>.<branches|tags>`](#onpushbranchestagsbranches-ignoretags-ignore)", "[`on.<pull_request>.<branches|tags>`](#onpull_requestpull_request_targetbranchesbranches-ignore)", and "[`on.<push|pull_request>.paths`](#onpushpull_requestpull_request_targetpathspaths-ignore)."
|
||||
|
||||
### <a name="patterns-to-match-branches-and-tags"></a>匹配分支和标记的模式
|
||||
### Patterns to match branches and tags
|
||||
|
||||
| 模式 | 说明 | 匹配项示例 |
|
||||
| Pattern | Description | Example matches |
|
||||
|---------|------------------------|---------|
|
||||
| `feature/*` | `*` 通配符匹配任意字符,但不匹配斜杠 (`/`)。 | `feature/my-branch`<br/><br/>`feature/your-branch` |
|
||||
| `feature/**` | `**` 通配符匹配任意字符,包括分支中的斜杠 (`/`) 和标记名称。 | `feature/beta-a/my-branch`<br/><br/>`feature/your-branch`<br/><br/>`feature/mona/the/octocat` |
|
||||
| `main`<br/><br/>`releases/mona-the-octocat` | 匹配分支或标记名称的确切名称。 | `main`<br/><br/>`releases/mona-the-octocat` |
|
||||
| `'*'` | 匹配所有不包含斜杠 (`/`) 的分支和标记名称。 `*` 字符是 YAML 中的特殊字符。 当模式以 `*` 开头时,必须使用引号。 | `main`<br/><br/>`releases` |
|
||||
| `'**'` | 匹配所有分支和标记名称。 这是不使用 `branches` 或 `tags` 筛选器时的默认行为。 | `all/the/branches`<br/><br/>`every/tag` |
|
||||
| `'*feature'` | `*` 字符是 YAML 中的特殊字符。 当模式以 `*` 开头时,必须使用引号。 | `mona-feature`<br/><br/>`feature`<br/><br/>`ver-10-feature` |
|
||||
| `v2*` | 匹配以 `v2` 开头的分支和标记名称。 | `v2`<br/><br/>`v2.0`<br/><br/>`v2.9` |
|
||||
| `v[12].[0-9]+.[0-9]+` | 将所有语义版本控制分支和标记与主要版本 1 或 2 匹配。 | `v1.10.1`<br/><br/>`v2.0.0` |
|
||||
| `feature/*` | The `*` wildcard matches any character, but does not match slash (`/`). | `feature/my-branch`<br/><br/>`feature/your-branch` |
|
||||
| `feature/**` | The `**` wildcard matches any character including slash (`/`) in branch and tag names. | `feature/beta-a/my-branch`<br/><br/>`feature/your-branch`<br/><br/>`feature/mona/the/octocat` |
|
||||
| `main`<br/><br/>`releases/mona-the-octocat` | Matches the exact name of a branch or tag name. | `main`<br/><br/>`releases/mona-the-octocat` |
|
||||
| `'*'` | Matches all branch and tag names that don't contain a slash (`/`). The `*` character is a special character in YAML. When you start a pattern with `*`, you must use quotes. | `main`<br/><br/>`releases` |
|
||||
| `'**'` | Matches all branch and tag names. This is the default behavior when you don't use a `branches` or `tags` filter. | `all/the/branches`<br/><br/>`every/tag` |
|
||||
| `'*feature'` | The `*` character is a special character in YAML. When you start a pattern with `*`, you must use quotes. | `mona-feature`<br/><br/>`feature`<br/><br/>`ver-10-feature` |
|
||||
| `v2*` | Matches branch and tag names that start with `v2`. | `v2`<br/><br/>`v2.0`<br/><br/>`v2.9` |
|
||||
| `v[12].[0-9]+.[0-9]+` | Matches all semantic versioning branches and tags with major version 1 or 2. | `v1.10.1`<br/><br/>`v2.0.0` |
|
||||
|
||||
### <a name="patterns-to-match-file-paths"></a>匹配文件路径的模式
|
||||
### Patterns to match file paths
|
||||
|
||||
路径模式必须匹配整个路径,并从仓库根开始。
|
||||
Path patterns must match the whole path, and start from the repository's root.
|
||||
|
||||
| 模式 | 匹配描述 | 匹配项示例 |
|
||||
| Pattern | Description of matches | Example matches |
|
||||
|---------|------------------------|-----------------|
|
||||
| `'*'` | `*` 通配符匹配任意字符,但不匹配斜杠 (`/`)。 `*` 字符是 YAML 中的特殊字符。 当模式以 `*` 开头时,必须使用引号。 | `README.md`<br/><br/>`server.rb` |
|
||||
| `'*.jsx?'` | `?` 字符匹配零个或一个前面的字符。 | `page.js`<br/><br/>`page.jsx` |
|
||||
| `'**'` | `**`通配符匹配任意字符,包括斜杠 (`/`)。 这是不使用 `path` 筛选器时的默认行为。 | `all/the/files.md` |
|
||||
| `'*.js'` | `*` 通配符匹配任意字符,但不匹配斜杠 (`/`)。 匹配存储库根目录下的所有 `.js` 文件。 | `app.js`<br/><br/>`index.js`
|
||||
| `'**.js'` | 匹配存储库中的所有 `.js` 文件。 | `index.js`<br/><br/>`js/index.js`<br/><br/>`src/js/app.js` |
|
||||
| `docs/*` | 存储库根目录下 `docs` 根目录中的所有文件。 | `docs/README.md`<br/><br/>`docs/file.txt` |
|
||||
| `docs/**` | 存储库根目录下 `/docs` 目录中的任何文件。 | `docs/README.md`<br/><br/>`docs/mona/octocat.txt` |
|
||||
| `docs/**/*.md` | `docs` 目录下任意位置带有 `.md` 后缀的文件。 | `docs/README.md`<br/><br/>`docs/mona/hello-world.md`<br/><br/>`docs/a/markdown/file.md`
|
||||
| `'**/docs/**'` | 存储库中任意位置 `docs` 目录下的任何文件。 | `docs/hello.md`<br/><br/>`dir/docs/my-file.txt`<br/><br/>`space/docs/plan/space.doc`
|
||||
| `'**/README.md'` | 仓库中任意位置的 README.md 文件。 | `README.md`<br/><br/>`js/README.md`
|
||||
| `'**/*src/**'` | 存储库中任意位置带有 `src` 后缀的文件夹中的任何文件。 | `a/src/app.js`<br/><br/>`my-src/code/js/app.js`
|
||||
| `'**/*-post.md'` | 存储库中任意位置带有 `-post.md` 后缀的文件。 | `my-post.md`<br/><br/>`path/their-post.md` |
|
||||
| `'**/migrate-*.sql'` | 存储库中任意位置带有 `migrate-` 前缀和 `.sql` 后缀的文件。 | `migrate-10909.sql`<br/><br/>`db/migrate-v1.0.sql`<br/><br/>`db/sept/migrate-v1.sql` |
|
||||
| `*.md`<br/><br/>`!README.md` | 模式前使用感叹号 `!` 对其进行否定。 当文件与模式匹配并且也匹配文件后面定义的否定模式时,则不包括该文件。 | `hello.md`<br/><br/>_不匹配_<br/><br/>`README.md`<br/><br/>`docs/hello.md` |
|
||||
| `*.md`<br/><br/>`!README.md`<br/><br/>`README*` | 按顺序检查模式。 否定前一个模式的模式将重新包含文件路径。 | `hello.md`<br/><br/>`README.md`<br/><br/>`README.doc`|
|
||||
| `'*'` | The `*` wildcard matches any character, but does not match slash (`/`). The `*` character is a special character in YAML. When you start a pattern with `*`, you must use quotes. | `README.md`<br/><br/>`server.rb` |
|
||||
| `'*.jsx?'` | The `?` character matches zero or one of the preceding character. | `page.js`<br/><br/>`page.jsx` |
|
||||
| `'**'` | The `**` wildcard matches any character including slash (`/`). This is the default behavior when you don't use a `path` filter. | `all/the/files.md` |
|
||||
| `'*.js'` | The `*` wildcard matches any character, but does not match slash (`/`). Matches all `.js` files at the root of the repository. | `app.js`<br/><br/>`index.js`
|
||||
| `'**.js'` | Matches all `.js` files in the repository. | `index.js`<br/><br/>`js/index.js`<br/><br/>`src/js/app.js` |
|
||||
| `docs/*` | All files within the root of the `docs` directory, at the root of the repository. | `docs/README.md`<br/><br/>`docs/file.txt` |
|
||||
| `docs/**` | Any files in the `/docs` directory at the root of the repository. | `docs/README.md`<br/><br/>`docs/mona/octocat.txt` |
|
||||
| `docs/**/*.md` | A file with a `.md` suffix anywhere in the `docs` directory. | `docs/README.md`<br/><br/>`docs/mona/hello-world.md`<br/><br/>`docs/a/markdown/file.md`
|
||||
| `'**/docs/**'` | Any files in a `docs` directory anywhere in the repository. | `docs/hello.md`<br/><br/>`dir/docs/my-file.txt`<br/><br/>`space/docs/plan/space.doc`
|
||||
| `'**/README.md'` | A README.md file anywhere in the repository. | `README.md`<br/><br/>`js/README.md`
|
||||
| `'**/*src/**'` | Any file in a folder with a `src` suffix anywhere in the repository. | `a/src/app.js`<br/><br/>`my-src/code/js/app.js`
|
||||
| `'**/*-post.md'` | A file with the suffix `-post.md` anywhere in the repository. | `my-post.md`<br/><br/>`path/their-post.md` |
|
||||
| `'**/migrate-*.sql'` | A file with the prefix `migrate-` and suffix `.sql` anywhere in the repository. | `migrate-10909.sql`<br/><br/>`db/migrate-v1.0.sql`<br/><br/>`db/sept/migrate-v1.sql` |
|
||||
| `*.md`<br/><br/>`!README.md` | Using an exclamation mark (`!`) in front of a pattern negates it. When a file matches a pattern and also matches a negative pattern defined later in the file, the file will not be included. | `hello.md`<br/><br/>_Does not match_<br/><br/>`README.md`<br/><br/>`docs/hello.md` |
|
||||
| `*.md`<br/><br/>`!README.md`<br/><br/>`README*` | Patterns are checked sequentially. A pattern that negates a previous pattern will re-include file paths. | `hello.md`<br/><br/>`README.md`<br/><br/>`README.doc`|
|
||||
|
||||
@@ -4,7 +4,7 @@ intro: '通过向 {% data variables.product.product_name %} 添加自定义页
|
||||
versions:
|
||||
ghec: '*'
|
||||
ghes: '>=3.4'
|
||||
ghae: issue-5487
|
||||
ghae: '>= 3.4'
|
||||
type: how_to
|
||||
topics:
|
||||
- Enterprise
|
||||
|
||||
@@ -93,7 +93,7 @@ You can enforce TLS encryption for all incoming SMTP connections, which can help
|
||||
{%- ifversion ghes = 3.6 %}
|
||||
{% note %}
|
||||
|
||||
**Note**: Enforcement of TLS for SMTP connections is unavailable in {% data variables.product.product_name %} 3.6.0. The feature will be available in an upcoming release.
|
||||
**Note**: Enforcement of TLS for SMTP connections is unavailable in {% data variables.product.product_name %} 3.6.0 and 3.6.1. The feature is available in 3.6.2 and later.
|
||||
|
||||
{% endnote %}
|
||||
{%- endif %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 配置速率限制
|
||||
intro: '您可以使用 {% data variables.enterprise.management_console %} 为 {% data variables.product.prodname_ghe_server %} 配置速率限制。'
|
||||
title: Configuring rate limits
|
||||
intro: 'You can set rate limits for {% data variables.product.prodname_ghe_server %} using the {% data variables.enterprise.management_console %}.'
|
||||
redirect_from:
|
||||
- /enterprise/admin/installation/configuring-rate-limits
|
||||
- /enterprise/admin/configuration/configuring-rate-limits
|
||||
@@ -12,91 +12,99 @@ topics:
|
||||
- Enterprise
|
||||
- Infrastructure
|
||||
- Performance
|
||||
ms.openlocfilehash: e40c6453934c4b80157c46a08784aab850ccc837
|
||||
ms.sourcegitcommit: 1309b46201604c190c63bfee47dce559003899bf
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/10/2022
|
||||
ms.locfileid: '147066472'
|
||||
---
|
||||
## 为 {% data variables.product.prodname_enterprise_api %} 启用速率限制
|
||||
## Enabling rate limits for {% data variables.product.prodname_enterprise_api %}
|
||||
|
||||
在 {% data variables.product.prodname_enterprise_api %} 上启用速率限制可以防止个别用户或未通过身份验证的用户过度使用资源。 有关详细信息,请参阅“[REST API 中的资源](/rest/overview/resources-in-the-rest-api#rate-limiting)”。
|
||||
Enabling rate limits on {% data variables.product.prodname_enterprise_api %} can prevent overuse of resources by individual or unauthenticated users. For more information, see "[Resources in the REST API](/rest/overview/resources-in-the-rest-api#rate-limiting)."
|
||||
|
||||
{% ifversion ghes %} 可使用管理 shell 中的 `ghe-config` 实用工具使用户列表免受 API 速率限制。 有关详细信息,请参阅“[命令行实用工具](/enterprise/admin/configuration/command-line-utilities#ghe-config)”。
|
||||
{% ifversion ghes %}
|
||||
You can exempt a list of users from API rate limits using the `ghe-config` utility in the administrative shell. For more information, see "[Command-line utilities](/enterprise/admin/configuration/command-line-utilities#ghe-config)."
|
||||
{% endif %}
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:{% data variables.enterprise.management_console %} 列出了每种速率限制的时限(按分钟或按小时)。
|
||||
**Note:** The {% data variables.enterprise.management_console %} lists the time period (per minute or per hour) for each rate limit.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
{% data reusables.enterprise_site_admin_settings.access-settings %} {% data reusables.enterprise_site_admin_settings.management-console %}
|
||||
2. 在“速率限制”下,选择“启用 HTTP API 速率限制”。
|
||||

|
||||
3. 输入对每个 API 的已验证和未验证请求的限制,或者接受预先填入的默认限制。
|
||||
{% data reusables.enterprise_site_admin_settings.access-settings %}
|
||||
{% data reusables.enterprise_site_admin_settings.management-console %}
|
||||
2. Under "Rate Limiting", select **Enable HTTP API Rate Limiting**.
|
||||

|
||||
3. Type limits for authenticated and unauthenticated requests for each API, or accept the pre-filled default limits.
|
||||
{% data reusables.enterprise_management_console.save-settings %}
|
||||
|
||||
## 启用二级费率限制
|
||||
## Enabling secondary rate limits
|
||||
|
||||
设置二级费限制可保护 {% data variables.product.product_location %} 上的整体服务等级。
|
||||
Setting secondary rate limits protects the overall level of service on {% data variables.product.product_location %}.
|
||||
|
||||
{% data reusables.enterprise_site_admin_settings.access-settings %} {% data reusables.enterprise_site_admin_settings.management-console %} {% ifversion ghes %}
|
||||
2. 在“速率限制”下,选择“启用二级速率限制”。
|
||||
 {% else %}
|
||||
2. 在“速率限制”下,选择“启用滥用速率限制”。
|
||||
 {% endif %}
|
||||
3. 输入总请求限制、CPU 限制或对搜索的 CPU 限制,或接受预先填入的默认限制。
|
||||
{% data reusables.enterprise_site_admin_settings.access-settings %}
|
||||
{% data reusables.enterprise_site_admin_settings.management-console %}
|
||||
{% ifversion ghes %}
|
||||
2. Under "Rate Limiting", select **Enable Secondary Rate Limiting**.
|
||||

|
||||
{% else %}
|
||||
2. Under "Rate Limiting", select **Enable Abuse Rate Limiting**.
|
||||

|
||||
{% endif %}
|
||||
3. Type limits for Total Requests, CPU Limit, and CPU Limit for Searching, or accept the pre-filled default limits.
|
||||
{% data reusables.enterprise_management_console.save-settings %}
|
||||
|
||||
## 启用 Git 速率限制
|
||||
## Enabling rate limits for Git
|
||||
|
||||
您可以按仓库网络或用户 ID 应用 Git 速率限制。 Git 速率限制以每分钟并行操作数表示,不过会根据当前 CPU 负荷进行调整。
|
||||
If a member of {% data variables.product.company_short %}'s staff has recommended it, you can apply Git rate limits per repository network or per user ID. Git rate limits are expressed in concurrent operations per minute, and are adaptive based on the current CPU load.
|
||||
|
||||
{% data reusables.enterprise_site_admin_settings.access-settings %} {% data reusables.enterprise_site_admin_settings.management-console %}
|
||||
2. 在“速率限制”下,选择“启用 Git 速率限制”。
|
||||

|
||||
3. 输入对每个仓库网络或用户 ID 的限制。
|
||||
 {% data reusables.enterprise_management_console.save-settings %}
|
||||
{% warning %}
|
||||
|
||||
**Warning:** We encourage you to leave this setting disabled unless directly recommended by a member of {% data variables.product.company_short %}'s staff. Git operations are rarely the leading driver of CPU and RAM usage. Enabling this feature can make Git operations more likely to fail under high load conditions but does not address the underlying cause of those conditions.
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
{% data reusables.enterprise_site_admin_settings.access-settings %}
|
||||
{% data reusables.enterprise_site_admin_settings.management-console %}
|
||||
2. Under "Rate Limiting", select **Enable Git Rate Limiting**.
|
||||

|
||||
3. Type limits for each repository network or user ID.
|
||||

|
||||
{% data reusables.enterprise_management_console.save-settings %}
|
||||
|
||||
{% ifversion ghes > 3.4 %}
|
||||
|
||||
## 配置 {% data variables.product.prodname_actions %} 的速率限制
|
||||
## Configuring rate limits for {% data variables.product.prodname_actions %}
|
||||
|
||||
可以将速率限制应用于 {% data variables.product.prodname_actions %} 工作流运行。 有关 {% data variables.product.prodname_actions %} 的详细信息,请参阅“[关于企业的 {% data variables.product.prodname_actions %}](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/about-github-actions-for-enterprises)”。
|
||||
You can apply a rate limit to {% data variables.product.prodname_actions %} workflow runs. For more information about {% data variables.product.prodname_actions %}, see "[About {% data variables.product.prodname_actions %} for enterprises](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/about-github-actions-for-enterprises)."
|
||||
|
||||
### 关于 {% data variables.product.prodname_actions %} 的速率限制
|
||||
### About rate limits for {% data variables.product.prodname_actions %}
|
||||
|
||||
{% data variables.product.product_name %} 实例将每个 {% data variables.product.prodname_actions %} 工作流作业分配给运行器。 如果实例无法立即将作业分配给可用的运行器,作业将在队列中等待,直到运行器可用。 如果 {% data variables.product.prodname_actions %} 遇到持续高负载,则队列可以备份,并且 {% data variables.product.product_location %} 的性能可能会降级。
|
||||
Your {% data variables.product.product_name %} instance assigns each {% data variables.product.prodname_actions %} workflow job to a runner. If your instance cannot immediately assign a job to an available runner, the job will wait in a queue until a runner is available. If {% data variables.product.prodname_actions %} experiences sustained high load, the queue can back up, and the performance of {% data variables.product.product_location %} may degrade.
|
||||
|
||||
为了避免这种性能降低,可以配置 {% data variables.product.prodname_actions %} 的速率限制。 此速率限制以每分钟作业运行数表示。 {% data variables.product.product_name %} 计算并应用实例上所有作业运行的总数的速率限制。 如果运行数超过速率限制,其他运行将失败,而不是进入队列。 以下错误将显示在运行的注释中。
|
||||
To avoid this performance degradation, you can configure a rate limit for {% data variables.product.prodname_actions %}. This rate limit is expressed in job runs per minute. {% data variables.product.product_name %} calculates and applies the rate limit for the sum total of all job runs on the instance. If runs exceed the rate limit, additional runs will fail instead of entering the queue. The following error will appear in the run's annotations.
|
||||
|
||||
> 已超出工作流运行请求的速率限制。 请稍等,然后重试运行。
|
||||
> You've exceeded the rate limit for workflow run requests. Please wait before retrying the run.
|
||||
|
||||
适当的速率限制可保护 {% data variables.product.product_location %} 免受 {% data variables.product.prodname_actions %} 的异常使用,而不会干扰日常运营。 确切的阈值取决于实例的可用资源和总体负载配置文件。 有关 {% data variables.product.prodname_actions %} 硬件要求的详细信息,请参阅“[{% data variables.product.product_name %} 的 {% data variables.product.prodname_actions %} 入门](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-enterprise-server#review-hardware-requirements)”。
|
||||
An appropriate rate limit protects {% data variables.product.product_location %} from abnormal usage of {% data variables.product.prodname_actions %} without interfering with day-to-day operations. The exact threshold depends on your instance's available resources and overall load profile. For more information about the hardware requirements for {% data variables.product.prodname_actions %}, see "[Getting started with {% data variables.product.prodname_actions %} for {% data variables.product.product_name %}](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-enterprise-server#review-hardware-requirements)."
|
||||
|
||||
默认情况下,禁用 {% data variables.product.prodname_actions %} 的速率限制。 由于 {% data variables.product.product_name %} 可以在不降低性能的情况下处理临时使用高峰,因此此速率限制旨在防止持续高负载。 建议将此速率限制保留禁用状态,除非遇到性能问题。 在某些情况下,{% data variables.contact.github_support %} 可能会建议启用 {% data variables.product.prodname_actions %} 的速率限制。
|
||||
By default, the rate limit for {% data variables.product.prodname_actions %} is disabled. Because {% data variables.product.product_name %} can handle temporary spikes in usage without performance degradation, this rate limit is intended to protect against sustained high load. We recommend leaving the rate limit disabled unless you are experiencing performance problems. In some cases, {% data variables.contact.github_support %} may recommend that you enable a rate limit for {% data variables.product.prodname_actions %}.
|
||||
|
||||
### 启用或禁用 {% data variables.product.prodname_actions %} 的速率限制
|
||||
### Enabling or disabling rate limits for {% data variables.product.prodname_actions %}
|
||||
|
||||
{% data reusables.enterprise_installation.ssh-into-instance %}
|
||||
1. 若要启用和配置速率限制,请运行以下两个命令,将 RUNS-PER-MINUTE 替换为所选值。
|
||||
1. To enable and configure the rate limit, run the following two commands, replacing **RUNS-PER-MINUTE** with the value of your choice.
|
||||
|
||||
```shell
|
||||
ghe-config actions-rate-limiting.enabled true
|
||||
ghe-config actions-rate-limiting.queue-runs-per-minute <em>RUNS-PER-MINUTE</em>
|
||||
```
|
||||
1. 若要在启用速率限制后将其禁用,请运行以下命令。
|
||||
1. To disable the rate limit after it's been enabled, run the following command.
|
||||
|
||||
```
|
||||
ghe-config actions-rate-limiting.enabled false
|
||||
```
|
||||
1. 若要应用配置,请运行以下命令。
|
||||
1. To apply the configuration, run the following command.
|
||||
|
||||
```
|
||||
ghe-config-apply
|
||||
```
|
||||
1. 等待配置运行完毕。
|
||||
1. Wait for the configuration run to complete.
|
||||
|
||||
{% endif %}
|
||||
|
||||
@@ -101,7 +101,7 @@ You can create a runner group to manage access to the runner that you added to y
|
||||
{% endwarning %}
|
||||
{%- endif %}
|
||||
{% data reusables.actions.create-runner-group %}
|
||||
{%- ifversion ghec or ghes > 3.3 or ghae-issue-5091 %}
|
||||
{%- ifversion ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
1. Click the "Runners" tab.
|
||||
1. In the list of runners, click the runner that you deployed in the previous section.
|
||||
1. Click **Edit**.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: 为企业引入 GitHub Actions
|
||||
title: Introducing GitHub Actions to your enterprise
|
||||
shortTitle: Introduce Actions
|
||||
intro: '您可以计划如何在企业中推出 {% data variables.product.prodname_actions %}。'
|
||||
intro: 'You can plan how to roll out {% data variables.product.prodname_actions %} in your enterprise.'
|
||||
versions:
|
||||
ghec: '*'
|
||||
ghes: '*'
|
||||
@@ -10,125 +10,133 @@ type: how_to
|
||||
topics:
|
||||
- Actions
|
||||
- Enterprise
|
||||
ms.openlocfilehash: 8bb732deb2710ca54d173682703403ec6fa86326
|
||||
ms.sourcegitcommit: 478f2931167988096ae6478a257f492ecaa11794
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/09/2022
|
||||
ms.locfileid: '147717819'
|
||||
---
|
||||
## 关于企业的 {% data variables.product.prodname_actions %}
|
||||
|
||||
{% data reusables.actions.about-actions %} 借助 {% data variables.product.prodname_actions %},您的企业可以自动化、自定义和执行软件开发工作流程,如测试和部署。 有关详细信息,请参阅“[关于企业的 {% data variables.product.prodname_actions %}](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/about-github-actions-for-enterprises)”。
|
||||
## About {% data variables.product.prodname_actions %} for enterprises
|
||||
|
||||

|
||||
{% data reusables.actions.about-actions %} With {% data variables.product.prodname_actions %}, your enterprise can automate, customize, and execute your software development workflows like testing and deployments. For more information, see "[About {% data variables.product.prodname_actions %} for enterprises](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/about-github-actions-for-enterprises)."
|
||||
|
||||

|
||||
|
||||
{% data reusables.enterprise.upgrade-ghes-for-actions %}
|
||||
|
||||
在为大型企业引入 {% data variables.product.prodname_actions %} 之前,首先需要规划采用情况,并决定企业将如何使用 {% data variables.product.prodname_actions %} 来最好地支持您的独特需求。
|
||||
Before you introduce {% data variables.product.prodname_actions %} to a large enterprise, you first need to plan your adoption and make decisions about how your enterprise will use {% data variables.product.prodname_actions %} to best support your unique needs.
|
||||
|
||||
## 管理和符合性
|
||||
## Governance and compliance
|
||||
|
||||
您应制定一个计划来管理企业对 {% data variables.product.prodname_actions %} 的使用,并履行合规性义务。
|
||||
You should create a plan to govern your enterprise's use of {% data variables.product.prodname_actions %} and meet your compliance obligations.
|
||||
|
||||
确定允许开发人员使用的操作 {% ifversion actions-workflow-policy %}和可重用工作流 {% endif %}。 {% ifversion ghes %}首先,确定是否允许从实例外部访问操作{% ifversion actions-workflow-policy %}和可重用工作流 {% endif %}。 {% data reusables.actions.access-actions-on-dotcom %} 有关详细信息,请参阅“[关于在企业中使用操作](/admin/github-actions/managing-access-to-actions-from-githubcom/about-using-actions-in-your-enterprise)”。
|
||||
Determine which actions {% ifversion actions-workflow-policy %}and reusable workflows{% endif %} your developers will be allowed to use. {% ifversion ghes %}First, decide whether you'll enable access to actions {% ifversion actions-workflow-policy %}and reusable workflows{% endif %} from outside your instance. {% data reusables.actions.access-actions-on-dotcom %} For more information, see "[About using actions in your enterprise](/admin/github-actions/managing-access-to-actions-from-githubcom/about-using-actions-in-your-enterprise)."
|
||||
|
||||
然后,{% else %}首先{% endif %}确定是否允许第三方操作 {% ifversion actions-workflow-policy %}和并非由 {% data variables.product.company_short %} 创建的可重用工作流{% endif %}。 可以配置允许在存储库、组织和企业级别运行的操作 {% ifversion actions-workflow-policy %}和可重用工作流 {% endif %},并且可以选择仅允许由 {% data variables.product.company_short %} 创建的操作。 如果确实允许第三方操作 {% ifversion actions-workflow-policy %}和可重用工作流{% endif %},则可以将允许的操作限制为由经过验证的创建者创建的操作,或者某个列表中的特定操作{% ifversion actions-workflow-policy %} 和可重用工作流{% endif %}。 有关详细信息,请参阅“[管理存储库的 {% data variables.product.prodname_actions %} 设置](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#managing-github-actions-permissions-for-your-repository)”、“[为组织禁用或限制 {% data variables.product.prodname_actions %}](/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization#managing-github-actions-permissions-for-your-organization)”和“[在企业中强制实施 {% data variables.product.prodname_actions %}](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#enforcing-a-policy-to-restrict-the-use-of-github-actions-in-your-enterprise)”。
|
||||
Then,{% else %}First,{% endif %} decide whether you'll allow third-party actions {% ifversion actions-workflow-policy %}and reusable workflows{% endif %} that were not created by {% data variables.product.company_short %}. You can configure the actions {% ifversion actions-workflow-policy %}and reusable workflows{% endif %} that are allowed to run at the repository, organization, and enterprise levels and can choose to only allow actions that are created by {% data variables.product.company_short %}. If you do allow third-party actions{% ifversion actions-workflow-policy %} and reusable workflows{% endif %}, you can limit allowed actions to those created by verified creators or a list of specific actions{% ifversion actions-workflow-policy %} and reusable workflows{% endif %}. For more information, see "[Managing {% data variables.product.prodname_actions %} settings for a repository](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#managing-github-actions-permissions-for-your-repository)", "[Disabling or limiting {% data variables.product.prodname_actions %} for your organization](/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization#managing-github-actions-permissions-for-your-organization)", and "[Enforcing policies for {% data variables.product.prodname_actions %} in your enterprise](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#enforcing-a-policy-to-restrict-the-use-of-github-actions-in-your-enterprise)."
|
||||
|
||||
{% ifversion actions-workflow-policy %}  {%- else %}  {%- endif %}
|
||||
{% ifversion actions-workflow-policy %}
|
||||

|
||||
{%- else %}
|
||||

|
||||
{%- endif %}
|
||||
|
||||
{% ifversion ghec or ghae-issue-4757 %} 考虑将 OpenID Connect (OIDC) 与可重用的工作流相结合,以在存储库、组织或企业中实施一致的部署。 为此,可以基于可重用工作流程在云角色上定义信任条件。 有关详细信息,请参阅“[将 OpenID Connect 与可重用工作流结合使用](/actions/deployment/security-hardening-your-deployments/using-openid-connect-with-reusable-workflows)”。
|
||||
{% ifversion ghec or ghes > 3.4 %}
|
||||
Consider combining OpenID Connect (OIDC) with reusable workflows to enforce consistent deployments across your repository, organization, or enterprise. You can do this by defining trust conditions on cloud roles based on reusable workflows. For more information, see "[Using OpenID Connect with reusable workflows](/actions/deployment/security-hardening-your-deployments/using-openid-connect-with-reusable-workflows)."
|
||||
{% endif %}
|
||||
|
||||
您可以在企业的审核日志中访问与 {% data variables.product.prodname_actions %} 相关的活动信息。 如果业务需要保留此信息的时间超过保留审核日志数据的时间,请规划如何导出此数据并存储在 {% data variables.product.prodname_dotcom %} 之外。 有关详细信息,请参阅{% ifversion ghec %}“[为企业导出审核日志活动](/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/exporting-audit-log-activity-for-your-enterprise)”和“[为企业流式传输审核日志](/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/streaming-the-audit-log-for-your-enterprise)”。{% else %}{% ifversion audit-log-streaming %}“[为企业流式传输审核日志](/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/streaming-the-audit-log-for-your-enterprise)”和{% endif %}“[日志转发](/admin/monitoring-activity-in-your-enterprise/exploring-user-activity/log-forwarding)”。{% endif %}
|
||||
You can access information about activity related to {% data variables.product.prodname_actions %} in the audit logs for your enterprise. If your business needs require retaining this information longer than audit log data is retained, plan how you'll export and store this data outside of {% data variables.product.prodname_dotcom %}. For more information, see {% ifversion ghec %}"[Exporting audit log activity for your enterprise](/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/exporting-audit-log-activity-for-your-enterprise)" and "[Streaming the audit log for your enterprise](/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/streaming-the-audit-log-for-your-enterprise)."{% else %}{% ifversion audit-log-streaming %}"[Streaming the audit log for your enterprise](/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/streaming-the-audit-log-for-your-enterprise)" and {% endif %}"[Log forwarding](/admin/monitoring-activity-in-your-enterprise/exploring-user-activity/log-forwarding)."{% endif %}
|
||||
|
||||

|
||||

|
||||
|
||||
## 安全性
|
||||
## Security
|
||||
|
||||
您应该规划 {% data variables.product.prodname_actions %} 的安全强化方法。
|
||||
You should plan your approach to security hardening for {% data variables.product.prodname_actions %}.
|
||||
|
||||
### 加强单个工作流程和存储库的安全性
|
||||
### Security hardening individual workflows and repositories
|
||||
|
||||
制定计划,为在企业中使用 {% data variables.product.prodname_actions %} 功能的用户强制实施良好的安全实践。 有关这些做法的详细信息,请参阅“[{% data variables.product.prodname_actions %} 的安全强化](/actions/security-guides/security-hardening-for-github-actions)”。
|
||||
Make a plan to enforce good security practices for people using {% data variables.product.prodname_actions %} features within your enterprise. For more information about these practices, see "[Security hardening for {% data variables.product.prodname_actions %}](/actions/security-guides/security-hardening-for-github-actions)."
|
||||
|
||||
您还可以鼓励重用已评估过安全性的工作流程。 有关详细信息,请参阅“[内包](#innersourcing)”。
|
||||
You can also encourage reuse of workflows that have already been evaluated for security. For more information, see "[Innersourcing](#innersourcing)."
|
||||
|
||||
### 保护对机密和部署资源的访问
|
||||
### Securing access to secrets and deployment resources
|
||||
|
||||
您应该计划将要存储机密的位置。 我们建议将机密存储在 {% data variables.product.prodname_dotcom %} 中,但您可以选择将机密存储在云提供商中。
|
||||
You should plan where you'll store your secrets. We recommend storing secrets in {% data variables.product.prodname_dotcom %}, but you might choose to store secrets in a cloud provider.
|
||||
|
||||
在 {% data variables.product.prodname_dotcom %} 中,您可以在存储库或组织级别存储机密。 存储库级别的机密可限于某些环境中的工作流程,例如生产或测试。 有关详细信息,请参阅“[加密机密](/actions/security-guides/encrypted-secrets)”。
|
||||
In {% data variables.product.prodname_dotcom %}, you can store secrets at the repository or organization level. Secrets at the repository level can be limited to workflows in certain environments, such as production or testing. For more information, see "[Encrypted secrets](/actions/security-guides/encrypted-secrets)."
|
||||
|
||||
 你应该考虑为敏感环境添加手动批准保护,以便必须先批准工作流,然后才能访问环境的机密。 有关详细信息,请参阅“[使用环境进行部署](/actions/deployment/targeting-different-environments/using-environments-for-deployment)”。
|
||||

|
||||
You should consider adding manual approval protection for sensitive environments, so that workflows must be approved before getting access to the environments' secrets. For more information, see "[Using environments for deployments](/actions/deployment/targeting-different-environments/using-environments-for-deployment)."
|
||||
|
||||
### 第三方操作的安全注意事项
|
||||
### Security considerations for third-party actions
|
||||
|
||||
从 {% data variables.product.prodname_dotcom %} 上的第三方存储库获取操作存在重大风险。 如果允许任何第三方操作,则应创建内部准则,鼓励团队遵循最佳做法,例如将操作固定到完整提交 SHA。 有关详细信息,请参阅“[使用第三方操作](/actions/security-guides/security-hardening-for-github-actions#using-third-party-actions)”。
|
||||
There is significant risk in sourcing actions from third-party repositories on {% data variables.product.prodname_dotcom %}. If you do allow any third-party actions, you should create internal guidelines that encourage your team to follow best practices, such as pinning actions to the full commit SHA. For more information, see "[Using third-party actions](/actions/security-guides/security-hardening-for-github-actions#using-third-party-actions)."
|
||||
|
||||
## 内包
|
||||
## Innersourcing
|
||||
|
||||
想一想您的企业如何使用 {% data variables.product.prodname_actions %} 的功能来实现内包自动化。 内包是一种将开源方法的优势融入内部软件开发周期的方法。 有关详细信息,请参阅 {% data variables.product.company_short %} 资源中的[内部资源简介](https://resources.github.com/whitepapers/introduction-to-innersource/)。
|
||||
Think about how your enterprise can use features of {% data variables.product.prodname_actions %} to innersource automation. Innersourcing is a way to incorporate the benefits of open source methodologies into your internal software development cycle. For more information, see [An introduction to innersource](https://resources.github.com/whitepapers/introduction-to-innersource/) in {% data variables.product.company_short %} Resources.
|
||||
|
||||
{% data reusables.actions.internal-actions-summary %}
|
||||
|
||||
{% ifversion ghec or ghes > 3.3 or ghae-issue-4757 %} {% data reusables.actions.reusable-workflows-ghes-beta %} 使用可重用工作流,团队可以从一个工作流调用另一个工作流,避免重复。 可重用的工作流程通过帮助团队使用设计良好且经过测试的工作流程来促进最佳实践。 有关详细信息,请参阅“[重用工作流](/actions/learn-github-actions/reusing-workflows)”。
|
||||
{% ifversion ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
{% data reusables.actions.reusable-workflows-ghes-beta %}
|
||||
With reusable workflows, your team can call one workflow from another workflow, avoiding exact duplication. Reusable workflows promote best practice by helping your team use workflows that are well designed and have already been tested. For more information, see "[Reusing workflows](/actions/learn-github-actions/reusing-workflows)."
|
||||
{% endif %}
|
||||
|
||||
要为开发人员构建新工作流程提供起点,可以使用入门工作流程。 这不仅为开发人员节省了时间,而且促进了整个企业的一致性和最佳实践。 有关详细信息,请参阅“[为组织创建入门工作流](/actions/learn-github-actions/creating-starter-workflows-for-your-organization)”。
|
||||
To provide a starting place for developers building new workflows, you can use starter workflows. This not only saves time for your developers, but promotes consistency and best practice across your enterprise. For more information, see "[Creating starter workflows for your organization](/actions/learn-github-actions/creating-starter-workflows-for-your-organization)."
|
||||
|
||||
{% ifversion not internal-actions %} 每当工作流开发人员想要使用存储在私有存储库中的操作时,他们必须将工作流配置为先克隆存储库。 要减少必须克隆的存储库的数量,请考虑将常用操作分组到单个存储库中。 有关详细信息,请参阅“[关于自定义操作](/actions/creating-actions/about-custom-actions#choosing-a-location-for-your-action)”。
|
||||
{% ifversion not internal-actions %}
|
||||
Whenever your workflow developers want to use an action that's stored in a private repository, they must configure the workflow to clone the repository first. To reduce the number of repositories that must be cloned, consider grouping commonly used actions in a single repository. For more information, see "[About custom actions](/actions/creating-actions/about-custom-actions#choosing-a-location-for-your-action)."
|
||||
{% endif %}
|
||||
|
||||
## 管理资源
|
||||
## Managing resources
|
||||
|
||||
您应规划如何管理使用 {% data variables.product.prodname_actions %} 所需的资源。
|
||||
You should plan for how you'll manage the resources required to use {% data variables.product.prodname_actions %}.
|
||||
|
||||
{% ifversion ghes %}
|
||||
### 硬件要求
|
||||
### Hardware requirements
|
||||
|
||||
您可能需要升级 CPU 和内存资源,以便 {% 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-your-enterprise/getting-started-with-github-actions-for-github-enterprise-server#review-hardware-requirements)”。
|
||||
You may need to upgrade the CPU and memory resources for {% data variables.product.product_location %} to handle the load from {% data variables.product.prodname_actions %} without causing performance loss. 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-your-enterprise/getting-started-with-github-actions-for-github-enterprise-server#review-hardware-requirements)."
|
||||
{% endif %}
|
||||
|
||||
### 运行程序
|
||||
### Runners
|
||||
|
||||
{% data variables.product.prodname_actions %} 工作流程需要运行器。{% ifversion ghec %} 您可以选择使用 {% data variables.product.prodname_dotcom %} 托管的运行器或自托管的运行器。 {% data variables.product.prodname_dotcom %} 托管的运行器很方便,因为它们由 {% data variables.product.company_short %} 管理,后者为您处理维护和升级。 但是,如果需要运行将访问防火墙后面的资源的工作流程,或者希望更好地控制运行器计算机的资源、配置或地理位置,则可能需要考虑自托管运行器。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_dotcom %} 托管的运行器](/actions/using-github-hosted-runners/about-github-hosted-runners)”和“[关于自托管运行器](/actions/hosting-your-own-runners/about-self-hosted-runners)”。{% else %}需要在自己的计算机上安装 {% data variables.product.prodname_actions %} 自托管运行器应用程序来托管自己的运行器。 有关详细信息,请参阅“[关于子托管运行器](/actions/hosting-your-own-runners/about-self-hosted-runners)”。{% endif %}
|
||||
{% data variables.product.prodname_actions %} workflows require runners.{% ifversion ghec %} You can choose to use {% data variables.product.prodname_dotcom %}-hosted runners or self-hosted runners. {% data variables.product.prodname_dotcom %}-hosted runners are convenient because they are managed by {% data variables.product.company_short %}, who handles maintenance and upgrades for you. However, you may want to consider self-hosted runners if you need to run a workflow that will access resources behind your firewall or you want more control over the resources, configuration, or geographic location of your runner machines. For more information, see "[About {% data variables.product.prodname_dotcom %}-hosted runners](/actions/using-github-hosted-runners/about-github-hosted-runners)" and "[About self-hosted runners](/actions/hosting-your-own-runners/about-self-hosted-runners)."{% else %} You will need to host your own runners by installing the {% data variables.product.prodname_actions %} self-hosted runner application on your own machines. For more information, see "[About self-hosted runners](/actions/hosting-your-own-runners/about-self-hosted-runners)."{% endif %}
|
||||
|
||||
{% ifversion ghec %}如果您使用的是自托管运行器,则必须决定是要使用物理机、虚拟机还是容器。{% else %}决定是要将物理机、虚拟机还是容器用于自托管运行器。{% endif %} 物理机将保留以前作业的残余部分,虚拟机也会保留,除非您为每个作业使用新映像或在每次作业运行后清理计算机。 如果选择容器,则应注意,运行器自动更新将关闭容器,这可能会导致工作流程失败。 您应该通过阻止自动更新或跳过命令来终止容器来为此提出解决方案。
|
||||
{% ifversion ghec %}If you are using self-hosted runners, you have to decide whether you want to use physical machines, virtual machines, or containers.{% else %}Decide whether you want to use physical machines, virtual machines, or containers for your self-hosted runners.{% endif %} Physical machines will retain remnants of previous jobs, and so will virtual machines unless you use a fresh image for each job or clean up the machines after each job run. If you choose containers, you should be aware that the runner auto-updating will shut down the container, which can cause workflows to fail. You should come up with a solution for this by preventing auto-updates or skipping the command to kill the container.
|
||||
|
||||
您还必须决定在何处添加每个运行器。 您可以将自托管运行器添加到单个存储库,也可以使运行器可供整个组织或整个企业使用。 在组织或企业级别添加运行器允许共享运行器,这可能会减小运行器基础结构的大小。 您可以使用策略,通过将运行者组分配给特定存储库或组织,在组织和企业级别限制对自托管运行器的访问。 有关详细信息,请参阅“[添加自托管运行器](/actions/hosting-your-own-runners/adding-self-hosted-runners)”和“[使用组管理对自托管运行器的访问权限](/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups)”。
|
||||
You also have to decide where to add each runner. You can add a self-hosted runner to an individual repository, or you can make the runner available to an entire organization or your entire enterprise. Adding runners at the organization or enterprise levels allows sharing of runners, which might reduce the size of your runner infrastructure. You can use policies to limit access to self-hosted runners at the organization and enterprise levels by assigning groups of runners to specific repositories or organizations. For more information, see "[Adding self-hosted runners](/actions/hosting-your-own-runners/adding-self-hosted-runners)" and "[Managing access to self-hosted runners using groups](/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups)."
|
||||
|
||||
{% ifversion ghec or ghes > 3.2 %} 应考虑使用自动缩放来自动增加或减少可用的自托管运行器的数量。 有关详细信息,请参阅“[使用自托管运行器进行自动缩放](/actions/hosting-your-own-runners/autoscaling-with-self-hosted-runners)”。
|
||||
{% ifversion ghec or ghes > 3.2 %}
|
||||
You should consider using autoscaling to automatically increase or decrease the number of available self-hosted runners. For more information, see "[Autoscaling with self-hosted runners](/actions/hosting-your-own-runners/autoscaling-with-self-hosted-runners)."
|
||||
{% endif %}
|
||||
|
||||
最后,您应该考虑对自托管运行器进行安全强化。 有关详细信息,请参阅“[{% data variables.product.prodname_actions %} 的安全强化](/actions/security-guides/security-hardening-for-github-actions#hardening-for-self-hosted-runners)”。
|
||||
Finally, you should consider security hardening for self-hosted runners. For more information, see "[Security hardening for {% data variables.product.prodname_actions %}](/actions/security-guides/security-hardening-for-github-actions#hardening-for-self-hosted-runners)."
|
||||
|
||||
### 存储
|
||||
### Storage
|
||||
|
||||
{% data reusables.actions.about-artifacts %} 有关详细信息,请参阅“[将工作流数据存储为工件](/actions/advanced-guides/storing-workflow-data-as-artifacts)”。
|
||||
{% data reusables.actions.about-artifacts %} For more information, see "[Storing workflow data as artifacts](/actions/advanced-guides/storing-workflow-data-as-artifacts)."
|
||||
|
||||
{% ifversion actions-caching %}{% data variables.product.prodname_actions %} 还有一个缓存系统,可用于缓存依赖项来加快工作流运行速度。 有关详细信息,请参阅“[缓存依赖项以加快工作流](/actions/using-workflows/caching-dependencies-to-speed-up-workflows)”。{% endif %}
|
||||
{% ifversion actions-caching %}{% data variables.product.prodname_actions %} also has a caching system that you can use to cache dependencies to speed up workflow runs. For more information, see "[Caching dependencies to speed up workflows](/actions/using-workflows/caching-dependencies-to-speed-up-workflows)."{% endif %}
|
||||
|
||||
{% ifversion ghes %} 必须为工作流项目{% ifversion actions-caching %}、缓存、{% endif %} 和其他工作流日志配置外部 Blob 存储。 确定您的企业将使用哪个受支持的存储提供商。 有关详细信息,请参阅“[{% data variables.product.product_name %} 的 {% data variables.product.prodname_actions %} 入门](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-enterprise-server#external-storage-requirements)”。
|
||||
{% ifversion ghes %}
|
||||
You must configure external blob storage for workflow artifacts{% ifversion actions-caching %}, caches,{% endif %} and other workflow logs. Decide which supported storage provider your enterprise will use. For more information, see "[Getting started with {% data variables.product.prodname_actions %} for {% data variables.product.product_name %}](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-enterprise-server#external-storage-requirements)."
|
||||
{% endif %}
|
||||
|
||||
{% ifversion ghec or ghes %}
|
||||
|
||||
可以使用 {% data variables.product.prodname_actions %} 的策略设置来自定义工作流工件的存储{% ifversion actions-caching %}、缓存、{% endif %} 和日志保留。 有关详细信息,请参阅“[在企业中强制实施 {% data variables.product.prodname_actions %} 的策略](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise)”。
|
||||
You can use policy settings for {% data variables.product.prodname_actions %} to customize the storage of workflow artifacts{% ifversion actions-caching %}, caches,{% endif %} and log retention. For more information, see "[Enforcing policies for {% data variables.product.prodname_actions %} in your enterprise](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise)."
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% ifversion ghec %} 某些存储包含在订阅中,但额外的存储将影响计费。 您应该为此费用做好计划。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_actions %} 的计费](/billing/managing-billing-for-github-actions/about-billing-for-github-actions)”。
|
||||
{% ifversion ghec %}
|
||||
Some storage is included in your subscription, but additional storage will affect your bill. You should plan for this cost. For more information, see "[About billing for {% data variables.product.prodname_actions %}](/billing/managing-billing-for-github-actions/about-billing-for-github-actions)."
|
||||
{% endif %}
|
||||
|
||||
## 跟踪用法
|
||||
## Tracking usage
|
||||
|
||||
您应考虑制定计划来跟踪企业对 {% data variables.product.prodname_actions %} 的使用,例如工作流程的运行频率、这些运行中有多少次通过和失败,以及哪些存储库正在使用哪些工作流程。
|
||||
You should consider making a plan to track your enterprise's usage of {% data variables.product.prodname_actions %}, such as how often workflows are running, how many of those runs are passing and failing, and which repositories are using which workflows.
|
||||
|
||||
{% ifversion ghec %} 可以通过计费设置查看企业中每个组织的 {% data variables.product.prodname_actions %} 的存储和数据传输使用情况的基本详细信息。 有关详细信息,请参阅“[查看 {% data variables.product.prodname_actions %} 使用情况](/billing/managing-billing-for-github-actions/viewing-your-github-actions-usage#viewing-github-actions-usage-for-your-enterprise-account)”。
|
||||
{% ifversion ghec %}
|
||||
You can see basic details of storage and data transfer usage of {% data variables.product.prodname_actions %} for each organization in your enterprise via your billing settings. For more information, see "[Viewing your {% data variables.product.prodname_actions %} usage](/billing/managing-billing-for-github-actions/viewing-your-github-actions-usage#viewing-github-actions-usage-for-your-enterprise-account)."
|
||||
|
||||
有关更详细的使用数据,{% else %}您{% endif %} 可以使用 web 挂钩订阅有关工作流程作业和工作流程运行的信息。 有关详细信息,请参阅“[关于 Webhook](/developers/webhooks-and-events/webhooks/about-webhooks)”。
|
||||
For more detailed usage data, you{% else %}You{% endif %} can use webhooks to subscribe to information about workflow jobs and workflow runs. For more information, see "[About webhooks](/developers/webhooks-and-events/webhooks/about-webhooks)."
|
||||
|
||||
制定一个计划,说明您的企业如何将信息从这些 web 挂钩传递到数据归档系统中。 您可以考虑使用开源工具“CEDAR.GitHub.Collector”来收集和处理来自 {% data variables.product.prodname_dotcom %} 的 web 挂钩数据。 有关详细信息,请参阅[`Microsoft/CEDAR.GitHub.Collector`存储库](https://github.com/microsoft/CEDAR.GitHub.Collector/)。
|
||||
Make a plan for how your enterprise can pass the information from these webhooks into a data archiving system. You can consider using "CEDAR.GitHub.Collector", an open source tool that collects and processes webhook data from {% data variables.product.prodname_dotcom %}. For more information, see the [`Microsoft/CEDAR.GitHub.Collector` repository](https://github.com/microsoft/CEDAR.GitHub.Collector/).
|
||||
|
||||
您还应该规划如何让您的团队从存档系统获取所需的数据。
|
||||
You should also plan how you'll enable your teams to get the data they need from your archiving system.
|
||||
|
||||
@@ -171,7 +171,7 @@ Deleting a CA cannot be undone. If you want to use the same CA in the future, yo
|
||||
{% data reusables.enterprise-accounts.security-tab %}
|
||||
{% data reusables.organizations.delete-ssh-ca %}
|
||||
|
||||
{% ifversion ghec or ghae-issue-7803 %}
|
||||
{% ifversion ghec %}
|
||||
|
||||
## Managing SSO for unauthenticated users
|
||||
|
||||
|
||||
@@ -311,7 +311,18 @@ Anonymous Git read access is disabled by default.{% ifversion ghes = 3.4 or ghes
|
||||
The unauthenticated git protocol on port 9418 is no longer supported.
|
||||
```
|
||||
|
||||
If you wish to support the unathenticated Git protocol in your environment, you must manually re-enable the feature. {% data variables.product.company_short %} recommends using SSH instead of the Git protocol. For more information, see [{% data variables.product.prodname_blog %}](https://github.blog/2022-06-28-improving-git-protocol-security-on-github-enterprise-server).
|
||||
{% ifversion ghes > 3.5 %}
|
||||
|
||||
If you wish to support the unathenticated Git protocol in your environment, you must manually re-enable the feature. Run the following commands after your upgrade:
|
||||
|
||||
```ShellSession
|
||||
$ sudo ghe-config app.gitauth.git-protocol true
|
||||
$ sudo ghe-config-apply
|
||||
```
|
||||
|
||||
{% endif %}
|
||||
|
||||
Anonymous Git read access will be entirely removed in a future release of {% data variables.product.prodname_ghe_server %}. {% data variables.product.company_short %} recommends using SSH instead of the Git protocol. For more information about this change, see [{% data variables.product.prodname_blog %}](https://github.blog/2022-06-28-improving-git-protocol-security-on-github-enterprise-server).
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 审查您的部署密钥
|
||||
intro: 您应审查部署密钥,以确保没有任何未经授权(或可能已受损)的密钥。 您还可以批准有效的现有部署密钥。
|
||||
title: Reviewing your deploy keys
|
||||
intro: You should review deploy keys to ensure that there aren't any unauthorized (or possibly compromised) keys. You can also approve existing deploy keys that are valid.
|
||||
redirect_from:
|
||||
- /articles/reviewing-your-deploy-keys
|
||||
- /github/authenticating-to-github/reviewing-your-deploy-keys
|
||||
@@ -14,22 +14,19 @@ topics:
|
||||
- Identity
|
||||
- Access management
|
||||
shortTitle: Deploy keys
|
||||
ms.openlocfilehash: 964ec4cbc91745c041dd973e4e950b605c5c0233
|
||||
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/10/2022
|
||||
ms.locfileid: '145084641'
|
||||
---
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5658 %}
|
||||
3. 在边栏的“安全性”部分中,单击“{% octicon "key" aria-label="The key icon" %} 部署密钥”。
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
3. In the "Security" section of the sidebar, click **{% octicon "key" aria-label="The key icon" %} Deploy keys**.
|
||||
{% else %}
|
||||
3. 在左边栏中,单击“部署密钥”。
|
||||
 {% endif %}
|
||||
4. 在 Deploy keys(部署密钥)页面中,记下与您的帐户关联的部署密钥。 对于无法识别或已过期的密钥,请单击“删除”。 如果有要保留的有效部署密钥,请单击“批准”。
|
||||

|
||||
3. In the left sidebar, click **Deploy keys**.
|
||||

|
||||
{% endif %}
|
||||
4. On the Deploy keys page, take note of the deploy keys associated with your account. For those that you don't recognize, or that are out-of-date, click **Delete**. If there are valid deploy keys you'd like to keep, click **Approve**.
|
||||

|
||||
|
||||
有关详细信息,请参阅“[管理部署密钥](/guides/managing-deploy-keys)”。
|
||||
For more information, see "[Managing deploy keys](/guides/managing-deploy-keys)."
|
||||
|
||||
## 延伸阅读
|
||||
- [配置通知](/account-and-profile/managing-subscriptions-and-notifications-on-github/setting-up-notifications/configuring-notifications#organization-alerts-notification-options)
|
||||
## Further reading
|
||||
- [Configuring notifications](/account-and-profile/managing-subscriptions-and-notifications-on-github/setting-up-notifications/configuring-notifications#organization-alerts-notification-options)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 审查您的安全日志
|
||||
intro: 你可以查看个人帐户的安全日志,以更好地了解你执行的操作以及其他人执行的与你有关的操作。
|
||||
title: Reviewing your security log
|
||||
intro: You can review the security log for your personal account to better understand actions you've performed and actions others have performed that involve you.
|
||||
miniTocMaxHeadingLevel: 3
|
||||
redirect_from:
|
||||
- /articles/reviewing-your-security-log
|
||||
@@ -15,239 +15,245 @@ topics:
|
||||
- Identity
|
||||
- Access management
|
||||
shortTitle: Security log
|
||||
ms.openlocfilehash: 11ace590e926548a8dd04975880b1220cad4a3da
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147110552'
|
||||
---
|
||||
## 访问安全日志
|
||||
## Accessing your security log
|
||||
|
||||
安全日志列出了过去 90 天内执行的所有操作。
|
||||
The security log lists all actions performed within the last 90 days.
|
||||
|
||||
{% data reusables.user-settings.access_settings %} {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5658 %}
|
||||
1. 在边栏的“存档”部分中,单击“{% octicon "log" aria-label="The log icon" %} 安全日志”。
|
||||
{% data reusables.user-settings.access_settings %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
1. In the "Archives" section of the sidebar, click **{% octicon "log" aria-label="The log icon" %} Security log**.
|
||||
{% else %}
|
||||
1. 在“用户设置”边栏中,单击“安全日志”。
|
||||
 {% endif %}
|
||||
1. In the user settings sidebar, click **Security log**.
|
||||

|
||||
{% endif %}
|
||||
|
||||
## 搜索安全日志
|
||||
## Searching your security log
|
||||
|
||||
{% data reusables.audit_log.audit-log-search %}
|
||||
|
||||
### 基于执行的操作搜索
|
||||
### Search based on the action performed
|
||||
|
||||
安全日志中列出的事件由您的操作触发。 操作分为以下几类:
|
||||
The events listed in your security log are triggered by your actions. Actions are grouped into the following categories:
|
||||
|
||||
| 类别名称 | 说明 |------------------|-------------------{% ifversion fpt or ghec %} | [`billing`](#billing-category-actions) | 包含与你的账单信息相关的所有活动。
|
||||
| [`codespaces`](#codespaces-category-actions) | 包含与 {% data variables.product.prodname_github_codespaces %} 相关的所有活动。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_codespaces %}](/github/developing-online-with-codespaces/about-codespaces)”。
|
||||
| [`marketplace_agreement_signature`](#marketplace_agreement_signature-category-actions) | 包含与签署 {% data variables.product.prodname_marketplace %} 开发者协议相关的所有活动。
|
||||
| [`marketplace_listing`](#marketplace_listing-category-actions) | 包含与在 {% data variables.product.prodname_marketplace %} 中推广应用相关的所有活动。{% endif %} | [`oauth_access`](#oauth_access-category-actions) | 包含与已连接的 [{% data variables.product.prodname_oauth_apps %}](/github/authenticating-to-github/keeping-your-account-and-data-secure/authorizing-oauth-apps) 相关的所有活动。{% ifversion fpt or ghec %} | [`payment_method`](#payment_method-category-actions) | 包括与支付 {% data variables.product.prodname_dotcom %} 订阅相关的所有活动。{% endif %} | [`profile_picture`](#profile_picture-category-actions) | 包含与个人资料图片相关的所有活动。
|
||||
| [`project`](#project-category-actions) | 包含与项目板相关的所有活动。
|
||||
| [`public_key`](#public_key-category-actions) | 包含与[公共 SSH 密钥](/articles/adding-a-new-ssh-key-to-your-github-account)相关的所有活动。
|
||||
| [`repo`](#repo-category-actions) | 包含与你拥有的存储库相关的所有活动。{% ifversion fpt or ghec %} | [`sponsors`](#sponsors-category-actions) | 包含与 {% data variables.product.prodname_sponsors %} 和发起人按钮相关的所有事件(请参阅“[关于 {% data variables.product.prodname_sponsors %}](/sponsors/getting-started-with-github-sponsors/about-github-sponsors)”和“[在存储库中显示发起人按钮](/articles/displaying-a-sponsor-button-in-your-repository)”){% endif %}{% ifversion ghes or ghae %} | [`team`](#team-category-actions) | 包含与你所属的团队相关的所有活动。{% endif %}{% ifversion not ghae %} | [`two_factor_authentication`](#two_factor_authentication-category-actions) | 包含与[双重身份验证](/articles/securing-your-account-with-two-factor-authentication-2fa)相关的所有活动。{% endif %} | [`user`](#user-category-actions) | 包含与帐户相关的所有活动。
|
||||
| Category name | Description
|
||||
|------------------|-------------------{% ifversion fpt or ghec %}
|
||||
| [`billing`](#billing-category-actions) | Contains all activities related to your billing information.
|
||||
| [`codespaces`](#codespaces-category-actions) | Contains all activities related to {% data variables.product.prodname_github_codespaces %}. For more information, see "[About {% data variables.product.prodname_codespaces %}](/github/developing-online-with-codespaces/about-codespaces)."
|
||||
| [`marketplace_agreement_signature`](#marketplace_agreement_signature-category-actions) | Contains all activities related to signing the {% data variables.product.prodname_marketplace %} Developer Agreement.
|
||||
| [`marketplace_listing`](#marketplace_listing-category-actions) | Contains all activities related to listing apps in {% data variables.product.prodname_marketplace %}.{% endif %}
|
||||
| [`oauth_access`](#oauth_access-category-actions) | Contains all activities related to [{% data variables.product.prodname_oauth_apps %}](/github/authenticating-to-github/keeping-your-account-and-data-secure/authorizing-oauth-apps) you've connected with.{% ifversion fpt or ghec %}
|
||||
| [`payment_method`](#payment_method-category-actions) | Contains all activities related to paying for your {% data variables.product.prodname_dotcom %} subscription.{% endif %}
|
||||
| [`profile_picture`](#profile_picture-category-actions) | Contains all activities related to your profile picture.
|
||||
| [`project`](#project-category-actions) | Contains all activities related to project boards.
|
||||
| [`public_key`](#public_key-category-actions) | Contains all activities related to [your public SSH keys](/articles/adding-a-new-ssh-key-to-your-github-account).
|
||||
| [`repo`](#repo-category-actions) | Contains all activities related to the repositories you own.{% ifversion fpt or ghec %}
|
||||
| [`sponsors`](#sponsors-category-actions) | Contains all events related to {% data variables.product.prodname_sponsors %} and sponsor buttons (see "[About {% data variables.product.prodname_sponsors %}](/sponsors/getting-started-with-github-sponsors/about-github-sponsors)" and "[Displaying a sponsor button in your repository](/articles/displaying-a-sponsor-button-in-your-repository)"){% endif %}{% ifversion ghes or ghae %}
|
||||
| [`team`](#team-category-actions) | Contains all activities related to teams you are a part of.{% endif %}{% ifversion not ghae %}
|
||||
| [`two_factor_authentication`](#two_factor_authentication-category-actions) | Contains all activities related to [two-factor authentication](/articles/securing-your-account-with-two-factor-authentication-2fa).{% endif %}
|
||||
| [`user`](#user-category-actions) | Contains all activities related to your account.
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
|
||||
## 导出安全日志
|
||||
## Exporting your security log
|
||||
|
||||
{% data reusables.audit_log.export-log %} {% data reusables.audit_log.exported-log-keys-and-values %}
|
||||
{% data reusables.audit_log.export-log %}
|
||||
{% data reusables.audit_log.exported-log-keys-and-values %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
## 安全日志操作
|
||||
## Security log actions
|
||||
|
||||
安全日志中记录为事件的一些最常见操作的概述。
|
||||
An overview of some of the most common actions that are recorded as events in the security log.
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
|
||||
### `billing` 类别操作
|
||||
### `billing` category actions
|
||||
|
||||
| 操作 | 说明
|
||||
| Action | Description
|
||||
|------------------|-------------------
|
||||
| `change_billing_type` | [更改 {% data variables.product.prodname_dotcom %} 的支付方式](/articles/adding-or-editing-a-payment-method)时触发。
|
||||
| `change_email` | [更改电子邮件地址](/articles/changing-your-primary-email-address)时触发。
|
||||
| `change_billing_type` | Triggered when you [change how you pay](/articles/adding-or-editing-a-payment-method) for {% data variables.product.prodname_dotcom %}.
|
||||
| `change_email` | Triggered when you [change your email address](/articles/changing-your-primary-email-address).
|
||||
|
||||
### `codespaces` 类别操作
|
||||
### `codespaces` category actions
|
||||
|
||||
| 操作 | 说明
|
||||
| Action | Description
|
||||
|------------------|-------------------
|
||||
| `create` | [创建 codespace](/github/developing-online-with-codespaces/creating-a-codespace) 时触发。
|
||||
| `resume` | 恢复暂停的代码空间时触发。
|
||||
| `delete` | [删除 codespace](/github/developing-online-with-codespaces/deleting-a-codespace) 时触发。
|
||||
| `manage_access_and_security` | 更新 [codespace 有权访问的存储库](/github/developing-online-with-codespaces/managing-access-and-security-for-codespaces)时触发。
|
||||
| `trusted_repositories_access_update` | [为 {% data variables.product.prodname_codespaces %} 更改个人帐户的访问权限和安全设置](/github/developing-online-with-codespaces/managing-access-and-security-for-codespaces)时触发。
|
||||
| `create` | Triggered when you [create a codespace](/github/developing-online-with-codespaces/creating-a-codespace).
|
||||
| `resume` | Triggered when you resume a suspended codespace.
|
||||
| `delete` | Triggered when you [delete a codespace](/github/developing-online-with-codespaces/deleting-a-codespace).
|
||||
| `manage_access_and_security` | Triggered when you update [the repositories a codespace has access to](/github/developing-online-with-codespaces/managing-access-and-security-for-codespaces).
|
||||
| `trusted_repositories_access_update` | Triggered when you change your personal account's [access and security setting for {% data variables.product.prodname_codespaces %}](/github/developing-online-with-codespaces/managing-access-and-security-for-codespaces).
|
||||
|
||||
### `marketplace_agreement_signature` 类别操作
|
||||
### `marketplace_agreement_signature` category actions
|
||||
|
||||
| 操作 | 说明
|
||||
| Action | Description
|
||||
|------------------|-------------------
|
||||
| `create` | 在签署 {% data variables.product.prodname_marketplace %} 开发者协议时触发。
|
||||
| `create` | Triggered when you sign the {% data variables.product.prodname_marketplace %} Developer Agreement.
|
||||
|
||||
### `marketplace_listing` 类别操作
|
||||
### `marketplace_listing` category actions
|
||||
|
||||
| 操作 | 说明
|
||||
| Action | Description
|
||||
|------------------|-------------------
|
||||
| `approve` | 当您的列表被批准包含在 {% data variables.product.prodname_marketplace %} 中时触发。
|
||||
| `create` | 当您在 {% data variables.product.prodname_marketplace %} 中为应用程序创建列表时触发。
|
||||
| `delist` | 当您的列表从 {% data variables.product.prodname_marketplace %} 中被删除时触发。
|
||||
| `redraft` | 将您的列表被返回到草稿状态时触发。
|
||||
| `reject` | 当您的列表被拒绝包含在 {% data variables.product.prodname_marketplace %} 中时触发。
|
||||
| `approve` | Triggered when your listing is approved for inclusion in {% data variables.product.prodname_marketplace %}.
|
||||
| `create` | Triggered when you create a listing for your app in {% data variables.product.prodname_marketplace %}.
|
||||
| `delist` | Triggered when your listing is removed from {% data variables.product.prodname_marketplace %}.
|
||||
| `redraft` | Triggered when your listing is sent back to draft state.
|
||||
| `reject` | Triggered when your listing is not accepted for inclusion in {% data variables.product.prodname_marketplace %}.
|
||||
|
||||
{% endif %}
|
||||
|
||||
### `oauth_authorization` 类别操作
|
||||
### `oauth_authorization` category actions
|
||||
|
||||
| 操作 | 说明
|
||||
| Action | Description
|
||||
|------------------|-------------------
|
||||
| `create` | [授予对 {% data variables.product.prodname_oauth_app %} 的访问权限](/github/authenticating-to-github/keeping-your-account-and-data-secure/authorizing-oauth-apps)时触发。
|
||||
| `destroy` | [撤销 {% data variables.product.prodname_oauth_app %} 对帐户的访问权限](/articles/reviewing-your-authorized-integrations){% ifversion fpt or ghae or ghes > 3.2 or ghec %} 以及[授权被撤销或过期](/github/authenticating-to-github/keeping-your-account-and-data-secure/token-expiration-and-revocation)时触发。{% else %}.{% endif %}
|
||||
| `create` | Triggered when you [grant access to an {% data variables.product.prodname_oauth_app %}](/github/authenticating-to-github/keeping-your-account-and-data-secure/authorizing-oauth-apps).
|
||||
| `destroy` | Triggered when you [revoke an {% data variables.product.prodname_oauth_app %}'s access to your account](/articles/reviewing-your-authorized-integrations){% ifversion fpt or ghae or ghes > 3.2 or ghec %} and when [authorizations are revoked or expire](/github/authenticating-to-github/keeping-your-account-and-data-secure/token-expiration-and-revocation).{% else %}.{% endif %}
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
|
||||
### `payment_method` 类别操作
|
||||
### `payment_method` category actions
|
||||
|
||||
| 操作 | 说明
|
||||
| Action | Description
|
||||
|------------------|-------------------
|
||||
| `create` | 在添加新的付款方式(例如新的信用卡或 PayPal 帐户)时触发。
|
||||
| `update` | 当现有付款方式被更新时触发。
|
||||
| `create` | Triggered when a new payment method is added, such as a new credit card or PayPal account.
|
||||
| `update` | Triggered when an existing payment method is updated.
|
||||
|
||||
{% endif %}
|
||||
|
||||
### `profile_picture` 类别操作
|
||||
### `profile_picture` category actions
|
||||
|
||||
| 操作 | 说明
|
||||
| Action | Description
|
||||
|------------------|-------------------
|
||||
| `update` | [设置或更新个人资料图片](/articles/setting-your-profile-picture/)时触发。
|
||||
| `update` | Triggered when you [set or update your profile picture](/articles/setting-your-profile-picture/).
|
||||
|
||||
### `project` 类别操作
|
||||
### `project` category actions
|
||||
|
||||
| 操作 | 说明
|
||||
| Action | Description
|
||||
|--------------------|---------------------
|
||||
| `access` | 当项目板的可见性被更改时触发。
|
||||
| `create` | 在创建项目板时触发。
|
||||
| `rename` | 当项目板被重命名时触发。
|
||||
| `update` | 当项目板被更新时触发。
|
||||
| `delete` | 在删除项目板时触发。
|
||||
| `link` | 当仓库被链接到项目板时触发。
|
||||
| `unlink` | 当仓库从项目板解除链接时触发。
|
||||
| `update_user_permission` | 在项目板中添加或删除外部协作者时,或者他们的权限级别被更改时触发。
|
||||
| `access` | Triggered when a project board's visibility is changed.
|
||||
| `create` | Triggered when a project board is created.
|
||||
| `rename` | Triggered when a project board is renamed.
|
||||
| `update` | Triggered when a project board is updated.
|
||||
| `delete` | Triggered when a project board is deleted.
|
||||
| `link` | Triggered when a repository is linked to a project board.
|
||||
| `unlink` | Triggered when a repository is unlinked from a project board.
|
||||
| `update_user_permission` | Triggered when an outside collaborator is added to or removed from a project board or has their permission level changed.
|
||||
|
||||
### `public_key` 类别操作
|
||||
### `public_key` category actions
|
||||
|
||||
| 操作 | 说明
|
||||
| Action | Description
|
||||
|------------------|-------------------
|
||||
| `create` | [将新的公共 SSH 密钥添加到 {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.product.product_location %}{% endif %} 上的帐户](/articles/adding-a-new-ssh-key-to-your-github-account)时触发。
|
||||
| `delete` | [从在 {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.product.product_location %}{% endif %} 上的帐户删除公共 SSH 密钥](/articles/reviewing-your-ssh-keys)时触发。
|
||||
| `create` | Triggered when you [add a new public SSH key to your account on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.product.product_location %}{% endif %}](/articles/adding-a-new-ssh-key-to-your-github-account).
|
||||
| `delete` | Triggered when you [remove a public SSH key to your account on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.product.product_location %}{% endif %}](/articles/reviewing-your-ssh-keys).
|
||||
|
||||
### `repo` 类别操作
|
||||
### `repo` category actions
|
||||
|
||||
| 操作 | 说明
|
||||
| Action | Description
|
||||
|------------------|-------------------
|
||||
| `access` | 当你拥有的存储库[从“专用”切换到“公共”](/articles/making-a-private-repository-public)时触发(反之亦然)。
|
||||
| `add_member` | 当 {% data variables.product.product_name %} 用户{% ifversion fpt or ghec %}[被邀请协作访问](/articles/inviting-collaborators-to-a-personal-repository){% else %}[被授权协作访问](/articles/inviting-collaborators-to-a-personal-repository){% endif %}存储库时触发。
|
||||
| `add_topic` | 当存储库所有者[添加主题](/articles/classifying-your-repository-with-topics)至存储库时触发。
|
||||
| `archived` | 存储库所有者[存档存储库](/articles/about-archiving-repositories)时触发。{% ifversion ghes %}
|
||||
| `config.disable_anonymous_git_access` | 在公共存储库中[禁用匿名 Git 读取访问](/enterprise/user/articles/enabling-anonymous-git-read-access-for-a-repository)时触发。
|
||||
| `config.enable_anonymous_git_access` | 在公共存储库中[启用匿名 Git 读取访问](/enterprise/user/articles/enabling-anonymous-git-read-access-for-a-repository)时触发。
|
||||
| `config.lock_anonymous_git_access` | 当存储库的[匿名 Git 读取访问设置锁定](/enterprise/admin/guides/user-management/preventing-users-from-changing-anonymous-git-read-access)时触发。
|
||||
| `config.unlock_anonymous_git_access` | 当存储库的[匿名 Git 读取访问设置解锁](/enterprise/admin/guides/user-management/preventing-users-from-changing-anonymous-git-read-access)时触发。{% endif %}
|
||||
| `create` | [创建新存储库](/articles/creating-a-new-repository)时触发。
|
||||
| `destroy` | [创建存储库](/articles/deleting-a-repository)时触发。{% ifversion fpt or ghec %}
|
||||
| `disable` | 在禁用存储库时触发(例如针对[资金不足](/articles/unlocking-a-locked-account))。{% endif %}{% ifversion fpt or ghec %}
|
||||
| `download_zip` | 下载存储库的 ZIP 或 TAR 存档时触发。
|
||||
| `enable` | 在重新启用仓库时触发。{% endif %}
|
||||
| `remove_member` | 在 {% data variables.product.product_name %} 用户[以协作者身份从存储库中被删除](/articles/removing-a-collaborator-from-a-personal-repository)时触发。
|
||||
| `remove_topic` | 当仓库所有者从仓库中删除主题时触发。
|
||||
| `rename` | [存储库重命名](/articles/renaming-a-repository)时触发。
|
||||
| `transfer` | [传输存储库](/articles/how-to-transfer-a-repository)时触发。
|
||||
| `transfer_start` | 在仓库转让即将发生时触发。
|
||||
| `unarchived` | 当仓库所有者取消存档仓库时触发。
|
||||
| `access` | Triggered when you a repository you own is [switched from "private" to "public"](/articles/making-a-private-repository-public) (or vice versa).
|
||||
| `add_member` | Triggered when a {% data variables.product.product_name %} user is {% ifversion fpt or ghec %}[invited to have collaboration access](/articles/inviting-collaborators-to-a-personal-repository){% else %}[given collaboration access](/articles/inviting-collaborators-to-a-personal-repository){% endif %} to a repository.
|
||||
| `add_topic` | Triggered when a repository owner [adds a topic](/articles/classifying-your-repository-with-topics) to a repository.
|
||||
| `archived` | Triggered when a repository owner [archives a repository](/articles/about-archiving-repositories).{% ifversion ghes %}
|
||||
| `config.disable_anonymous_git_access` | Triggered when [anonymous Git read access is disabled](/enterprise/user/articles/enabling-anonymous-git-read-access-for-a-repository) in a public repository.
|
||||
| `config.enable_anonymous_git_access` | Triggered when [anonymous Git read access is enabled](/enterprise/user/articles/enabling-anonymous-git-read-access-for-a-repository) in a public repository.
|
||||
| `config.lock_anonymous_git_access` | Triggered when a repository's [anonymous Git read access setting is locked](/enterprise/admin/guides/user-management/preventing-users-from-changing-anonymous-git-read-access).
|
||||
| `config.unlock_anonymous_git_access` | Triggered when a repository's [anonymous Git read access setting is unlocked](/enterprise/admin/guides/user-management/preventing-users-from-changing-anonymous-git-read-access).{% endif %}
|
||||
| `create` | Triggered when [a new repository is created](/articles/creating-a-new-repository).
|
||||
| `destroy` | Triggered when [a repository is deleted](/articles/deleting-a-repository).{% ifversion fpt or ghec %}
|
||||
| `disable` | Triggered when a repository is disabled (e.g., for [insufficient funds](/articles/unlocking-a-locked-account)).{% endif %}{% ifversion fpt or ghec %}
|
||||
| `download_zip` | Triggered when a ZIP or TAR archive of a repository is downloaded.
|
||||
| `enable` | Triggered when a repository is re-enabled.{% endif %}
|
||||
| `remove_member` | Triggered when a {% data variables.product.product_name %} user is [removed from a repository as a collaborator](/articles/removing-a-collaborator-from-a-personal-repository).
|
||||
| `remove_topic` | Triggered when a repository owner removes a topic from a repository.
|
||||
| `rename` | Triggered when [a repository is renamed](/articles/renaming-a-repository).
|
||||
| `transfer` | Triggered when [a repository is transferred](/articles/how-to-transfer-a-repository).
|
||||
| `transfer_start` | Triggered when a repository transfer is about to occur.
|
||||
| `unarchived` | Triggered when a repository owner unarchives a repository.
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
### `sponsors` 类别操作
|
||||
### `sponsors` category actions
|
||||
|
||||
| 操作 | 说明
|
||||
| Action | Description
|
||||
|------------------|-------------------
|
||||
| `custom_amount_settings_change` | 在启用或禁用自定义金额,或者在更改建议的自定义金额时触发(请参阅“[管理赞助级别](/github/supporting-the-open-source-community-with-github-sponsors/managing-your-sponsorship-tiers)”)
|
||||
| `repo_funding_links_file_action` | 更改存储库中的 FUNDING 文件时触发(请参阅“[在存储库中显示赞助按钮](/articles/displaying-a-sponsor-button-in-your-repository)”)
|
||||
| `sponsor_sponsorship_cancel` | 取消赞助时触发(请参阅“[降级赞助](/articles/downgrading-a-sponsorship)”)
|
||||
| `sponsor_sponsorship_create` | 赞助帐户时触发(请参阅“[赞助开源贡献者](/sponsors/sponsoring-open-source-contributors/sponsoring-an-open-source-contributor)”)
|
||||
| `sponsor_sponsorship_payment_complete` | 赞助帐户并且付款已处理后触发(请参阅“[赞助开源贡献者](/sponsors/sponsoring-open-source-contributors/sponsoring-an-open-source-contributor)”)
|
||||
| `sponsor_sponsorship_preference_change` | 更改是否从受赞助的开发者接收电子邮件更新时触发(请参阅“[管理赞助](/sponsors/sponsoring-open-source-contributors/managing-your-sponsorship)”)
|
||||
| `sponsor_sponsorship_tier_change` | 升级或降级赞助时触发(请参阅“[升级赞助](/articles/upgrading-a-sponsorship)”和“[降级赞助](/articles/downgrading-a-sponsorship)”)
|
||||
| `sponsored_developer_approve` | 审批 {% data variables.product.prodname_sponsors %} 帐户时触发(请参阅“[为个人帐户设置 {% data variables.product.prodname_sponsors %}](/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-personal-account)”)
|
||||
| `sponsored_developer_create` | 创建 {% data variables.product.prodname_sponsors %} 帐户时触发(请参阅“[为个人帐户设置 {% data variables.product.prodname_sponsors %}](/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-personal-account)”)
|
||||
| `sponsored_developer_disable` | 帐户 {% data variables.product.prodname_sponsors %} 禁用时触发
|
||||
| `sponsored_developer_redraft` | 当您的 {% data variables.product.prodname_sponsors %} 帐户从已批准状态恢复为草稿状态时触发
|
||||
| `sponsored_developer_profile_update` | 在编辑受赞助开发者个人资料时触发(请参阅“[编辑 {% data variables.product.prodname_sponsors %} 的个人资料详细信息](/sponsors/receiving-sponsorships-through-github-sponsors/editing-your-profile-details-for-github-sponsors)”)
|
||||
| `sponsored_developer_request_approval` | 提交 {% data variables.product.prodname_sponsors %} 申请以供审批时触发(请参阅“[为个人帐户设置 {% data variables.product.prodname_sponsors %}](/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-personal-account)”)
|
||||
| `sponsored_developer_tier_description_update` | 更改赞助级别的描述时触发(请参阅“[管理赞助级别](/sponsors/receiving-sponsorships-through-github-sponsors/managing-your-sponsorship-tiers)”)
|
||||
| `sponsored_developer_update_newsletter_send` | 向赞助商发送电子邮件更新时触发(请参阅“[与赞助商联系](/sponsors/receiving-sponsorships-through-github-sponsors/contacting-your-sponsors)”)
|
||||
| `waitlist_invite_sponsored_developer` | 受邀加入候补名单中的 {% data variables.product.prodname_sponsors %} 时触发(请参阅“[为个人帐户设置 {% data variables.product.prodname_sponsors %}](/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-personal-account)”)
|
||||
| `waitlist_join` | 加入候补名单成为受赞助开发者时触发(请参阅“[为个人帐户设置 {% data variables.product.prodname_sponsors %}](/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-personal-account)”)
|
||||
| `custom_amount_settings_change` | Triggered when you enable or disable custom amounts, or when you change the suggested custom amount (see "[Managing your sponsorship tiers](/github/supporting-the-open-source-community-with-github-sponsors/managing-your-sponsorship-tiers)")
|
||||
| `repo_funding_links_file_action` | Triggered when you change the FUNDING file in your repository (see "[Displaying a sponsor button in your repository](/articles/displaying-a-sponsor-button-in-your-repository)")
|
||||
| `sponsor_sponsorship_cancel` | Triggered when you cancel a sponsorship (see "[Downgrading a sponsorship](/articles/downgrading-a-sponsorship)")
|
||||
| `sponsor_sponsorship_create` | Triggered when you sponsor an account (see "[Sponsoring an open source contributor](/sponsors/sponsoring-open-source-contributors/sponsoring-an-open-source-contributor)")
|
||||
| `sponsor_sponsorship_payment_complete` | Triggered after you sponsor an account and your payment has been processed (see "[Sponsoring an open source contributor](/sponsors/sponsoring-open-source-contributors/sponsoring-an-open-source-contributor)")
|
||||
| `sponsor_sponsorship_preference_change` | Triggered when you change whether you receive email updates from a sponsored developer (see "[Managing your sponsorship](/sponsors/sponsoring-open-source-contributors/managing-your-sponsorship)")
|
||||
| `sponsor_sponsorship_tier_change` | Triggered when you upgrade or downgrade your sponsorship (see "[Upgrading a sponsorship](/articles/upgrading-a-sponsorship)" and "[Downgrading a sponsorship](/articles/downgrading-a-sponsorship)")
|
||||
| `sponsored_developer_approve` | Triggered when your {% data variables.product.prodname_sponsors %} account is approved (see "[Setting up {% data variables.product.prodname_sponsors %} for your personal account](/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-personal-account)")
|
||||
| `sponsored_developer_create` | Triggered when your {% data variables.product.prodname_sponsors %} account is created (see "[Setting up {% data variables.product.prodname_sponsors %} for your personal account](/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-personal-account)")
|
||||
| `sponsored_developer_disable` | Triggered when your {% data variables.product.prodname_sponsors %} account is disabled
|
||||
| `sponsored_developer_redraft` | Triggered when your {% data variables.product.prodname_sponsors %} account is returned to draft state from approved state
|
||||
| `sponsored_developer_profile_update` | Triggered when you edit your sponsored developer profile (see "[Editing your profile details for {% data variables.product.prodname_sponsors %}](/sponsors/receiving-sponsorships-through-github-sponsors/editing-your-profile-details-for-github-sponsors)")
|
||||
| `sponsored_developer_request_approval` | Triggered when you submit your application for {% data variables.product.prodname_sponsors %} for approval (see "[Setting up {% data variables.product.prodname_sponsors %} for your personal account](/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-personal-account)")
|
||||
| `sponsored_developer_tier_description_update` | Triggered when you change the description for a sponsorship tier (see "[Managing your sponsorship tiers](/sponsors/receiving-sponsorships-through-github-sponsors/managing-your-sponsorship-tiers)")
|
||||
| `sponsored_developer_update_newsletter_send` | Triggered when you send an email update to your sponsors (see "[Contacting your sponsors](/sponsors/receiving-sponsorships-through-github-sponsors/contacting-your-sponsors)")
|
||||
| `waitlist_invite_sponsored_developer` | Triggered when you are invited to join {% data variables.product.prodname_sponsors %} from the waitlist (see "[Setting up {% data variables.product.prodname_sponsors %} for your personal account](/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-personal-account)")
|
||||
| `waitlist_join` | Triggered when you join the waitlist to become a sponsored developer (see "[Setting up {% data variables.product.prodname_sponsors %} for your personal account](/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-personal-account)")
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
### `successor_invitation` 类别操作
|
||||
### `successor_invitation` category actions
|
||||
|
||||
| 操作 | 说明
|
||||
| Action | Description
|
||||
|------------------|-------------------
|
||||
| `accept` | 接受连续邀请时触发(请参阅“[个人帐户存储库的所有权连续性](/github/setting-up-and-managing-your-github-user-account/maintaining-ownership-continuity-of-your-user-accounts-repositories)”)
|
||||
| `cancel` | 取消连续邀请时触发(请参阅“[保持个人帐户存储库的所有权连续性](/github/setting-up-and-managing-your-github-user-account/maintaining-ownership-continuity-of-your-user-accounts-repositories)”)
|
||||
| `create` | 创建连续邀请时触发(请参阅“[保持个人帐户存储库的所有权连续性](/github/setting-up-and-managing-your-github-user-account/maintaining-ownership-continuity-of-your-user-accounts-repositories)”)
|
||||
| `decline` | 拒绝连续邀请时触发(请参阅“[保持个人帐户存储库的所有权连续性](/github/setting-up-and-managing-your-github-user-account/maintaining-ownership-continuity-of-your-user-accounts-repositories)”)
|
||||
| `revoke` | 撤销连续邀请时触发(请参阅“[保持个人帐户存储库的所有权连续性](/github/setting-up-and-managing-your-github-user-account/maintaining-ownership-continuity-of-your-user-accounts-repositories)”)
|
||||
| `accept` | Triggered when you accept a succession invitation (see "[Maintaining ownership continuity of your personal account's repositories](/github/setting-up-and-managing-your-github-user-account/maintaining-ownership-continuity-of-your-user-accounts-repositories)")
|
||||
| `cancel` | Triggered when you cancel a succession invitation (see "[Maintaining ownership continuity of your personal account's repositories](/github/setting-up-and-managing-your-github-user-account/maintaining-ownership-continuity-of-your-user-accounts-repositories)")
|
||||
| `create` | Triggered when you create a succession invitation (see "[Maintaining ownership continuity of your personal account's repositories](/github/setting-up-and-managing-your-github-user-account/maintaining-ownership-continuity-of-your-user-accounts-repositories)")
|
||||
| `decline` | Triggered when you decline a succession invitation (see "[Maintaining ownership continuity of your personal account's repositories](/github/setting-up-and-managing-your-github-user-account/maintaining-ownership-continuity-of-your-user-accounts-repositories)")
|
||||
| `revoke` | Triggered when you revoke a succession invitation (see "[Maintaining ownership continuity of your personal account's repositories](/github/setting-up-and-managing-your-github-user-account/maintaining-ownership-continuity-of-your-user-accounts-repositories)")
|
||||
{% endif %}
|
||||
|
||||
{% ifversion ghes or ghae %}
|
||||
|
||||
### `team` 类别操作
|
||||
### `team` category actions
|
||||
|
||||
| 操作 | 说明
|
||||
| Action | Description
|
||||
|------------------|-------------------
|
||||
| `add_member` | 当你所属组织的成员[将你添加到团队](/articles/adding-organization-members-to-a-team)时触发。
|
||||
| `add_repository` | 当您所属团队被授予控制仓库的权限时触发。
|
||||
| `create` | 当您所属组织中创建了新团队时触发。
|
||||
| `destroy` | 当您所属团队从组织中被删除时触发。
|
||||
| `remove_member` | [从你所属的团队中删除](/articles/removing-organization-members-from-a-team)组织成员时触发。
|
||||
| `remove_repository` | 当仓库不再受团队控制时触发。
|
||||
| `add_member` | Triggered when a member of an organization you belong to [adds you to a team](/articles/adding-organization-members-to-a-team).
|
||||
| `add_repository` | Triggered when a team you are a member of is given control of a repository.
|
||||
| `create` | Triggered when a new team in an organization you belong to is created.
|
||||
| `destroy` | Triggered when a team you are a member of is deleted from the organization.
|
||||
| `remove_member` | Triggered when a member of an organization is [removed from a team](/articles/removing-organization-members-from-a-team) you are a member of.
|
||||
| `remove_repository` | Triggered when a repository is no longer under a team's control.
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% ifversion not ghae %}
|
||||
### `two_factor_authentication` 类别操作
|
||||
### `two_factor_authentication` category actions
|
||||
|
||||
| 操作 | 说明
|
||||
| Action | Description
|
||||
|------------------|-------------------
|
||||
| `enabled` | 在启用[双因素身份验证](/articles/securing-your-account-with-two-factor-authentication-2fa)时触发。
|
||||
| `disabled` | 在禁用双重身份验证时触发。
|
||||
| `enabled` | Triggered when [two-factor authentication](/articles/securing-your-account-with-two-factor-authentication-2fa) is enabled.
|
||||
| `disabled` | Triggered when two-factor authentication is disabled.
|
||||
{% endif %}
|
||||
|
||||
### `user` 类别操作
|
||||
### `user` category actions
|
||||
|
||||
| 操作 | 说明
|
||||
| Action | Description
|
||||
|--------------------|---------------------
|
||||
| `add_email` | 在你 {% ifversion not ghae %}[添加新电子邮件地址](/articles/changing-your-primary-email-address)时触发{% else %}添加新电子邮件地址{% endif %}。{% ifversion fpt or ghec %}
|
||||
| `codespaces_trusted_repo_access_granted` | [允许为某个存储库创建的 codespaces 访问个人帐户拥有的其他存储库](/github/developing-online-with-codespaces/managing-access-and-security-for-codespaces)时触发。
|
||||
| `codespaces_trusted_repo_access_revoked` | [禁止为某个存储库创建的 codespaces 访问个人帐户拥有的其他存储库](/github/developing-online-with-codespaces/managing-access-and-security-for-codespaces)时触发。 {% endif %}
|
||||
| `create` | 新建个人帐户时触发。{% ifversion not ghae %}
|
||||
| `change_password` | 当您更改密码时触发。
|
||||
| `forgot_password` | 请求[密码重置](/articles/how-can-i-reset-my-password)时触发。{% endif %}
|
||||
| `hide_private_contributions_count` | 在[个人资料中隐藏私人贡献](/articles/publicizing-or-hiding-your-private-contributions-on-your-profile)时触发。
|
||||
| `login` | 当您登录到 {% data variables.product.product_location %} 时触发。{% ifversion ghes or ghae %}
|
||||
`mandatory_message_viewed` | 查看强制消息时触发(请参阅“[自定义用户消息](/admin/user-management/customizing-user-messages-for-your-enterprise)”以了解详细信息) | {% endif %}
|
||||
| `failed_login` | 当您未能成功登录时触发。
|
||||
| `remove_email` | 当您删除电子邮件地址时触发。
|
||||
| `rename` | 重命名帐户时触发。{% ifversion fpt or ghec %}
|
||||
| `report_content` | 当你[报告问题或拉取请求,或者报告对问题、拉取请求或提交的评论](/communities/maintaining-your-safety-on-github/reporting-abuse-or-spam)时触发。{% endif %}
|
||||
| `show_private_contributions_count` | [在个人资料中公开私人贡献](/articles/publicizing-or-hiding-your-private-contributions-on-your-profile)时触发。{% ifversion not ghae %}
|
||||
| `two_factor_requested` | 当 {% data variables.product.product_name %} 要求你提供[双因素身份验证代码](/articles/accessing-github-using-two-factor-authentication)时触发。{% endif %}
|
||||
| `add_email` | Triggered when you {% ifversion not ghae %}[add a new email address](/articles/changing-your-primary-email-address){% else %}add a new email address{% endif %}.{% ifversion fpt or ghec %}
|
||||
| `codespaces_trusted_repo_access_granted` | Triggered when you [allow the codespaces you create for a repository to access other repositories owned by your personal account](/github/developing-online-with-codespaces/managing-access-and-security-for-codespaces).
|
||||
| `codespaces_trusted_repo_access_revoked` | Triggered when you [disallow the codespaces you create for a repository to access other repositories owned by your personal account](/github/developing-online-with-codespaces/managing-access-and-security-for-codespaces). {% endif %}
|
||||
| `create` | Triggered when you create a new personal account.{% ifversion not ghae %}
|
||||
| `change_password` | Triggered when you change your password.
|
||||
| `forgot_password` | Triggered when you ask for [a password reset](/articles/how-can-i-reset-my-password).{% endif %}
|
||||
| `hide_private_contributions_count` | Triggered when you [hide private contributions on your profile](/articles/publicizing-or-hiding-your-private-contributions-on-your-profile).
|
||||
| `login` | Triggered when you log in to {% data variables.product.product_location %}.{% ifversion ghes or ghae %}
|
||||
`mandatory_message_viewed` | Triggered when you view a mandatory message (see "[Customizing user messages](/admin/user-management/customizing-user-messages-for-your-enterprise)" for details) | {% endif %}
|
||||
| `failed_login` | Triggered when you failed to log in successfully.
|
||||
| `remove_email` | Triggered when you remove an email address.
|
||||
| `rename` | Triggered when you rename your account.{% ifversion fpt or ghec %}
|
||||
| `report_content` | Triggered when you [report an issue or pull request, or a comment on an issue, pull request, or commit](/communities/maintaining-your-safety-on-github/reporting-abuse-or-spam).{% endif %}
|
||||
| `show_private_contributions_count` | Triggered when you [publicize private contributions on your profile](/articles/publicizing-or-hiding-your-private-contributions-on-your-profile).{% ifversion not ghae %}
|
||||
| `two_factor_requested` | Triggered when {% data variables.product.product_name %} asks you for [your two-factor authentication code](/articles/accessing-github-using-two-factor-authentication).{% endif %}
|
||||
|
||||
### `user_status` 类别操作
|
||||
### `user_status` category actions
|
||||
|
||||
| 操作 | 说明
|
||||
| Action | Description
|
||||
|--------------------|---------------------
|
||||
| `update` | 当您在个人资料中设置或更改状态时触发。 有关详细信息,请参阅“[设置状态](/articles/personalizing-your-profile/#setting-a-status)”。
|
||||
| `destroy` | 当您在个人资料中清除状态时触发。
|
||||
| `update` | Triggered when you set or change the status on your profile. For more information, see "[Setting a status](/articles/personalizing-your-profile/#setting-a-status)."
|
||||
| `destroy` | Triggered when you clear the status on your profile.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 关于代码扫描警报
|
||||
intro: 了解不同类型的代码扫描警报以及有助于了解每个警报突出显示的问题的信息。
|
||||
title: About code scanning alerts
|
||||
intro: Learn about the different types of code scanning alerts and the information that helps you understand the problem each alert highlights.
|
||||
product: '{% data reusables.gated-features.code-scanning %}'
|
||||
versions:
|
||||
fpt: '*'
|
||||
@@ -12,113 +12,115 @@ topics:
|
||||
- Advanced Security
|
||||
- Code scanning
|
||||
- CodeQL
|
||||
ms.openlocfilehash: 1e540aa8b061e0bbdd5b7be1a2563cd983cfb753
|
||||
ms.sourcegitcommit: fb047f9450b41b24afc43d9512a5db2a2b750a2a
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/11/2022
|
||||
ms.locfileid: '147881225'
|
||||
---
|
||||
{% data reusables.code-scanning.beta %} {% data reusables.code-scanning.enterprise-enable-code-scanning %}
|
||||
|
||||
## 关于 {% data variables.product.prodname_code_scanning %} 中的警报
|
||||
{% data reusables.code-scanning.beta %}
|
||||
{% data reusables.code-scanning.enterprise-enable-code-scanning %}
|
||||
|
||||
您可以设置 {% data variables.product.prodname_code_scanning %},以使用默认 {% data variables.product.prodname_codeql %} 分析、第三方分析或多种类型的分析来检查仓库中的代码。 分析完成后,生成的警报将并排显示在仓库的安全视图中。 第三方工具或自定义查询的结果可能不包括您在 {% data variables.product.company_short %} 的默认 {% data variables.product.prodname_codeql %} 分析所检测的警报中看到的所有属性。 有关详细信息,请参阅“[为存储库设置 {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/setting-up-code-scanning-for-a-repository)”。
|
||||
## About alerts from {% data variables.product.prodname_code_scanning %}
|
||||
|
||||
默认情况下, {% data variables.product.prodname_code_scanning %} 定期在默认分支和拉取请求中分析您的代码。 有关管理拉取请求警报的信息,请参阅“[会审拉取请求中的 {% data variables.product.prodname_code_scanning %} 警报](/code-security/secure-coding/triaging-code-scanning-alerts-in-pull-requests)”。
|
||||
You can set up {% data variables.product.prodname_code_scanning %} to check the code in a repository using the default {% data variables.product.prodname_codeql %} analysis, a third-party analysis, or multiple types of analysis. When the analysis is complete, the resulting alerts are displayed alongside each other in the security view of the repository. Results from third-party tools or from custom queries may not include all of the properties that you see for alerts detected by {% data variables.product.company_short %}'s default {% data variables.product.prodname_codeql %} analysis. For more information, see "[Setting up {% data variables.product.prodname_code_scanning %} for a repository](/code-security/secure-coding/setting-up-code-scanning-for-a-repository)."
|
||||
|
||||
## 关于警报详细信息
|
||||
By default, {% data variables.product.prodname_code_scanning %} analyzes your code periodically on the default branch and during pull requests. For information about managing alerts on a pull request, see "[Triaging {% data variables.product.prodname_code_scanning %} alerts in pull requests](/code-security/secure-coding/triaging-code-scanning-alerts-in-pull-requests)."
|
||||
|
||||
每个警报都会高亮显示代码的问题以及识别该问题的工具名称。 你可以看到触发警报的代码行以及警报的属性,例如警报严重性、安全严重性和问题的性质。 警报还会告知该问题第一次被引入的时间。 对于由 {% data variables.product.prodname_codeql %} 分析确定的警报,您还会看到如何解决问题的信息。
|
||||
## About alert details
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6249 %} {% data reusables.code-scanning.alert-default-branch %} {% endif %}
|
||||
Each alert highlights a problem with the code and the name of the tool that identified it. You can see the line of code that triggered the alert, as well as properties of the alert, such as the alert severity, security severity, and the nature of the problem. Alerts also tell you when the issue was first introduced. For alerts identified by {% data variables.product.prodname_codeql %} analysis, you will also see information on how to fix the problem.
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6249 %}  {% else %}  {% endif %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
{% data reusables.code-scanning.alert-default-branch %}
|
||||
{% endif %}
|
||||
|
||||
如果使用 {% data variables.product.prodname_codeql %} 设置 {% data variables.product.prodname_code_scanning %},则还可以在代码中发现数据流问题。 数据流分析将查找代码中的潜在安全问题,例如:不安全地使用数据、将危险参数传递给函数以及泄漏敏感信息。
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||

|
||||
{% else %}
|
||||

|
||||
{% endif %}
|
||||
|
||||
当 {% data variables.product.prodname_code_scanning %} 报告数据流警报时,{% data variables.product.prodname_dotcom %} 将显示数据在代码中如何移动。 {% data variables.product.prodname_code_scanning_capc %} 可用于识别泄露敏感信息的代码区域,以及可能成为恶意用户攻击切入点的代码区域。
|
||||
If you set up {% data variables.product.prodname_code_scanning %} using {% data variables.product.prodname_codeql %}, you can also find data-flow problems in your code. Data-flow analysis finds potential security issues in code, such as: using data insecurely, passing dangerous arguments to functions, and leaking sensitive information.
|
||||
|
||||
### 关于严重性级别
|
||||
When {% data variables.product.prodname_code_scanning %} reports data-flow alerts, {% data variables.product.prodname_dotcom %} shows you how data moves through the code. {% data variables.product.prodname_code_scanning_capc %} allows you to identify the areas of your code that leak sensitive information, and that could be the entry point for attacks by malicious users.
|
||||
|
||||
警报严重性级别可能为 `Error`、`Warning` 或 `Note`。
|
||||
### About severity levels
|
||||
|
||||
如果将 {% data variables.product.prodname_code_scanning %} 作为拉取请求检查启用,检测到严重性为 `error` 的任何结果时,检查都将失败。 可以指定代码扫描警报的哪个严重性级别会导致检查失败。 有关详细信息,请参阅“[定义导致拉取请求检查失败的严重性](/code-security/secure-coding/configuring-code-scanning#defining-the-severities-causing-pull-request-check-failure)”。
|
||||
Alert severity levels may be `Error`, `Warning`, or `Note`.
|
||||
|
||||
### 关于安全严重性级别
|
||||
If {% data variables.product.prodname_code_scanning %} is enabled as a pull request check, the check will fail if it detects any results with a severity of `error`. You can specify which severity level of code scanning alerts causes a check failure. For more information, see "[Defining the severities causing pull request check failure](/code-security/secure-coding/configuring-code-scanning#defining-the-severities-causing-pull-request-check-failure)."
|
||||
|
||||
{% data variables.product.prodname_code_scanning_capc %} 显示安全查询生成的警报的安全严重性级别。 安全严重性级别可以是 `Critical`、`High`、`Medium` 或 `Low`。
|
||||
### About security severity levels
|
||||
|
||||
为计算警报的安全严重性,我们将使用常见漏洞评分系统 (CVSS) 数据。 CVSS 是一个开放框架,用于传达软件漏洞的特征和严重性,通常由其他安全产品用来为警报评分。 若要详细了解如何计算严重性级别,请参阅[此博客文章](https://github.blog/changelog/2021-07-19-codeql-code-scanning-new-severity-levels-for-security-alerts/)。
|
||||
{% data variables.product.prodname_code_scanning_capc %} displays security severity levels for alerts that are generated by security queries. Security severity levels can be `Critical`, `High`, `Medium`, or `Low`.
|
||||
|
||||
默认情况下,安全严重性为 `Critical` 或 `High` 的任何 {% data variables.product.prodname_code_scanning %} 结果都会导致检查失败。 可以指定 {% data variables.product.prodname_code_scanning %} 结果的哪个安全严重性级别会导致检查失败。 有关详细信息,请参阅“[定义导致拉取请求检查失败的严重性](/code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#defining-the-severities-causing-pull-request-check-failure)”。
|
||||
To calculate the security severity of an alert, we use Common Vulnerability Scoring System (CVSS) data. CVSS is an open framework for communicating the characteristics and severity of software vulnerabilities, and is commonly used by other security products to score alerts. For more information about how severity levels are calculated, see [this blog post](https://github.blog/changelog/2021-07-19-codeql-code-scanning-new-severity-levels-for-security-alerts/).
|
||||
|
||||
{% ifversion fpt or ghes > 3.4 or ghae-issue-6251 or ghec %}
|
||||
### 关于分析源
|
||||
By default, any {% data variables.product.prodname_code_scanning %} results with a security severity of `Critical` or `High` will cause a check failure. You can specify which security severity level for {% data variables.product.prodname_code_scanning %} results should cause a check failure. For more information, see "[Defining the severities causing pull request check failure](/code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#defining-the-severities-causing-pull-request-check-failure)."
|
||||
|
||||
可以使用不同的工具和针对代码的不同语言或区域,在存储库上设置多个代码分析配置。 代码扫描的每个配置都是它生成的所有警报的分析源。 例如,与外部生成并通过代码扫描 API 上传的警报相比,使用带有 GitHub Actions 的默认 CodeQL 分析生成的警报具有不同的分析源。
|
||||
{% ifversion fpt or ghes > 3.4 or ghae > 3.4 or ghec %}
|
||||
### About analysis origins
|
||||
|
||||
如果使用多个配置来分析文件,同一查询检测到的任何问题都将报告为具有多个分析源的警报。 如果警报有多个分析源,在警报页面右侧的“受影响的分支”部分中,任何相关的分支旁都会出现一个 {% octicon "workflow" aria-label="The workflow icon" %} 图标。 可以将鼠标悬停在 {% octicon "workflow" aria-label="The workflow icon" %} 图标上,以查看每个分析源的名称以及该分析源警报的状态。 还可以在警报页面的时间线中查看每个分析源的警报出现时间的历史记录。 如果警报只有一个分析源,则警报页上不会显示任何有关分析源的信息。
|
||||
You can set up multiple configurations of code analysis on a repository, using different tools and targeting different languages or areas of the code. Each configuration of code scanning is the analysis origin for all the alerts it generates. For example, an alert generated using the default CodeQL analysis with GitHub Actions will have a different analysis origin from an alert generated externally and uploaded via the code scanning API.
|
||||
|
||||

|
||||
If you use multiple configurations to analyze a file, any problems detected by the same query are reported as alerts with multiple analysis origins. If an alert has more than one analysis origin, a {% octicon "workflow" aria-label="The workflow icon" %} icon will appear next to any relevant branch in the **Affected branches** section on the right-hand side of the alert page. You can hover over the {% octicon "workflow" aria-label="The workflow icon" %} icon to see the names of each analysis origin and the status of the alert for that analysis origin. You can also view the history of when alerts appeared in each analysis origin in the timeline on the alert page. If an alert only has one analysis origin, no information about analysis origins is displayed on the alert page.
|
||||
|
||||

|
||||
|
||||
{% note %}
|
||||
|
||||
注意:有时,代码扫描警报显示为固定的一个分析源,但仍可用于第二个分析源。 可通过重新运行第二个代码扫描配置以更新该分析源的警报状态,来解决此问题。
|
||||
**Note:** Sometimes a code scanning alert displays as fixed for one analysis origin but is still open for a second analysis origin. You can resolve this by re-running the second code scanning configuration to update the alert status for that analysis origin.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
{% endif %}
|
||||
### 关于应用程序代码中未找到的警报的标签
|
||||
### About labels for alerts that are not found in application code
|
||||
|
||||
{% data variables.product.product_name %} 向应用程序代码中找不到的警报分配类别标签。 标签与警报的位置相关。
|
||||
{% data variables.product.product_name %} assigns a category label to alerts that are not found in application code. The label relates to the location of the alert.
|
||||
|
||||
- Generated:生成过程生成的代码
|
||||
- Test:测试代码
|
||||
- Library:库或第三方代码
|
||||
- Documentation:文档
|
||||
- **Generated**: Code generated by the build process
|
||||
- **Test**: Test code
|
||||
- **Library**: Library or third-party code
|
||||
- **Documentation**: Documentation
|
||||
|
||||
{% data variables.product.prodname_code_scanning_capc %} 按文件路径对文件进行分类。 无法手动对源文件进行分类。
|
||||
{% data variables.product.prodname_code_scanning_capc %} categorizes files by file path. You cannot manually categorize source files.
|
||||
|
||||
下面是库代码中标记为已发生的警报的 {% data variables.product.prodname_code_scanning %} 警报列表中的一个示例。
|
||||
Here is an example from the {% data variables.product.prodname_code_scanning %} alert list of an alert marked as occurring in library code.
|
||||
|
||||

|
||||

|
||||
|
||||
在警报页上,可以看到文件路径标记为库代码(`Library` 标签)。
|
||||
On the alert page, you can see that the filepath is marked as library code (`Library` label).
|
||||
|
||||

|
||||

|
||||
|
||||
{% ifversion codeql-ml-queries %}
|
||||
|
||||
## 关于实验性警报
|
||||
## About experimental alerts
|
||||
|
||||
{% data reusables.code-scanning.beta-codeql-ml-queries %}
|
||||
|
||||
在使用 {% data variables.product.prodname_codeql %} 操作运行 {% data variables.product.prodname_code_scanning %} 的存储库中,你可能会看到一些标记为实验性的警报。 下面是使用机器学习模型扩展现有 {% data variables.product.prodname_codeql %} 查询的功能时发现的警报。
|
||||
In repositories that run {% data variables.product.prodname_code_scanning %} using the {% data variables.product.prodname_codeql %} action, you may see some alerts that are marked as experimental. These are alerts that were found using a machine learning model to extend the capabilities of an existing {% data variables.product.prodname_codeql %} query.
|
||||
|
||||

|
||||

|
||||
|
||||
### 使用机器学习模型扩展查询的好处
|
||||
### Benefits of using machine learning models to extend queries
|
||||
|
||||
在使用未包含在原始查询编写器中的框架和库编写的代码中,使用机器学习模型的查询能够发现漏洞。
|
||||
Queries that use machine learning models are capable of finding vulnerabilities in code that was written using frameworks and libraries that the original query writer did not include.
|
||||
|
||||
{% data variables.product.prodname_codeql %} 的每个安全查询都标识易受特定类型攻击的代码。 安全研究人员编写查询,并纳入最常见的框架和库。 因此,每个现有查询都会发现对常见框架和库的易受攻击用法。 但是,开发人员使用许多不同的框架和库,而手动维护的查询不能包含所有这些框架和库。 因此,手动维护的查询不包含所有框架和库。
|
||||
Each of the security queries for {% data variables.product.prodname_codeql %} identifies code that's vulnerable to a specific type of attack. Security researchers write the queries and include the most common frameworks and libraries. So each existing query finds vulnerable uses of common frameworks and libraries. However, developers use many different frameworks and libraries, and a manually maintained query cannot include them all. Consequently, manually maintained queries do not provide coverage for all frameworks and libraries.
|
||||
|
||||
{% data variables.product.prodname_codeql %} 使用机器学习模型来扩展现有的安全查询,以涵盖更多框架和库。 机器学习模型经过训练可检测出它从未见过的代码中的问题。 使用模型的查询将查找原始查询中未描述的框架和库的结果。
|
||||
{% data variables.product.prodname_codeql %} uses a machine learning model to extend an existing security query to cover a wider range of frameworks and libraries. The machine learning model is trained to detect problems in code it's never seen before. Queries that use the model will find results for frameworks and libraries that are not described in the original query.
|
||||
|
||||
### 使用机器学习识别的警报
|
||||
### Alerts identified using machine learning
|
||||
|
||||
使用机器学习模型发现的警报被标记为“实验性警报”,以表明技术正在积极开发中。 这些警报的误报率高于其基于的查询。 机器学习模型将根据用户操作进行改进(例如将不良结果标记为误报或修复良好结果)。
|
||||
Alerts found using a machine learning model are tagged as "Experimental alerts" to show that the technology is under active development. These alerts have a higher rate of false positive results than the queries they are based on. The machine learning model will improve based on user actions such as marking a poor result as a false positive or fixing a good result.
|
||||
|
||||

|
||||

|
||||
|
||||
## 启用实验性警报
|
||||
## Enabling experimental alerts
|
||||
|
||||
默认 {% data variables.product.prodname_codeql %} 查询套件不包含使用机器学习生成实验性警报的任何查询。 若要在 {% data variables.product.prodname_code_scanning %} 期间运行机器学习查询,需要运行其他包含在以下查询套件之一中的查询。
|
||||
The default {% data variables.product.prodname_codeql %} query suites do not include any queries that use machine learning to generate experimental alerts. To run machine learning queries during {% data variables.product.prodname_code_scanning %} you need to run the additional queries contained in one of the following query suites.
|
||||
|
||||
{% data reusables.code-scanning.codeql-query-suites %}
|
||||
|
||||
更新工作流以运行其他查询套件时,这将增加分析时间。
|
||||
When you update your workflow to run an additional query suite this will increase the analysis time.
|
||||
|
||||
``` yaml
|
||||
- uses: {% data reusables.actions.action-codeql-action-init %}
|
||||
@@ -127,14 +129,14 @@ ms.locfileid: '147881225'
|
||||
queries: security-extended
|
||||
```
|
||||
|
||||
有关详细信息,请参阅“[配置代码扫描](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs)”。
|
||||
For more information, see "[Configuring code scanning](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs)."
|
||||
|
||||
## 禁用实验性警报
|
||||
## Disabling experimental alerts
|
||||
|
||||
禁用使用机器学习生成实验性警报的查询的最简单方法是,停止运行 `security-extended` 或 `security-and-quality` 查询套件。 在上面的示例中,将注释掉 `queries` 行。 如果需要继续运行 `security-extended` 或 `security-and-quality` 套件,并且机器学习查询会导致问题,则可通过 [{% data variables.product.company_short %} 支持](https://support.github.com/contact)创建包含以下详细信息的工单。
|
||||
The simplest way to disable queries that use machine learning to generate experimental alerts is to stop running the `security-extended` or `security-and-quality` query suite. In the example above, you would comment out the `queries` line. If you need to continue to run the `security-extended` or `security-and-quality` suite and the machine learning queries are causing problems, then you can open a ticket with [{% data variables.product.company_short %} support](https://support.github.com/contact) with the following details.
|
||||
|
||||
- 工单标题:“{% data variables.product.prodname_code_scanning %}: 从实验性警报 beta 版本中删除”
|
||||
- 指定受影响的存储库或组织的详细信息
|
||||
- 请求工程升级
|
||||
- Ticket title: "{% data variables.product.prodname_code_scanning %}: removal from experimental alerts beta"
|
||||
- Specify details of the repositories or organizations that are affected
|
||||
- Request an escalation to engineering
|
||||
|
||||
{% endif %}
|
||||
|
||||
@@ -511,7 +511,7 @@ For more information about using `exclude` and `include` filters in your custom
|
||||
|
||||
### Specifying directories to scan
|
||||
|
||||
For the interpreted languages that {% data variables.product.prodname_codeql %} supports (Python{% ifversion fpt or ghes > 3.3 or ghae-issue-5017 %}, Ruby{% endif %} and JavaScript/TypeScript), you can restrict {% data variables.product.prodname_code_scanning %} to files in specific directories by adding a `paths` array to the configuration file. You can exclude the files in specific directories from analysis by adding a `paths-ignore` array.
|
||||
For the interpreted languages that {% data variables.product.prodname_codeql %} supports (Python{% ifversion fpt or ghes > 3.3 or ghae > 3.3 %}, Ruby{% endif %} and JavaScript/TypeScript), you can restrict {% data variables.product.prodname_code_scanning %} to files in specific directories by adding a `paths` array to the configuration file. You can exclude the files in specific directories from analysis by adding a `paths-ignore` array.
|
||||
|
||||
``` yaml
|
||||
paths:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: 管理存储库的代码扫描警报
|
||||
title: Managing code scanning alerts for your repository
|
||||
shortTitle: Manage alerts
|
||||
intro: '从安全视图中,针对项目代码中的潜在漏洞或错误,{% ifversion delete-code-scanning-alerts %}可查看、修复、关闭或删除警报{% else %}可查看、修复或关闭警报{% endif %}。'
|
||||
intro: 'From the security view, {% ifversion delete-code-scanning-alerts %}you can view, fix, dismiss, or delete alerts {% else %}you can view, fix, or dismiss alerts{% endif %} for potential vulnerabilities or errors in your project''s code.'
|
||||
product: '{% data reusables.gated-features.code-scanning %}'
|
||||
permissions: 'If you have write permission to a repository you can manage {% data variables.product.prodname_code_scanning %} alerts for that repository.'
|
||||
versions:
|
||||
@@ -22,175 +22,206 @@ topics:
|
||||
- Code scanning
|
||||
- Alerts
|
||||
- Repositories
|
||||
ms.openlocfilehash: b672af79096c1f52a0670cd747ef159f071a3d07
|
||||
ms.sourcegitcommit: 478f2931167988096ae6478a257f492ecaa11794
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/09/2022
|
||||
ms.locfileid: '147693325'
|
||||
---
|
||||
|
||||
{% data reusables.code-scanning.beta %}
|
||||
|
||||
## 查看仓库的警报
|
||||
## Viewing the alerts for a repository
|
||||
|
||||
任何对仓库有读取权限的人都可以查看拉取请求上的 {% data variables.product.prodname_code_scanning %} 注释。 有关详细信息,请参阅“[会审拉取请求中的 {% data variables.product.prodname_code_scanning %} 警报](/code-security/secure-coding/triaging-code-scanning-alerts-in-pull-requests)”。
|
||||
Anyone with read permission for a repository can see {% data variables.product.prodname_code_scanning %} annotations on pull requests. For more information, see "[Triaging {% data variables.product.prodname_code_scanning %} alerts in pull requests](/code-security/secure-coding/triaging-code-scanning-alerts-in-pull-requests)."
|
||||
|
||||
你需要写入权限才能在“安全”选项卡上查看存储库所有警报的摘要。
|
||||
You need write permission to view a summary of all the alerts for a repository on the **Security** tab.
|
||||
|
||||
默认情况下,将筛选代码扫描警报页面,以仅显示存储库默认分支的警报。
|
||||
By default, the code scanning alerts page is filtered to show alerts for the default branch of the repository only.
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-security %} {% data reusables.repositories.sidebar-code-scanning-alerts %}
|
||||
1. (可选)使用自由文本搜索框或下拉菜单来筛选警报。 例如,您可以通过用于识别警报的工具进行过滤。
|
||||
 {% data reusables.code-scanning.explore-alert %} 
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-security %}
|
||||
{% data reusables.repositories.sidebar-code-scanning-alerts %}
|
||||
1. Optionally, use the free text search box or the drop-down menus to filter alerts. For example, you can filter by the tool that was used to identify alerts.
|
||||

|
||||
{% data reusables.code-scanning.explore-alert %}
|
||||

|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6249 %} {% data reusables.code-scanning.alert-default-branch %} {% endif %}
|
||||
1. (可选)如果警报突出显示数据流的问题,请单击“显示路径”以显示从数据源到使用它的接收者的路径。
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6249 %}  {% else %}  {% endif %}
|
||||
2. 来自 {% data variables.product.prodname_codeql %} 分析的警报包括对问题的描述。 单击“显示更多”以获取有关如何修复代码的指导。
|
||||

|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
{% data reusables.code-scanning.alert-default-branch %}
|
||||
{% endif %}
|
||||
1. Optionally, if the alert highlights a problem with data flow, click **Show paths** to display the path from the data source to the sink where it's used.
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||

|
||||
{% else %}
|
||||

|
||||
{% endif %}
|
||||
2. Alerts from {% data variables.product.prodname_codeql %} analysis include a description of the problem. Click **Show more** for guidance on how to fix your code.
|
||||

|
||||
|
||||
有关详细信息,请参阅“[关于 {% data variables.product.prodname_code_scanning %} 警报](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-alerts)”。
|
||||
For more information, see "[About {% data variables.product.prodname_code_scanning %} alerts](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-alerts)."
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:对于 {% data variables.product.prodname_codeql %} 的 {% data variables.product.prodname_code_scanning %} 分析,你可以在存储库的 {% data variables.product.prodname_code_scanning %} 警报列表顶部的标头中看到有关最新运行的信息。
|
||||
**Note:** For {% data variables.product.prodname_code_scanning %} analysis with {% data variables.product.prodname_codeql %}, you can see information about the latest run in a header at the top of the list of {% data variables.product.prodname_code_scanning %} alerts for the repository.
|
||||
|
||||
例如,您可以看到上次扫描运行的时间,所分析的代码行数与您仓库中的代码行总数的比较, 以及生成的警报总数。
|
||||

|
||||
For example, you can see when the last scan ran, the number of lines of code analyzed compared to the total number of lines of code in your repository, and the total number of alerts that were generated.
|
||||

|
||||
|
||||
{% endnote %}
|
||||
|
||||
## 筛选 {% data variables.product.prodname_code_scanning %} 警报
|
||||
## Filtering {% data variables.product.prodname_code_scanning %} alerts
|
||||
|
||||
您可以筛选 {% data variables.product.prodname_code_scanning %} 警报视图中显示的警报。 如果存在许多警报,这将非常有用,因为您可以专注于特定类型的警报。 有一些预定义的筛选器和一系列关键字可用于优化显示的警报列表。
|
||||
You can filter the alerts shown in the {% data variables.product.prodname_code_scanning %} alerts view. This is useful if there are many alerts as you can focus on a particular type of alert. There are some predefined filters and a range of keywords that you can use to refine the list of alerts displayed.
|
||||
|
||||
- 要使用预定义的筛选器,请单击“筛选器”或警报列表标题中显示的筛选器,然后从下拉列表中选择一个筛选器。
|
||||
{% ifversion fpt or ghes or ghec %} {% else %}{% endif %}
|
||||
- 要使用关键字,请直接在筛选器文本框中键入,或者:
|
||||
1. 在筛选器文本框中单击以显示所有可用筛选器关键字的列表。
|
||||
2. 单击要使用的关键字,然后从下拉列表中选择值。
|
||||

|
||||
- To use a predefined filter, click **Filters**, or a filter shown in the header of the list of alerts, and choose a filter from the drop-down list.
|
||||
{% ifversion fpt or ghes or ghec %}
|
||||
{% else %}{% endif %}
|
||||
- To use a keyword, either type directly in the filters text box, or:
|
||||
1. Click in the filters text box to show a list of all available filter keywords.
|
||||
2. Click the keyword you want to use and then choose a value from the drop-down list.
|
||||

|
||||
|
||||
使用关键字筛选器的好处是,下拉列表中仅显示带有结果的值。 这样可以很容易地避免设置没有结果的筛选器。
|
||||
The benefit of using keyword filters is that only values with results are shown in the drop-down lists. This makes it easy to avoid setting filters that find no results.
|
||||
|
||||
如果输入多个筛选器,视图将显示与所有这些筛选器匹配的警报。 例如,`is:closed severity:high branch:main` 仅显示 `main` 分支上存在的已关闭高严重性警报。 例外情况是与 refs 相关的筛选器(`ref`、`branch` 和 `pr`):`is:open branch:main branch:next` 将显示来自 `main` 分支和 `next` 分支的开放式警报。
|
||||
If you enter multiple filters, the view will show alerts matching _all_ these filters. For example, `is:closed severity:high branch:main` will only display closed high-severity alerts that are present on the `main` branch. The exception is filters relating to refs (`ref`, `branch` and `pr`): `is:open branch:main branch:next` will show you open alerts from both the `main` branch and the `next` branch.
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6249 %} {% data reusables.code-scanning.filter-non-default-branches %} {% endif %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
{% data reusables.code-scanning.filter-non-default-branches %}
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghec %}
|
||||
|
||||
你可以在 `tag` 筛选器前面加上 `-` 以排除带有该标记的结果。 例如,`-tag:style` 仅显示没有 `style` 标记{% ifversion codeql-ml-queries %}的警报,而 `-tag:experimental` 将忽略所有实验性警报。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_code_scanning %} 警报](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-alerts#about-experimental-alerts)”。{% else %}。{% endif %}
|
||||
You can prefix the `tag` filter with `-` to exclude results with that tag. For example, `-tag:style` only shows alerts that do not have the `style` tag{% ifversion codeql-ml-queries %} and `-tag:experimental` will omit all experimental alerts. For more information, see "[About {% data variables.product.prodname_code_scanning %} alerts](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-alerts#about-experimental-alerts)."{% else %}.{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
### 将结果限制为仅应用程序代码
|
||||
### Restricting results to application code only
|
||||
|
||||
可以使用“仅应用程序代码中的警报”筛选器或 `autofilter:true` 关键字和值,将结果限于应用程序代码中的警报。 有关不是应用程序代码的代码类型的详细信息,请参阅上面的[关于不在应用程序代码中的警报的标签](#about-labels-for-alerts-that-are-not-found-in-application-code)。
|
||||
You can use the "Only alerts in application code" filter or `autofilter:true` keyword and value to restrict results to alerts in application code. See "[About labels for alerts not in application code](#about-labels-for-alerts-that-are-not-found-in-application-code)" above for more information about the types of code that are not application code.
|
||||
|
||||
{% ifversion fpt or ghes or ghec %}
|
||||
|
||||
## 搜索 {% data variables.product.prodname_code_scanning %} 警报
|
||||
## Searching {% data variables.product.prodname_code_scanning %} alerts
|
||||
|
||||
您可以搜索警报列表。 如果仓库中存在大量警报,或者您不知道警报的确切名称,这很有用。 {% data variables.product.product_name %} 可执行以下自由文本搜索:
|
||||
- 警报的名称
|
||||
- 警报详细信息(这也包括默认情况下在“显示更多”可折叠部分中隐藏的信息){% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6249 %}  {% else %}  {% endif %}
|
||||
You can search the list of alerts. This is useful if there is a large number of alerts in your repository, or if you don't know the exact name for an alert for example. {% data variables.product.product_name %} performs the free text search across:
|
||||
- The name of the alert
|
||||
- The alert details (this also includes the information hidden from view by default in the **Show more** collapsible section)
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||

|
||||
{% else %}
|
||||

|
||||
{% endif %}
|
||||
|
||||
| 支持的搜索 | 语法示例 | 结果 |
|
||||
| Supported search | Syntax example | Results |
|
||||
| ---- | ---- | ---- |
|
||||
| 单字搜索 | `injection` | 返回包含单词 `injection` 的所有警报 |
|
||||
| 多字词搜索 | `sql injection` | 返回包含 `sql` 或 `injection` 的所有警报 |
|
||||
| 精确匹配搜索</br>(使用双引号) | `"sql injection"` | 返回包含确切短语 `sql injection` 的所有警报 |
|
||||
| OR 搜索 | `sql OR injection` | 返回包含 `sql` 或 `injection` 的所有警报 |
|
||||
| AND 搜索 | `sql AND injection` | 返回包含单词 `sql` 和 `injection` 的所有警报 |
|
||||
| Single word search | `injection` | Returns all the alerts containing the word `injection` |
|
||||
| Multiple word search | `sql injection` | Returns all the alerts containing `sql` or `injection` |
|
||||
| Exact match search</br>(use double quotes) | `"sql injection"` | Returns all the alerts containing the exact phrase `sql injection` |
|
||||
| OR search | `sql OR injection` | Returns all the alerts containing `sql` or `injection` |
|
||||
| AND search | `sql AND injection` | Returns all the alerts containing both words `sql` and `injection` |
|
||||
|
||||
{% tip %}
|
||||
|
||||
**提示:**
|
||||
- 多字词搜索等同于 OR 搜索。
|
||||
- AND 搜索将返回以任何顺序在警报名称或详细信息中的“任意位置”找到搜索词的结果。
|
||||
**Tips:**
|
||||
- The multiple word search is equivalent to an OR search.
|
||||
- The AND search will return results where the search terms are found _anywhere_, in any order in the alert name or details.
|
||||
|
||||
{% endtip %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-security %} {% data reusables.repositories.sidebar-code-scanning-alerts %}
|
||||
1. 在“筛选器”下拉菜单右侧,在自由文本搜索框中键入关键字以进行搜索。
|
||||

|
||||
2. 按 <kbd>return</kbd>。 警报列表将包含与搜索条件匹配的未处理 {% data variables.product.prodname_code_scanning %} 警报。
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-security %}
|
||||
{% data reusables.repositories.sidebar-code-scanning-alerts %}
|
||||
1. To the right of the **Filters** drop-down menus, type the keywords to search for in the free text search box.
|
||||

|
||||
2. Press <kbd>return</kbd>. The alert listing will contain the open {% data variables.product.prodname_code_scanning %} alerts matching your search criteria.
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% ifversion code-scanning-task-lists %}
|
||||
## 跟踪议题中的 {% data variables.product.prodname_code_scanning %} 警报
|
||||
## Tracking {% data variables.product.prodname_code_scanning %} alerts in issues
|
||||
|
||||
{% data reusables.code-scanning.beta-alert-tracking-in-issues %} {% data reusables.code-scanning.github-issues-integration %} {% data reusables.code-scanning.alert-tracking-link %}
|
||||
{% data reusables.code-scanning.beta-alert-tracking-in-issues %}
|
||||
{% data reusables.code-scanning.github-issues-integration %}
|
||||
{% data reusables.code-scanning.alert-tracking-link %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
## 修复警报
|
||||
## Fixing an alert
|
||||
|
||||
任何对仓库具有写入权限的人都可以通过提交对代码的更正来修复警报。 如果仓库已安排对拉取请求运行 {% data variables.product.prodname_code_scanning %},则最好通过拉取请求提交您的更正。 这将触发对更改的 {% data variables.product.prodname_code_scanning %} 分析,并测试您的修复是否会带来任何新的问题。 有关详细信息,请参阅“[配置 {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/configuring-code-scanning)”和“[会审拉取请求中的 {% data variables.product.prodname_code_scanning %} 警报](/code-security/secure-coding/triaging-code-scanning-alerts-in-pull-requests)”。
|
||||
Anyone with write permission for a repository can fix an alert by committing a correction to the code. If the repository has {% data variables.product.prodname_code_scanning %} scheduled to run on pull requests, it's best to raise a pull request with your correction. This will trigger {% data variables.product.prodname_code_scanning %} analysis of the changes and test that your fix doesn't introduce any new problems. For more information, see "[Configuring {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/configuring-code-scanning)" and "[Triaging {% data variables.product.prodname_code_scanning %} alerts in pull requests](/code-security/secure-coding/triaging-code-scanning-alerts-in-pull-requests)."
|
||||
|
||||
如果你有存储库的写入权限,则可以通过查看警报摘要并单击“已关闭”来查看已修复的警报。 有关详细信息,请参阅“[查看存储库的警报](#viewing-the-alerts-for-a-repository)”。 “Closed(已关闭)”列表显示已修复的警报和用户已忽略的警报。
|
||||
If you have write permission for a repository, you can view fixed alerts by viewing the summary of alerts and clicking **Closed**. For more information, see "[Viewing the alerts for a repository](#viewing-the-alerts-for-a-repository)." The "Closed" list shows fixed alerts and alerts that users have dismissed.
|
||||
|
||||
可使用自由文本搜索或筛选器显示警报子集,然后依次将所有匹配的警报标记为已关闭。
|
||||
You can use the free text search or the filters to display a subset of alerts and then in turn mark all matching alerts as closed.
|
||||
|
||||
警报只能在一个分支中修复。 您可以在警报摘要上使用“Branch(分支)”过滤器检查警报是否是在特定分支中修复的。
|
||||
Alerts may be fixed in one branch but not in another. You can use the "Branch" filter, on the summary of alerts, to check whether an alert is fixed in a particular branch.
|
||||
|
||||

|
||||

|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6249 %} {% data reusables.code-scanning.filter-non-default-branches %} {% endif %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
{% data reusables.code-scanning.filter-non-default-branches %}
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.4 or ghae-issue-6251 or ghec %} {% note %}
|
||||
{% ifversion fpt or ghes > 3.4 or ghae > 3.4 or ghec %}
|
||||
{% note %}
|
||||
|
||||
注意:如果使用多个配置运行代码扫描,则有时警报会有多个分析源。 除非定期运行所有配置,否则可能会看到在一个分析源中已修复但在另一个分析源中未修复的警报。 有关详细信息,请参阅[关于分析源](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-alerts#about-analysis-origins)。
|
||||
**Note:** If you run code scanning using multiple configurations, then sometimes an alert will have multiple analysis origins. Unless you run all configurations regularly, you may see alerts that are fixed in one analysis origin but not in another. For more information, see "[About analysis origins](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-alerts#about-analysis-origins)."
|
||||
|
||||
{% endnote %} {% endif %}
|
||||
## 关闭{% ifversion delete-code-scanning-alerts %}或删除{% endif %}警报
|
||||
{% endnote %}
|
||||
{% endif %}
|
||||
## Dismissing {% ifversion delete-code-scanning-alerts %}or deleting{% endif %} alerts
|
||||
|
||||
有两种方法可以关闭警报。 您可以修复代码中的问题,也可以忽略警报。 {% ifversion delete-code-scanning-alerts %}或者,如果你拥有存储库的管理员权限,则可删除警报。 删除警报适用于以下情况:您设置了 {% data variables.product.prodname_code_scanning %} 工具,然后决定删除它,或者您配置了 {% data variables.product.prodname_codeql %} 分析,但查询集超出您的需求,于是您从工具中删除了某些查询。 在这两种情况下,删除警报允许您清理 {% data variables.product.prodname_code_scanning %} 结果。 可以从“安全性”选项卡中的摘要列表中删除警报。{% endif %}
|
||||
There are two ways of closing an alert. You can fix the problem in the code, or you can dismiss the alert. {% ifversion delete-code-scanning-alerts %}Alternatively, if you have admin permissions for the repository, you can delete alerts. Deleting alerts is useful in situations where you have set up a {% data variables.product.prodname_code_scanning %} tool and then decided to remove it, or where you have configured {% data variables.product.prodname_codeql %} analysis with a larger set of queries than you want to continue using, and you've then removed some queries from the tool. In both cases, deleting alerts allows you to clean up your {% data variables.product.prodname_code_scanning %} results. You can delete alerts from the summary list within the **Security** tab.{% endif %}
|
||||
|
||||
取消显示警报是关闭你认为不需要修复的警报的一种方法。 {% data reusables.code-scanning.close-alert-examples %} 你可以从代码中的 {% data variables.product.prodname_code_scanning %} 注释取消显示警报,或者从“安全”选项卡中的摘要列表取消显示警报。
|
||||
Dismissing an alert is a way of closing an alert that you don't think needs to be fixed. {% data reusables.code-scanning.close-alert-examples %} You can dismiss alerts from {% data variables.product.prodname_code_scanning %} annotations in code, or from the summary list within the **Security** tab.
|
||||
|
||||
当您忽略警报时:
|
||||
When you dismiss an alert:
|
||||
|
||||
- 它在所有分支中被忽略。
|
||||
- 警报将从项目的当前警报数中删除。
|
||||
- 警报被移动到警报摘要中的“Closed(已关闭)”列表,需要时您可以在其中重新打开它。
|
||||
- 会记录关闭警报的原因。{% ifversion comment-dismissed-code-scanning-alert %}
|
||||
- (可选)可对关闭操作进行注释以记录警报关闭操作的上下文。{% endif %}
|
||||
- {% data variables.product.prodname_code_scanning %} 下次运行时,相同的代码将不会生成警报。
|
||||
- It's dismissed in all branches.
|
||||
- The alert is removed from the number of current alerts for your project.
|
||||
- The alert is moved to the "Closed" list in the summary of alerts, from where you can reopen it, if required.
|
||||
- The reason why you closed the alert is recorded.{% ifversion comment-dismissed-code-scanning-alert %}
|
||||
- Optionally, you can comment on a dismissal to record the context of an alert dismissal.{% endif %}
|
||||
- Next time {% data variables.product.prodname_code_scanning %} runs, the same code won't generate an alert.
|
||||
|
||||
{% ifversion delete-code-scanning-alerts %}删除警报时:
|
||||
{% ifversion delete-code-scanning-alerts %}When you delete an alert:
|
||||
|
||||
- 它在所有分支中被删除。
|
||||
- 警报将从项目的当前警报数中删除。
|
||||
- 它不会添加到警报摘要中的“已关闭”列表。
|
||||
- 如果生成警报的代码保持不变,并且相同的 {% data variables.product.prodname_code_scanning %} 工具在不更改任何配置的情况下再次运行,则该警报将再次显示在你的分析结果中。{% endif %}
|
||||
- It's deleted in all branches.
|
||||
- The alert is removed from the number of current alerts for your project.
|
||||
- It is _not_ added to the "Closed" list in the summary of alerts.
|
||||
- If the code that generated the alert stays the same, and the same {% data variables.product.prodname_code_scanning %} tool runs again without any configuration changes, the alert will be shown again in your analysis results.{% endif %}
|
||||
|
||||
若要关闭{% ifversion delete-code-scanning-alerts %}或删除{% endif %}警报:
|
||||
To dismiss {% ifversion delete-code-scanning-alerts %}or delete{% endif %} alerts:
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-security %} {% data reusables.repositories.sidebar-code-scanning-alerts %}{% ifversion delete-code-scanning-alerts %}
|
||||
1. 如果你拥有存储库管理员权限,并且想要删除此 {% data variables.product.prodname_code_scanning %} 工具的警报,请选中部分或全部复选框,然后单击“删除”。
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-security %}
|
||||
{% data reusables.repositories.sidebar-code-scanning-alerts %}{% ifversion delete-code-scanning-alerts %}
|
||||
1. If you have admin permissions for the repository, and you want to delete alerts for this {% data variables.product.prodname_code_scanning %} tool, select some or all of the check boxes and click **Delete**.
|
||||
|
||||

|
||||

|
||||
|
||||
(可选)可使用自由文本搜索或筛选器显示警报子集,然后一次删除所有匹配的警报。 例如,如果您从 {% data variables.product.prodname_codeql %} 分析中删除了查询,您可以使用“Rule(规则)”过滤器仅列出该查询的警报,然后选择并删除所有这些警报。
|
||||
Optionally, you can use the free text search or the filters to display a subset of alerts and then delete all matching alerts at once. For example, if you have removed a query from {% data variables.product.prodname_codeql %} analysis, you can use the "Rule" filter to list just the alerts for that query and then select and delete all of those alerts.
|
||||
|
||||
{% ifversion ghes or ghae %}  {% else %}  {% endif %}{% endif %}
|
||||
1. 如果要忽略警报,请务必先了解警报,以便选择正确的忽略原因。 单击要了解的警报。
|
||||
 {%- ifversion comment-dismissed-code-scanning-alert %}
|
||||
1. 查看警报,然后单击“消除警报”并选择或键入关闭警报的原因。
|
||||
 {%- else %}
|
||||
1. 查看警报,然后单击“取消显示”并选择取消显示警报的原因。
|
||||
 {%- endif %} {% data reusables.code-scanning.choose-alert-dismissal-reason %}
|
||||
{% ifversion ghes or ghae %}
|
||||

|
||||
{% else %}
|
||||

|
||||
{% endif %}{% endif %}
|
||||
1. If you want to dismiss an alert, it's important to explore the alert first, so that you can choose the correct dismissal reason. Click the alert you'd like to explore.
|
||||

|
||||
{%- ifversion comment-dismissed-code-scanning-alert %}
|
||||
1. Review the alert, then click **Dismiss alert** and choose, or type, a reason for closing the alert.
|
||||

|
||||
{%- else %}
|
||||
1. Review the alert, then click **Dismiss** and choose a reason for closing the alert.
|
||||

|
||||
{%- endif %}
|
||||
{% data reusables.code-scanning.choose-alert-dismissal-reason %}
|
||||
|
||||
{% data reusables.code-scanning.false-positive-fix-codeql %}
|
||||
|
||||
### 一次忽略多个警报
|
||||
### Dismissing multiple alerts at once
|
||||
|
||||
如果项目有多个由于相同原因要忽略的警报,您可以从警报摘要中批量忽略它们。 通常,您需要过滤列表,然后忽略所有匹配的警报。 例如,您可能想要忽略项目中所有已标记为特定通用缺陷枚举 (CWE) 漏洞的当前警报。
|
||||
If a project has multiple alerts that you want to dismiss for the same reason, you can bulk dismiss them from the summary of alerts. Typically, you'll want to filter the list and then dismiss all of the matching alerts. For example, you might want to dismiss all of the current alerts in the project that have been tagged for a particular Common Weakness Enumeration (CWE) vulnerability.
|
||||
|
||||
## 延伸阅读
|
||||
## Further reading
|
||||
|
||||
- [会审拉取请求中的 {% data variables.product.prodname_code_scanning %} 警报](/code-security/secure-coding/triaging-code-scanning-alerts-in-pull-requests)
|
||||
- [为存储库设置 {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/setting-up-code-scanning-for-a-repository)
|
||||
- [关于与 {% data variables.product.prodname_code_scanning %} 的集成](/code-security/secure-coding/about-integration-with-code-scanning)
|
||||
- "[Triaging {% data variables.product.prodname_code_scanning %} alerts in pull requests](/code-security/secure-coding/triaging-code-scanning-alerts-in-pull-requests)"
|
||||
- "[Setting up {% data variables.product.prodname_code_scanning %} for a repository](/code-security/secure-coding/setting-up-code-scanning-for-a-repository)"
|
||||
- "[About integration with {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/about-integration-with-code-scanning)"
|
||||
|
||||
@@ -33,7 +33,7 @@ You decide how to generate {% data variables.product.prodname_code_scanning %} a
|
||||
|
||||
{% data reusables.code-scanning.enabling-options %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.4 or ghae-issue-6251 or ghec %}
|
||||
{% ifversion fpt or ghes > 3.4 or ghae > 3.4 or ghec %}
|
||||
{% data reusables.code-scanning.about-analysis-origins-link %}
|
||||
{% endif %}
|
||||
|
||||
@@ -153,7 +153,7 @@ The names of the {% data variables.product.prodname_code_scanning %} analysis ch
|
||||
|
||||
When the {% data variables.product.prodname_code_scanning %} jobs complete, {% data variables.product.prodname_dotcom %} works out whether any alerts were added by the pull request and adds the "{% data variables.product.prodname_code_scanning_capc %} results / TOOL NAME" entry to the list of checks. After {% data variables.product.prodname_code_scanning %} has been performed at least once, you can click **Details** to view the results of the analysis.
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-7095 %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
<!--Troubleshooting section no longer relevant-->
|
||||
{% elsif ghes < 3.5 or ghae %}
|
||||
If you used a pull request to add {% data variables.product.prodname_code_scanning %} to the repository, you will initially see {% ifversion ghes > 3.2 or ghae %}an "Analysis not found"{% elsif ghes = 3.2 %}a "Missing analysis"{% endif %} message when you click **Details** on the "{% data variables.product.prodname_code_scanning_capc %} results / TOOL NAME" check.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: 使用任务列表跟踪问题中的代码扫描警报
|
||||
title: Tracking code scanning alerts in issues using task lists
|
||||
shortTitle: Track alerts in issues
|
||||
intro: 您可以使用任务列表将代码扫描警报添加到议题中。 这样可以轻松创建包括修复警报在内的开发工作计划。
|
||||
intro: You can add code scanning alerts to issues using task lists. This makes it easy to create a plan for development work that includes fixing alerts.
|
||||
product: '{% data reusables.gated-features.code-scanning %}'
|
||||
permissions: 'If you have write permission to a repository you can track {% data variables.product.prodname_code_scanning %} alerts in issues using task lists.'
|
||||
versions:
|
||||
@@ -13,68 +13,76 @@ topics:
|
||||
- Alerts
|
||||
- Repositories
|
||||
- Issues
|
||||
ms.openlocfilehash: a5112bc5982415865a47d752af4e980a2e3d12ea
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '145099102'
|
||||
---
|
||||
|
||||
{% data reusables.code-scanning.beta-alert-tracking-in-issues %}
|
||||
|
||||
## 关于跟踪议题中的 {% data variables.product.prodname_code_scanning %} 警报
|
||||
## About tracking {% data variables.product.prodname_code_scanning %} alerts in issues
|
||||
|
||||
{% data reusables.code-scanning.github-issues-integration %}
|
||||
|
||||
您还可以创建新议题来跟踪警报:
|
||||
- 从 {% data variables.product.prodname_code_scanning %} 警报创建,这会自动将代码扫描警报添加到新议题的任务列表中。 有关详细信息,请参阅下面的“[从 {% data variables.product.prodname_code_scanning %} 警报创建跟踪问题](#creating-a-tracking-issue-from-a-code-scanning-alert)”。
|
||||
You can also create a new issue to track an alert:
|
||||
- From a {% data variables.product.prodname_code_scanning %} alert, which automatically adds the code scanning alert to a task list in the new issue. For more information, see "[Creating a tracking issue from a {% data variables.product.prodname_code_scanning %} alert](#creating-a-tracking-issue-from-a-code-scanning-alert)" below.
|
||||
|
||||
- 像往常一样通过 API 创建,然后在议题正文中提供代码扫描链接。 您必须使用任务列表语法来创建跟踪关系:
|
||||
- Via the API as you normally would, and then provide the code scanning link within the body of the issue. You must use the task list syntax to create the tracked relationship:
|
||||
- `- [ ] <full-URL- to-the-code-scanning-alert>`
|
||||
- 例如,如果将 `- [ ] https://github.com/octocat-org/octocat-repo/security/code-scanning/17` 添加到问题,该问题将在 `octocat-org` 组织的 `octocat-repo` 存储库的“安全性”选项卡中跟踪 ID 号为 17 的代码扫描警报。
|
||||
- For example, if you add `- [ ] https://github.com/octocat-org/octocat-repo/security/code-scanning/17` to an issue, the issue will track the code scanning alert that has an ID number of 17 in the "Security" tab of the `octocat-repo` repository in the `octocat-org` organization.
|
||||
|
||||
您可以使用多个议题来跟踪同一 {% data variables.product.prodname_code_scanning %} 警报,并且议题可属于找到 {% data variables.product.prodname_code_scanning %} 警报的存储库中的不同存储库。
|
||||
You can use more than one issue to track the same {% data variables.product.prodname_code_scanning %} alert, and issues can belong to different repositories from the repository where the {% data variables.product.prodname_code_scanning %} alert was found.
|
||||
|
||||
|
||||
{% data variables.product.product_name %} 在用户界面的不同位置提供视觉提示,以指示何时跟踪议题中的 {% data variables.product.prodname_code_scanning %} 警报。
|
||||
{% data variables.product.product_name %} provides visual cues in different locations of the user interface to indicate when you are tracking {% data variables.product.prodname_code_scanning %} alerts in issues.
|
||||
|
||||
- 代码扫描警报列表页将显示在议题中跟踪的警报,以便您可以一目了然地查看哪些警报仍需要处理。
|
||||
- The code scanning alerts list page will show which alerts are tracked in issues so that you can view at a glance which alerts still require processing.
|
||||
|
||||

|
||||

|
||||
|
||||
- “tracked in(跟踪)”部分也会显示在相应的警报页面中。
|
||||
- A "tracked in" section will also show in the corresponding alert page.
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6249 %}  {% else %}  {% endif %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||

|
||||
{% else %}
|
||||

|
||||
{% endif %}
|
||||
|
||||
- 在跟踪议题上,{% data variables.product.prodname_dotcom %} 会在任务列表和悬停卡上显示安全徽章图标。
|
||||
- On the tracking issue, {% data variables.product.prodname_dotcom %} displays a security badge icon in the task list and on the hovercard.
|
||||
|
||||
{% note %}
|
||||
|
||||
只有对存储库具有写入权限的用户才能看到议题中警报的展开 URL 以及悬停卡片。 对于对存储库具有读取权限或根本没有权限的用户,警报将显示为纯 URL。
|
||||
Only users with write permissions to the repository will see the unfurled URL to the alert in the issue, as well as the hovercard. For users with read permissions to the repository, or no permissions at all, the alert will appear as a plain URL.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
图标的颜色为灰色,因为警报在每个分支上的状态为“打开”或“关闭”。 议题跟踪警报,因此警报在议题中不能具有单个打开/关闭状态。 如果一个分支上的警报已关闭,则图标颜色不变。
|
||||
The color of the icon is grey because an alert has a status of "open" or "closed" on every branch. The issue tracks an alert, so the alert cannot have a single open/closed state in the issue. If the alert is closed on one branch, the icon color will not change.
|
||||
|
||||

|
||||

|
||||
|
||||
如果更改议题中相应任务列表项的复选框状态(选中/未选中),则跟踪的警报状态不会更改。
|
||||
The status of the tracked alert won't change if you change the checkbox state of the corresponding task list item (checked/unchecked) in the issue.
|
||||
|
||||
## 从代码扫描警报创建跟踪议题
|
||||
## Creating a tracking issue from a code scanning alert
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-security %} {% data reusables.repositories.sidebar-code-scanning-alerts %} {% ifversion fpt or ghes or ghae %} {% data reusables.code-scanning.explore-alert %}
|
||||
1. (可选)若要查找要跟踪的警报,可以使用自由文本搜索或下拉菜单来筛选和定位警报。 有关详细信息,请参阅“[管理存储库的代码扫描警报](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/managing-code-scanning-alerts-for-your-repository#filtering-code-scanning-alerts)”。
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-security %}
|
||||
{% data reusables.repositories.sidebar-code-scanning-alerts %}
|
||||
{% ifversion fpt or ghes or ghae %}
|
||||
{% data reusables.code-scanning.explore-alert %}
|
||||
1. Optionally, to find the alert to track, you can use the free-text search or the drop-down menus to filter and locate the alert. For more information, see "[Managing code scanning alerts for your repository](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/managing-code-scanning-alerts-for-your-repository#filtering-code-scanning-alerts)."
|
||||
{% endif %}
|
||||
1. 在页面顶部的右侧,单击“创建问题”。
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6249 %}  {% else %}  {% endif %} {% data variables.product.prodname_dotcom %} 自动创建问题以跟踪警报并将警报添加为任务列表项。
|
||||
{% data variables.product.prodname_dotcom %} 会预填议题:
|
||||
- 标题包含 {% data variables.product.prodname_code_scanning %} 警报的名称。
|
||||
- 正文包含任务列表项,其中包含 {% data variables.product.prodname_code_scanning %} 警报的完整 URL。
|
||||
2. (可选)编辑议题的标题和正文。
|
||||
1. Towards the top of the page, on the right side, click **Create issue**.
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||

|
||||
{% else %}
|
||||

|
||||
{% endif %}
|
||||
{% data variables.product.prodname_dotcom %} automatically creates an issue to track the alert and adds the alert as a task list item.
|
||||
{% data variables.product.prodname_dotcom %} prepopulates the issue:
|
||||
- The title contains the name of the {% data variables.product.prodname_code_scanning %} alert.
|
||||
- The body contains the task list item with the full URL to the {% data variables.product.prodname_code_scanning %} alert.
|
||||
2. Optionally, edit the title and the body of the issue.
|
||||
{% warning %}
|
||||
|
||||
警告:你可能需要编辑问题的标题,因为它可能会暴露安全信息。 您还可以编辑议题的正文,但不要编辑任务列表项,否则议题将不再跟踪警报。
|
||||
**Warning:** You may want to edit the title of the issue as it may expose security information. You can also edit the body of the issue, but do not edit the task list item or the issue will no longer track the alert.
|
||||
{% endwarning %}
|
||||
|
||||

|
||||
3. 单击“提交新问题”。
|
||||

|
||||
3. Click **Submit new issue**.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: 鉴定拉取请求中的代码扫描警报
|
||||
title: Triaging code scanning alerts in pull requests
|
||||
shortTitle: Triage alerts in pull requests
|
||||
intro: '当 {% data variables.product.prodname_code_scanning %} 在拉取请求中发现问题时,您可以审查高亮的代码并解决警报。'
|
||||
intro: 'When {% data variables.product.prodname_code_scanning %} identifies a problem in a pull request, you can review the highlighted code and resolve the alert.'
|
||||
product: '{% data reusables.gated-features.code-scanning %}'
|
||||
permissions: 'If you have read permission for a repository, you can see annotations on pull requests. With write permission, you can see detailed information and resolve {% data variables.product.prodname_code_scanning %} alerts for that repository.'
|
||||
redirect_from:
|
||||
@@ -20,96 +20,108 @@ topics:
|
||||
- Pull requests
|
||||
- Alerts
|
||||
- Repositories
|
||||
ms.openlocfilehash: 0b5fd364bcc9da7b0334214980ea943a4f12f74b
|
||||
ms.sourcegitcommit: 478f2931167988096ae6478a257f492ecaa11794
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/09/2022
|
||||
ms.locfileid: '147760868'
|
||||
---
|
||||
|
||||
|
||||
{% data reusables.code-scanning.beta %}
|
||||
|
||||
## 关于拉取请求上的 {% data variables.product.prodname_code_scanning %} 结果
|
||||
## About {% data variables.product.prodname_code_scanning %} results on pull requests
|
||||
|
||||
在仓库中,如果 {% data variables.product.prodname_code_scanning %} 被配置为拉取请求检查,则 {% data variables.product.prodname_code_scanning %} 将检查拉取请求中的代码。 默认情况下,这仅限于针对默认分支的拉取请求,但是您可以在 {% data variables.product.prodname_actions %} 或第三方 CI/CD 系统中更改此配置。 如果合并更改会向目标分支引入新的 {% data variables.product.prodname_code_scanning %} 警报,这些警报将在多个位置报告。
|
||||
In repositories where {% data variables.product.prodname_code_scanning %} is configured as a pull request check, {% data variables.product.prodname_code_scanning %} checks the code in the pull request. By default, this is limited to pull requests that target the default branch, but you can change this configuration within {% data variables.product.prodname_actions %} or in a third-party CI/CD system. If merging the changes would introduce new {% data variables.product.prodname_code_scanning %} alerts to the target branch, the alerts are reported in multiple places.
|
||||
|
||||
- 检查拉取请求 {% ifversion code-scanning-pr-conversations-tab %} 中的结果
|
||||
- 拉取请求的“对话”选项卡是拉取请求审查的一部分 {% endif %}
|
||||
- 拉取请求的“已更改的文件”选项卡
|
||||
- Check results in the pull request {% ifversion code-scanning-pr-conversations-tab %}
|
||||
- The **Conversation** tab of the pull request, as part of a pull request review {% endif %}
|
||||
- The **Files changed** tab of the pull request
|
||||
|
||||
如果你拥有存储库的写入权限,可以在“安全性”选项卡上看到任何现有的 {% data variables.product.prodname_code_scanning %} 警报。有关存储库警报的信息,请参阅“[管理存储库的 {% data variables.product.prodname_code_scanning %} 警报](/code-security/secure-coding/managing-code-scanning-alerts-for-your-repository)”。
|
||||
If you have write permission for the repository, you can see any existing {% data variables.product.prodname_code_scanning %} alerts on the **Security** tab. For information about repository alerts, see "[Managing {% data variables.product.prodname_code_scanning %} alerts for your repository](/code-security/secure-coding/managing-code-scanning-alerts-for-your-repository)."
|
||||
|
||||
{% ifversion fpt or ghes > 3.2 or ghae or ghec %} 当 {% data variables.product.prodname_code_scanning %} 配置为在每次推送代码时进行扫描的存储库中,{% data variables.product.prodname_code_scanning %} 还会将结果映射到任何打开的拉取请求,并将警报作为注释添加到与其他拉取请求检查相同的位置。 有关详细信息,请参阅“[推送时扫描](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#scanning-on-push)”。
|
||||
{% ifversion fpt or ghes > 3.2 or ghae or ghec %}
|
||||
In repositories where {% data variables.product.prodname_code_scanning %} is configured to scan each time code is pushed, {% data variables.product.prodname_code_scanning %} will also map the results to any open pull requests and add the alerts as annotations in the same places as other pull request checks. For more information, see "[Scanning on push](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#scanning-on-push)."
|
||||
{% endif %}
|
||||
|
||||
如果拉取请求针对使用 {% data variables.product.prodname_code_scanning %} 的受保护分支,并且存储库所有者已配置所需的状态检查,则“{% data variables.product.prodname_code_scanning_capc %} 结果”检查必须先通过,然后才能合并拉取请求。 有关详细信息,请参阅“[关于受保护的分支](/github/administering-a-repository/about-protected-branches#require-status-checks-before-merging)”。
|
||||
If your pull request targets a protected branch that uses {% data variables.product.prodname_code_scanning %}, and the repository owner has configured required status checks, then the "{% data variables.product.prodname_code_scanning_capc %} results" check must pass before you can merge the pull request. For more information, see "[About protected branches](/github/administering-a-repository/about-protected-branches#require-status-checks-before-merging)."
|
||||
|
||||
## 关于 {% data variables.product.prodname_code_scanning %} 作为拉取请求检查
|
||||
## About {% data variables.product.prodname_code_scanning %} as a pull request check
|
||||
|
||||
有许多选项可将 {% data variables.product.prodname_code_scanning %} 配置为拉取请求检查,因此每个仓库的确切设置会有所不同,有些仓库还会有多个检查。
|
||||
There are many options for configuring {% data variables.product.prodname_code_scanning %} as a pull request check, so the exact setup of each repository will vary and some will have more than one check.
|
||||
|
||||
### {% data variables.product.prodname_code_scanning_capc %} 结果检查
|
||||
### {% data variables.product.prodname_code_scanning_capc %} results check
|
||||
|
||||
对于 {% data variables.product.prodname_code_scanning %} 的所有配置,包含 {% data variables.product.prodname_code_scanning %} 结果的检查为:{% data variables.product.prodname_code_scanning_capc %} 结果。 所使用的每个分析工具的结果将单独显示。 由拉取请求中的更改引起的任何新警报都显示为注释。
|
||||
For all configurations of {% data variables.product.prodname_code_scanning %}, the check that contains the results of {% data variables.product.prodname_code_scanning %} is: **{% data variables.product.prodname_code_scanning_capc %} results**. The results for each analysis tool used are shown separately. Any new alerts caused by changes in the pull request are shown as annotations.
|
||||
|
||||
{% ifversion fpt or ghes > 3.2 or ghae or ghec %} 要查看所分析分支的完整警报集,请单击“查看所有分支警报”。 这将打开完整的警报视图,你可以在其中按类型、严重性、标记等筛选分支上的所有警报。有关详细信息,请参阅“[管理存储库的代码扫描警报](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/managing-code-scanning-alerts-for-your-repository#filtering-and-searching-for-code-scanning-alerts)”。
|
||||
{% ifversion fpt or ghes > 3.2 or ghae or ghec %} To see the full set of alerts for the analyzed branch, click **View all branch alerts**. This opens the full alert view where you can filter all the alerts on the branch by type, severity, tag, etc. For more information, see "[Managing code scanning alerts for your repository](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/managing-code-scanning-alerts-for-your-repository#filtering-and-searching-for-code-scanning-alerts)."
|
||||
|
||||
 {% endif %}
|
||||

|
||||
{% endif %}
|
||||
|
||||
### {% data variables.product.prodname_code_scanning_capc %} 结果检查失败
|
||||
### {% data variables.product.prodname_code_scanning_capc %} results check failures
|
||||
|
||||
如果 {% data variables.product.prodname_code_scanning %} 结果检查发现严重性为 `error``critical` 或 `high` 的问题,检查将失败并在检查结果中报告错误。 如果 {% data variables.product.prodname_code_scanning %} 发现的所有结果的严重性都较低,则警报将被视为警告或通知,检查成功。
|
||||
If the {% data variables.product.prodname_code_scanning %} results check finds any problems with a severity of `error`, `critical`, or `high`, the check fails and the error is reported in the check results. If all the results found by {% data variables.product.prodname_code_scanning %} have lower severities, the alerts are treated as warnings or notes and the check succeeds.
|
||||
|
||||

|
||||

|
||||
|
||||
你可以通过指定会导致拉取请求检查失败的严重级别和安全严重性来覆盖仓库设置中的默认行为。 有关详细信息,请参阅“[定义导致拉取请求检查失败的严重性](/code-security/secure-coding/configuring-code-scanning#defining-the-severities-causing-pull-request-check-failure)”。
|
||||
You can override the default behavior in your repository settings, by specifying the level of severities and security severities that will cause a pull request check failure. For more information, see "[Defining the severities causing pull request check failure](/code-security/secure-coding/configuring-code-scanning#defining-the-severities-causing-pull-request-check-failure)".
|
||||
|
||||
### 其他 {% data variables.product.prodname_code_scanning %} 检查
|
||||
### Other {% data variables.product.prodname_code_scanning %} checks
|
||||
|
||||
根据您的配置,您可能会看到在配置了 {% data variables.product.prodname_code_scanning %} 的拉取请求上运行其他检查。 这些通常是分析代码或上传 {% data variables.product.prodname_code_scanning %} 结果的工作流程。 当分析出现问题时,这些检查对于故障排除非常有用。
|
||||
Depending on your configuration, you may see additional checks running on pull requests with {% data variables.product.prodname_code_scanning %} configured. These are usually workflows that analyze the code or that upload {% data variables.product.prodname_code_scanning %} results. These checks are useful for troubleshooting when there are problems with the analysis.
|
||||
|
||||
例如,如果存储库使用 {% data variables.product.prodname_codeql_workflow %},则在结果检查运行之前,将针对每种语言运行 {% data variables.product.prodname_codeql %} / Analyze (LANGUAGE) 检查。 如果存在配置问题,或者拉取请求中断了分析需要编译的语言(例如 C/C ++、C# 或 Java)的构建,则分析检查可能会失败。
|
||||
For example, if the repository uses the {% data variables.product.prodname_codeql_workflow %} a **{% data variables.product.prodname_codeql %} / Analyze (LANGUAGE)** check is run for each language before the results check runs. The analysis check may fail if there are configuration problems, or if the pull request breaks the build for a language that the analysis needs to compile (for example, C/C++, C#, or Java).
|
||||
|
||||
与其他拉取请求检查一样,可以在“检查”选项卡上看到检查失败的完整详细信息。有关配置和故障排除的详细信息,请参阅“[配置 {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/configuring-code-scanning)”或“[对 {% data variables.product.prodname_codeql %} 工作流进行故障排除](/code-security/secure-coding/troubleshooting-the-codeql-workflow)”。
|
||||
As with other pull request checks, you can see full details of the check failure on the **Checks** tab. For more information about configuring and troubleshooting, see "[Configuring {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/configuring-code-scanning)" or "[Troubleshooting the {% data variables.product.prodname_codeql %} workflow](/code-security/secure-coding/troubleshooting-the-codeql-workflow)."
|
||||
|
||||
## 查看拉取请求上的警报
|
||||
|
||||
{% ifversion code-scanning-pr-conversations-tab %} 通过查看“对话”选项卡,可以看到拉取请求中引入的任何 {% data variables.product.prodname_code_scanning %} 警报。{% data variables.product.prodname_code_scanning_capc %} 会发布拉取请求审查,该审查将每个警报作为触发警报的代码行上的注释显示。 可以对警报进行注释、关闭警报并直接从注释中查看警报的路径。 可以通过单击“显示更多详细信息”链接来查看警报的完整详细信息,该链接将带你进入警报详细信息页面。
|
||||
|
||||

|
||||
|
||||
还可以在拉取请求的“已更改的文件”选项卡中查看所有 {% data variables.product.prodname_code_scanning %} 警报。 拉取请求中引入的更改差异之外的文件上的现有 {% data variables.product.prodname_code_scanning %} 警报将只显示在“已更改的文件”选项卡中。
|
||||
|
||||
{% else %} 通过显示“已更改的文件”选项卡,可以看到拉取请求中引入的任何 {% data variables.product.prodname_code_scanning %} 警报。每个警报都在触发警报的代码行上显示为一条注释。 警报的严重性显示在注释中。
|
||||
|
||||
 {% endif %}
|
||||
|
||||
如果您拥有仓库的写入权限,则某些注释将包含警报额外上下文的链接。 在上例中,可以在 {% data variables.product.prodname_codeql %} 分析中单击“用户提供的值”,以查看不受信任的数据进入数据流的位置(这称为源)。 在此例中,还可以通过单击“显示路径”来查看从源到使用数据的代码(池)的完整路径。 这样就很容易检查数据是否不受信任,或者分析是否无法识别源与池之间的数据净化步骤。 有关使用 {% data variables.product.prodname_codeql %} 分析数据流的信息,请参阅“[关于数据流分析](https://codeql.github.com/docs/writing-codeql-queries/about-data-flow-analysis/)”。
|
||||
|
||||
要查看有关警报的更多信息,拥有写入权限的用户可单击注释中所示的“显示更多详情”链接。 这允许您在警报视图中查看工具提供的所有上下文和元数据。 在下例中,您可以查看显示问题的严重性、类型和相关通用缺陷枚举 (CWE) 的标记。 该视图还显示哪个提交引入了问题。
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6249 %} {% data reusables.code-scanning.alert-default-branch %} {% endif %}
|
||||
|
||||
在警报的详细视图中,有些 {% data variables.product.prodname_code_scanning %} 工具(例如 {% data variables.product.prodname_codeql %} 分析)还包括问题描述和“显示更多”链接以指导你如何修复代码。
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6249 %}  {% else %}  {% endif %}
|
||||
## Viewing an alert on your pull request
|
||||
|
||||
{% ifversion code-scanning-pr-conversations-tab %}
|
||||
## 对拉取请求中的警报进行注释
|
||||
You can see any {% data variables.product.prodname_code_scanning %} alerts introduced in a pull request by viewing the **Conversation** tab. {% data variables.product.prodname_code_scanning_capc %} posts a pull request review that shows each alert as an annotation on the lines of code that triggered the alert. You can comment on the alerts, dismiss the alerts, and view paths for the alerts, directly from the annotations. You can view the full details of an alert by clicking the "Show more details" link, which will take you to the alert details page.
|
||||
|
||||
可以对由拉取请求中更改引入的任何 {% data variables.product.prodname_code_scanning %} 警报进行注释。 警报在拉取请求的“对话”选项卡中显示为注释,作为拉取请求审查的一部分,也显示在“已更改的文件”选项卡中。只能对拉取请求中的更改引入的警报进行注释 。 拉取请求中引入的更改之外的文件上的现有 {% data variables.product.prodname_code_scanning %} 警报将显示在“文件已更改”选项卡中,但不能注释。
|
||||

|
||||
|
||||
可以选择要求拉取请求中的所有对话(包括 {% data variables.product.prodname_code_scanning %} 警报上的对话),以在合并拉取请求之前被解析。 有关详细信息,请参阅“[关于受保护的分支](/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches#require-conversation-resolution-before-merging)”。
|
||||
You can also view all {% data variables.product.prodname_code_scanning %} alerts in the **Files changed** tab of the pull request. Existing {% data variables.product.prodname_code_scanning %} alerts on a file that are outside the diff of the changes introduced in the pull request will only appear in the **Files changed** tab.
|
||||
|
||||
{% else %}
|
||||
You can see any {% data variables.product.prodname_code_scanning %} alerts introduced in a pull request by displaying the **Files changed** tab. Each alert is shown as an annotation on the lines of code that triggered the alert. The severity of the alert is displayed in the annotation.
|
||||
|
||||

|
||||
{% endif %}
|
||||
## 修复拉取请求上的警报
|
||||
|
||||
任何对拉取请求具有推送权限的人都可以修复在该拉取请求上已识别的 {% data variables.product.prodname_code_scanning %} 警报。 如果将更改提交到拉取请求,这将触发拉取请求检查的新运行。 如果您的更改修复了问题,则警报将被关闭,注释将被删除。
|
||||
If you have write permission for the repository, some annotations contain links with extra context for the alert. In the example above, from {% data variables.product.prodname_codeql %} analysis, you can click **user-provided value** to see where the untrusted data enters the data flow (this is referred to as the source). In this case you can also view the full path from the source to the code that uses the data (the sink) by clicking **Show paths**. This makes it easy to check whether the data is untrusted or if the analysis failed to recognize a data sanitization step between the source and the sink. For information about analyzing data flow using {% data variables.product.prodname_codeql %}, see "[About data flow analysis](https://codeql.github.com/docs/writing-codeql-queries/about-data-flow-analysis/)."
|
||||
|
||||
## 忽略拉取请求上的警报
|
||||
To see more information about an alert, users with write permission can click the **Show more details** link shown in the annotation. This allows you to see all of the context and metadata provided by the tool in an alert view. In the example below, you can see tags showing the severity, type, and relevant common weakness enumerations (CWEs) for the problem. The view also shows which commit introduced the problem.
|
||||
|
||||
关闭警报的另一种办法是忽略它。 您可以忽略您认为不需要修复的警报。 {% data reusables.code-scanning.close-alert-examples %} 如果你拥有存储库的写入权限,则“忽略”按钮在代码注释和警报摘要中可用。 单击“忽略”时,系统会提示你选择关闭警报的原因。
|
||||
{% ifversion comment-dismissed-code-scanning-alert %}  {% else %}  {% endif %} {% data reusables.code-scanning.choose-alert-dismissal-reason %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
{% data reusables.code-scanning.alert-default-branch %}
|
||||
{% endif %}
|
||||
|
||||
In the detailed view for an alert, some {% data variables.product.prodname_code_scanning %} tools, like {% data variables.product.prodname_codeql %} analysis, also include a description of the problem and a **Show more** link for guidance on how to fix your code.
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||

|
||||
{% else %}
|
||||

|
||||
{% endif %}
|
||||
|
||||
{% ifversion code-scanning-pr-conversations-tab %}
|
||||
## Commenting on an alert in a pull request
|
||||
|
||||
You can comment on any {% data variables.product.prodname_code_scanning %} alert introduced by the changes in a pull request. Alerts appear as annotations in the **Conversation** tab of a pull request, as part of a pull request review, and also are shown in the **Files changed** tab. You can only comment on alerts introduced by the changes in a pull request. Existing {% data variables.product.prodname_code_scanning %} alerts, on files that are outside the changes introduced in the pull request, will appear in the **Files changed** tab but cannot be commented on.
|
||||
|
||||
You can choose to require all conversations in a pull request, including those on {% data variables.product.prodname_code_scanning %} alerts, to be resolved before a pull request can be merged. For more information, see "[About protected branches](/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches#require-conversation-resolution-before-merging)."
|
||||
{% endif %}
|
||||
## Fixing an alert on your pull request
|
||||
|
||||
Anyone with push access to a pull request can fix a {% data variables.product.prodname_code_scanning %} alert that's identified on that pull request. If you commit changes to the pull request this triggers a new run of the pull request checks. If your changes fix the problem, the alert is closed and the annotation removed.
|
||||
|
||||
## Dismissing an alert on your pull request
|
||||
|
||||
An alternative way of closing an alert is to dismiss it. You can dismiss an alert if you don't think it needs to be fixed. {% data reusables.code-scanning.close-alert-examples %} If you have write permission for the repository, the **Dismiss** button is available in code annotations and in the alerts summary. When you click **Dismiss** you will be prompted to choose a reason for closing the alert.
|
||||
{% ifversion comment-dismissed-code-scanning-alert %}
|
||||

|
||||
{% else %}
|
||||

|
||||
{% endif %}
|
||||
{% data reusables.code-scanning.choose-alert-dismissal-reason %}
|
||||
|
||||
{% data reusables.code-scanning.false-positive-fix-codeql %}
|
||||
|
||||
有关消除警报的详细信息,请参阅 {% ifversion delete-code-scanning-alerts %}“[管理存储库的 {% data variables.product.prodname_code_scanning %} 警报](/code-security/secure-coding/managing-code-scanning-alerts-for-your-repository#dismissing-or-deleting-alerts)”。{% else %}“[管理存储库的 {% data variables.product.prodname_code_scanning %} 警报](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/managing-code-scanning-alerts-for-your-repository#dismissing--alerts)”。{% endif %}
|
||||
For more information about dismissing alerts, see {% ifversion delete-code-scanning-alerts %}"[Managing {% data variables.product.prodname_code_scanning %} alerts for your repository](/code-security/secure-coding/managing-code-scanning-alerts-for-your-repository#dismissing-or-deleting-alerts)."{% else %} "[Managing {% data variables.product.prodname_code_scanning %} alerts for your repository](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/managing-code-scanning-alerts-for-your-repository#dismissing--alerts)."{% endif %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: CodeQL 工作流程疑难解答
|
||||
title: Troubleshooting the CodeQL workflow
|
||||
shortTitle: Troubleshoot CodeQL workflow
|
||||
intro: '如果您在 {% data variables.product.prodname_code_scanning %} 方面遇到问题,可使用这些提示来解决问题。'
|
||||
intro: 'If you''re having problems with {% data variables.product.prodname_code_scanning %}, you can troubleshoot by using these tips for resolving issues.'
|
||||
product: '{% data reusables.gated-features.code-scanning %}'
|
||||
miniTocMaxHeadingLevel: 3
|
||||
redirect_from:
|
||||
@@ -26,52 +26,51 @@ topics:
|
||||
- C/C++
|
||||
- C#
|
||||
- Java
|
||||
ms.openlocfilehash: f4de6a52db9651ed1ad6db49959fffbf696aea9a
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147444619'
|
||||
---
|
||||
{% data reusables.code-scanning.beta %} {% data reusables.code-scanning.not-available %}
|
||||
|
||||
{% ifversion ghes or ghae %} {% note %}
|
||||
|
||||
注意:本文介绍了此版 {% data variables.product.product_name %} 的初始发行版中包含的 CodeQL 操作版本和相关 CodeQL CLI 捆绑包中可用的功能。 如果企业使用较新版本的 CodeQL 操作,请参阅 [{% data variables.product.prodname_ghe_cloud %} 一文](/enterprise-cloud@latest/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/troubleshooting-the-codeql-workflow),了解有关最新功能的信息。 {% ifversion not ghae %}有关使用最新版本的信息,请参阅“[为设备配置代码扫描](/admin/advanced-security/configuring-code-scanning-for-your-appliance#configuring-codeql-analysis-on-a-server-without-internet-access)”。{% endif %}
|
||||
{% data reusables.code-scanning.beta %}
|
||||
{% data reusables.code-scanning.not-available %}
|
||||
|
||||
{% endnote %} {% endif %}
|
||||
{% ifversion ghes or ghae %}
|
||||
{% note %}
|
||||
|
||||
## 生成详细的调试日志
|
||||
**Note:** This article describes the features available with the version of the CodeQL action and associated CodeQL CLI bundle included in the initial release of this version of {% data variables.product.product_name %}. If your enterprise uses a more recent version of the CodeQL action, see the [{% data variables.product.prodname_ghe_cloud %} article](/enterprise-cloud@latest/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/troubleshooting-the-codeql-workflow) for information on the latest features. {% ifversion not ghae %} For information on using the latest version, see "[Configuring code scanning for your appliance](/admin/advanced-security/configuring-code-scanning-for-your-appliance#configuring-codeql-analysis-on-a-server-without-internet-access)."{% endif %}
|
||||
|
||||
要生成更详细的日志输出,您可以启用步骤调试日志记录。 有关详细信息,请参阅“[启用调试日志记录](/actions/managing-workflow-runs/enabling-debug-logging#enabling-step-debug-logging)”。
|
||||
{% endnote %}
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5601 %}
|
||||
## Producing detailed logs for debugging
|
||||
|
||||
## 创建 {% data variables.product.prodname_codeql %} 调试工件
|
||||
To produce more detailed logging output, you can enable step debug logging. For more information, see "[Enabling debug logging](/actions/managing-workflow-runs/enabling-debug-logging#enabling-step-debug-logging)."
|
||||
|
||||
可以获取生成工件来帮助你调试 {% data variables.product.prodname_codeql %}。
|
||||
调试工件作为名为 `debug-artifacts` 的工件上传到工作流运行。 数据包含 {% data variables.product.prodname_codeql %} 日志、 {% data variables.product.prodname_codeql %} 数据库以及工作流程生成的任何 SARIF 文件。
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
|
||||
这些生成工件将帮助你调试 {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %} 的问题。 如果您联系 GitHub 支持人员,他们可能会要求您提供此数据。
|
||||
## Creating {% data variables.product.prodname_codeql %} debugging artifacts
|
||||
|
||||
You can obtain artifacts to help you debug {% data variables.product.prodname_codeql %}.
|
||||
The debug artifacts will be uploaded to the workflow run as an artifact named `debug-artifacts`. The data contains the {% data variables.product.prodname_codeql %} logs, {% data variables.product.prodname_codeql %} database(s), and any SARIF file(s) produced by the workflow.
|
||||
|
||||
These artifacts will help you debug problems with {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %}. If you contact GitHub support, they might ask for this data.
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% ifversion codeql-action-debug-logging %}
|
||||
|
||||
### 通过重新运行启用调试日志记录的作业来创建 {% data variables.product.prodname_codeql %} 调试生成工件
|
||||
### Creating {% data variables.product.prodname_codeql %} debugging artifacts by re-running jobs with debug logging enabled
|
||||
|
||||
可以通过启用调试日志记录和重新运行作业来创建 {% data variables.product.prodname_codeql %} 调试生成工件。 有关重新运行 {% data variables.product.prodname_actions %} 工作流和作业的详细信息,请参阅“[重新运行工作流和作业](/actions/managing-workflow-runs/re-running-workflows-and-jobs)”。
|
||||
You can create {% data variables.product.prodname_codeql %} debugging artifacts by enabling debug logging and re-running the jobs. For more information about re-running {% data variables.product.prodname_actions %} workflows and jobs, see "[Re-running workflows and jobs](/actions/managing-workflow-runs/re-running-workflows-and-jobs)."
|
||||
|
||||
需要确保选择“启用调试日志记录”。 此选项将为运行启用运行器诊断日志记录和步骤调试日志记录。 然后你便可以下载 `debug-artifacts` 进行进一步调查。 通过重新运行作业创建 {% data variables.product.prodname_codeql %} 调试生成工件时,无需修改工作流文件。
|
||||
You need to ensure that you select **Enable debug logging** . This option enables runner diagnostic logging and step debug logging for the run. You'll then be able to download `debug-artifacts` to investigate further. You do not need to modify the workflow file when creating {% data variables.product.prodname_codeql %} debugging artifacts by re-running jobs.
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5601 %}
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
|
||||
### 创建 {% data variables.product.prodname_codeql %} 调试生成工件
|
||||
### Creating {% data variables.product.prodname_codeql %} debugging artifacts using a workflow flag
|
||||
|
||||
可以通过在工作流中使用标志来创建 {% data variables.product.prodname_codeql %} 调试生成工件。 为此,需要修改 {% data variables.product.prodname_codeql_workflow %} 文件的 `init` 步骤并设置 `debug: true`。
|
||||
You can create {% data variables.product.prodname_codeql %} debugging artifacts by using a flag in your workflow. For this, you need to modify the `init` step of your {% data variables.product.prodname_codeql_workflow %} file and set `debug: true`.
|
||||
|
||||
```yaml
|
||||
- name: Initialize CodeQL
|
||||
@@ -82,15 +81,15 @@ ms.locfileid: '147444619'
|
||||
|
||||
{% endif %}
|
||||
|
||||
## 编译语言的自动构建失败
|
||||
## Automatic build for a compiled language fails
|
||||
|
||||
如果项目中编译语言的代码自动构建失败,请尝试以下疑难解答步骤。
|
||||
If an automatic build of code for a compiled language within your project fails, try the following troubleshooting steps.
|
||||
|
||||
- 从 {% data variables.product.prodname_code_scanning %} 工作流中删除 `autobuild` 步骤,并添加特定构建步骤。 有关编辑工作流的信息,请参阅“[配置 {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/configuring-code-scanning#editing-a-code-scanning-workflow)”。 有关替换 `autobuild` 步骤的详细信息,请参阅“[为已编译语言配置 {% data variables.product.prodname_codeql %} 工作流](/code-security/secure-coding/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language)”。
|
||||
- Remove the `autobuild` step from your {% data variables.product.prodname_code_scanning %} workflow and add specific build steps. For information about editing the workflow, see "[Configuring {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/configuring-code-scanning#editing-a-code-scanning-workflow)." For more information about replacing the `autobuild` step, see "[Configuring the {% data variables.product.prodname_codeql %} workflow for compiled languages](/code-security/secure-coding/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language)."
|
||||
|
||||
- 如果您的工作流程未明确指定要分析的语言,则 {% data variables.product.prodname_codeql %} 会隐式检测代码库中支持的语言。 在此配置中,对于编译语言 C/C++、C# 和 Java,{% data variables.product.prodname_codeql %} 只分析涵盖最多源文件的语言。 编辑工作流并添加一个矩阵,以指定要分析的语言。 默认的 CodeQL 分析工作流程使用这种矩阵。
|
||||
- If your workflow doesn't explicitly specify the languages to analyze, {% data variables.product.prodname_codeql %} implicitly detects the supported languages in your code base. In this configuration, out of the compiled languages C/C++, C#, and Java, {% data variables.product.prodname_codeql %} only analyzes the language with the most source files. Edit the workflow and add a matrix specifying the languages you want to analyze. The default CodeQL analysis workflow uses such a matrix.
|
||||
|
||||
以下工作流程摘录显示了如何在作业策略中使用矩阵来指定语言,然后在“初始化 {% data variables.product.prodname_codeql %}”步骤中引用每种语言:
|
||||
The following extracts from a workflow show how you can use a matrix within the job strategy to specify languages, and then reference each language within the "Initialize {% data variables.product.prodname_codeql %}" step:
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@@ -112,15 +111,15 @@ ms.locfileid: '147444619'
|
||||
languages: {% raw %}${{ matrix.language }}{% endraw %}
|
||||
```
|
||||
|
||||
有关编辑工作流的详细信息,请参阅“[配置代码扫描](/code-security/secure-coding/configuring-code-scanning)”。
|
||||
For more information about editing the workflow, see "[Configuring code scanning](/code-security/secure-coding/configuring-code-scanning)."
|
||||
|
||||
## 构建过程中找不到代码
|
||||
## No code found during the build
|
||||
|
||||
如果工作流失败并出现错误 `No source code was seen during the build` 或 `The process '/opt/hostedtoolcache/CodeQL/0.0.0-20200630/x64/codeql/codeql' failed with exit code 32`,则表示 {% data variables.product.prodname_codeql %} 无法监视代码。 有几个原因可以解释这种失败:
|
||||
If your workflow fails with an error `No source code was seen during the build` or `The process '/opt/hostedtoolcache/CodeQL/0.0.0-20200630/x64/codeql/codeql' failed with exit code 32`, this indicates that {% data variables.product.prodname_codeql %} was unable to monitor your code. Several reasons can explain such a failure:
|
||||
|
||||
1. 存储库可能不包含以 {% data variables.product.prodname_codeql %} 支持的语言编写的源代码。 检查受支持的语言列表,如果是这种情况,请删除 {% data variables.product.prodname_codeql %} 工作流。 有关详细信息,请参阅“[关于使用 CodeQL 进行代码扫描](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-with-codeql#about-codeql)”。
|
||||
1. The repository may not contain source code that is written in languages supported by {% data variables.product.prodname_codeql %}. Check the list of supported languages and, if this is the case, remove the {% data variables.product.prodname_codeql %} workflow. For more information, see "[About code scanning with CodeQL](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-with-codeql#about-codeql)
|
||||
|
||||
1. 自动语言检测发现了受支持的语言,但仓库中没有该语言的可分析代码。 一个典型的例子是,我们的语言检测服务发现了一个与特定的编程语言相关的文件,例如 `.h` 或 `.gyp` 文件,但存储库中没有相应的可执行代码。 要解决此问题,可通过更新 `language` 矩阵中的语言列表来手动定义要分析的语言。 例如,以下配置将仅分析 Go 和 JavaScript。
|
||||
1. Automatic language detection identified a supported language, but there is no analyzable code of that language in the repository. A typical example is when our language detection service finds a file associated with a particular programming language like a `.h`, or `.gyp` file, but no corresponding executable code is present in the repository. To solve the problem, you can manually define the languages you want to analyze by updating the list of languages in the `language` matrix. For example, the following configuration will analyze only Go, and JavaScript.
|
||||
|
||||
```yaml
|
||||
strategy:
|
||||
@@ -131,46 +130,46 @@ ms.locfileid: '147444619'
|
||||
language: ['go', 'javascript']
|
||||
```
|
||||
|
||||
有关详细信息,请参阅上述“[编译语言的自动生成失败](#automatic-build-for-a-compiled-language-fails)”中的工作流提取。
|
||||
1. {% data variables.product.prodname_code_scanning %} 工作流程在分析一种已编译的语言(C、C++、C# 或 Java),但代码尚未编译。 默认情况下,{% data variables.product.prodname_codeql %} 分析工作流包含 `autobuild` 步骤,但是,此步骤是一个尽力而为的过程,可能无法成功构建你的代码,具体取决于你的特定构建环境。 如果你删除了 `autobuild` 步骤但没有手动添加构建步骤,编译也可能会失败。 有关指定构建步骤的详细信息,请参阅“[为已编译语言配置 {% data variables.product.prodname_codeql %} 工作流](/code-security/secure-coding/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language)”。
|
||||
1. 工作流程在分析一种编译语言(C、C++、C# 或 Java),但构建的一部分被缓存以提高性能(最有可能发生在 Gradle 或 Bazel 等构建系统中)。 因为 {% data variables.product.prodname_codeql %} 观察编译器的活动以了解仓库中的数据流,因此 {% data variables.product.prodname_codeql %} 需要进行完整的构建才能执行分析。
|
||||
1. 工作流可分析编译语言(C、C++、C# 或 Java),但工作流程中的 `init` 与 `analyze` 步骤之间不发生编译。 {% data variables.product.prodname_codeql %} 需要这两个步骤之间发生构建以观察编译器的活动并执行分析。
|
||||
1. 您的编译代码(使用 C、C ++、C# 或 Java)已成功编译,但 {% data variables.product.prodname_codeql %} 无法检测到编译器调用。 最常见原因是:
|
||||
For more information, see the workflow extract in "[Automatic build for a compiled language fails](#automatic-build-for-a-compiled-language-fails)" above.
|
||||
1. Your {% data variables.product.prodname_code_scanning %} workflow is analyzing a compiled language (C, C++, C#, or Java), but the code was not compiled. By default, the {% data variables.product.prodname_codeql %} analysis workflow contains an `autobuild` step, however, this step represents a best effort process, and may not succeed in building your code, depending on your specific build environment. Compilation may also fail if you have removed the `autobuild` step and did not include build steps manually. For more information about specifying build steps, see "[Configuring the {% data variables.product.prodname_codeql %} workflow for compiled languages](/code-security/secure-coding/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language)."
|
||||
1. Your workflow is analyzing a compiled language (C, C++, C#, or Java), but portions of your build are cached to improve performance (most likely to occur with build systems like Gradle or Bazel). Since {% data variables.product.prodname_codeql %} observes the activity of the compiler to understand the data flows in a repository, {% data variables.product.prodname_codeql %} requires a complete build to take place in order to perform analysis.
|
||||
1. Your workflow is analyzing a compiled language (C, C++, C#, or Java), but compilation does not occur between the `init` and `analyze` steps in the workflow. {% data variables.product.prodname_codeql %} requires that your build happens in between these two steps in order to observe the activity of the compiler and perform analysis.
|
||||
1. Your compiled code (in C, C++, C#, or Java) was compiled successfully, but {% data variables.product.prodname_codeql %} was unable to detect the compiler invocations. The most common causes are:
|
||||
|
||||
* 在独立于 {% data variables.product.prodname_codeql %} 的容器中运行构建过程。 有关详细信息,请参阅[在容器中运行 CodeQL 代码扫描](/code-security/secure-coding/running-codeql-code-scanning-in-a-container)。
|
||||
* 使用 GitHub Actions 外部的分布式构建系统,使用守护进程构建。
|
||||
* {% data variables.product.prodname_codeql %} 不知道您使用的特定编译器。
|
||||
* Running your build process in a separate container to {% data variables.product.prodname_codeql %}. For more information, see "[Running CodeQL code scanning in a container](/code-security/secure-coding/running-codeql-code-scanning-in-a-container)."
|
||||
* Building using a distributed build system external to GitHub Actions, using a daemon process.
|
||||
* {% data variables.product.prodname_codeql %} isn't aware of the specific compiler you are using.
|
||||
|
||||
对于 .NET Framework 项目以及使用 `dotnet build` 或 `msbuild` 的 C# 项目,应在构建代码时在工作流的 `run` 步骤中指定 `/p:UseSharedCompilation=false`。
|
||||
For .NET Framework projects, and for C# projects using either `dotnet build` or `msbuild`, you should specify `/p:UseSharedCompilation=false` in your workflow's `run` step, when you build your code.
|
||||
|
||||
例如,以下 C# 的配置将在第一个构建步骤中传递标志。
|
||||
For example, the following configuration for C# will pass the flag during the first build step.
|
||||
|
||||
``` yaml
|
||||
- run: |
|
||||
dotnet build /p:UseSharedCompilation=false
|
||||
```
|
||||
|
||||
如果您在特定编译器或配置方面遇到其他问题,请联系 {% data variables.contact.contact_support %}。
|
||||
If you encounter another problem with your specific compiler or configuration, contact {% data variables.contact.contact_support %}.
|
||||
|
||||
有关指定构建步骤的详细信息,请参阅“[为已编译语言配置 {% data variables.product.prodname_codeql %} 工作流](/code-security/secure-coding/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language)”。
|
||||
For more information about specifying build steps, see "[Configuring the {% data variables.product.prodname_codeql %} workflow for compiled languages](/code-security/secure-coding/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language)."
|
||||
|
||||
{% ifversion fpt or ghes > 3.1 or ghae or ghec %}
|
||||
## 扫描的代码行数低于预期
|
||||
## Lines of code scanned are lower than expected
|
||||
|
||||
对于 C/C++、C#、Go 和 Java 等编译语言,{% data variables.product.prodname_codeql %} 仅扫描在分析过程中生成的文件。 因此,如果某些源代码未正确编译,则扫描的代码行数将低于预期。 这可能是多种原因引起的:
|
||||
For compiled languages like C/C++, C#, Go, and Java, {% data variables.product.prodname_codeql %} only scans files that are built during the analysis. Therefore the number of lines of code scanned will be lower than expected if some of the source code isn't compiled correctly. This can happen for several reasons:
|
||||
|
||||
1. {% data variables.product.prodname_codeql %} `autobuild` 功能使用启发式方法在存储库中生成代码。 但是,有时这种方法会导致对存储库的分析不完整。 例如,当单个存储库中存在多个 `build.sh` 命令时,分析可能不完整,因为 `autobuild` 步骤将仅执行其中一个命令,因此可能无法编译某些源文件。
|
||||
1. 某些编译器无法使用 {% data variables.product.prodname_codeql %} ,因此在分析代码时可能会导致问题。 例如,Lombok 项目使用非公共编译器 API 来修改编译器行为。 这些编译器修改中使用的假设不适用于 {% data variables.product.prodname_codeql %} 的 Java 提取器,因此无法分析代码。
|
||||
1. The {% data variables.product.prodname_codeql %} `autobuild` feature uses heuristics to build the code in a repository. However, sometimes this approach results in an incomplete analysis of a repository. For example, when multiple `build.sh` commands exist in a single repository, the analysis may not be complete since the `autobuild` step will only execute one of the commands, and therefore some source files may not be compiled.
|
||||
1. Some compilers do not work with {% data variables.product.prodname_codeql %} and can cause issues while analyzing the code. For example, Project Lombok uses non-public compiler APIs to modify compiler behavior. The assumptions used in these compiler modifications are not valid for {% data variables.product.prodname_codeql %}'s Java extractor, so the code cannot be analyzed.
|
||||
|
||||
如果 {% data variables.product.prodname_codeql %} 分析扫描的代码行数少于预期,则可以尝试使用多种方法来确保编译了所有必需的源文件。
|
||||
If your {% data variables.product.prodname_codeql %} analysis scans fewer lines of code than expected, there are several approaches you can try to make sure all the necessary source files are compiled.
|
||||
|
||||
### 替换 `autobuild` 步骤
|
||||
### Replace the `autobuild` step
|
||||
|
||||
将 `autobuild` 步骤替换为将在生产中使用的相同生成命令。 这可以确保 {% data variables.product.prodname_codeql %} 确切地知道如何编译要扫描的所有源文件。
|
||||
有关详细信息,请参阅“[为已编译语言配置 {% data variables.product.prodname_codeql %} 工作流](/code-security/secure-coding/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language)”。
|
||||
Replace the `autobuild` step with the same build commands you would use in production. This makes sure that {% data variables.product.prodname_codeql %} knows exactly how to compile all of the source files you want to scan.
|
||||
For more information, see "[Configuring the {% data variables.product.prodname_codeql %} workflow for compiled languages](/code-security/secure-coding/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language)."
|
||||
|
||||
### 检查 {% data variables.product.prodname_codeql %} 数据库中源文件的副本
|
||||
您可以通过检查 {% data variables.product.prodname_codeql %} 数据库中包含的源代码副本来了解为什么没有分析某些源文件。 要从 Actions 工作流中获取数据库,请修改 {% data variables.product.prodname_codeql %} 工作流文件的 `init` 步骤,并设置 `debug: true`。
|
||||
### Inspect the copy of the source files in the {% data variables.product.prodname_codeql %} database
|
||||
You may be able to understand why some source files haven't been analyzed by inspecting the copy of the source code included with the {% data variables.product.prodname_codeql %} database. To obtain the database from your Actions workflow, modify the `init` step of your {% data variables.product.prodname_codeql %} workflow file and set `debug: true`.
|
||||
|
||||
```yaml
|
||||
- name: Initialize CodeQL
|
||||
@@ -179,86 +178,89 @@ ms.locfileid: '147444619'
|
||||
debug: true
|
||||
```
|
||||
|
||||
这会将数据库作为操作构件上传,您可以将其下载到本地计算机。 有关详细信息,请参阅“[存储工作流工件](/actions/guides/storing-workflow-data-as-artifacts)”。
|
||||
This uploads the database as an actions artifact that you can download to your local machine. For more information, see "[Storing workflow artifacts](/actions/guides/storing-workflow-data-as-artifacts)."
|
||||
|
||||
该构件将包含由名为 src.zip 的 {% data variables.product.prodname_codeql %} 扫描的源文件存档副本。 如果比较存储库中的源代码文件和 src.zip 中的文件,则可以看到缺少哪些类型的文件。 一旦您知道了哪些类型的文件没有被分析,就更容易理解了如何更改 {% data variables.product.prodname_codeql %} 分析的工作流程。
|
||||
The artifact will contain an archived copy of the source files scanned by {% data variables.product.prodname_codeql %} called _src.zip_. If you compare the source code files in the repository and the files in _src.zip_, you can see which types of file are missing. Once you know what types of file are not being analyzed, it is easier to understand how you may need to change the workflow for {% data variables.product.prodname_codeql %} analysis.
|
||||
|
||||
## 在生成的代码中找到的警报
|
||||
## Alerts found in generated code
|
||||
|
||||
{% data reusables.code-scanning.alerts-found-in-generated-code %}
|
||||
|
||||
## 数据库中的提取错误
|
||||
## Extraction errors in the database
|
||||
|
||||
{% data variables.product.prodname_codeql %} 团队不断处理关键的提取错误,以确保可以扫描所有源文件。 但是,{% data variables.product.prodname_codeql %} 提取程序偶尔会在数据库创建过程中生成错误。 {% data variables.product.prodname_codeql %} 提供有关在日志文件中创建数据库期间生成的提取错误和警告的信息。 提取诊断信息指示数据库的整体运行状况。 大多数提取程序错误不会显著影响分析。 少量提取程序错误是正常的,通常表示分析状态良好。
|
||||
The {% data variables.product.prodname_codeql %} team constantly works on critical extraction errors to make sure that all source files can be scanned. However, the {% data variables.product.prodname_codeql %} extractors do occasionally generate errors during database creation. {% data variables.product.prodname_codeql %} provides information about extraction errors and warnings generated during database creation in a log file.
|
||||
The extraction diagnostics information gives an indication of overall database health. Most extractor errors do not significantly impact the analysis. A small number of extractor errors is healthy and typically indicates a good state of analysis.
|
||||
|
||||
但是,如果在数据库创建期间编译的绝大多数文件中看到提取程序错误,则应更详细地查看这些错误,以尝试了解为什么某些源文件未正确提取。
|
||||
However, if you see extractor errors in the overwhelming majority of files that were compiled during database creation, you should look into the errors in more detail to try to understand why some source files weren't extracted properly.
|
||||
|
||||
{% else %}
|
||||
## 我的存储库中有部分内容未使用 `autobuild` 进行分析
|
||||
## Portions of my repository were not analyzed using `autobuild`
|
||||
|
||||
{% data variables.product.prodname_codeql %} `autobuild` 功能使用启发式方法在存储库中构建代码,但有时这种方法会导致对存储库的分析不完整。 例如,当单个存储库中存在多个 `build.sh` 命令时,分析可能不完整,因为 `autobuild` 步骤将只执行其中一个命令。 解决方案是将 `autobuild` 步骤替换为可构建要分析的所有源代码的构建步骤。 有关详细信息,请参阅“[为已编译语言配置 {% data variables.product.prodname_codeql %} 工作流](/code-security/secure-coding/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language)”。
|
||||
The {% data variables.product.prodname_codeql %} `autobuild` feature uses heuristics to build the code in a repository, however, sometimes this approach results in incomplete analysis of a repository. For example, when multiple `build.sh` commands exist in a single repository, the analysis may not complete since the `autobuild` step will only execute one of the commands. The solution is to replace the `autobuild` step with build steps which build all of the source code which you wish to analyze. For more information, see "[Configuring the {% data variables.product.prodname_codeql %} workflow for compiled languages](/code-security/secure-coding/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language)."
|
||||
{% endif %}
|
||||
|
||||
## 构建耗时过长
|
||||
## The build takes too long
|
||||
|
||||
如果使用 {% data variables.product.prodname_codeql %} 分析进行的构建花费的时间太长,则可以尝试几种方法来减少构建时间。
|
||||
If your build with {% data variables.product.prodname_codeql %} analysis takes too long to run, there are several approaches you can try to reduce the build time.
|
||||
|
||||
### 增加内存或内核
|
||||
### Increase the memory or cores
|
||||
|
||||
如果使用自托管运行器运行 {% data variables.product.prodname_codeql %} 分析,您可以增加这些运行器上的内存或内核数。
|
||||
If you use self-hosted runners to run {% data variables.product.prodname_codeql %} analysis, you can increase the memory or the number of cores on those runners.
|
||||
|
||||
### 使用矩阵构建来并行化分析
|
||||
### Use matrix builds to parallelize the analysis
|
||||
|
||||
默认 {% data variables.product.prodname_codeql_workflow %} 使用语言的矩阵,这会导致每种语言的分析并行运行。 如果在“初始化 CodeQL”步骤中指定了要直接分析的语言,则将依次进行每种语言的分析。 要加快对多种语言的分析,请修改工作流程以使用矩阵。 有关详细信息,请参阅上述“[编译语言的自动生成失败](#automatic-build-for-a-compiled-language-fails)”中的工作流提取。
|
||||
The default {% data variables.product.prodname_codeql_workflow %} uses a matrix of languages, which causes the analysis of each language to run in parallel. If you have specified the languages you want to analyze directly in the "Initialize CodeQL" step, analysis of each language will happen sequentially. To speed up analysis of multiple languages, modify your workflow to use a matrix. For more information, see the workflow extract in "[Automatic build for a compiled language fails](#automatic-build-for-a-compiled-language-fails)" above.
|
||||
|
||||
### 减少单个工作流程中要分析的代码量
|
||||
### Reduce the amount of code being analyzed in a single workflow
|
||||
|
||||
分析时间通常与所分析的代码量成正比。 您可以通过减少一次分析的代码量来缩短分析时间,例如,排除测试代码,或将分析分解为多个工作流程,这些工作流程一次只分析一部分代码。
|
||||
Analysis time is typically proportional to the amount of code being analyzed. You can reduce the analysis time by reducing the amount of code being analyzed at once, for example, by excluding test code, or breaking analysis into multiple workflows that analyze only a subset of your code at a time.
|
||||
|
||||
{% data reusables.code-scanning.alerts-found-in-generated-code %}
|
||||
|
||||
如果你按上文所述将分析拆分为多个工作流,我们仍然建议你至少保留一个按 `schedule` 运行的工作流分析存储库中的所有代码。 因为 {% data variables.product.prodname_codeql %} 分析组件之间的数据流量,所以某些复杂的安全行为只能在完整的构建中检测到。
|
||||
If you split your analysis into multiple workflows as described above, we still recommend that you have at least one workflow which runs on a `schedule` which analyzes all of the code in your repository. Because {% data variables.product.prodname_codeql %} analyzes data flows between components, some complex security behaviors may only be detected on a complete build.
|
||||
|
||||
### 仅在 `schedule` 事件期间运行
|
||||
### Run only during a `schedule` event
|
||||
|
||||
如果分析速度太慢,而无法在 `push` 或 `pull_request` 事件期间运行,建议仅在 `schedule` 事件上触发分析。 有关详细信息,请参阅“[事件](/actions/learn-github-actions/introduction-to-github-actions#events)”。
|
||||
If your analysis is still too slow to be run during `push` or `pull_request` events, then you may want to only trigger analysis on the `schedule` event. For more information, see "[Events](/actions/learn-github-actions/introduction-to-github-actions#events)."
|
||||
|
||||
### 检查工作流程运行的查询套件
|
||||
### Check which query suites the workflow runs
|
||||
|
||||
默认情况下,每种语言都有三个主要查询套件可用。 如果已优化 CodeQL 数据库生成,但过程仍然太长,则可以减少运行的查询数。 默认查询套件将自动运行;它包含最快的安全查询,误报结果率最低。
|
||||
By default, there are three main query suites available for each language. If you have optimized the CodeQL database build and the process is still too long, you could reduce the number of queries you run. The default query suite is run automatically; it contains the fastest security queries with the lowest rates of false positive results.
|
||||
|
||||
除了默认查询之外,您可能还会运行额外的查询或查询套件。 检查工作流是否定义了其他查询套件或要使用 `queries` 元素运行的其他查询。 您可以尝试禁用其他一个或多个查询套件。 有关详细信息,请参阅“[配置 {% data variables.product.prodname_code_scanning %}](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs)”。
|
||||
You may be running extra queries or query suites in addition to the default queries. Check whether the workflow defines an additional query suite or additional queries to run using the `queries` element. You can experiment with disabling the additional query suite or queries. For more information, see "[Configuring {% data variables.product.prodname_code_scanning %}](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs)."
|
||||
|
||||
{% ifversion codeql-ml-queries %} {% note %}
|
||||
{% ifversion codeql-ml-queries %}
|
||||
{% note %}
|
||||
|
||||
**注意:** 如果运行 `security-extended` JavaScript 或 `security-and-quality` 查询套件,则某些查询使用实验技术。 有关详细信息,请参阅“[关于代码扫描警报](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-alerts#about-experimental-alerts)”。
|
||||
{% endnote %} {% endif %}
|
||||
**Note:** If you run the `security-extended` or `security-and-quality` query suite for JavaScript, then some queries use experimental technology. For more information, see "[About code scanning alerts](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-alerts#about-experimental-alerts)."
|
||||
{% endnote %}
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
## 分析平台之间的结果差异
|
||||
## Results differ between analysis platforms
|
||||
|
||||
如果您分析的是使用 Python 编写的代码,根据您是在 Linux、macOS 还是 Windows 上运行 {% data variables.product.prodname_codeql_workflow %},可能会看到不同的结果。
|
||||
If you are analyzing code written in Python, you may see different results depending on whether you run the {% data variables.product.prodname_codeql_workflow %} on Linux, macOS, or Windows.
|
||||
|
||||
在使用 Linux 的 GitHub 托管运行器上,{% data variables.product.prodname_codeql_workflow %} 会尝试安装和分析 Python 依赖项,这可能导致更多结果。 若要禁用自动安装,请将 `setup-python-dependencies: false` 添加到工作流的“初始化 CodeQL”步骤。 有关配置 Python 依赖项分析的详细信息,请参阅“[分析 Python 依赖项](/code-security/secure-coding/configuring-code-scanning#analyzing-python-dependencies)”。
|
||||
On GitHub-hosted runners that use Linux, the {% data variables.product.prodname_codeql_workflow %} tries to install and analyze Python dependencies, which could lead to more results. To disable the auto-install, add `setup-python-dependencies: false` to the "Initialize CodeQL" step of the workflow. For more information about configuring the analysis of Python dependencies, see "[Analyzing Python dependencies](/code-security/secure-coding/configuring-code-scanning#analyzing-python-dependencies)."
|
||||
|
||||
{% endif %}
|
||||
|
||||
## 错误:“服务器错误”
|
||||
## Error: "Server error"
|
||||
|
||||
如果 {% data variables.product.prodname_code_scanning %} 的工作流程运行因服务器错误而失败,请尝试再次运行工作流程。 如果问题仍然存在,请联系 {% data variables.contact.contact_support %}。
|
||||
If the run of a workflow for {% data variables.product.prodname_code_scanning %} fails due to a server error, try running the workflow again. If the problem persists, contact {% data variables.contact.contact_support %}.
|
||||
|
||||
## 错误:“磁盘不足”或“内存不足”
|
||||
## Error: "Out of disk" or "Out of memory"
|
||||
|
||||
在非常大的项目中, {% data variables.product.prodname_codeql %} 运行器上的磁盘或内存可能会耗尽。
|
||||
{% ifversion fpt or ghec %}如果你在托管的 {% data variables.product.prodname_actions %} 运行器上遇到此问题,请联系 {% data variables.contact.contact_support %},以便我们对问题调查。
|
||||
{% else %}如果遇到此问题,请尝试增加运行器上的内存。{% endif %}
|
||||
On very large projects, {% data variables.product.prodname_codeql %} may run out of disk or memory on the runner.
|
||||
{% ifversion fpt or ghec %}If you encounter this issue on a hosted {% data variables.product.prodname_actions %} runner, contact {% data variables.contact.contact_support %} so that we can investigate the problem.
|
||||
{% else %}If you encounter this issue, try increasing the memory on the runner.{% endif %}
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
## 使用 {% data variables.product.prodname_dependabot %} 时出现错误:403“集成无法访问资源”
|
||||
## Error: 403 "Resource not accessible by integration" when using {% data variables.product.prodname_dependabot %}
|
||||
|
||||
{% data variables.product.prodname_dependabot %} 在触发工作流运行时被视为不信任,工作流程将以只读范围运行。 为分支上传 {% data variables.product.prodname_code_scanning %} 结果通常需要 `security_events: write` 范围。 但是,当 `pull_request` 事件触发操作运行时,{% data variables.product.prodname_code_scanning %} 始终允许上传结果。 因此,对于 {% data variables.product.prodname_dependabot %} 分支,建议使用 `pull_request` 事件,而不是 `push` 事件。
|
||||
{% data variables.product.prodname_dependabot %} is considered untrusted when it triggers a workflow run, and the workflow will run with read-only scopes. Uploading {% data variables.product.prodname_code_scanning %} results for a branch usually requires the `security_events: write` scope. However, {% data variables.product.prodname_code_scanning %} always allows the uploading of results when the `pull_request` event triggers the action run. This is why, for {% data variables.product.prodname_dependabot %} branches, we recommend you use the `pull_request` event instead of the `push` event.
|
||||
|
||||
一个简单的方法是推送到默认分支和任何其他重要的长期分支,以及在此组分支上打开的拉取请求:
|
||||
A simple approach is to run on pushes to the default branch and any other important long-running branches, as well as pull requests opened against this set of branches:
|
||||
```yaml
|
||||
on:
|
||||
push:
|
||||
@@ -268,7 +270,7 @@ on:
|
||||
branches:
|
||||
- main
|
||||
```
|
||||
另一种方法是运行除 {% data variables.product.prodname_dependabot %} 分支以外的所有推送:
|
||||
An alternative approach is to run on all pushes except for {% data variables.product.prodname_dependabot %} branches:
|
||||
```yaml
|
||||
on:
|
||||
push:
|
||||
@@ -277,27 +279,27 @@ on:
|
||||
pull_request:
|
||||
```
|
||||
|
||||
### 默认分支上的分析仍然失败
|
||||
### Analysis still failing on the default branch
|
||||
|
||||
如果 {% data variables.product.prodname_codeql_workflow %} 在默认分支上的提交仍然失败,您需要检查:
|
||||
- {% data variables.product.prodname_dependabot %} 是否撰写了提交
|
||||
- 包含该提交的请求是否已使用 `@dependabot squash and merge` 进行合并
|
||||
If the {% data variables.product.prodname_codeql_workflow %} still fails on a commit made on the default branch, you need to check:
|
||||
- whether {% data variables.product.prodname_dependabot %} authored the commit
|
||||
- whether the pull request that includes the commit has been merged using `@dependabot squash and merge`
|
||||
|
||||
此类型的合并提交由 {% data variables.product.prodname_dependabot %} 编写,因此在提交上运行的任何工作流程都将具有只读权限。 如果在存储库上启用了 {% data variables.product.prodname_code_scanning %} 和 {% data variables.product.prodname_dependabot %} 安全更新或版本更新,建议避免使用 {% data variables.product.prodname_dependabot %} `@dependabot squash and merge` 命令。 不过,你可以为存储库启用自动合并。 这意味着,如果满足所有必需的评审并已通过状态检查,将自动合并拉取请求。 有关启用自动合并的详细信息,请参阅“[自动合并拉取请求](/github/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request#enabling-auto-merge)”。
|
||||
This type of merge commit is authored by {% data variables.product.prodname_dependabot %} and therefore, any workflows running on the commit will have read-only permissions. If you enabled {% data variables.product.prodname_code_scanning %} and {% data variables.product.prodname_dependabot %} security updates or version updates on your repository, we recommend you avoid using the {% data variables.product.prodname_dependabot %} `@dependabot squash and merge` command. Instead, you can enable auto-merge for your repository. This means that pull requests will be automatically merged when all required reviews are met and status checks have passed. For more information about enabling auto-merge, see "[Automatically merging a pull request](/github/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request#enabling-auto-merge)."
|
||||
{% endif %}
|
||||
|
||||
## 错误:“不是 .ql 文件、.qls 文件、目录或查询包规范”
|
||||
## Error: "is not a .ql file, .qls file, a directory, or a query pack specification"
|
||||
|
||||
如果 CodeQL 在工作流中请求的位置找不到命名查询、查询套件或查询包,则会看到此错误。 此错误有两个常见的原因。
|
||||
You will see this error if CodeQL is unable to find the named query, query suite, or query pack at the location requested in the workflow. There are two common reasons for this error.
|
||||
|
||||
- 工作流中有拼写错误。
|
||||
- 工作流通过路径引用的资源被重命名、删除或移动到新位置。
|
||||
- There is a typo in the workflow.
|
||||
- A resource the workflow refers to by path was renamed, deleted, or moved to a new location.
|
||||
|
||||
验证资源的位置后,可以更新工作流以指定正确的位置。 如果在 Go 分析中运行其他查询,则可能受到源文件重定位的影响。 有关详细信息,请参阅[重定位公告:`github/codeql-go` 移动到 github/codeql-go 存储库中的 `github/codeql`](https://github.com/github/codeql-go/issues/741)。
|
||||
After verifying the location of the resource, you can update the workflow to specify the correct location. If you run additional queries in Go analysis, you may have been affected by the relocation of the source files. For more information, see [Relocation announcement: `github/codeql-go` moving into `github/codeql`](https://github.com/github/codeql-go/issues/741) in the github/codeql-go repository.
|
||||
|
||||
## 警告:“不再需要 git checkout HEAD^2”
|
||||
## Warning: "git checkout HEAD^2 is no longer necessary"
|
||||
|
||||
如果您使用的是旧 {% data variables.product.prodname_codeql %} 工作流程,您可能会在输出中收到来自“初始化 {% data variables.product.prodname_codeql %}”操作的以下警告:
|
||||
If you're using an old {% data variables.product.prodname_codeql %} workflow you may get the following warning in the output from the "Initialize {% data variables.product.prodname_codeql %}" action:
|
||||
|
||||
```
|
||||
Warning: 1 issue was detected with this workflow: git checkout HEAD^2 is no longer
|
||||
@@ -305,7 +307,7 @@ necessary. Please remove this step as Code Scanning recommends analyzing the mer
|
||||
commit for best results.
|
||||
```
|
||||
|
||||
通过从 {% data variables.product.prodname_codeql %} 工作流程中删除以下行来修复此问题。 这些行包含在 {% data variables.product.prodname_codeql %} 工作流初始版本中 `Analyze` 作业的 `steps` 部分。
|
||||
Fix this by removing the following lines from the {% data variables.product.prodname_codeql %} workflow. These lines were included in the `steps` section of the `Analyze` job in initial versions of the {% data variables.product.prodname_codeql %} workflow.
|
||||
|
||||
```yaml
|
||||
with:
|
||||
@@ -319,7 +321,7 @@ commit for best results.
|
||||
if: {% raw %}${{ github.event_name == 'pull_request' }}{% endraw %}
|
||||
```
|
||||
|
||||
修改后的工作流的 `steps` 部分将如下所示:
|
||||
The revised `steps` section of the workflow will look like this:
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -333,4 +335,4 @@ commit for best results.
|
||||
...
|
||||
```
|
||||
|
||||
有关编辑 {% data variables.product.prodname_codeql %} 工作流文件的详细信息,请参阅“[配置 {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/configuring-code-scanning#editing-a-code-scanning-workflow)”。
|
||||
For more information about editing the {% data variables.product.prodname_codeql %} workflow file, see "[Configuring {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/configuring-code-scanning#editing-a-code-scanning-workflow)."
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: 关于与代码扫描的集成
|
||||
title: About integration with code scanning
|
||||
shortTitle: About integration
|
||||
intro: '您可以在外部执行 {% data variables.product.prodname_code_scanning %},然后在 {% data variables.product.prodname_dotcom %} 中显示结果,或者设置侦听仓库中 {% data variables.product.prodname_code_scanning %} 活动的 web 挂钩。'
|
||||
intro: 'You can perform {% data variables.product.prodname_code_scanning %} externally and then display the results in {% data variables.product.prodname_dotcom %}, or set up webhooks that listen to {% data variables.product.prodname_code_scanning %} activity in your repository.'
|
||||
product: '{% data reusables.gated-features.code-scanning %}'
|
||||
redirect_from:
|
||||
- /github/finding-security-vulnerabilities-and-errors-in-your-code/about-integration-with-code-scanning
|
||||
@@ -18,27 +18,26 @@ topics:
|
||||
- Code scanning
|
||||
- Webhooks
|
||||
- Integration
|
||||
ms.openlocfilehash: b12f5146a90cae0ed1bd38d452e43eb611232e72
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '145099099'
|
||||
---
|
||||
{% data reusables.code-scanning.beta %} {% data reusables.code-scanning.enterprise-enable-code-scanning %}
|
||||
|
||||
作为在 {% data variables.product.prodname_dotcom %} 中运行 {% data variables.product.prodname_code_scanning %} 的替代方法,您可以在其他地方执行分析,然后上传结果。 在外部运行的 {% data variables.product.prodname_code_scanning %} 的警报显示方式与在 {% data variables.product.prodname_dotcom %} 内运行的 {% data variables.product.prodname_code_scanning %} 的警报显示方式相同。 有关详细信息,请参阅“[管理存储库的 {% data variables.product.prodname_code_scanning %} 警报](/code-security/secure-coding/managing-code-scanning-alerts-for-your-repository)”。
|
||||
|
||||
如果使用可生成结果为静态分析结果交换格式 (SARIF) 2.1.0 数据的第三方静态分析工具,您可以将其上传到 {% data variables.product.prodname_dotcom %}。 有关详细信息,请参阅“[将 SARIF 文件上传到 GitHub](/code-security/secure-coding/uploading-a-sarif-file-to-github)”。
|
||||
{% data reusables.code-scanning.beta %}
|
||||
{% data reusables.code-scanning.enterprise-enable-code-scanning %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.4 or ghae-issue-6251 or ghec %} {% data reusables.code-scanning.about-analysis-origins-link %} {% endif %}
|
||||
As an alternative to running {% data variables.product.prodname_code_scanning %} within {% data variables.product.prodname_dotcom %}, you can perform analysis elsewhere and then upload the results. Alerts for {% data variables.product.prodname_code_scanning %} that you run externally are displayed in the same way as those for {% data variables.product.prodname_code_scanning %} that you run within {% data variables.product.prodname_dotcom %}. For more information, see "[Managing {% data variables.product.prodname_code_scanning %} alerts for your repository](/code-security/secure-coding/managing-code-scanning-alerts-for-your-repository)."
|
||||
|
||||
## 与 web 挂钩集成
|
||||
If you use a third-party static analysis tool that can produce results as Static Analysis Results Interchange Format (SARIF) 2.1.0 data, you can upload this to {% data variables.product.prodname_dotcom %}. For more information, see "[Uploading a SARIF file to GitHub](/code-security/secure-coding/uploading-a-sarif-file-to-github)."
|
||||
|
||||
可以使用 {% data variables.product.prodname_code_scanning %} Webhook 构建或设置集成,例如 [{% data variables.product.prodname_github_apps %}](/apps/building-github-apps/) 或 [{% data variables.product.prodname_oauth_apps %}](/apps/building-oauth-apps/),以订阅存储库中的 {% data variables.product.prodname_code_scanning %} 事件。 例如,可以构建在 {% data variables.product.product_name %} 上创建问题,或者在存储库中新增 {% data variables.product.prodname_code_scanning %} 警报时向你发送 Slack 通知的集成。 有关详细信息,请参阅“[创建 Webhook](/developers/webhooks-and-events/creating-webhooks)”和“[Webhook 事件和有效负载](/developers/webhooks-and-events/webhook-events-and-payloads#code_scanning_alert)”。
|
||||
{% ifversion fpt or ghes > 3.4 or ghae > 3.4 or ghec %}
|
||||
{% data reusables.code-scanning.about-analysis-origins-link %}
|
||||
{% endif %}
|
||||
|
||||
## 延伸阅读
|
||||
## Integrations with webhooks
|
||||
|
||||
* [关于 {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/about-code-scanning)
|
||||
* [将 {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %} 与现有 CI 系统配合使用](/code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system)
|
||||
* [{% data variables.product.prodname_code_scanning %} 的 SARIF 支持](/code-security/secure-coding/sarif-support-for-code-scanning)
|
||||
You can use {% data variables.product.prodname_code_scanning %} webhooks to build or set up integrations, such as [{% data variables.product.prodname_github_apps %}](/apps/building-github-apps/) or [{% data variables.product.prodname_oauth_apps %}](/apps/building-oauth-apps/), that subscribe to {% data variables.product.prodname_code_scanning %} events in your repository. For example, you could build an integration that creates an issue on {% data variables.product.product_name %} or sends you a Slack notification when a new {% data variables.product.prodname_code_scanning %} alert is added in your repository. For more information, see "[Creating webhooks](/developers/webhooks-and-events/creating-webhooks)" and "[Webhook events and payloads](/developers/webhooks-and-events/webhook-events-and-payloads#code_scanning_alert)."
|
||||
|
||||
## Further reading
|
||||
|
||||
* "[About {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/about-code-scanning)"
|
||||
* "[Using {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %} with your existing CI system](/code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system)"
|
||||
* "[SARIF support for {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/sarif-support-for-code-scanning)"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: 关于 CI 系统中的 CodeQL 代码扫描
|
||||
title: About CodeQL code scanning in your CI system
|
||||
shortTitle: Code scanning in your CI
|
||||
intro: '您可以在第三方持续集成 系统中用 {% data variables.product.prodname_codeql %} 分析您的代码,并将结果上传到 {% data variables.product.product_location %}。 由此产生的 {% data variables.product.prodname_code_scanning %} 警报与 {% data variables.product.product_name %} 内生成的任何警报一起显示。'
|
||||
intro: 'You can analyze your code with {% data variables.product.prodname_codeql %} in a third-party continuous integration system and upload the results to {% data variables.product.product_location %}. The resulting {% data variables.product.prodname_code_scanning %} alerts are shown alongside any alerts generated within {% data variables.product.product_name %}.'
|
||||
product: '{% data reusables.gated-features.code-scanning %}'
|
||||
versions:
|
||||
fpt: '*'
|
||||
@@ -20,20 +20,15 @@ topics:
|
||||
redirect_from:
|
||||
- /code-security/secure-coding/about-codeql-code-scanning-in-your-ci-system
|
||||
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/about-codeql-code-scanning-in-your-ci-system
|
||||
ms.openlocfilehash: 9f64b56bb5c766aaeb9a9fd59d8f7f009f19fa89
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147061448'
|
||||
---
|
||||
<!--UI-LINK: When GitHub Enterprise Server 3.1+ doesn't have GitHub Actions set up, the Security > Code scanning alerts view links to this article.-->
|
||||
|
||||
{% data reusables.code-scanning.beta %} {% data reusables.code-scanning.enterprise-enable-code-scanning %}
|
||||
{% data reusables.code-scanning.beta %}
|
||||
{% data reusables.code-scanning.enterprise-enable-code-scanning %}
|
||||
|
||||
## 关于 CI 系统中的 {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %}
|
||||
## About {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %} in your CI system
|
||||
|
||||
{% 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 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)."
|
||||
|
||||
{% data reusables.code-scanning.codeql-context-for-actions-and-third-party-tools %}
|
||||
|
||||
@@ -41,28 +36,30 @@ ms.locfileid: '147061448'
|
||||
|
||||
{% data reusables.code-scanning.codeql-cli-context-for-third-party-tools %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.4 or ghae-issue-6251 or ghec %} {% data reusables.code-scanning.about-analysis-origins-link %} {% endif %}
|
||||
{% ifversion fpt or ghes > 3.4 or ghae > 3.4 or ghec %}
|
||||
{% data reusables.code-scanning.about-analysis-origins-link %}
|
||||
{% endif %}
|
||||
|
||||
{% data reusables.code-scanning.upload-sarif-ghas %}
|
||||
|
||||
## 关于 {% data variables.product.prodname_codeql_cli %}
|
||||
## About the {% data variables.product.prodname_codeql_cli %}
|
||||
|
||||
{% data reusables.code-scanning.what-is-codeql-cli %}
|
||||
|
||||
使用 {% data variables.product.prodname_codeql_cli %} 分析:
|
||||
Use the {% data variables.product.prodname_codeql_cli %} to analyze:
|
||||
|
||||
- 动态语言,例如 JavaScript 和 Python。
|
||||
- 编译的语言,例如 C/C++、C# 和 Java。
|
||||
- 以多种语言编写的代码库。
|
||||
- Dynamic languages, for example, JavaScript and Python.
|
||||
- Compiled languages, for example, C/C++, C# and Java.
|
||||
- Codebases written in a mixture of languages.
|
||||
|
||||
有关详细信息,请参阅“[在 CI 系统中安装 {% data variables.product.prodname_codeql_cli %}](/code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/installing-codeql-cli-in-your-ci-system)”。
|
||||
For more information, see "[Installing {% data variables.product.prodname_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)."
|
||||
|
||||
{% data reusables.code-scanning.licensing-note %}
|
||||
|
||||
{% ifversion ghes = 3.2 %}
|
||||
<!-- Content for GHES 3.2 only. CodeQL CLI 2.6.2, which introduces full feature parity between CodeQL CLI and CodeQL runner, is officially recommended for GHES 3.0+ -->
|
||||
|
||||
自版本 2.6.3 以来,{% data variables.product.prodname_codeql_cli %} 与 {% data variables.product.prodname_codeql_runner %} 的功能完全同等。
|
||||
Since version 2.6.3, the {% data variables.product.prodname_codeql_cli %} has had full feature parity with the {% data variables.product.prodname_codeql_runner %}.
|
||||
|
||||
{% data reusables.code-scanning.deprecation-codeql-runner %}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ Generally, we name our supported ecosystems after the software programming langu
|
||||
- Composer (registry: https://packagist.org/){% ifversion GH-advisory-db-erlang-support %}
|
||||
- Erlang (registry: https://hex.pm/){% endif %}
|
||||
- Go (registry: https://pkg.go.dev/)
|
||||
{%- ifversion fpt or ghec or ghes > 3.6 or ghae-issue-7508 %}
|
||||
{%- ifversion fpt or ghec or ghes > 3.6 or ghae > 3.6 %}
|
||||
- GitHub Actions (https://github.com/marketplace?type=actions/) {% endif %}
|
||||
- Maven (registry: https://repo.maven.apache.org/maven2)
|
||||
- npm (registry: https://www.npmjs.com/)
|
||||
|
||||
@@ -26,7 +26,7 @@ topics:
|
||||
{% data reusables.dependabot.beta-security-and-version-updates %}
|
||||
{% data reusables.dependabot.enterprise-enable-dependabot %}
|
||||
|
||||
Your repository's {% data variables.product.prodname_dependabot_alerts %} tab lists all open and closed {% data variables.product.prodname_dependabot_alerts %}{% ifversion fpt or ghec or ghes > 3.2 %} and corresponding {% data variables.product.prodname_dependabot_security_updates %}{% endif %}. You can{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5638 %} filter alerts by package, ecosystem, or manifest. You can {% endif %} sort the list of alerts, and you can click into specific alerts for more details. {% ifversion dependabot-bulk-alerts %}You can also dismiss or reopen alerts, either one by one or by selecting multiple alerts at once.{% else %}You can also dismiss or reopen alerts. {% endif %} For more information, see "[About {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/about-alerts-for-vulnerable-dependencies)."
|
||||
Your repository's {% data variables.product.prodname_dependabot_alerts %} tab lists all open and closed {% data variables.product.prodname_dependabot_alerts %}{% ifversion fpt or ghec or ghes > 3.2 %} and corresponding {% data variables.product.prodname_dependabot_security_updates %}{% endif %}. You can{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %} filter alerts by package, ecosystem, or manifest. You can {% endif %} sort the list of alerts, and you can click into specific alerts for more details. {% ifversion dependabot-bulk-alerts %}You can also dismiss or reopen alerts, either one by one or by selecting multiple alerts at once.{% else %}You can also dismiss or reopen alerts. {% endif %} For more information, see "[About {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/about-alerts-for-vulnerable-dependencies)."
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.2 %}
|
||||
You can enable automatic security updates for any repository that uses {% data variables.product.prodname_dependabot_alerts %} and the dependency graph. For more information, see "[About {% data variables.product.prodname_dependabot_security_updates %}](/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-dependabot-security-updates)."
|
||||
@@ -39,7 +39,7 @@ You can enable automatic security updates for any repository that uses {% data v
|
||||
|
||||
Each {% data variables.product.prodname_dependabot %} alert has a unique numeric identifier and the {% data variables.product.prodname_dependabot_alerts %} tab lists an alert for every detected vulnerability. Legacy {% data variables.product.prodname_dependabot_alerts %} grouped vulnerabilities by dependency and generated a single alert per dependency. If you navigate to a legacy {% data variables.product.prodname_dependabot %} alert, you will be redirected to a {% data variables.product.prodname_dependabot_alerts %} tab filtered for that package. {% endif %}
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5638 %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
You can filter and sort {% data variables.product.prodname_dependabot_alerts %} using a variety of filters and sort options available on the user interface. For more information, see "[Prioritizing {% data variables.product.prodname_dependabot_alerts %}](#prioritizing-across--data-variablesproductprodname_dependabot_alerts-)" below.
|
||||
|
||||
## Prioritizing {% data variables.product.prodname_dependabot_alerts %}
|
||||
@@ -107,7 +107,7 @@ For more information, see "[Reviewing and fixing alerts](#reviewing-and-fixing-a
|
||||
|
||||
## Viewing {% data variables.product.prodname_dependabot_alerts %}
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5638 %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-security %}
|
||||
{% data reusables.repositories.sidebar-dependabot-alerts %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 关于 Dependabot 安全更新
|
||||
intro: '{% data variables.product.prodname_dependabot %} 可通过提出安全更新拉取请求为您修复有漏洞依赖项。'
|
||||
title: About Dependabot security updates
|
||||
intro: '{% data variables.product.prodname_dependabot %} can fix vulnerable dependencies for you by raising pull requests with security updates.'
|
||||
shortTitle: Dependabot security updates
|
||||
redirect_from:
|
||||
- /github/managing-security-vulnerabilities/about-github-dependabot-security-updates
|
||||
@@ -19,55 +19,50 @@ topics:
|
||||
- Repositories
|
||||
- Dependencies
|
||||
- Pull requests
|
||||
ms.openlocfilehash: 993fb0c4a810f24c63d0b4063029a7a5801ff85a
|
||||
ms.sourcegitcommit: 478f2931167988096ae6478a257f492ecaa11794
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/09/2022
|
||||
ms.locfileid: '147861666'
|
||||
---
|
||||
|
||||
<!--Marketing-LINK: From /features/security/software-supply-chain page "About Dependabot security updates".-->
|
||||
|
||||
{% data reusables.dependabot.beta-security-and-version-updates %} {% data reusables.dependabot.enterprise-enable-dependabot %}
|
||||
{% data reusables.dependabot.beta-security-and-version-updates %}
|
||||
{% data reusables.dependabot.enterprise-enable-dependabot %}
|
||||
|
||||
## 关于 {% data variables.product.prodname_dependabot_security_updates %}
|
||||
## About {% data variables.product.prodname_dependabot_security_updates %}
|
||||
|
||||
{% data variables.product.prodname_dependabot_security_updates %} 使您更容易修复仓库中的有漏洞依赖项。 如果启用此功能,当针对存储库依赖项关系图中有漏洞的依赖项发出 {% data variables.product.prodname_dependabot %} 警报时,{% data variables.product.prodname_dependabot %} 将自动尝试对其进行修复。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/about-alerts-for-vulnerable-dependencies)”和“[配置 {% data variables.product.prodname_dependabot_security_updates %}](/github/managing-security-vulnerabilities/configuring-dependabot-security-updates)”。
|
||||
{% data variables.product.prodname_dependabot_security_updates %} make it easier for you to fix vulnerable dependencies in your repository. If you enable this feature, when a {% data variables.product.prodname_dependabot %} alert is raised for a vulnerable dependency in the dependency graph of your repository, {% data variables.product.prodname_dependabot %} automatically tries to fix it. For more information, see "[About {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/about-alerts-for-vulnerable-dependencies)" and "[Configuring {% data variables.product.prodname_dependabot_security_updates %}](/github/managing-security-vulnerabilities/configuring-dependabot-security-updates)."
|
||||
|
||||
{% data variables.product.prodname_dotcom %} 可能会向受最近发布的 {% data variables.product.prodname_dotcom %} 安全通告披露的漏洞影响的仓库发送 {% data variables.product.prodname_dependabot_alerts %}。 {% data reusables.security-advisory.link-browsing-advisory-db %}
|
||||
|
||||
{% data variables.product.prodname_dependabot %} 将检查是否可以在不破坏仓库依赖关系图的情况下将有漏洞依赖项升级到已修复版本。 然后 {% data variables.product.prodname_dependabot %} 提出拉取请求以将依赖项更新到包含补丁的最低版本,并将拉取请求链接到 {% data variables.product.prodname_dependabot %} 警报,或者在警报中报告错误。 有关详细信息,请参阅“[排查 {% data variables.product.prodname_dependabot %} 错误](/github/managing-security-vulnerabilities/troubleshooting-dependabot-errors)”。
|
||||
{% data variables.product.prodname_dotcom %} may send {% data variables.product.prodname_dependabot_alerts %} to repositories affected by a vulnerability disclosed by a recently published {% data variables.product.prodname_dotcom %} security advisory. {% data reusables.security-advisory.link-browsing-advisory-db %}
|
||||
|
||||
{% data variables.product.prodname_dependabot %} checks whether it's possible to upgrade the vulnerable dependency to a fixed version without disrupting the dependency graph for the repository. Then {% data variables.product.prodname_dependabot %} raises a pull request to update the dependency to the minimum version that includes the patch and links the pull request to the {% data variables.product.prodname_dependabot %} alert, or reports an error on the alert. For more information, see "[Troubleshooting {% data variables.product.prodname_dependabot %} errors](/github/managing-security-vulnerabilities/troubleshooting-dependabot-errors)."
|
||||
|
||||
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 %}
|
||||
|
||||
注意:{% data variables.product.prodname_dependabot_security_updates %} 功能适用于已启用依赖项关系图和 {% data variables.product.prodname_dependabot_alerts %} 的存储库。 你将在完整依赖项关系图中看到针对已识别的每个有漏洞依赖项的 {% data variables.product.prodname_dependabot %} 警报。 但是,安全更新仅针对清单或锁定文件中指定的依赖项而触发。 有关详细信息,请参阅“[关于依赖项关系图](/github/visualizing-repository-data-with-graphs/about-the-dependency-graph#dependencies-included)”。{% ifversion dependabot-security-updates-unlock-transitive-dependencies %}
|
||||
**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)."
|
||||
|
||||
对于 npm,{% data variables.product.prodname_dependabot %} 会引发拉取请求,以将显式定义的依赖项更新到安全版本,即使这意味着更新父依赖项或其他依赖项。 对于其他生态系统,如果 {% data variables.product.prodname_dependabot %} 还需要更新父依赖项,则无法更新间接依赖项或可传递依赖项。 有关详细信息,请参阅“[Dependabot 尝试在没有警报的情况下更新依赖项](/en/code-security/dependabot/working-with-dependabot/troubleshooting-dependabot-errors#dependabot-tries-to-update-dependencies-without-an-alert)”。{% endif %}
|
||||
{% endnote %}{% endif %}
|
||||
|
||||
{% endnote %}
|
||||
|
||||
您可以启用相关功能 {% data variables.product.prodname_dependabot_version_updates %},这样无论 {% data variables.product.prodname_dependabot %} 是否检测到过期的依赖项,都可以提出拉取请求,以将清单更新到依赖项的最新版本。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot %} 版本更新](/github/administering-a-repository/about-dependabot-version-updates)”。
|
||||
You can enable a related feature, {% data variables.product.prodname_dependabot_version_updates %}, so that {% data variables.product.prodname_dependabot %} raises pull requests to update the manifest to the latest version of the dependency, whenever it detects an outdated dependency. For more information, see "[About {% data variables.product.prodname_dependabot %} version updates](/github/administering-a-repository/about-dependabot-version-updates)."
|
||||
|
||||
{% data reusables.dependabot.pull-request-security-vs-version-updates %}
|
||||
|
||||
## 关于安全更新的拉取请求
|
||||
## About pull requests for security updates
|
||||
|
||||
每个拉取请求都包含快速、安全地查看提议的修复程序并将其合并到项目中所需的全部内容。 这包括漏洞的相关信息,如发行说明、变更日志条目和提交详细信息。 无法访问仓库的 {% data variables.product.prodname_dependabot_alerts %} 的任何人都看不到拉取请求所解决的漏洞详细信息。
|
||||
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.
|
||||
|
||||
合并包含安全更新程序的拉取请求时,存储库相应的 {% data variables.product.prodname_dependabot %} 警报会标记为已解决。 有关 {% data variables.product.prodname_dependabot %} 拉取请求的详细信息,请参阅“[管理依赖项更新的拉取请求](/github/administering-a-repository/managing-pull-requests-for-dependency-updates)”。
|
||||
When you merge a pull request that contains a security update, the corresponding {% data variables.product.prodname_dependabot %} alert is marked as resolved for your repository. For more information about {% data variables.product.prodname_dependabot %} pull requests, see "[Managing pull requests for dependency updates](/github/administering-a-repository/managing-pull-requests-for-dependency-updates)."
|
||||
|
||||
{% data reusables.dependabot.automated-tests-note %}
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
|
||||
## 关于兼容性分数
|
||||
## About compatibility scores
|
||||
|
||||
{% data variables.product.prodname_dependabot_security_updates %} 可能包括兼容性分数,以便您了解更新依赖项是否可能导致对项目的重大更改。 这些分数是根据已生成相同安全更新的其他公共仓库中的 CI 测试计算的。 更新的兼容性分数是在依赖项的特定版本之间进行更新时,CI 运行被视为通过的百分比。
|
||||
{% data variables.product.prodname_dependabot_security_updates %} may include compatibility scores to let you know whether updating a dependency could cause breaking changes to your project. These are calculated from CI tests in other public repositories where the same security update has been generated. An update's compatibility score is the percentage of CI runs that passed when updating between specific versions of the dependency.
|
||||
|
||||
{% endif %}
|
||||
|
||||
## 关于 {% data variables.product.prodname_dependabot %} 安全更新通知
|
||||
## About notifications for {% data variables.product.prodname_dependabot %} security updates
|
||||
|
||||
您可以在 {% data variables.product.company_short %} 上过滤通知以显示 {% data variables.product.prodname_dependabot %} 安全更新。 有关详细信息,请参阅“[管理收件箱中的通知](/github/managing-subscriptions-and-notifications-on-github/managing-notifications-from-your-inbox#dependabot-custom-filters)”。
|
||||
You can filter your notifications on {% data variables.product.company_short %} to show {% data variables.product.prodname_dependabot %} security updates. For more information, see "[Managing notifications from your inbox](/github/managing-subscriptions-and-notifications-on-github/managing-notifications-from-your-inbox#dependabot-custom-filters)."
|
||||
|
||||
@@ -56,7 +56,7 @@ You can also enable or disable {% data variables.product.prodname_dependabot_sec
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.navigate-to-code-security-and-analysis %}
|
||||
1. Under "Code security and analysis", to the right of "{% data variables.product.prodname_dependabot %} security updates", click **Enable** to enable the feature or **Disable** to disable it. {% ifversion fpt or ghec %}For public repositories, the button is disabled if the feature is always enabled.{% endif %}
|
||||
{% ifversion fpt or ghec %}{% elsif ghes > 3.6 or ghae-issue-7044 %}<!--Insert screenshot for GHES 3.7 when available--> {% else %}{% endif %}
|
||||
{% ifversion fpt or ghec %}{% elsif ghes > 3.6 or ghae > 3.6 %}<!--Insert screenshot for GHES 3.7 when available--> {% else %}{% endif %}
|
||||
|
||||
## Overriding the default behavior with a configuration file
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ updates:
|
||||
If you use the same configuration as in the example above, bumping the `requests` library in the `pip` development dependency group will generate a commit message of:
|
||||
|
||||
`pip dev: bump requests from 1.0.0 to 1.0.1`
|
||||
|
||||
|
||||
### `ignore`
|
||||
|
||||
{% data reusables.dependabot.default-dependencies-allow-ignore %}
|
||||
@@ -776,11 +776,15 @@ registries:
|
||||
|
||||
### `docker-registry`
|
||||
|
||||
{% note %}
|
||||
{% data variables.product.prodname_dependabot %} works with container registries that implement the OCI container registry. For more information, see [https://github.com/opencontainers/distribution-spec/blob/main/spec.md](https://github.com/opencontainers/distribution-spec/blob/main/spec.md). {% data variables.product.prodname_dependabot %} supports authentication to private registries via a central service. For further details, see [Token Authentication Specification](https://docs.docker.com/registry/spec/auth/token/) in the Docker documentation.
|
||||
|
||||
**Note:** We don't support the Azure Container Registry (ACR).
|
||||
We currently support the container registries listed here:
|
||||
|
||||
* Docker Hub
|
||||
* {% data variables.product.company_short %} {% data variables.product.prodname_container_registry %}
|
||||
* GCR (Google Cloud)
|
||||
* Private ECR (AWS) - public ECR support is tracked in [https://github.com/dependabot/dependabot-core/issues/4212](https://github.com/dependabot/dependabot-core/issues/4212).
|
||||
|
||||
{% endnote %}
|
||||
|
||||
The `docker-registry` type supports username and password.
|
||||
|
||||
@@ -795,7 +799,7 @@ registries:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
The `docker-registry` type can also be used to pull from Amazon ECR using static AWS credentials.
|
||||
The `docker-registry` type can also be used to pull from private Amazon ECR using static AWS credentials.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -972,7 +976,7 @@ registries:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 %}
|
||||
## Enabling support for beta-level ecosystems
|
||||
|
||||
### `enable-beta-ecosystems`
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
---
|
||||
title: 通过 GitHub Actions 自动化 Dependabot
|
||||
intro: '如何使用 {% data variables.product.prodname_actions %} 来自动执行常见 {% data variables.product.prodname_dependabot %} 相关任务的示例。'
|
||||
title: Automating Dependabot with GitHub Actions
|
||||
intro: 'Examples of how you can use {% data variables.product.prodname_actions %} to automate common {% data variables.product.prodname_dependabot %} related tasks.'
|
||||
permissions: 'People with write permissions to a repository can configure {% data variables.product.prodname_actions %} to respond to {% data variables.product.prodname_dependabot %}-created pull requests.'
|
||||
miniTocMaxHeadingLevel: 3
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghec: '*'
|
||||
ghes: '>3.2'
|
||||
ghae: '*'
|
||||
type: how_to
|
||||
topics:
|
||||
- Actions
|
||||
@@ -19,40 +20,39 @@ topics:
|
||||
shortTitle: Use Dependabot with Actions
|
||||
redirect_from:
|
||||
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/automating-dependabot-with-github-actions
|
||||
ms.openlocfilehash: 573304093b85fcc05d86a99934a94904aa98b816
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147429730'
|
||||
---
|
||||
{% data reusables.dependabot.beta-security-and-version-updates %} {% data reusables.dependabot.enterprise-enable-dependabot %}
|
||||
|
||||
## 关于 {% data variables.product.prodname_dependabot %} 与 {% data variables.product.prodname_actions %}
|
||||
{% data reusables.dependabot.beta-security-and-version-updates %}
|
||||
{% data reusables.dependabot.enterprise-enable-dependabot %}
|
||||
|
||||
{% data variables.product.prodname_dependabot %} 创建拉动请求以保持依赖项的最新状态,并且当创建这些拉取请求时,您可以使用 {% data variables.product.prodname_actions %} 执行自动任务。 例如,获取其他构件、添加标签、运行测试或修改拉取请求。
|
||||
## About {% data variables.product.prodname_dependabot %} and {% data variables.product.prodname_actions %}
|
||||
|
||||
## 响应事件
|
||||
{% data variables.product.prodname_dependabot %} creates pull requests to keep your dependencies up to date, and you can use {% data variables.product.prodname_actions %} to perform automated tasks when these pull requests are created. For example, fetch additional artifacts, add labels, run tests, or otherwise modifying the pull request.
|
||||
|
||||
{% data variables.product.prodname_dependabot %} 能够在其拉取请求和评论上触发 {% data variables.product.prodname_actions %} 工作流程;但是,某些事件的处理方式不同。
|
||||
## Responding to events
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5792 %} 对于 {% data variables.product.prodname_dependabot %} (`github.actor == 'dependabot[bot]'`) 使用 `pull_request`、`pull_request_review`、`pull_request_review_comment`、`push`、`create`、`deployment` 和 `deployment_status` 事件发起的工作流,适用以下限制:{% endif %}
|
||||
{% data variables.product.prodname_dependabot %} is able to trigger {% data variables.product.prodname_actions %} workflows on its pull requests and comments; however, certain events are treated differently.
|
||||
|
||||
- {% ifversion ghes = 3.3 %}`GITHUB_TOKEN` 具有只读权限,除非管理员已移除限制。{% else %}默认情况下,`GITHUB_TOKEN` 具有只读权限。{% endif %}
|
||||
- {% ifversion ghes = 3.3 %}机密是不可访问的,除非管理员已删除限制。{% else %}机密是从 {% data variables.product.prodname_dependabot %} 机密填充的。 {% data variables.product.prodname_actions %} 机密不可用。{% endif %}
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5792 %} 对于 {% data variables.product.prodname_dependabot %} (`github.actor == 'dependabot[bot]'`) 使用 `pull_request_target` 事件发起的工作流,如果拉取请求的基本引用是由 {% data variables.product.prodname_dependabot %} (`github.actor == 'dependabot[bot]'`) 创建的,`GITHUB_TOKEN` 将是只读的,并且机密不可用。
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
For workflows initiated by {% data variables.product.prodname_dependabot %} (`github.actor == 'dependabot[bot]'`) using the `pull_request`, `pull_request_review`, `pull_request_review_comment`, `push`, `create`, `deployment`, and `deployment_status` events, the following restrictions apply:
|
||||
{% endif %}
|
||||
|
||||
{% ifversion actions-stable-actor-ids %}即使工作流由其他参与者重新运行,这些限制也适用。{% endif %}
|
||||
- {% ifversion ghes = 3.3 %}`GITHUB_TOKEN` has read-only permissions, unless your administrator has removed restrictions.{% else %}`GITHUB_TOKEN` has read-only permissions by default.{% endif %}
|
||||
- {% ifversion ghes = 3.3 %}Secrets are inaccessible, unless your administrator has removed restrictions.{% else %}Secrets are populated from {% data variables.product.prodname_dependabot %} secrets. {% data variables.product.prodname_actions %} secrets are not available.{% endif %}
|
||||
|
||||
有关详细信息,请参阅[“确保 GitHub Actions 和工作流安全:阻止 pwn 请求”](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)。
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
For workflows initiated by {% data variables.product.prodname_dependabot %} (`github.actor == 'dependabot[bot]'`) using the `pull_request_target` event, if the base ref of the pull request was created by {% data variables.product.prodname_dependabot %} (`github.actor == 'dependabot[bot]'`), the `GITHUB_TOKEN` will be read-only and secrets are not available.
|
||||
{% endif %}
|
||||
|
||||
{% ifversion actions-stable-actor-ids %}These restrictions apply even if the workflow is re-run by a different actor.{% endif %}
|
||||
|
||||
For more information, see ["Keeping your GitHub Actions and workflows secure: Preventing pwn requests"](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/).
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 %}
|
||||
|
||||
### 更改 `GITHUB_TOKEN` 权限
|
||||
### Changing `GITHUB_TOKEN` permissions
|
||||
|
||||
默认情况下,由 {% data variables.product.prodname_dependabot %} 触发的 {% data variables.product.prodname_actions %} 工作流都会获得具有只读权限的 `GITHUB_TOKEN`。 可以使用工作流中的 `permissions` 密钥来增加对令牌的访问权限:
|
||||
By default, {% data variables.product.prodname_actions %} workflows triggered by {% data variables.product.prodname_dependabot %} get a `GITHUB_TOKEN` with read-only permissions. You can use the `permissions` key in your workflow to increase the access for the token:
|
||||
|
||||
{% raw %}
|
||||
|
||||
@@ -73,17 +73,17 @@ jobs:
|
||||
|
||||
{% endraw %}
|
||||
|
||||
有关详细信息,请参阅“[修改 GITHUB_TOKEN 的权限](/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token)”。
|
||||
For more information, see "[Modifying the permissions for the GITHUB_TOKEN](/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token)."
|
||||
|
||||
### 访问密钥
|
||||
### Accessing secrets
|
||||
|
||||
当 {% data variables.product.prodname_dependabot %} 事件触发工作流程时,工作流程唯一可用的机密是 {% data variables.product.prodname_dependabot %} 机密。 {% data variables.product.prodname_actions %} 机密不可用。 因此,必须将 {% data variables.product.prodname_dependabot %} 事件触发的工作流程使用的任何机密存储为 {% data variables.product.prodname_dependabot %} 机密。 有关详细信息,请参阅“[管理 Dependabot 的加密机密](/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/managing-encrypted-secrets-for-dependabot)”。
|
||||
When a {% data variables.product.prodname_dependabot %} event triggers a workflow, the only secrets available to the workflow are {% data variables.product.prodname_dependabot %} secrets. {% data variables.product.prodname_actions %} secrets are not available. Consequently, you must store any secrets that are used by a workflow triggered by {% data variables.product.prodname_dependabot %} events as {% data variables.product.prodname_dependabot %} secrets. For more information, see "[Managing encrypted secrets for Dependabot](/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/managing-encrypted-secrets-for-dependabot)".
|
||||
|
||||
{% data variables.product.prodname_dependabot %} 机密添加到 `secrets` 上下文,并使用与 {% data variables.product.prodname_actions %} 的机密完全相同的语法进行引用。 有关详细信息,请参阅“[加密机密](/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow)”。
|
||||
{% data variables.product.prodname_dependabot %} secrets are added to the `secrets` context and referenced using exactly the same syntax as secrets for {% data variables.product.prodname_actions %}. For more information, see "[Encrypted secrets](/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow)."
|
||||
|
||||
如果您的工作流程将由 {% data variables.product.prodname_dependabot %} 和其他参与者触发,则最简单的解决方案是将令牌与操作以及名称相同的 {% data variables.product.prodname_dependabot %} 密钥中所需的权限一起存储。 然后,工作流程可以包括对这些机密的单个调用。 如果 {% data variables.product.prodname_dependabot %} 的机密具有不同的名称,请使用条件指定正确的机密,以供不同的参与者使用。 有关使用条件的示例,请参阅下面的“[常见自动化](#common-dependabot-automations)”。
|
||||
If you have a workflow that will be triggered by {% data variables.product.prodname_dependabot %} and also by other actors, the simplest solution is to store the token with the permissions required in an action and in a {% data variables.product.prodname_dependabot %} secret with identical names. Then the workflow can include a single call to these secrets. If the secret for {% data variables.product.prodname_dependabot %} has a different name, use conditions to specify the correct secrets for different actors to use. For examples that use conditions, see "[Common automations](#common-dependabot-automations)" below.
|
||||
|
||||
要使用用户名和密码访问 AWS 上的私有容器注册表,工作流必须包含 `username` 和 `password` 的机密。 在下面的示例中,当 {% data variables.product.prodname_dependabot %} 触发工作流时,将使用名称为 `READONLY_AWS_ACCESS_KEY_ID` 和 `READONLY_AWS_ACCESS_KEY` 的 {% data variables.product.prodname_dependabot %} 机密。 如果另一个执行组件触发了工作流程,则使用具有这些名称的操作机密。
|
||||
To access a private container registry on AWS with a user name and password, a workflow must include a secret for `username` and `password`. In the example below, when {% data variables.product.prodname_dependabot %} triggers the workflow, the {% data variables.product.prodname_dependabot %} secrets with the names `READONLY_AWS_ACCESS_KEY_ID` and `READONLY_AWS_ACCESS_KEY` are used. If another actor triggers the workflow, the actions secrets with those names are used.
|
||||
|
||||
```yaml
|
||||
name: CI
|
||||
@@ -115,17 +115,17 @@ jobs:
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:站点管理员可以覆盖 {% data variables.product.product_location %} 的这些限制。 有关详细信息,请参阅[排查企业 {% data variables.product.prodname_actions %} 问题](/admin/github-actions/advanced-configuration-and-troubleshooting/troubleshooting-github-actions-for-your-enterprise#troubleshooting-failures-when-dependabot-triggers-existing-workflows)。
|
||||
**Note:** Your site administrator can override these restrictions for {% data variables.product.product_location %}. For more information, see "[Troubleshooting {% data variables.product.prodname_actions %} for your enterprise](/admin/github-actions/advanced-configuration-and-troubleshooting/troubleshooting-github-actions-for-your-enterprise#troubleshooting-failures-when-dependabot-triggers-existing-workflows)."
|
||||
|
||||
如果移除限制,则当工作流由 {% data variables.product.prodname_dependabot %} 触发时,它将有权访问 {% data variables.product.prodname_actions %} 机密,并且可以使用 `permissions` 一词增加 `GITHUB_TOKEN` 只读访问权限的默认范围。 可以忽略“处理 `pull_request` 事件”和“处理 `push` 事件”部分中的特定步骤,因为不再适用。
|
||||
If the restrictions are removed, when a workflow is triggered by {% data variables.product.prodname_dependabot %} it will have access to {% data variables.product.prodname_actions %} secrets and can use the `permissions` term to increase the default scope of the `GITHUB_TOKEN` from read-only access. You can ignore the specific steps in the "Handling `pull_request` events" and "Handling `push` events" sections, as it no longer applies.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
### 处理 `pull_request` 事件
|
||||
### Handling `pull_request` events
|
||||
|
||||
如果工作流需要访问机密或具有写入权限的 `GITHUB_TOKEN`,则有两个选项:使用`pull_request_target`或使用两个单独的工作流。 我们将在本部分中详细介绍如何使用 `pull_request_target`,以及如何在“[处理 `push` 事件](#handling-push-events)”中使用以下两个工作流。
|
||||
If your workflow needs access to secrets or a `GITHUB_TOKEN` with write permissions, you have two options: using `pull_request_target`, or using two separate workflows. We will detail using `pull_request_target` in this section, and using two workflows below in "[Handling `push` events](#handling-push-events)."
|
||||
|
||||
下面是一个简单的 `pull_request` 工作流示例,该工作流现在可能失败:
|
||||
Below is a simple example of a `pull_request` workflow that might now be failing:
|
||||
|
||||
```yaml
|
||||
### This workflow now has no secrets and a read-only token
|
||||
@@ -142,11 +142,11 @@ jobs:
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
```
|
||||
|
||||
可以将 `pull_request` 替换为 `pull_request_target`,后者用于来自分叉的拉取请求,然后显式签出拉取请求 `HEAD`。
|
||||
You can replace `pull_request` with `pull_request_target`, which is used for pull requests from forks, and explicitly check out the pull request `HEAD`.
|
||||
|
||||
{% warning %}
|
||||
|
||||
警告:使用 `pull_request_target` 替代 `pull_request` 会使你面临不安全的行为。 建议使用双工作流方法,如“[处理 `push` 事件](#handling-push-events)”中所述。
|
||||
**Warning:** Using `pull_request_target` as a substitute for `pull_request` exposes you to insecure behavior. We recommend you use the two workflow method, as described below in "[Handling `push` events](#handling-push-events)."
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
@@ -171,13 +171,13 @@ jobs:
|
||||
github-token: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}
|
||||
```
|
||||
|
||||
还强烈建议你缩小授予 `GITHUB_TOKEN` 的权限范围,以避免泄露具有不必要特权的令牌。 有关详细信息,请参阅“[`GITHUB_TOKEN` 的权限](/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token)”。
|
||||
It is also strongly recommended that you downscope the permissions granted to the `GITHUB_TOKEN` in order to avoid leaking a token with more privilege than necessary. For more information, see "[Permissions for the `GITHUB_TOKEN`](/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token)."
|
||||
|
||||
### 处理 `push` 事件
|
||||
### Handling `push` events
|
||||
|
||||
因为没有等效于 `push` 事件的 `pull_request_target`,因此必须使用两个工作流程:一个是以上传构件结束的不可信工作流,它将触发第二个下载构件并继续处理的可信任工作流程。
|
||||
As there is no `pull_request_target` equivalent for `push` events, you will have to use two workflows: one untrusted workflow that ends by uploading artifacts, which triggers a second trusted workflow that downloads artifacts and continues processing.
|
||||
|
||||
第一个工作流程执行任何不信任的工作:
|
||||
The first workflow performs any untrusted work:
|
||||
|
||||
{% raw %}
|
||||
|
||||
@@ -197,7 +197,7 @@ jobs:
|
||||
|
||||
{% endraw %}
|
||||
|
||||
第二个工作流程在第一个工作流程成功完成后执行受信任的工作:
|
||||
The second workflow performs trusted work after the first workflow completes successfully:
|
||||
|
||||
{% raw %}
|
||||
|
||||
@@ -225,37 +225,37 @@ jobs:
|
||||
|
||||
{% endif %}
|
||||
|
||||
### 手动重新运行工作流程
|
||||
### Manually re-running a workflow
|
||||
|
||||
{% ifversion actions-stable-actor-ids %}
|
||||
|
||||
手动重新运行 Dependabot 工作流时,即使发起重新运行的用户具有不同的权限,该工作流也会使用以前所用的权限运行。 有关详细信息,请参阅“[重新运行工作流和作业](/actions/managing-workflow-runs/re-running-workflows-and-jobs)”。
|
||||
When you manually re-run a Dependabot workflow, it will run with the same privileges as before even if the user who initiated the rerun has different privileges. For more information, see "[Re-running workflows and jobs](/actions/managing-workflow-runs/re-running-workflows-and-jobs)."
|
||||
|
||||
{% else %}
|
||||
|
||||
您还可以手动重新运行失败的 Dependabot 工作流程,它将以读写令牌运行并访问密码。 在手动重新运行失败的工作流程之前,您应始终检查更新的依赖项,以确保更改不会引入任何恶意或意外行为。
|
||||
You can also manually re-run a failed Dependabot workflow, and it will run with a read-write token and access to secrets. Before manually re-running a failed workflow, you should always check the dependency being updated to ensure that the change doesn't introduce any malicious or unintended behavior.
|
||||
|
||||
{% endif %}
|
||||
|
||||
## 常用 Dependabot 自动化
|
||||
## Common Dependabot automations
|
||||
|
||||
以下是可以使用 {% data variables.product.prodname_actions %} 自动化的几个常见场景。
|
||||
Here are several common scenarios that can be automated using {% data variables.product.prodname_actions %}.
|
||||
|
||||
{% ifversion ghes = 3.3 %}
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:如果站点管理员已覆盖对 {% data variables.product.product_location %} 上的 {% data variables.product.prodname_dependabot %} 的限制,则可以在以下工作流中使用 `pull_request`,而不是 `pull_request_target`。
|
||||
**Note:** If your site administrator has overridden restrictions for {% data variables.product.prodname_dependabot %} on {% data variables.product.product_location %}, you can use `pull_request` instead of `pull_request_target` in the following workflows.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
### 获取有关拉取请求的元数据
|
||||
### Fetch metadata about a pull request
|
||||
|
||||
大量自动化需要了解拉取请求内容的信息:依赖项名称是什么,是否为生产依赖项,以及是否为主要、次要或补丁更新。
|
||||
A large amount of automation requires knowing information about the contents of the pull request: what the dependency name was, if it's a production dependency, and if it's a major, minor, or patch update.
|
||||
|
||||
`dependabot/fetch-metadata` 操作为你提供了所有这些信息:
|
||||
The `dependabot/fetch-metadata` action provides all that information for you:
|
||||
|
||||
{% ifversion ghes = 3.3 %}
|
||||
|
||||
@@ -321,13 +321,13 @@ jobs:
|
||||
|
||||
{% endif %}
|
||||
|
||||
有关详细信息,请参阅 [`dependabot/fetch-metadata`](https://github.com/dependabot/fetch-metadata) 存储库。
|
||||
For more information, see the [`dependabot/fetch-metadata`](https://github.com/dependabot/fetch-metadata) repository.
|
||||
|
||||
### 标记拉取请求
|
||||
### Label a pull request
|
||||
|
||||
如果您有基于 {% data variables.product.prodname_dotcom %} 标签的其他自动化或分类工作流程,则可以配置操作以根据提供的元数据分配标签。
|
||||
If you have other automation or triage workflows based on {% data variables.product.prodname_dotcom %} labels, you can configure an action to assign labels based on the metadata provided.
|
||||
|
||||
例如,如果您想用标签标记所有生产依赖项更新:
|
||||
For example, if you want to flag all production dependency updates with a label:
|
||||
|
||||
{% ifversion ghes = 3.3 %}
|
||||
|
||||
@@ -395,9 +395,9 @@ jobs:
|
||||
|
||||
{% endif %}
|
||||
|
||||
### 批准拉取请求
|
||||
### Approve a pull request
|
||||
|
||||
如果您想要自动批准 Dependabot 拉取请求,您可以在工作流程中使用 {% data variables.product.prodname_cli %}:
|
||||
If you want to automatically approve Dependabot pull requests, you can use the {% data variables.product.prodname_cli %} in a workflow:
|
||||
|
||||
{% ifversion ghes = 3.3 %}
|
||||
|
||||
@@ -461,11 +461,11 @@ jobs:
|
||||
|
||||
{% endif %}
|
||||
|
||||
### 在拉取请求上启用自动合并
|
||||
### Enable auto-merge on a pull request
|
||||
|
||||
如果要允许维护者标记某些拉取请求以进行自动合并,可以使用 {% data variables.product.prodname_dotcom %} 的自动合并功能。 这样,当所有所需的测试和批准都成功满足时,拉取请求即可合并。 有关自动合并的详细信息,请参阅“[自动合并拉取请求](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request)”。
|
||||
If you want to allow maintainers to mark certain pull requests for auto-merge, you can use {% data variables.product.prodname_dotcom %}'s auto-merge functionality. This enables the pull request to be merged when all required tests and approvals are successfully met. For more information on auto-merge, see "[Automatically merging a pull request](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request)."
|
||||
|
||||
可以改为使用 {% data variables.product.prodname_actions %} 和 {% data variables.product.prodname_cli %}。 以下示例会将所有补丁更新自动合并为 `my-dependency`:
|
||||
You can instead use {% data variables.product.prodname_actions %} and the {% data variables.product.prodname_cli %}. Here is an example that auto merges all patch updates to `my-dependency`:
|
||||
|
||||
{% ifversion ghes = 3.3 %}
|
||||
|
||||
@@ -533,24 +533,24 @@ jobs:
|
||||
|
||||
{% endif %}
|
||||
|
||||
## 失败的工作流程运行故障排除
|
||||
## Troubleshooting failed workflow runs
|
||||
|
||||
如果您的工作流程运行失败,请检查以下情况:
|
||||
If your workflow run fails, check the following:
|
||||
|
||||
{% ifversion ghes = 3.3 %}
|
||||
|
||||
- 只有当正确的角色触发工作流程时,才运行工作流程。
|
||||
- 你正在检查 `pull_request` 的正确 `ref` 值。
|
||||
- 你不会尝试从 Dependabot 触发的 `pull_request`、`pull_request_review`、`pull_request_review_comment` 或 `push` 事件中访问机密。
|
||||
- 你不会尝试从 Dependabot 触发的 `pull_request`、`pull_request_review`、`pull_request_review_comment` 或 `push` 事件中执行任何 `write` 操作。
|
||||
- You are running the workflow only when the correct actor triggers it.
|
||||
- You are checking out the correct `ref` for your `pull_request`.
|
||||
- You aren't trying to access secrets from within a Dependabot-triggered `pull_request`, `pull_request_review`, `pull_request_review_comment`, or `push` event.
|
||||
- You aren't trying to perform any `write` actions from within a Dependabot-triggered `pull_request`, `pull_request_review`, `pull_request_review_comment`, or `push` event.
|
||||
|
||||
{% else %}
|
||||
|
||||
- 只有当正确的角色触发工作流程时,才运行工作流程。
|
||||
- 你正在检查 `pull_request` 的正确 `ref` 值。
|
||||
- 您的机密在 {% data variables.product.prodname_dependabot %} 机密中可用,而不是作为 {% data variables.product.prodname_actions %} 机密。
|
||||
- 你有一个具有适当权限的 `GITHUB_TOKEN`。
|
||||
- You are running the workflow only when the correct actor triggers it.
|
||||
- You are checking out the correct `ref` for your `pull_request`.
|
||||
- Your secrets are available in {% data variables.product.prodname_dependabot %} secrets rather than as {% data variables.product.prodname_actions %} secrets.
|
||||
- You have a `GITHUB_TOKEN` with the correct permissions.
|
||||
|
||||
{% endif %}
|
||||
|
||||
有关编写和调试 {% data variables.product.prodname_actions %} 的详细信息,请参阅“[了解 GitHub Actions](/actions/learn-github-actions)”。
|
||||
For information on writing and debugging {% data variables.product.prodname_actions %}, see "[Learning GitHub Actions](/actions/learn-github-actions)."
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: GitHub 安全功能
|
||||
intro: '{% data variables.product.prodname_dotcom %} 安全功能概述。'
|
||||
title: GitHub security features
|
||||
intro: 'An overview of {% data variables.product.prodname_dotcom %} security features.'
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghes: '*'
|
||||
@@ -12,34 +12,31 @@ topics:
|
||||
- Dependencies
|
||||
- Vulnerabilities
|
||||
- Advanced Security
|
||||
ms.openlocfilehash: fc2e4452e83245535c3d5f7ead70b1b23a5d874a
|
||||
ms.sourcegitcommit: fb047f9450b41b24afc43d9512a5db2a2b750a2a
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/11/2022
|
||||
ms.locfileid: '147881483'
|
||||
---
|
||||
## 关于 {% data variables.product.prodname_dotcom %} 安全功能
|
||||
|
||||
{% data variables.product.prodname_dotcom %} 具有安全功能,有助于在仓库和组织间保持代码和秘密安全。 {% data reusables.advanced-security.security-feature-availability %}
|
||||
## About {% data variables.product.prodname_dotcom %}'s security features
|
||||
|
||||
{% data variables.product.prodname_advisory_database %} 包含您可以查看、搜索和过滤的安全漏洞列表。 {% data reusables.security-advisory.link-browsing-advisory-db %}
|
||||
{% data variables.product.prodname_dotcom %} has security features that help keep code and secrets secure in repositories and across organizations. {% data reusables.advanced-security.security-feature-availability %}
|
||||
|
||||
## 适用于所有仓库
|
||||
### 安全策略
|
||||
The {% data variables.product.prodname_advisory_database %} contains a curated list of security vulnerabilities that you can view, search, and filter. {% data reusables.security-advisory.link-browsing-advisory-db %}
|
||||
|
||||
让您的用户能够轻松地秘密报告他们在仓库中发现的安全漏洞。 有关详细信息,请参阅“[向存储库添加安全策略](/code-security/getting-started/adding-a-security-policy-to-your-repository)”。
|
||||
## Available for all repositories
|
||||
### Security policy
|
||||
|
||||
Make it easy for your users to confidentially report security vulnerabilities they've found in your repository. For more information, see "[Adding a security policy to your repository](/code-security/getting-started/adding-a-security-policy-to-your-repository)."
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
### 安全通知
|
||||
### Security advisories
|
||||
|
||||
私下讨论并修复仓库代码中的安全漏洞。 然后,您可以发布安全通告,提醒您的社区注意漏洞并鼓励社区成员升级。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_security_advisories %}](/github/managing-security-vulnerabilities/about-github-security-advisories)”。
|
||||
Privately discuss and fix security vulnerabilities in your repository's code. You can then publish a security advisory to alert your community to the vulnerability and encourage community members to upgrade. For more information, see "[About {% data variables.product.prodname_security_advisories %}](/github/managing-security-vulnerabilities/about-github-security-advisories)."
|
||||
|
||||
{% endif %} {% ifversion fpt or ghec or ghes > 3.2 %}
|
||||
{% endif %}
|
||||
{% ifversion fpt or ghec or ghes > 3.2 %}
|
||||
|
||||
### {% data variables.product.prodname_dependabot_alerts %} 和安全更新
|
||||
### {% data variables.product.prodname_dependabot_alerts %} and security updates
|
||||
|
||||
查看有关已知包含安全漏洞的依赖项的警报,并选择是否自动生成拉取请求以更新这些依赖项。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_alerts %}](/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies)”和“[关于 {% data variables.product.prodname_dependabot_security_updates %}](/github/managing-security-vulnerabilities/about-dependabot-security-updates)”。
|
||||
View alerts about dependencies that are known to contain security vulnerabilities, and choose whether to have pull requests generated automatically to update these dependencies. For more information, see "[About {% data variables.product.prodname_dependabot_alerts %}](/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies)"
|
||||
and "[About {% data variables.product.prodname_dependabot_security_updates %}](/github/managing-security-vulnerabilities/about-dependabot-security-updates)."
|
||||
{% endif %}
|
||||
|
||||
{% ifversion ghes < 3.3 or ghae %}
|
||||
@@ -47,73 +44,79 @@ ms.locfileid: '147881483'
|
||||
|
||||
{% data reusables.dependabot.dependabot-alerts-beta %}
|
||||
|
||||
查看有关已知包含安全漏洞的依赖项的警报,并管理这些警报。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_alerts %}](/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies)”。
|
||||
View alerts about dependencies that are known to contain security vulnerabilities, and manage these alerts. For more information, see "[About {% data variables.product.prodname_dependabot_alerts %}](/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies)."
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.2 %}
|
||||
### {% data variables.product.prodname_dependabot %} version updates
|
||||
|
||||
使用 {% data variables.product.prodname_dependabot %} 自动提出拉取请求以保持依赖项的更新。 这有助于减少您暴露于旧版本依赖项。 如果发现安全漏洞,使用更新后的版本就更容易打补丁,{% data variables.product.prodname_dependabot_security_updates %} 也更容易成功地提出拉取请求以升级有漏洞的依赖项。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_version_updates %}](/github/administering-a-repository/about-dependabot-version-updates)”。
|
||||
Use {% data variables.product.prodname_dependabot %} to automatically raise pull requests to keep your dependencies up-to-date. This helps reduce your exposure to older versions of dependencies. Using newer versions makes it easier to apply patches if security vulnerabilities are discovered, and also makes it easier for {% data variables.product.prodname_dependabot_security_updates %} to successfully raise pull requests to upgrade vulnerable dependencies. For more information, see "[About {% data variables.product.prodname_dependabot_version_updates %}](/github/administering-a-repository/about-dependabot-version-updates)."
|
||||
{% endif %}
|
||||
|
||||
### 依赖关系图
|
||||
依赖关系图允许您探索仓库所依赖的生态系统和包,以及依赖于您的仓库的仓库和包。
|
||||
### Dependency graph
|
||||
The dependency graph allows you to explore the ecosystems and packages that your repository depends on and the repositories and packages that depend on your repository.
|
||||
|
||||
你可以在存储库的“见解”选项卡上找到依赖项关系图。 有关详细信息,请参阅[关于依赖项关系图](/github/visualizing-repository-data-with-graphs/about-the-dependency-graph)。
|
||||
You can find the dependency graph on the **Insights** tab for your repository. For more information, see "[About the dependency graph](/github/visualizing-repository-data-with-graphs/about-the-dependency-graph)."
|
||||
|
||||
{% ifversion security-overview-displayed-alerts %}
|
||||
### 安全概述
|
||||
### Security overview
|
||||
|
||||
通过安全概览,可以查看安全配置和警报,从而轻松识别面临最大风险的存储库和组织。 有关详细信息,请参阅“[关于安全概述](/code-security/security-overview/about-the-security-overview)”。
|
||||
The security overview allows you to review security configurations and alerts, making it easy to identify the repositories and organizations at greatest risk. For more information, see "[About the security overview](/code-security/security-overview/about-the-security-overview)."
|
||||
|
||||
{% else %}
|
||||
### 存储库的安全概述
|
||||
安全概览显示为存储库启用了哪些安全功能,并提供用于配置尚未启用的任何可用安全功能的选项。
|
||||
### Security overview for repositories
|
||||
The security overview shows which security features are enabled for the repository, and offers you the option of configuring any available security features that are not already enabled.
|
||||
{% endif %}
|
||||
|
||||
## 通过 {% data variables.product.prodname_GH_advanced_security %} 可用
|
||||
## Available with {% data variables.product.prodname_GH_advanced_security %}
|
||||
|
||||
{% ifversion fpt %} {% data variables.product.prodname_dotcom_the_website %} 上的公共存储库免费提供以下 {% data variables.product.prodname_GH_advanced_security %} 功能。 使用具有 {% data variables.product.prodname_GH_advanced_security %} 许可证的 {% data variables.product.prodname_ghe_cloud %} 的组织可以在其任何存储库中使用完整的功能集。 有关 {% data variables.product.prodname_ghe_cloud %} 可用功能的列表,请参阅 [{% data variables.product.prodname_ghe_cloud %} 文档](/enterprise-cloud@latest/code-security/getting-started/github-security-features#available-with-github-advanced-security)。
|
||||
{% ifversion fpt %}
|
||||
The following {% data variables.product.prodname_GH_advanced_security %} features are available and free of charge for public repositories on {% data variables.product.prodname_dotcom_the_website %}. Organizations that use {% data variables.product.prodname_ghe_cloud %} with a license for {% data variables.product.prodname_GH_advanced_security %} can use the full set of features in any of their repositories. For a list of the features available with {% data variables.product.prodname_ghe_cloud %}, see the [{% data variables.product.prodname_ghe_cloud %} documentation](/enterprise-cloud@latest/code-security/getting-started/github-security-features#available-with-github-advanced-security).
|
||||
|
||||
{% elsif ghec %} {% data variables.product.prodname_dotcom_the_website %} 上的公共存储库免费提供了许多 {% data variables.product.prodname_GH_advanced_security %} 功能。 企业中具有 {% data variables.product.prodname_GH_advanced_security %} 许可证的组织可以在其所有存储库上使用以下功能。 {% data reusables.advanced-security.more-info-ghas %}
|
||||
{% elsif ghec %}
|
||||
Many {% data variables.product.prodname_GH_advanced_security %} features are available and free of charge for public repositories on {% data variables.product.prodname_dotcom_the_website %}. Organizations within an enterprise that have a {% data variables.product.prodname_GH_advanced_security %} license can use the following features on all their repositories. {% data reusables.advanced-security.more-info-ghas %}
|
||||
|
||||
{% elsif ghes %} {% data variables.product.prodname_GH_advanced_security %} 功能适用于具有 {% data variables.product.prodname_GH_advanced_security %} 许可证的企业。 这些功能仅限于组织拥有的存储库。 {% data reusables.advanced-security.more-info-ghas %}
|
||||
{% elsif ghes %}
|
||||
{% data variables.product.prodname_GH_advanced_security %} features are available for enterprises with a license for {% data variables.product.prodname_GH_advanced_security %}. The features are restricted to repositories owned by an organization. {% data reusables.advanced-security.more-info-ghas %}
|
||||
|
||||
{% elsif ghae %} {% data variables.product.prodname_GH_advanced_security %} 功能可用于组织拥有的存储库。 {% data reusables.advanced-security.more-info-ghas %} {% endif %}
|
||||
{% elsif ghae %}
|
||||
{% data variables.product.prodname_GH_advanced_security %} features are available for repositories owned by an organization. {% data reusables.advanced-security.more-info-ghas %}
|
||||
{% endif %}
|
||||
|
||||
### {% data variables.product.prodname_code_scanning_capc %}
|
||||
|
||||
自动检测新代码或修改代码中的安全漏洞和编码错误。 潜在的问题被高亮显示,并附有详细信息,允许您在将代码合并到默认分支之前修复它。 有关详细信息,请参阅“[关于代码扫描](/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning)”。
|
||||
Automatically detect security vulnerabilities and coding errors in new or modified code. Potential problems are highlighted, with detailed information, allowing you to fix the code before it's merged into your default branch. For more information, see "[About code scanning](/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning)."
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
### {% data variables.product.prodname_secret_scanning_partner_caps %}
|
||||
|
||||
自动检测所有公共存储库中泄露的机密。 {% data variables.product.company_short %} 通知相关服务提供商机密可能已泄露。 有关支持的机密和服务提供商的详细信息,请参阅 “[{% data variables.product.prodname_secret_scanning_caps %} 模式](/code-security/secret-scanning/secret-scanning-patterns)”。
|
||||
Automatically detect leaked secrets across all public repositories. {% data variables.product.company_short %} informs the relevant service provider that the secret may be compromised. For details of the supported secrets and service providers, see "[{% data variables.product.prodname_secret_scanning_caps %} patterns](/code-security/secret-scanning/secret-scanning-patterns)."
|
||||
{% endif %}
|
||||
|
||||
{% ifversion ghec or ghes or ghae %}
|
||||
### {% data variables.product.prodname_secret_scanning_GHAS_caps %}
|
||||
|
||||
{% ifversion ghec %} 仅通过 {% data variables.product.prodname_GH_advanced_security %} 的许可证提供。
|
||||
{% ifversion ghec %}
|
||||
Available only with a license for {% data variables.product.prodname_GH_advanced_security %}.
|
||||
{% endif %}
|
||||
|
||||
自动检测已签入存储库的令牌或凭据。 您可以查看 {% data variables.product.company_short %} 代码中找到的任何机密的警报,以便知道哪些令牌或凭据被视为已泄露。 有关详细信息,请参阅“[关于机密扫描](/code-security/secret-scanning/about-secret-scanning#about-secret-scanning-for-advanced-security)”。
|
||||
Automatically detect tokens or credentials that have been checked into a repository. You can view alerts for any secrets that {% data variables.product.company_short %} finds in your code, so that you know which tokens or credentials to treat as compromised. For more information, see "[About secret scanning](/code-security/secret-scanning/about-secret-scanning#about-secret-scanning-for-advanced-security)."
|
||||
{% endif %}
|
||||
|
||||
### 依赖项检查
|
||||
### Dependency review
|
||||
|
||||
在合并拉取请求之前显示依赖项更改的全部影响以及任何有漏洞版本的详情。 有关详细信息,请参阅“[关于依赖项审查](/code-security/supply-chain-security/about-dependency-review)”。
|
||||
Show the full impact of changes to dependencies and see details of any vulnerable versions before you merge a pull request. For more information, see "[About dependency review](/code-security/supply-chain-security/about-dependency-review)."
|
||||
|
||||
{% ifversion security-overview-displayed-alerts %}<!--Section appears in non-GHAS features above-->
|
||||
|
||||
{% elsif fpt %}<!--Feature requires enterprise product-->
|
||||
|
||||
{% else %}
|
||||
### 组织{% ifversion ghes > 3.4 or ghae-issue-6199 %}、企业、{% endif %}和团队的安全概览
|
||||
### Security overview for organizations{% ifversion ghes > 3.4 or ghae > 3.4 %}, enterprises,{% endif %} and teams
|
||||
|
||||
检查组织的安全配置和警报,并确定风险最大的存储库。 有关详细信息,请参阅“[关于安全概述](/code-security/security-overview/about-the-security-overview)”。
|
||||
Review the security configuration and alerts for your organization and identify the repositories at greatest risk. For more information, see "[About the security overview](/code-security/security-overview/about-the-security-overview)."
|
||||
{% endif %}
|
||||
|
||||
## 延伸阅读
|
||||
- [{% data variables.product.prodname_dotcom %} 的产品](/github/getting-started-with-github/githubs-products)
|
||||
- [{% data variables.product.prodname_dotcom %} 语言支持](/github/getting-started-with-github/github-language-support)
|
||||
## Further reading
|
||||
- "[{% data variables.product.prodname_dotcom %}'s products](/github/getting-started-with-github/githubs-products)"
|
||||
- "[{% data variables.product.prodname_dotcom %} language support](/github/getting-started-with-github/github-language-support)"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 保护您的仓库
|
||||
intro: '您可以使用许多 {% data variables.product.prodname_dotcom %} 功能来帮助保护仓库的安全。'
|
||||
title: Securing your repository
|
||||
intro: 'You can use a number of {% data variables.product.prodname_dotcom %} features to help keep your repository secure.'
|
||||
permissions: Repository administrators and organization owners can configure repository security settings.
|
||||
redirect_from:
|
||||
- /github/administering-a-repository/about-securing-your-repository
|
||||
@@ -17,123 +17,122 @@ topics:
|
||||
- Vulnerabilities
|
||||
- Advanced Security
|
||||
shortTitle: Secure your repository
|
||||
ms.openlocfilehash: 46addd796d3eee772dcc14da7604f7a375ac14b7
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147526684'
|
||||
---
|
||||
## 简介
|
||||
本指南向您展示如何配置仓库的安全功能。 您必须是仓库管理员或组织所有者才能配置仓库的安全设置。
|
||||
|
||||
您的安全需求是仓库独有的,因此您可能不需要启用仓库的每个功能。 有关详细信息,请参阅“[{% data variables.product.prodname_dotcom %} 安全功能](/code-security/getting-started/github-security-features)”。
|
||||
## Introduction
|
||||
This guide shows you how to configure security features for a repository. You must be a repository administrator or organization owner to configure security settings for a repository.
|
||||
|
||||
Your security needs are unique to your repository, so you may not need to enable every feature for your repository. For more information, see "[{% data variables.product.prodname_dotcom %} security features](/code-security/getting-started/github-security-features)."
|
||||
|
||||
{% data reusables.advanced-security.security-feature-availability %}
|
||||
|
||||
## 管理对仓库的访问
|
||||
## Managing access to your repository
|
||||
|
||||
保护仓库的第一步是设置谁可以查看和修改您的代码。 有关详细信息,请参阅“[管理存储库设置](/github/administering-a-repository/managing-repository-settings)”。
|
||||
The first step to securing a repository is to set up who can see and modify your code. For more information, see "[Managing repository settings](/github/administering-a-repository/managing-repository-settings)."
|
||||
|
||||
从存储库的主页中,单击“{% octicon "gear" aria-label="The Settings gear" %}设置”,然后向下滚动到“危险区域”。
|
||||
From the main page of your repository, click **{% octicon "gear" aria-label="The Settings gear" %}Settings**, then scroll down to the "Danger Zone."
|
||||
|
||||
- 要更改谁可以查看存储库,请单击“更改可见性”。 有关详细信息,请参阅“[设置存储库可见性](/github/administering-a-repository/setting-repository-visibility)”。{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5974 %}
|
||||
- 要更改谁可以访问存储库并调整权限,请单击“管理访问权限”。 有关详细信息,请参阅“[管理有权访问存储库的团队和人员](/github/administering-a-repository/managing-teams-and-people-with-access-to-your-repository)”。{% endif %}
|
||||
- To change who can view your repository, click **Change visibility**. For more information, see "[Setting repository visibility](/github/administering-a-repository/setting-repository-visibility)."{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
- To change who can access your repository and adjust permissions, click **Manage access**. For more information, see"[Managing teams and people with access to your repository](/github/administering-a-repository/managing-teams-and-people-with-access-to-your-repository)."{% endif %}
|
||||
|
||||
## 设置安全策略
|
||||
## Setting a security policy
|
||||
|
||||
1. 从存储库的主页中,单击“{% octicon "shield" aria-label="The shield symbol" %} 安全性”。
|
||||
2. 单击“安全策略”。
|
||||
3. 单击“开始设置”。
|
||||
4. 添加关于项目受支持版本以及如何报告漏洞的信息。
|
||||
1. From the main page of your repository, click **{% octicon "shield" aria-label="The shield symbol" %} Security**.
|
||||
2. Click **Security policy**.
|
||||
3. Click **Start setup**.
|
||||
4. Add information about supported versions of your project and how to report vulnerabilities.
|
||||
|
||||
有关详细信息,请参阅“[向存储库添加安全策略](/code-security/getting-started/adding-a-security-policy-to-your-repository)”。
|
||||
For more information, see "[Adding a security policy to your repository](/code-security/getting-started/adding-a-security-policy-to-your-repository)."
|
||||
|
||||
## 管理依赖关系图
|
||||
## Managing the dependency graph
|
||||
|
||||
{% ifversion fpt or ghec %} 依赖项关系图自动为所有公共存储库生成,你可以选择为专用存储库启用它。 它解释存储库中的清单和锁定文件以识别依赖项。
|
||||
{% ifversion fpt or ghec %}
|
||||
The dependency graph is automatically generated for all public repositories, and you can choose to enable it for private repositories. It interprets manifest and lock files in a repository to identify dependencies.
|
||||
|
||||
1. 从存储库的主页中,单击“{% octicon "gear" aria-label="The Settings gear" %} 设置”。
|
||||
2. 单击“安全性和分析”。
|
||||
3. 在依赖项关系图旁边,单击“启用”或“禁用” 。
|
||||
1. From the main page of your repository, click **{% octicon "gear" aria-label="The Settings gear" %} Settings**.
|
||||
2. Click **Security & analysis**.
|
||||
3. Next to Dependency graph, click **Enable** or **Disable**.
|
||||
{% endif %}
|
||||
|
||||
{% data reusables.dependabot.dependabot-alerts-dependency-graph-enterprise %}
|
||||
|
||||
有关详细信息,请参阅“[探索存储库的依赖项](/code-security/supply-chain-security/exploring-the-dependencies-of-a-repository#enabling-and-disabling-the-dependency-graph-for-a-private-repository)”。
|
||||
For more information, see "[Exploring the dependencies of a repository](/code-security/supply-chain-security/exploring-the-dependencies-of-a-repository#enabling-and-disabling-the-dependency-graph-for-a-private-repository)."
|
||||
|
||||
## 管理 {% data variables.product.prodname_dependabot_alerts %}
|
||||
## Managing {% data variables.product.prodname_dependabot_alerts %}
|
||||
|
||||
当 {% data variables.product.prodname_dotcom %} 在依赖关系图中标识具有漏洞的依赖项时,将生成 {% data variables.product.prodname_dependabot_alerts %} 。 {% ifversion fpt or ghec %}您可以为任何存储库启用 {% data variables.product.prodname_dependabot_alerts %}。{% endif %}
|
||||
{% data variables.product.prodname_dependabot_alerts %} are generated when {% data variables.product.prodname_dotcom %} identifies a dependency in the dependency graph with a vulnerability. {% ifversion fpt or ghec %}You can enable {% data variables.product.prodname_dependabot_alerts %} for any repository.{% endif %}
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
1. 单击你的个人资料照片,然后单击“设置”。
|
||||
2. 单击“安全性和分析”。
|
||||
3. 单击 {% data variables.product.prodname_dependabot_alerts %} 旁边的“全部启用”。
|
||||
1. Click your profile photo, then click **Settings**.
|
||||
2. Click **Security & analysis**.
|
||||
3. Click **Enable all** next to {% data variables.product.prodname_dependabot_alerts %}.
|
||||
{% endif %}
|
||||
|
||||
{% data reusables.dependabot.dependabot-alerts-beta %} {% data reusables.dependabot.dependabot-alerts-dependency-graph-enterprise %}
|
||||
{% data reusables.dependabot.dependabot-alerts-beta %}
|
||||
{% data reusables.dependabot.dependabot-alerts-dependency-graph-enterprise %}
|
||||
|
||||
有关详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/about-alerts-for-vulnerable-dependencies){% ifversion fpt or ghec %}”和“[管理个人帐户的安全和分析设置](/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){% endif %}”。
|
||||
For more information, see "[About {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/about-alerts-for-vulnerable-dependencies){% ifversion fpt or ghec %}" and "[Managing security and analysis settings for your personal 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){% endif %}."
|
||||
|
||||
## 管理依赖项审查
|
||||
## Managing dependency review
|
||||
|
||||
依赖项审查可让您在合并到仓库之前在拉取请求中显示依赖关系的变化。 有关详细信息,请参阅“[关于依赖项审查](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review)”。
|
||||
Dependency review lets you visualize dependency changes in pull requests before they are merged into your repositories. For more information, see "[About dependency review](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review)."
|
||||
|
||||
依赖项审查是一项 {% data variables.product.prodname_GH_advanced_security %} 功能。 {% ifversion fpt or ghec %} 已为所有公共存储库启用了依赖项审查。 {% ifversion fpt %}将 {% data variables.product.prodname_ghe_cloud %} 与 {% data variables.product.prodname_advanced_security %} 一起使用的组织还可以对私有和内部存储库启用依赖项审查。 有关详细信息,请参阅 [{% data variables.product.prodname_ghe_cloud %} 文档](/enterprise-cloud@latest/code-security/getting-started/securing-your-repository#managing-dependency-review)。 {% endif %}{% endif %}{% ifversion ghec or ghes or ghae %}要为 {% ifversion ghec %}私有或内部 {% endif %}存储库启用依赖项审查,请确保已启用依赖项关系图并启用 {% data variables.product.prodname_GH_advanced_security %}。
|
||||
Dependency review is a {% data variables.product.prodname_GH_advanced_security %} feature. {% ifversion fpt or ghec %}Dependency review is already enabled for all public repositories. {% ifversion fpt %}Organizations that use {% data variables.product.prodname_ghe_cloud %} with {% data variables.product.prodname_advanced_security %} can additionally enable dependency review for private and internal repositories. For more information, see the [{% data variables.product.prodname_ghe_cloud %} documentation](/enterprise-cloud@latest/code-security/getting-started/securing-your-repository#managing-dependency-review). {% endif %}{% endif %}{% ifversion ghec or ghes or ghae %}To enable dependency review for a {% ifversion ghec %}private or internal {% endif %}repository, ensure that the dependency graph is enabled and enable {% data variables.product.prodname_GH_advanced_security %}.
|
||||
|
||||
1. 从存储库的主页中,单击“{% octicon "gear" aria-label="The Settings gear" %}设置”。
|
||||
2. 单击“安全性和分析”。
|
||||
3. {% ifversion ghec %}如果尚未启用依赖项关系图,请单击“启用”。{% elsif ghes or ghae %}检查是否已为企业配置依赖项关系图。{% endif %}
|
||||
4. 如果尚未启用 {% data variables.product.prodname_GH_advanced_security %},请单击“启用”。
|
||||
1. From the main page of your repository, click **{% octicon "gear" aria-label="The Settings gear" %}Settings**.
|
||||
2. Click **Security & analysis**.
|
||||
3. {% ifversion ghec %}If dependency graph is not already enabled, click **Enable**.{% elsif ghes or ghae %}Check that dependency graph is configured for your enterprise.{% endif %}
|
||||
4. If {% data variables.product.prodname_GH_advanced_security %} is not already enabled, click **Enable**.
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.2 %}
|
||||
|
||||
## 管理 {% data variables.product.prodname_dependabot_security_updates %}
|
||||
## Managing {% data variables.product.prodname_dependabot_security_updates %}
|
||||
|
||||
对于任何使用 {% data variables.product.prodname_dependabot_alerts %} 的仓库,您可以启用 {% data variables.product.prodname_dependabot_security_updates %} 在检测到漏洞时提出带有安全更新的拉取请求。
|
||||
For any repository that uses {% data variables.product.prodname_dependabot_alerts %}, you can enable {% data variables.product.prodname_dependabot_security_updates %} to raise pull requests with security updates when vulnerabilities are detected.
|
||||
|
||||
1. 从存储库的主页中,单击“{% octicon "gear" aria-label="The Settings gear" %}设置”。
|
||||
2. 单击“安全性和分析”。
|
||||
3. 在 {% data variables.product.prodname_dependabot_security_updates %} 旁边,单击“启用”。
|
||||
1. From the main page of your repository, click **{% octicon "gear" aria-label="The Settings gear" %}Settings**.
|
||||
2. Click **Security & analysis**.
|
||||
3. Next to {% data variables.product.prodname_dependabot_security_updates %}, click **Enable**.
|
||||
|
||||
有关详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_security_updates %}](/code-security/supply-chain-security/about-dependabot-security-updates)”和“[配置 {% data variables.product.prodname_dependabot_security_updates %}](/code-security/supply-chain-security/configuring-dependabot-security-updates)”。
|
||||
For more information, see "[About {% data variables.product.prodname_dependabot_security_updates %}](/code-security/supply-chain-security/about-dependabot-security-updates)" and "[Configuring {% data variables.product.prodname_dependabot_security_updates %}](/code-security/supply-chain-security/configuring-dependabot-security-updates)."
|
||||
|
||||
## 管理 {% data variables.product.prodname_dependabot_version_updates %}
|
||||
## Managing {% data variables.product.prodname_dependabot_version_updates %}
|
||||
|
||||
您可以让 {% data variables.product.prodname_dependabot %} 自动提出拉取请求以保持依赖项的更新。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_version_updates %}](/code-security/supply-chain-security/about-dependabot-version-updates)”。
|
||||
You can enable {% data variables.product.prodname_dependabot %} to automatically raise pull requests to keep your dependencies up-to-date. For more information, see "[About {% data variables.product.prodname_dependabot_version_updates %}](/code-security/supply-chain-security/about-dependabot-version-updates)."
|
||||
|
||||
{% ifversion dependabot-settings-update-37 %}
|
||||
1. 从存储库的主页中,单击“{% octicon "gear" aria-label="The Settings gear" %} 设置”。
|
||||
2. 单击“安全性和分析”。
|
||||
3. 在 {% data variables.product.prodname_dependabot_version_updates %} 旁,单击“启用”以创建基本 dependabot.yml 配置文件。
|
||||
4. 指定要更新文件并将文件提交到存储库的依赖项。 有关详细信息,请参阅“[配置 Dependabot 版本更新](/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates#enabling-dependabot-version-updates)”。
|
||||
1. From the main page of your repository, click **{% octicon "gear" aria-label="The Settings gear" %} Settings**.
|
||||
2. Click **Security & analysis**.
|
||||
3. Next to {% data variables.product.prodname_dependabot_version_updates %}, click **Enable** to create a basic *dependabot.yml* configuration file.
|
||||
4. Specify the dependencies to update and commit the file to the repository. For more information, see "[Configuring Dependabot version updates](/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates#enabling-dependabot-version-updates)."
|
||||
|
||||
{% else %} 要启用 {% data variables.product.prodname_dependabot_version_updates %},必须创建 dependabot.yml 配置文件。 有关详细信息,请参阅“[配置 {% data variables.product.prodname_dependabot %} 版本更新](/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/enabling-and-disabling-dependabot-version-updates)”。
|
||||
{% else %}
|
||||
To enable {% data variables.product.prodname_dependabot_version_updates %}, you must create a *dependabot.yml* configuration file. 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)."
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
## 配置 {% data variables.product.prodname_code_scanning %}
|
||||
## Configuring {% data variables.product.prodname_code_scanning %}
|
||||
|
||||
您可以设置 {% data variables.product.prodname_code_scanning %} 使用 {% data variables.product.prodname_codeql_workflow %} 或第三方工具自动识别仓库中存储的代码中的漏洞和错误。 有关详细信息,请参阅“[为存储库设置 {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/setting-up-code-scanning-for-a-repository)”。
|
||||
You can set up {% data variables.product.prodname_code_scanning %} to automatically identify vulnerabilities and errors in the code stored in your repository by using a {% data variables.product.prodname_codeql_workflow %} or third-party tool. For more information, see "[Setting up {% data variables.product.prodname_code_scanning %} for a repository](/code-security/secure-coding/setting-up-code-scanning-for-a-repository)."
|
||||
|
||||
{% data variables.product.prodname_code_scanning_capc %} 适用于{% ifversion fpt or ghec %}所有公共存储库,以及属于具有许可证的企业一部分的组织所拥有的私有存储库{% else %}组织拥有的仓库(如果您的企业使用 {% endif %}{% data variables.product.prodname_GH_advanced_security %})。
|
||||
{% data variables.product.prodname_code_scanning_capc %} is available {% ifversion fpt or ghec %}for all public repositories, and for private repositories owned by organizations that are part of an enterprise with a license for {% else %}for organization-owned repositories if your enterprise uses {% endif %}{% data variables.product.prodname_GH_advanced_security %}.
|
||||
|
||||
## 配置 {% data variables.product.prodname_secret_scanning %}
|
||||
## Configuring {% data variables.product.prodname_secret_scanning %}
|
||||
|
||||
{% data variables.product.prodname_secret_scanning_caps %} 可{% ifversion fpt or ghec %}对所有公共存储库启用,并且可用于属于具有许可证的企业一部分的组织所拥有的私有存储库{% else %}组织拥有的仓库(如果您的企业使用 {% endif %}{% data variables.product.prodname_GH_advanced_security %})。 {% ifversion fpt %}有关详细信息,请参阅 [{% data variables.product.prodname_ghe_cloud %} 文档](/enterprise-cloud@latest/code-security/getting-started/securing-your-repository#configuring-secret-scanning)。{% else %}可能已为存储库启用 {% data variables.product.prodname_secret_scanning_caps %},具体取决于组织的设置。
|
||||
{% data variables.product.prodname_secret_scanning_caps %} is {% ifversion fpt or ghec %}enabled for all public repositories and is available for private repositories owned by organizations that are part of an enterprise with a license for {% else %}available for organization-owned repositories if your enterprise uses {% endif %}{% data variables.product.prodname_GH_advanced_security %}. {% ifversion fpt %}For more information, see the [{% data variables.product.prodname_ghe_cloud %} documentation](/enterprise-cloud@latest/code-security/getting-started/securing-your-repository#configuring-secret-scanning).{% else %}{% data variables.product.prodname_secret_scanning_caps %} may already be enabled for your repository, depending upon your organization's settings.
|
||||
|
||||
1. 从存储库的主页中,单击“{% octicon "gear" aria-label="The Settings gear" %}设置”。
|
||||
2. 单击“安全性和分析”。
|
||||
3. 如果尚未启用 {% data variables.product.prodname_GH_advanced_security %},请单击“启用”。
|
||||
4. 在 {% data variables.product.prodname_secret_scanning_caps %} 旁边,单击“启用”。 {% endif %}
|
||||
|
||||
## 后续步骤
|
||||
您可以查看和管理来自安全功能的警报,以解决代码中的依赖项和漏洞。 有关详细信息,请参阅{% ifversion fpt or ghes or ghec %}“[查看和更新 {% data variables.product.prodname_dependabot_alerts %}](/code-security/dependabot/dependabot-alerts/viewing-and-updating-dependabot-alerts)”、{% endif %} {% ifversion fpt or ghec or ghes > 3.2 %}“[管理用于依赖项更新的拉取请求](/code-security/supply-chain-security/managing-pull-requests-for-dependency-updates)”、{% endif %}“[管理存储库的 {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/managing-code-scanning-alerts-for-your-repository)”和“[管理来自 {% data variables.product.prodname_secret_scanning %} 的警报](/code-security/secret-security/managing-alerts-from-secret-scanning)”。
|
||||
|
||||
{% ifversion fpt or ghec %}如果您存在安全漏洞,您可以创建安全通告,以私下讨论和修复该漏洞。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_security_advisories %}](/code-security/security-advisories/about-github-security-advisories)”和“[创建安全通告](/code-security/security-advisories/creating-a-security-advisory)”。
|
||||
1. From the main page of your repository, click **{% octicon "gear" aria-label="The Settings gear" %}Settings**.
|
||||
2. Click **Security & analysis**.
|
||||
3. If {% data variables.product.prodname_GH_advanced_security %} is not already enabled, click **Enable**.
|
||||
4. Next to {% data variables.product.prodname_secret_scanning_caps %}, click **Enable**.
|
||||
{% endif %}
|
||||
|
||||
## Next steps
|
||||
You can view and manage alerts from security features to address dependencies and vulnerabilities in your code. For more information, see {% ifversion fpt or ghes or ghec %} "[Viewing and updating {% data variables.product.prodname_dependabot_alerts %}](/code-security/dependabot/dependabot-alerts/viewing-and-updating-dependabot-alerts),"{% endif %} {% ifversion fpt or ghec or ghes > 3.2 %}"[Managing pull requests for dependency updates](/code-security/supply-chain-security/managing-pull-requests-for-dependency-updates)," {% endif %}"[Managing {% data variables.product.prodname_code_scanning %} for your repository](/code-security/secure-coding/managing-code-scanning-alerts-for-your-repository)," and "[Managing alerts from {% data variables.product.prodname_secret_scanning %}](/code-security/secret-security/managing-alerts-from-secret-scanning)."
|
||||
|
||||
{% ifversion fpt or ghec %}If you have a security vulnerability, you can create a security advisory to privately discuss and fix the vulnerability. For more information, see "[About {% data variables.product.prodname_security_advisories %}](/code-security/security-advisories/about-github-security-advisories)" and "[Creating a security advisory](/code-security/security-advisories/creating-a-security-advisory)."
|
||||
{% endif %}
|
||||
|
||||
@@ -26,7 +26,7 @@ topics:
|
||||
|
||||
If your project communicates with an external service, you might use a token or private key for authentication. Tokens and private keys are examples of secrets that a service provider can issue. If you check a secret into a repository, anyone who has read access to the repository can use the secret to access the external service with your privileges. We recommend that you store secrets in a dedicated, secure location outside of the repository for your project.
|
||||
|
||||
{% data variables.product.prodname_secret_scanning_caps %} will scan your entire Git history on all branches present in your {% data variables.product.prodname_dotcom %} repository for secrets{% ifversion ghec or ghes > 3.4 or ghae-issue-6329 %}, even if the repository is archived{% endif %}.
|
||||
{% data variables.product.prodname_secret_scanning_caps %} will scan your entire Git history on all branches present in your {% data variables.product.prodname_dotcom %} repository for secrets{% ifversion ghec or ghes > 3.4 or ghae > 3.4 %}, even if the repository is archived{% endif %}.
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
{% data variables.product.prodname_secret_scanning_caps %} is available on {% data variables.product.prodname_dotcom_the_website %} in two forms:
|
||||
@@ -70,7 +70,7 @@ You cannot change the configuration of {% data variables.product.prodname_secret
|
||||
|
||||
{% data variables.product.prodname_secret_scanning_GHAS_caps %} is available on all organization-owned repositories as part of {% data variables.product.prodname_GH_advanced_security %}. It is not available on user-owned repositories. When you enable {% data variables.product.prodname_secret_scanning %} for a repository, {% data variables.product.prodname_dotcom %} scans the code for patterns that match secrets used by many service providers. For more information, see "{% ifversion ghec %}[Supported secrets for advanced security](/code-security/secret-scanning/secret-scanning-patterns#supported-secrets-for-advanced-security){% else %}[{% data variables.product.prodname_secret_scanning_caps %} patterns](/code-security/secret-scanning/secret-scanning-patterns){% endif %}."
|
||||
|
||||
If you're a repository administrator you can enable {% data variables.product.prodname_secret_scanning_GHAS %} for any repository{% ifversion ghec or ghes > 3.4 or ghae-issue-6329 %}, including archived repositories{% endif %}. Organization owners can also enable {% data variables.product.prodname_secret_scanning_GHAS %} for all repositories or for all new repositories within an organization. For more information, see "[Managing security and analysis settings for your repository](/github/administering-a-repository/managing-security-and-analysis-settings-for-your-repository)" and "[Managing security and analysis settings for your organization](/organizations/keeping-your-organization-secure/managing-security-and-analysis-settings-for-your-organization)."
|
||||
If you're a repository administrator you can enable {% data variables.product.prodname_secret_scanning_GHAS %} for any repository{% ifversion ghec or ghes > 3.4 or ghae > 3.4 %}, including archived repositories{% endif %}. Organization owners can also enable {% data variables.product.prodname_secret_scanning_GHAS %} for all repositories or for all new repositories within an organization. For more information, see "[Managing security and analysis settings for your repository](/github/administering-a-repository/managing-security-and-analysis-settings-for-your-repository)" and "[Managing security and analysis settings for your organization](/organizations/keeping-your-organization-secure/managing-security-and-analysis-settings-for-your-organization)."
|
||||
|
||||
{% ifversion ghes or ghae or ghec %}You can also define custom {% data variables.product.prodname_secret_scanning %} patterns for a repository, organization, or enterprise. For more information, see "[Defining custom patterns for {% data variables.product.prodname_secret_scanning %}](/code-security/secret-security/defining-custom-patterns-for-secret-scanning)."
|
||||
{% endif %}
|
||||
@@ -91,12 +91,12 @@ For more information about viewing and resolving {% data variables.product.prodn
|
||||
|
||||
Repository administrators and organization owners can grant users and teams access to {% data variables.product.prodname_secret_scanning %} alerts. For more information, see "[Managing security and analysis settings for your repository](/github/administering-a-repository/managing-security-and-analysis-settings-for-your-repository#granting-access-to-security-alerts)."
|
||||
|
||||
{% ifversion ghec or ghes or ghae-issue-5503 %}
|
||||
{% ifversion ghec or ghes or ghae > 3.4 %}
|
||||
You can use the security overview to see an organization-level view of which repositories have enabled {% data variables.product.prodname_secret_scanning %} and the alerts found. For more information, see "[Viewing the security overview](/code-security/security-overview/viewing-the-security-overview)."
|
||||
{% endif %}
|
||||
|
||||
{%- ifversion ghec or ghes %}You can also use the REST API to {% endif %}
|
||||
monitor results from {% data variables.product.prodname_secret_scanning %} across your {% ifversion ghec %}private {% endif %}repositories{% ifversion ghes %} or your organization{% endif %}. For more information about API endpoints, see "[{% data variables.product.prodname_secret_scanning_caps %}](/rest/reference/secret-scanning)."
|
||||
{%- ifversion ghec or ghes or ghae %}You can also use the REST API to
|
||||
monitor results from {% data variables.product.prodname_secret_scanning %} across your {% ifversion ghec %}private {% endif %}repositories{% ifversion ghes %} or your organization{% endif %}. For more information about API endpoints, see "[{% data variables.product.prodname_secret_scanning_caps %}](/rest/reference/secret-scanning)."{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: 为机密扫描定义自定义模式
|
||||
title: Defining custom patterns for secret scanning
|
||||
shortTitle: Define custom patterns
|
||||
intro: '您可以扩展 {% data variables.product.prodname_secret_scanning_GHAS %} 以检测默认模式之外的机密。'
|
||||
intro: 'You can extend {% data variables.product.prodname_secret_scanning_GHAS %} to detect secrets beyond the default patterns.'
|
||||
product: '{% data reusables.gated-features.secret-scanning %}'
|
||||
redirect_from:
|
||||
- /code-security/secret-security/defining-custom-patterns-for-secret-scanning
|
||||
@@ -13,74 +13,82 @@ type: how_to
|
||||
topics:
|
||||
- Advanced Security
|
||||
- Secret scanning
|
||||
ms.openlocfilehash: 7182de1985019ab2c0a3244f923944f78dc6060e
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147549098'
|
||||
---
|
||||
{% ifversion ghes < 3.3 %} {% note %}
|
||||
|
||||
**注意:** {% data variables.product.prodname_secret_scanning %} 的自定义模式目前为 beta 版本,可能会有变动。
|
||||
{% ifversion ghes < 3.3 %}
|
||||
{% note %}
|
||||
|
||||
{% endnote %} {% endif %}
|
||||
**Note:** Custom patterns for {% data variables.product.prodname_secret_scanning %} is currently in beta and is subject to change.
|
||||
|
||||
## 关于 {% data variables.product.prodname_secret_scanning %} 的自定义模式
|
||||
{% endnote %}
|
||||
{% endif %}
|
||||
|
||||
您可以定义自定义模式来标识 {% data variables.product.prodname_secret_scanning %} 支持的默认模式未检测到的机密。 例如,您可能有一个属于您组织内部的密钥模式。 有关支持的机密和服务提供商的详细信息,请参阅 “[{% data variables.product.prodname_secret_scanning_caps %} 模式](/code-security/secret-scanning/secret-scanning-patterns)”。
|
||||
## About custom patterns for {% data variables.product.prodname_secret_scanning %}
|
||||
|
||||
您可以为企业、组织或存储库定义自定义模式。 {% data variables.product.prodname_secret_scanning_caps %} 支持每个组织或企业帐户最多 {%- ifversion fpt or ghec or ghes > 3.3 or ghae-issue-7297 %} 500 个自定义模式,每个存储库最多 100 个自定义模式。
|
||||
{%- elsif ghes = 3.2 %}每个组织或企业帐户有 20 个自定义模式,每个存储库也有 20 个自定义模式。
|
||||
{%- else %}每个组织或企业帐户有 100 个自定义模式,每个存储库有 20 个自定义模式。
|
||||
You can define custom patterns to identify secrets that are not detected by the default patterns supported by {% data variables.product.prodname_secret_scanning %}. For example, you might have a secret pattern that is internal to your organization. For details of the supported secrets and service providers, see "[{% data variables.product.prodname_secret_scanning_caps %} patterns](/code-security/secret-scanning/secret-scanning-patterns)."
|
||||
|
||||
You can define custom patterns for your enterprise, organization, or repository. {% data variables.product.prodname_secret_scanning_caps %} supports up to
|
||||
{%- ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %} 500 custom patterns for each organization or enterprise account, and up to 100 custom patterns per repository.
|
||||
{%- elsif ghes = 3.2 %} 20 custom patterns for each organization or enterprise account, and per repository.
|
||||
{%- else %} 100 custom patterns for each organization or enterprise account, and 20 per repository.
|
||||
{%- endif %}
|
||||
|
||||
{% ifversion ghes < 3.3 %} {% note %}
|
||||
{% ifversion ghes < 3.3 %}
|
||||
{% note %}
|
||||
|
||||
**注意:** 在 beta 版本中,对 {% data variables.product.prodname_secret_scanning %} 使用自定义模式时存在一些限制:
|
||||
**Note:** During the beta, there are some limitations when using custom patterns for {% data variables.product.prodname_secret_scanning %}:
|
||||
|
||||
* 没有干运行功能。
|
||||
* 创建自定义模式后,您无法对其进行编辑。 要更改模式,您必须将其删除并重新创建。
|
||||
* 没有用于创建、编辑或删除自定义模式的 API。 但是,自定义模式的结果在[密钥扫描警报 API](/rest/reference/secret-scanning) 中返回。
|
||||
* There is no dry-run functionality.
|
||||
* You cannot edit custom patterns after they're created. To change a pattern, you must delete it and recreate it.
|
||||
* There is no API for creating, editing, or deleting custom patterns. However, results for custom patterns are returned in the [secret scanning alerts API](/rest/reference/secret-scanning).
|
||||
|
||||
{% endnote %} {% endif %}
|
||||
{% endnote %}
|
||||
{% endif %}
|
||||
|
||||
## 自定义模式的正则表达式语法
|
||||
## Regular expression syntax for custom patterns
|
||||
|
||||
您可以将 {% data variables.product.prodname_secret_scanning_GHAS %} 的自定义模式指定为一个或多个正则表达式。
|
||||
You can specify custom patterns for {% data variables.product.prodname_secret_scanning_GHAS %} as one or more regular expressions.
|
||||
|
||||
- **机密格式:** 描述机密本身格式的表达式。
|
||||
- **机密之前:** 描述机密之前的字符的表达式。 默认情况下,此值设置为 `\A|[^0-9A-Za-z]`,这意味着机密必须位于行首或前面有非字母数字字符。
|
||||
- **机密之后:** 描述机密后面的字符的表达式。 默认情况下,此值设置为 `\z|[^0-9A-Za-z]`,这意味着机密后面必须跟有新行或非字母数字字符。
|
||||
- **其他匹配要求:** 机密本身必须或不得匹配的一个或多个可选表达式。
|
||||
- **Secret format:** an expression that describes the format of the secret itself.
|
||||
- **Before secret:** an expression that describes the characters that come before the secret. By default, this is set to `\A|[^0-9A-Za-z]` which means that the secret must be at the start of a line or be preceded by a non-alphanumeric character.
|
||||
- **After secret:** an expression that describes the characters that come after the secret. By default, this is set to `\z|[^0-9A-Za-z]` which means that the secret must be followed by a new line or a non-alphanumeric character.
|
||||
- **Additional match requirements:** one or more optional expressions that the secret itself must or must not match.
|
||||
|
||||
对于简单令牌,通常只需指定机密格式。 其他字段提供了灵活性,以便您可以指定更复杂的机密,而无需创建复杂的正则表达式。 有关自定义模式的示例,请参阅下面的“[使用附加要求指定的自定义模式示例](#example-of-a-custom-pattern-specified-using-additional-requirements)”。
|
||||
For simple tokens you will usually only need to specify a secret format. The other fields provide flexibility so that you can specify more complex secrets without creating complex regular expressions. For an example of a custom pattern, see "[Example of a custom pattern specified using additional requirements](#example-of-a-custom-pattern-specified-using-additional-requirements)" below.
|
||||
|
||||
{% data variables.product.prodname_secret_scanning_caps %} 使用 [Hyperscan 库](https://github.com/intel/hyperscan),只支持 Hyperscan 正则表达式构造(PCRE 语法的子集)。 不支持 Hyperscan 选项修饰符。 有关 Hyperscan 模式构造的详细信息,请参阅 Hyperscan 文档中的“[模式支持](http://intel.github.io/hyperscan/dev-reference/compilation.html#pattern-support)”。
|
||||
{% data variables.product.prodname_secret_scanning_caps %} uses the [Hyperscan library](https://github.com/intel/hyperscan) and only supports Hyperscan regex constructs, which are a subset of PCRE syntax. Hyperscan option modifiers are not supported. For more information on Hyperscan pattern constructs, see "[Pattern support](http://intel.github.io/hyperscan/dev-reference/compilation.html#pattern-support)" in the Hyperscan documentation.
|
||||
|
||||
## 定义仓库的自定义模式
|
||||
## Defining a custom pattern for a repository
|
||||
|
||||
在定义自定义模式之前,您必须确保仓库上启用了 {% data variables.product.prodname_secret_scanning %}。 有关详细信息,请参阅“[为存储库配置 {% data variables.product.prodname_secret_scanning %}](/code-security/secret-security/configuring-secret-scanning-for-your-repositories)”。
|
||||
Before defining a custom pattern, you must ensure that {% data variables.product.prodname_secret_scanning %} is enabled on your repository. For more information, see "[Configuring {% data variables.product.prodname_secret_scanning %} for your repositories](/code-security/secret-security/configuring-secret-scanning-for-your-repositories)."
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.navigate-to-code-security-and-analysis %} {% data reusables.repositories.navigate-to-ghas-settings %} {% data reusables.advanced-security.secret-scanning-new-custom-pattern %} {% data reusables.advanced-security.secret-scanning-add-custom-pattern-details %}{% ifversion secret-scanning-custom-enterprise-35 or custom-pattern-dry-run-ga %}
|
||||
1. 准备好测试新的自定义模式时,若要识别存储库中的匹配项而不创建警报,请单击“保存并试运行”。
|
||||
{% data reusables.advanced-security.secret-scanning-dry-run-results %} {%- ifversion secret-scanning-custom-enterprise-35 %}{% indented_data_reference reusables.secret-scanning.beta-dry-runs spaces=3 %}{% endif %} {% endif %} {% data reusables.advanced-security.secret-scanning-create-custom-pattern %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.navigate-to-code-security-and-analysis %}
|
||||
{% data reusables.repositories.navigate-to-ghas-settings %}
|
||||
{% data reusables.advanced-security.secret-scanning-new-custom-pattern %}
|
||||
{% data reusables.advanced-security.secret-scanning-add-custom-pattern-details %}{% ifversion secret-scanning-custom-enterprise-35 or custom-pattern-dry-run-ga %}
|
||||
1. When you're ready to test your new custom pattern, to identify matches in the repository without creating alerts, click **Save and dry run**.
|
||||
{% data reusables.advanced-security.secret-scanning-dry-run-results %}
|
||||
{%- ifversion secret-scanning-custom-enterprise-35 %}{% indented_data_reference reusables.secret-scanning.beta-dry-runs spaces=3 %}{% endif %}
|
||||
{% endif %}
|
||||
{% data reusables.advanced-security.secret-scanning-create-custom-pattern %}
|
||||
|
||||
模式创建后,{% data reusables.secret-scanning.secret-scanning-process %} 有关查看 {% data variables.product.prodname_secret_scanning %} 警报的详细信息,请参阅“[管理来自 {% data variables.product.prodname_secret_scanning %} 的警报](/code-security/secret-security/managing-alerts-from-secret-scanning)”。
|
||||
After your pattern is created, {% data reusables.secret-scanning.secret-scanning-process %} For more information on viewing {% data variables.product.prodname_secret_scanning %} alerts, see "[Managing alerts from {% data variables.product.prodname_secret_scanning %}](/code-security/secret-security/managing-alerts-from-secret-scanning)."
|
||||
|
||||
### 使用其他要求指定的自定义模式示例
|
||||
### Example of a custom pattern specified using additional requirements
|
||||
|
||||
公司具有具有五个特征的内部令牌。 它们使用不同的字段来指定如何标识令牌,如下所示:
|
||||
A company has an internal token with five characteristics. They use the different fields to specify how to identify tokens as follows:
|
||||
|
||||
| **特征** | **字段和正则表达式** |
|
||||
| **Characteristic** | **Field and regular expression** |
|
||||
|----------------|------------------------------|
|
||||
| 长度介于 5 到 10 个字符之间 | 机密格式:`[$#%@AA-Za-z0-9]{5,10}` |
|
||||
| 不以 `.` 结尾 | 机密之后:`[^\.]` |
|
||||
| 包含数字和大写字母 | 其他要求:机密必须匹配 `[A-Z]` 和 `[0-9]` |
|
||||
| 一行中不包含多个小写字母 | 其他要求:机密不得匹配 `[a-z]{2,}` |
|
||||
| 包含 `$%@!` 之一 | 其他要求:机密必须匹配 `[$%@!]` |
|
||||
| Length between 5 and 10 characters | Secret format: `[$#%@AA-Za-z0-9]{5,10}` |
|
||||
| Does not end in a `.` | After secret: `[^\.]` |
|
||||
| Contains numbers and uppercase letters | Additional requirements: secret must match `[A-Z]` and `[0-9]` |
|
||||
| Does not include more than one lowercase letter in a row | Additional requirements: secret must not match `[a-z]{2,}` |
|
||||
| Contains one of `$%@!` | Additional requirements: secret must match `[$%@!]` |
|
||||
|
||||
这些令牌将与上述自定义模式匹配:
|
||||
These tokens would match the custom pattern described above:
|
||||
|
||||
```
|
||||
a9@AAfT! # Secret string match: a9@AAfT
|
||||
@@ -88,7 +96,7 @@ ee95GG@ZA942@aa # Secret string match: @ZA942@a
|
||||
a9@AA!ee9 # Secret string match: a9@AA
|
||||
```
|
||||
|
||||
这些字符串与上述自定义模式不匹配:
|
||||
These strings would not match the custom pattern described above:
|
||||
|
||||
```
|
||||
a9@AA.!
|
||||
@@ -97,75 +105,98 @@ aa9@AA!ee9
|
||||
aAAAe9
|
||||
```
|
||||
|
||||
## 定义组织的自定义模式
|
||||
## Defining a custom pattern for an organization
|
||||
|
||||
在定义自定义模式之前,您必须确保在组织中为要扫描的仓库启用 {% data variables.product.prodname_secret_scanning %}。 若要在组织中的所有存储库上启用 {% data variables.product.prodname_secret_scanning %},请参阅“[管理组织的安全和分析设置](/organizations/keeping-your-organization-secure/managing-security-and-analysis-settings-for-your-organization)”。
|
||||
Before defining a custom pattern, you must ensure that you enable {% data variables.product.prodname_secret_scanning %} for the repositories that you want to scan in your organization. To enable {% data variables.product.prodname_secret_scanning %} on all repositories in your organization, see "[Managing security and analysis settings for your organization](/organizations/keeping-your-organization-secure/managing-security-and-analysis-settings-for-your-organization)."
|
||||
|
||||
{% ifversion ghes < 3.5 or ghae %} {% note %}
|
||||
{% ifversion ghes < 3.5 or ghae %}
|
||||
{% note %}
|
||||
|
||||
**注意:** 由于没有试运行功能,我们建议你先在存储库中测试自定义模式,然后再为整个组织定义它们。 这样,可以避免创建过多的误报 {% data variables.product.prodname_secret_scanning %} 警报。
|
||||
**Note:** As there is no dry-run functionality, we recommend that you test your custom patterns in a repository before defining them for your entire organization. That way, you can avoid creating excess false-positive {% data variables.product.prodname_secret_scanning %} alerts.
|
||||
|
||||
{% endnote %} {% endif %}
|
||||
{% endnote %}
|
||||
{% endif %}
|
||||
|
||||
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.organizations.security-and-analysis %} {% data reusables.repositories.navigate-to-ghas-settings %} {% data reusables.advanced-security.secret-scanning-new-custom-pattern %} {% data reusables.advanced-security.secret-scanning-add-custom-pattern-details %} {%- ifversion secret-scanning-custom-enterprise-35 or custom-pattern-dry-run-ga %}
|
||||
1. 准备好测试新的自定义模式时,若要在不创建警报的情况下识别所选存储库中的匹配项,请单击“保存并试运行”。
|
||||
{% data reusables.advanced-security.secret-scanning-dry-run-select-repos %} {% data reusables.advanced-security.secret-scanning-dry-run-results %} {%- ifversion secret-scanning-custom-enterprise-35 %}{% indented_data_reference reusables.secret-scanning.beta-dry-runs spaces=3 %}{% endif %} {%- endif %} {% data reusables.advanced-security.secret-scanning-create-custom-pattern %}
|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.profile.org_settings %}
|
||||
{% data reusables.organizations.security-and-analysis %}
|
||||
{% data reusables.repositories.navigate-to-ghas-settings %}
|
||||
{% data reusables.advanced-security.secret-scanning-new-custom-pattern %}
|
||||
{% data reusables.advanced-security.secret-scanning-add-custom-pattern-details %}
|
||||
{%- ifversion secret-scanning-custom-enterprise-35 or custom-pattern-dry-run-ga %}
|
||||
1. When you're ready to test your new custom pattern, to identify matches in select repositories without creating alerts, click **Save and dry run**.
|
||||
{% data reusables.advanced-security.secret-scanning-dry-run-select-repos %}
|
||||
{% data reusables.advanced-security.secret-scanning-dry-run-results %}
|
||||
{%- ifversion secret-scanning-custom-enterprise-35 %}{% indented_data_reference reusables.secret-scanning.beta-dry-runs spaces=3 %}{% endif %}
|
||||
{%- endif %}
|
||||
{% data reusables.advanced-security.secret-scanning-create-custom-pattern %}
|
||||
|
||||
创建模式后,{% data variables.product.prodname_secret_scanning %} 扫描组织的仓库中的任何密钥,包括其所有分支的整个 Git 历史记录。 组织所有者和仓库管理员将会收到发现的任何密钥警报通知,并且可以审查发现密钥的仓库中的警报。 有关查看 {% data variables.product.prodname_secret_scanning %} 警报的详细信息,请参阅“[管理来自 {% data variables.product.prodname_secret_scanning %} 的警报](/code-security/secret-security/managing-alerts-from-secret-scanning)”。
|
||||
After your pattern is created, {% data variables.product.prodname_secret_scanning %} scans for any secrets in repositories in your organization, including their entire Git history on all branches. Organization owners and repository administrators will be alerted to any secrets found and can review the alert in the repository where the secret is found. For more information on viewing {% data variables.product.prodname_secret_scanning %} alerts, see "[Managing alerts from {% data variables.product.prodname_secret_scanning %}](/code-security/secret-security/managing-alerts-from-secret-scanning)."
|
||||
|
||||
## 为企业帐户定义自定义模式
|
||||
## Defining a custom pattern for an enterprise account
|
||||
|
||||
{% ifversion fpt or ghec or ghes %}
|
||||
|
||||
在定义自定义模式之前,必须确保为企业帐户启用机密扫描。 有关详细信息,请参阅“[为企业启用 {% data variables.product.prodname_GH_advanced_security %}]({% ifversion fpt or ghec %}/enterprise-server@latest/{% endif %}/admin/advanced-security/enabling-github-advanced-security-for-your-enterprise)”。
|
||||
Before defining a custom pattern, you must ensure that you enable secret scanning for your enterprise account. For more information, see "[Enabling {% data variables.product.prodname_GH_advanced_security %} for your enterprise]({% ifversion fpt or ghec %}/enterprise-server@latest/{% endif %}/admin/advanced-security/enabling-github-advanced-security-for-your-enterprise)."
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% note %}
|
||||
|
||||
{% ifversion secret-scanning-custom-enterprise-36 or custom-pattern-dry-run-ga %} **注意:**
|
||||
- 在企业级别,只有自定义模式的创建者才能编辑模式,并在试运行中使用它。
|
||||
- 企业所有者只能对有权访问的存储库使用试运行,并且企业所有者不一定有权访问企业中的所有组织或存储库。
|
||||
{% else %} 注意:由于没有试运行功能,我们建议你先在存储库中测试自定义模式,然后再为整个企业定义它们。 这样,可以避免创建过多的误报 {% data variables.product.prodname_secret_scanning %} 警报。
|
||||
{% ifversion secret-scanning-custom-enterprise-36 or custom-pattern-dry-run-ga %}
|
||||
**Notes:**
|
||||
- At the enterprise level, only the creator of a custom pattern can edit the pattern, and use it in a dry run.
|
||||
- Enterprise owners can only make use of dry runs on repositories that they have access to, and enterprise owners do not necessarily have access to all the organizations or repositories within the enterprise.
|
||||
{% else %}
|
||||
**Note:** As there is no dry-run functionality, we recommend that you test your custom patterns in a repository before defining them for your entire enterprise. That way, you can avoid creating excess false-positive {% data variables.product.prodname_secret_scanning %} alerts.
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endnote %}
|
||||
|
||||
{% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.advanced-security-policies %} {% data reusables.enterprise-accounts.advanced-security-security-features %}
|
||||
1. 在“机密扫描自定义模式”下,单击{% ifversion ghes = 3.2 %}“新建自定义模式”{% else %}“新建模式”{% endif %} 。
|
||||
{% data reusables.advanced-security.secret-scanning-add-custom-pattern-details %} {%- ifversion secret-scanning-custom-enterprise-36 or custom-pattern-dry-run-ga %}
|
||||
1. 准备好测试新的自定义模式时,若要识别企业中的匹配项而不创建警报,请单击“保存并试运行”。
|
||||
{% data reusables.advanced-security.secret-scanning-dry-run-select-enterprise-repos %} {% data reusables.advanced-security.secret-scanning-dry-run-results %} {%- ifversion secret-scanning-custom-enterprise-36 %}{% indented_data_reference reusables.secret-scanning.beta-dry-runs spaces=3 %}{% endif %} {%- endif %} {% data reusables.advanced-security.secret-scanning-create-custom-pattern %}
|
||||
{% data reusables.enterprise-accounts.access-enterprise %}
|
||||
{% data reusables.enterprise-accounts.policies-tab %}
|
||||
{% data reusables.enterprise-accounts.advanced-security-policies %}
|
||||
{% data reusables.enterprise-accounts.advanced-security-security-features %}
|
||||
1. Under "Secret scanning custom patterns", click {% ifversion ghes = 3.2 %}**New custom pattern**{% else %}**New pattern**{% endif %}.
|
||||
{% data reusables.advanced-security.secret-scanning-add-custom-pattern-details %}
|
||||
{%- ifversion secret-scanning-custom-enterprise-36 or custom-pattern-dry-run-ga %}
|
||||
1. When you're ready to test your new custom pattern, to identify matches in the enterprise without creating alerts, click **Save and dry run**.
|
||||
{% data reusables.advanced-security.secret-scanning-dry-run-select-enterprise-repos %}
|
||||
{% data reusables.advanced-security.secret-scanning-dry-run-results %}
|
||||
{%- ifversion secret-scanning-custom-enterprise-36 %}{% indented_data_reference reusables.secret-scanning.beta-dry-runs spaces=3 %}{% endif %}
|
||||
{%- endif %}
|
||||
{% data reusables.advanced-security.secret-scanning-create-custom-pattern %}
|
||||
|
||||
创建模式后,{% data variables.product.prodname_secret_scanning %} 扫描企业组织内存储库中的任何机密,并启用 {% data variables.product.prodname_GH_advanced_security %},包括其所有分支上的整个 Git 历史记录。 组织所有者和仓库管理员将会收到发现的任何密钥警报通知,并且可以审查发现密钥的仓库中的警报。 有关查看 {% data variables.product.prodname_secret_scanning %} 警报的详细信息,请参阅“[管理来自 {% data variables.product.prodname_secret_scanning %} 的警报](/code-security/secret-security/managing-alerts-from-secret-scanning)”。
|
||||
After your pattern is created, {% data variables.product.prodname_secret_scanning %} scans for any secrets in repositories within your enterprise's organizations with {% data variables.product.prodname_GH_advanced_security %} enabled, including their entire Git history on all branches. Organization owners and repository administrators will be alerted to any secrets found, and can review the alert in the repository where the secret is found. For more information on viewing {% data variables.product.prodname_secret_scanning %} alerts, see "[Managing alerts from {% data variables.product.prodname_secret_scanning %}](/code-security/secret-security/managing-alerts-from-secret-scanning)."
|
||||
|
||||
{% ifversion fpt or ghes > 3.2 or ghec or ghae %}
|
||||
## 编辑自定义模式
|
||||
## Editing a custom pattern
|
||||
|
||||
将更改保存到自定义模式时,这将关闭使用该模式的先前版本创建的所有 {% data variables.product.prodname_secret_scanning %} 警报。
|
||||
1. 导航到创建自定义模式的位置。 可以在存储库、组织或企业帐户中创建自定义模式。
|
||||
* 对于存储库或组织,显示创建自定义模式的存储库或组织的“安全和分析”设置。 有关详细信息,请参阅上面的“[为存储库定义自定义模式](#defining-a-custom-pattern-for-a-repository)”或“[为组织定义自定义模式](#defining-a-custom-pattern-for-an-organization)”。
|
||||
* 对于企业,在“策略”下显示“高级安全”区域,然后单击“安全功能”。 有关详细信息,请参阅上面的“[为企业帐户定义自定义模式](#defining-a-custom-pattern-for-an-enterprise-account)”。
|
||||
2. 在“{% data variables.product.prodname_secret_scanning_caps %}”下要编辑的自定义模式的右侧,单击 {% octicon "pencil" aria-label="The edit icon" %}。
|
||||
When you save a change to a custom pattern, this closes all the {% data variables.product.prodname_secret_scanning %} alerts that were created using the previous version of the pattern.
|
||||
1. Navigate to where the custom pattern was created. A custom pattern can be created in a repository, organization, or enterprise account.
|
||||
* For a repository or organization, display the "Security & analysis" settings for the repository or organization where the custom pattern was created. For more information, see "[Defining a custom pattern for a repository](#defining-a-custom-pattern-for-a-repository)" or "[Defining a custom pattern for an organization](#defining-a-custom-pattern-for-an-organization)" above.
|
||||
* For an enterprise, under "Policies" display the "Advanced Security" area, and then click **Security features**. For more information, see "[Defining a custom pattern for an enterprise account](#defining-a-custom-pattern-for-an-enterprise-account)" above.
|
||||
2. Under "{% data variables.product.prodname_secret_scanning_caps %}", to the right of the custom pattern you want to edit, click {% octicon "pencil" aria-label="The edit icon" %}.
|
||||
{%- ifversion secret-scanning-custom-enterprise-36 or custom-pattern-dry-run-ga %}
|
||||
3. 准备好测试编辑后的自定义模式时,若要识别匹配项而不创建警报,请单击“保存并试运行”。
|
||||
3. When you're ready to test your edited custom pattern, to identify matches without creating alerts, click **Save and dry run**.
|
||||
{%- endif %}
|
||||
4. 查看并测试更改后,单击“保存更改”。
|
||||
4. When you have reviewed and tested your changes, click **Save changes**.
|
||||
{% endif %}
|
||||
|
||||
## 删除自定义模式
|
||||
## Removing a custom pattern
|
||||
|
||||
1. 导航到创建自定义模式的位置。 可以在存储库、组织或企业帐户中创建自定义模式。
|
||||
1. Navigate to where the custom pattern was created. A custom pattern can be created in a repository, organization, or enterprise account.
|
||||
|
||||
* 对于存储库或组织,显示创建自定义模式的存储库或组织的“安全和分析”设置。 有关详细信息,请参阅上面的“[为存储库定义自定义模式](#defining-a-custom-pattern-for-a-repository)”或“[为组织定义自定义模式](#defining-a-custom-pattern-for-an-organization)”。
|
||||
* 对于企业,在“策略”下显示“高级安全”区域,然后单击“安全功能”。 有关详细信息,请参阅上面的“[为企业帐户定义自定义模式](#defining-a-custom-pattern-for-an-enterprise-account)”。
|
||||
* For a repository or organization, display the "Security & analysis" settings for the repository or organization where the custom pattern was created. For more information, see "[Defining a custom pattern for a repository](#defining-a-custom-pattern-for-a-repository)" or "[Defining a custom pattern for an organization](#defining-a-custom-pattern-for-an-organization)" above.
|
||||
* For an enterprise, under "Policies" display the "Advanced Security" area, and then click **Security features**. For more information, see "[Defining a custom pattern for an enterprise account](#defining-a-custom-pattern-for-an-enterprise-account)" above.
|
||||
{%- ifversion ghec or ghes > 3.2 or ghae %}
|
||||
1. 在要删除的自定义模式的右侧,单击 {% octicon "trash" aria-label="The trash icon" %}。
|
||||
1. 查看确认,并选择一种方法来处理与自定义模式相关的任何打开的警报。
|
||||
1. 单击“是,删除此模式”。
|
||||
1. To the right of the custom pattern you want to remove, click {% octicon "trash" aria-label="The trash icon" %}.
|
||||
1. Review the confirmation, and select a method for dealing with any open alerts relating to the custom pattern.
|
||||
1. Click **Yes, delete this pattern**.
|
||||
|
||||
 {%- elsif ghes = 3.2 %}
|
||||
1. 在要删除的自定义模式的右侧,单击“删除”。
|
||||
1. 查看确认信息,然后单击“删除自定义模式”。
|
||||

|
||||
{%- elsif ghes = 3.2 %}
|
||||
1. To the right of the custom pattern you want to remove, click **Remove**.
|
||||
1. Review the confirmation, and click **Remove custom pattern**.
|
||||
{%- endif %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 关于安全性概述
|
||||
intro: 可在“安全概述”页查看、筛选和排序组织或团队拥有的存储库的安全警报。
|
||||
title: About the security overview
|
||||
intro: 'You can view, filter, and sort security alerts for repositories owned by your organization or team in one place: the Security Overview page.'
|
||||
permissions: '{% data reusables.security-overview.permissions %}'
|
||||
product: '{% data reusables.gated-features.security-overview %}'
|
||||
redirect_from:
|
||||
@@ -20,66 +20,64 @@ topics:
|
||||
- Organizations
|
||||
- Teams
|
||||
shortTitle: About security overview
|
||||
ms.openlocfilehash: ac069277564d7249d36b54f218c78f33eefc3c47
|
||||
ms.sourcegitcommit: fb047f9450b41b24afc43d9512a5db2a2b750a2a
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/11/2022
|
||||
ms.locfileid: '147881475'
|
||||
---
|
||||
{% ifversion ghes < 3.5 or ghae %} {% data reusables.security-overview.beta %} {% endif %}
|
||||
|
||||
## 关于安全性概述
|
||||
{% ifversion ghes < 3.5 or ghae %}
|
||||
{% data reusables.security-overview.beta %}
|
||||
{% endif %}
|
||||
|
||||
{% ifversion ghes or ghec or ghae %}你的{% elsif fpt %}使用 {% data variables.product.prodname_ghe_cloud %}{% endif %} 的组织可以使用安全概述来概括性了解{% ifversion ghes or ghec or ghae %}你的{% elsif fpt %}他们{% endif %}组织的状态或识别需要干预的有问题的存储库。 {% ifversion ghes or ghec or ghae %} {% elsif fpt %}这些组织{% endif %} 可以在安全概述中查看聚合或特定于存储库的安全信息。 {% ifversion ghes or ghec or ghae %}你的{% elsif fpt %}使用 {% data variables.product.prodname_ghe_cloud %}{% endif %} 的组织还可以使用安全概述查看为{% ifversion ghes or ghec or ghae %}你的{% elsif fpt %}他们的{% endif %}存储库启用了哪些安全功能,并配置当前未使用的任何可用安全功能。 {% ifversion fpt %} 有关详细信息,请参阅 [{% data variables.product.prodname_ghe_cloud %} 文档](/enterprise-cloud@latest/code-security/security-overview/about-the-security-overview)。{% endif %}
|
||||
## About the security overview
|
||||
|
||||
{% ifversion ghec or ghes or ghae %} 安全概述指示是否为组织拥有的存储库启用了{% ifversion fpt or ghes or ghec %}安全{% endif %}{% ifversion ghae %}{% data variables.product.prodname_GH_advanced_security %}{% endif %}功能,并合并了每个功能的警报。{% ifversion fpt or ghes or ghec %}安全功能包括 {% data variables.product.prodname_GH_advanced_security %} 功能,例如 {% data variables.product.prodname_code_scanning %} 和 {% data variables.product.prodname_secret_scanning %},以及 {% data variables.product.prodname_dependabot_alerts %}。{% endif %} 有关 {% data variables.product.prodname_GH_advanced_security %} 功能的详细信息,请参阅“[关于 {% data variables.product.prodname_GH_advanced_security %}](/get-started/learning-about-github/about-github-advanced-security)”。{% ifversion fpt or ghes or ghec %} 有关 {% data variables.product.prodname_dependabot_alerts %} 的详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-alerts-for-vulnerable-dependencies#dependabot-alerts-for-vulnerable-dependencies)”。{% endif %}
|
||||
{% ifversion ghes or ghec or ghae %}You{% elsif fpt %}Organizations that use {% data variables.product.prodname_ghe_cloud %}{% endif %} can use the security overview for a high-level view of the security status of {% ifversion ghes or ghec or ghae %}your {% elsif fpt %}their{% endif %} organization or to identify problematic repositories that require intervention. {% ifversion ghes or ghec or ghae %}You {% elsif fpt %}These organizations{% endif %} can view aggregate or repository-specific security information in the security overview. {% ifversion ghes or ghec or ghae %}You {% elsif fpt %} Organizations that use {% data variables.product.prodname_ghe_cloud %}{% endif %} can also use the security overview to see which security features are enabled for {% ifversion ghes or ghec or ghae %}your {% elsif fpt %}their {% endif %} repositories and to configure any available security features that are not currently in use. {% ifversion fpt %}For more information, see [the {% data variables.product.prodname_ghe_cloud %} documentation](/enterprise-cloud@latest/code-security/security-overview/about-the-security-overview).{% endif %}
|
||||
|
||||
有关在存储库和组织级别保护代码的详细信息,请参阅“[保护存储库](/code-security/getting-started/securing-your-repository)”和“[保护组织](/code-security/getting-started/securing-your-organization)”。
|
||||
{% ifversion ghec or ghes or ghae %}
|
||||
The security overview indicates whether {% ifversion fpt or ghes or ghec %}security{% endif %}{% ifversion ghae %}{% data variables.product.prodname_GH_advanced_security %}{% endif %} features are enabled for repositories owned by your organization and consolidates alerts for each feature.{% ifversion fpt or ghes or ghec %} Security features include {% data variables.product.prodname_GH_advanced_security %} features, such as {% data variables.product.prodname_code_scanning %} and {% data variables.product.prodname_secret_scanning %}, as well as {% data variables.product.prodname_dependabot_alerts %}.{% endif %} For more information about {% data variables.product.prodname_GH_advanced_security %} features, see "[About {% data variables.product.prodname_GH_advanced_security %}](/get-started/learning-about-github/about-github-advanced-security)."{% ifversion fpt or ghes or ghec %} For more information about {% data variables.product.prodname_dependabot_alerts %}, see "[About {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-alerts-for-vulnerable-dependencies#dependabot-alerts-for-vulnerable-dependencies)."{% endif %}
|
||||
|
||||
公司的应用程序安全团队可以使用安全概述对组织的安全状态进行广泛和具体的分析。 例如,他们可以使用概述页来监视组织或特定团队在将 {% data variables.product.prodname_GH_advanced_security %} 部署到企业时采用的功能,或者查看组织中所有存储库中特定类型和严重性级别的所有警报。
|
||||
For more information about securing your code at the repository and organization levels, see "[Securing your repository](/code-security/getting-started/securing-your-repository)" and "[Securing your organization](/code-security/getting-started/securing-your-organization)."
|
||||
|
||||
### 关于筛选和排序警报
|
||||
The application security team at your company can use the security overview for both broad and specific analyses of your organization's security status. For example, they can use the overview page to monitor adoption of features by your organization or by a specific team as you rollout {% data variables.product.prodname_GH_advanced_security %} to your enterprise, or to review all alerts of a specific type and severity level across all repositories in your organization.
|
||||
|
||||
在安全概述中,您可以查看、排序和筛选警报,以了解组织和特定仓库中的安全风险。 安全摘要具有高度交互性,允许您根据警报风险级别、警报类型和功能启用等限定符调查特定类别的信息。 您还可以应用多个筛选器来关注更小的兴趣领域。 例如,您可以识别具有大量 {% data variables.product.prodname_dependabot_alerts %} 的私有仓库或者没有 {% data variables.product.prodname_code_scanning %} 警报的仓库。 有关详细信息,请参阅“[在安全概述中筛选警报](/code-security/security-overview/filtering-alerts-in-the-security-overview)”。
|
||||
### About filtering and sorting alerts
|
||||
|
||||
In the security overview, you can view, sort, and filter alerts to understand the security risks in your organization and in specific repositories. The security summary is highly interactive, allowing you to investigate specific categories of information, based on qualifiers like alert risk level, alert type, and feature enablement. You can also apply multiple filters to focus on narrower areas of interest. For example, you can identify private repositories that have a high number of {% data variables.product.prodname_dependabot_alerts %} or repositories that have no {% data variables.product.prodname_code_scanning %} alerts. For more information, see "[Filtering alerts in the security overview](/code-security/security-overview/filtering-alerts-in-the-security-overview)."
|
||||
|
||||
{% ifversion security-overview-views %}
|
||||
|
||||
在安全概览中,每种安全警报类型都有专用视图,例如 Dependabot、代码扫描和机密扫描警报。 您可以使用这些视图将分析限制为一组特定的警报,并使用特定于每个视图的一系列筛选器进一步缩小结果范围。 例如,在机密扫描警报视图中,可以使用 `Secret type` 筛选器仅查看特定机密(如 GitHub 个人访问令牌)的机密扫描警报。 在存储库级别,您可以使用安全概述来评估特定存储库的当前安全状态,并配置存储库中尚未使用的任何其他安全功能。
|
||||
In the security overview, there are dedicated views for each type of security alert, such as Dependabot, code scanning, and secret scanning alerts. You can use these views to limit your analysis to a specific set of alerts, and narrow the results further with a range of filters specific to each view. For example, in the secret scanning alert view, you can use the `Secret type` filter to view only secret scanning alerts for a specific secret, like a GitHub Personal Access Token. At the repository level, you can use the security overview to assess the specific repository's current security status, and configure any additional security features not yet in use on the repository.
|
||||
|
||||
{% endif %}
|
||||
|
||||

|
||||

|
||||
|
||||
对于安全概述中的每个存储库,您将看到每种类型的安全功能的图标以及每种类型的警报数。 如果没有为存储库启用安全功能,则该功能的图标将显示为灰色。此外,还会根据代码扫描、Dependabot 和机密扫描警报为每个存储库计算风险评分。 此分数处于测试阶段,应谨慎使用。 它的算法和方法可能会发生变化。
|
||||
For each repository in the security overview, you will see icons for each type of security feature and how many alerts there are of each type. If a security feature is not enabled for a repository, the icon for that feature will be grayed out. In addition, a risk score is calculated for each repository based on its code scanning, Dependabot and secret scanning alerts. This score is in beta and should be used with caution. Its algorithm and approach is subject to change.
|
||||
|
||||

|
||||

|
||||
|
||||
| 图标 | 含义 |
|
||||
| Icon | Meaning |
|
||||
| -------- | -------- |
|
||||
| {% octicon "code-square" aria-label="Code scanning alerts" %} | {% data variables.product.prodname_code_scanning_capc %} 警报。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/about-code-scanning)”。 |
|
||||
| {% octicon "key" aria-label="Secret scanning alerts" %} | {% data variables.product.prodname_secret_scanning_caps %} 警报。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_secret_scanning %}](/code-security/secret-security/about-secret-scanning)”。 |
|
||||
| {% octicon "hubot" aria-label="Dependabot alerts" %} | {% data variables.product.prodname_dependabot_alerts %} 的通知。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/about-alerts-for-vulnerable-dependencies)”。 |
|
||||
| {% octicon "check" aria-label="Check" %} | 安全功能已启用,但不会在此存储库中引发警报。 |
|
||||
| {% octicon "x" aria-label="x" %} | 此存储库不支持该安全功能。 |
|
||||
| {% octicon "code-square" aria-label="Code scanning alerts" %} | {% data variables.product.prodname_code_scanning_capc %} alerts. For more information, see "[About {% data variables.product.prodname_code_scanning %}](/code-security/secure-coding/about-code-scanning)." |
|
||||
| {% octicon "key" aria-label="Secret scanning alerts" %} | {% data variables.product.prodname_secret_scanning_caps %} alerts. For more information, see "[About {% data variables.product.prodname_secret_scanning %}](/code-security/secret-security/about-secret-scanning)." |
|
||||
| {% octicon "hubot" aria-label="Dependabot alerts" %} | {% data variables.product.prodname_dependabot_alerts %}. For more information, see "[About {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/about-alerts-for-vulnerable-dependencies)." |
|
||||
| {% octicon "check" aria-label="Check" %} | The security feature is enabled, but does not raise alerts in this repository. |
|
||||
| {% octicon "x" aria-label="x" %} | The security feature is not supported in this repository. |
|
||||
|
||||
安全概述显示由安全功能引发的活动警报。 如果仓库的安全概述中没有警报,则可能仍然存在未检测到的安全漏洞或代码错误。
|
||||
The security overview displays active alerts raised by security features. If there are no alerts in the security overview for a repository, undetected security vulnerabilities or code errors may still exist.
|
||||
|
||||
### 关于组织级安全性概述
|
||||
### About the organization-level security overview
|
||||
|
||||
在组织级别,安全概述显示组织拥有的仓库的聚合和仓库特定安全信息。 您可以在组织级别按安全功能筛选信息。
|
||||
At the organization-level, the security overview displays aggregate and repository-specific security information for repositories owned by your organization. You can filter information by security features at the organization-level.
|
||||
|
||||
{% ifversion ghec or ghes > 3.4 or ghae-issue-6199 %}
|
||||
### 关于企业级安全性概述
|
||||
在企业级别,安全性概述显示企业的综合和存储库特定的安全信息。 可以查看企业拥有的具有安全警报的存储库、查看整个企业的所有安全警报或特定于安全功能的警报。
|
||||
{% ifversion ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
### About the enterprise-level security overview
|
||||
At the enterprise-level, the security overview displays aggregate and repository-specific security information for your enterprise. You can view repositories owned by your enterprise that have security alerts, view all security alerts, or security feature-specific alerts from across your enterprise.
|
||||
|
||||
企业中组织的组织所有者和安全管理员对企业级安全概述的访问权限也有限。 他们只能查看他们具有完全访问权限的组织的存储库和警报。
|
||||
Organization owners and security managers for organizations in your enterprise also have limited access to the enterprise-level security overview. They can only view repositories and alerts for the organizations that they have full access to.
|
||||
|
||||
{% elsif fpt %}
|
||||
### 关于企业级安全性概述
|
||||
在企业级别,安全性概述显示企业的综合和存储库特定信息。 有关详细信息,请参阅 {% data variables.product.prodname_ghe_cloud %} 文档中的“[关于企业级安全概述](/enterprise-cloud@latest/code-security/security-overview/about-the-security-overview#about-the-enterprise-level-security-overview)”。
|
||||
### About the enterprise-level security overview
|
||||
At the enterprise-level, the security overview displays aggregate and repository-specific information for an enterprise. For more information, see "[About the enterprise-level security overview](/enterprise-cloud@latest/code-security/security-overview/about-the-security-overview#about-the-enterprise-level-security-overview)" in the {% data variables.product.prodname_ghe_cloud %} documentation.
|
||||
{% endif %}
|
||||
|
||||
### 关于团队级安全性概述
|
||||
在团队级别,安全概述显示团队拥有管理权限的仓库特定安全信息。 有关详细信息,请参阅“[管理团队对组织存储库的访问](/organizations/managing-access-to-your-organizations-repositories/managing-team-access-to-an-organization-repository)”。
|
||||
### About the team-level security overview
|
||||
At the team-level, the security overview displays repository-specific security information for repositories that the team has admin privileges for. For more information, see "[Managing team access to an organization repository](/organizations/managing-access-to-your-organizations-repositories/managing-team-access-to-an-organization-repository)."
|
||||
{% endif %}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
---
|
||||
title: 查看安全概述
|
||||
intro: 导航到安全概述中提供的不同视图
|
||||
title: Viewing the security overview
|
||||
intro: Navigate to the different views available in the security overview
|
||||
permissions: '{% data reusables.security-overview.permissions %}'
|
||||
product: '{% data reusables.gated-features.security-overview %}'
|
||||
versions:
|
||||
ghae: issue-5503
|
||||
ghae: '>= 3.5'
|
||||
ghes: '*'
|
||||
ghec: '*'
|
||||
type: how_to
|
||||
@@ -15,50 +15,60 @@ topics:
|
||||
- Organizations
|
||||
- Teams
|
||||
shortTitle: View the security overview
|
||||
ms.openlocfilehash: a0b6371155e7b7780ea216373b42481aa403e6db
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147525687'
|
||||
---
|
||||
{% ifversion ghes < 3.5 or ghae %} {% data reusables.security-overview.beta %} {% endif %}
|
||||
|
||||
{% ifversion ghes < 3.5 or ghae %}
|
||||
{% data reusables.security-overview.beta %}
|
||||
{% endif %}
|
||||
|
||||
{% data reusables.security-overview.information-varies-GHAS %}
|
||||
|
||||
## 查看组织的安全概述
|
||||
## Viewing the security overview for an organization
|
||||
|
||||
{% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.security-overview %}
|
||||
1. 要查看有关警报类型的汇总信息,请单击“显示更多”。
|
||||
 {% data reusables.organizations.filter-security-overview %} {% ifversion security-overview-views %} {% data reusables.organizations.security-overview-feature-specific-page %} 
|
||||
{% data reusables.organizations.navigate-to-org %}
|
||||
{% data reusables.organizations.security-overview %}
|
||||
1. To view aggregate information about alert types, click **Show more**.
|
||||

|
||||
{% data reusables.organizations.filter-security-overview %}
|
||||
{% ifversion security-overview-views %}
|
||||
{% data reusables.organizations.security-overview-feature-specific-page %}
|
||||

|
||||
|
||||
## 查看整个组织的警报
|
||||
## Viewing alerts across your organization
|
||||
|
||||
{% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.security-overview %}
|
||||
1. 在安全性边栏中,选择要查看的警报子集。
|
||||

|
||||
2. (可选)过滤警报列表。 每个视图都有自己的可用筛选器选择。 您可以单击下拉过滤菜单中的多个过滤器以缩小搜索范围。 还可在搜索字段中键入搜索限定符。 有关可用限定符的详细信息,请参阅“[在安全概述中筛选警报](/code-security/security-overview/filtering-alerts-in-the-security-overview)”。
|
||||

|
||||
{% data reusables.organizations.navigate-to-org %}
|
||||
{% data reusables.organizations.security-overview %}
|
||||
1. In the security sidebar, select the subset of alerts you want to view.
|
||||

|
||||
2. Optionally, filter the list of alerts. Each view has its own selection of available filters. You can click multiple filters in the drop-down filter menus to narrow your search. You can also type search qualifiers in the search field. For more information about the available qualifiers, see "[Filtering alerts in the security overview](/code-security/security-overview/filtering-alerts-in-the-security-overview)."
|
||||

|
||||
|
||||
{% ifversion ghec or ghes > 3.4 or ghae-issue-6199 %}
|
||||
## 查看企业的安全概述
|
||||
{% ifversion ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
## Viewing the security overview for an enterprise
|
||||
|
||||
{% data reusables.enterprise-accounts.access-enterprise-on-dotcom %}
|
||||
1. 在左侧边栏中,单击 {% octicon "shield" aria-label="The shield icon" %}“代码安全”。
|
||||
{% ifversion security-overview-feature-specific-alert-page %} {% data reusables.organizations.security-overview-feature-specific-page %} {% endif %} {% endif %}
|
||||
1. In the left sidebar, click {% octicon "shield" aria-label="The shield icon" %} **Code Security**.
|
||||
{% ifversion security-overview-feature-specific-alert-page %}
|
||||
{% data reusables.organizations.security-overview-feature-specific-page %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
## 查看存储库的警报
|
||||
## Viewing alerts for a repository
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
1. 在存储库名称下,单击“安全性”。
|
||||

|
||||
2. 在安全性边栏中,选择要打开的视图。
|
||||

|
||||
3. (可选)过滤警报列表。 每个视图都有自己的可用筛选器选择。 您可以单击下拉过滤菜单中的多个过滤器以缩小搜索范围。 还可在搜索字段中键入搜索限定符。 有关可用限定符的详细信息,请参阅“[在安全概述中筛选警报](/code-security/security-overview/filtering-alerts-in-the-security-overview)”。
|
||||

|
||||
1. Under your repository name, click **Security**.
|
||||

|
||||
2. In the security sidebar, select the view you want to open.
|
||||

|
||||
3. Optionally, filter the list of alerts. Each view has its own selection of available filters. You can click multiple filters in the drop-down filter menus to narrow your search. You can also type search qualifiers in the search field. For more information about the available qualifiers, see "[Filtering alerts in the security overview](/code-security/security-overview/filtering-alerts-in-the-security-overview)."
|
||||

|
||||
|
||||
{% endif %}
|
||||
|
||||
## 查看团队的安全概述
|
||||
## Viewing the security overview for a team
|
||||
|
||||
{% data reusables.profile.access_org %} {% data reusables.user-settings.access_org %} {% data reusables.organizations.specific_team %} {% data reusables.organizations.team-security-overview %} {% data reusables.organizations.filter-security-overview %}
|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.user-settings.access_org %}
|
||||
{% data reusables.organizations.specific_team %}
|
||||
{% data reusables.organizations.team-security-overview %}
|
||||
{% data reusables.organizations.filter-security-overview %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 关于依赖项评审
|
||||
intro: 依赖项审查可让你在将有不安全的依赖项引入你的环境之前找到它们,并提供关于许可证、依赖项和依赖项存在时间的信息。
|
||||
title: About dependency review
|
||||
intro: 'Dependency review lets you catch insecure dependencies before you introduce them to your environment, and provides information on license, dependents, and age of dependencies.'
|
||||
product: '{% data reusables.gated-features.dependency-review %}'
|
||||
shortTitle: Dependency review
|
||||
versions:
|
||||
@@ -17,57 +17,54 @@ topics:
|
||||
- Pull requests
|
||||
redirect_from:
|
||||
- /code-security/supply-chain-security/about-dependency-review
|
||||
ms.openlocfilehash: aeb85342f027125328ef5537e718bc671f02eb3e
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147424702'
|
||||
---
|
||||
|
||||
{% data reusables.dependency-review.beta %}
|
||||
|
||||
## 关于依赖项评审
|
||||
## About dependency review
|
||||
|
||||
{% data reusables.dependency-review.feature-overview %}
|
||||
|
||||
如果拉取请求针对仓库的默认分支并且包含对包清单或锁定文件的更改,您可以显示依赖项审查以查看更改的内容。 依赖项审查包括对锁定文件中间接依赖项的更改详情,并告诉您任何已添加或更新的依赖项是否包含已知漏洞。
|
||||
If a pull request targets your repository's default branch and contains changes to package manifests or lock files, you can display a dependency review to see what has changed. The dependency review includes details of changes to indirect dependencies in lock files, and it tells you if any of the added or updated dependencies contain known vulnerabilities.
|
||||
|
||||
有时,您可能只想更新清单中一个依赖项的版本并生成拉取请求。 但是,如果此直接依赖项的更新版本也更新了依赖项,则拉取请求的更改可能超过您的预期。 每个清单和锁定文件的依赖项审查提供了一种简单的方法来查看更改的内容,以及任何新的依赖项版本是否包含已知的漏洞。
|
||||
Sometimes you might just want to update the version of one dependency in a manifest and generate a pull request. However, if the updated version of this direct dependency also has updated dependencies, your pull request may have more changes than you expected. The dependency review for each manifest and lock file provides an easy way to see what has changed, and whether any of the new dependency versions contain known vulnerabilities.
|
||||
|
||||
通过检查拉取请求中的依赖项审查并更改被标记为有漏洞的任何依赖项,可以避免将漏洞添加到项目中。 有关依赖项审查工作原理的详细信息,请参阅“[查看拉取请求中的依赖项更改](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-dependency-changes-in-a-pull-request)”。
|
||||
By checking the dependency reviews in a pull request, and changing any dependencies that are flagged as vulnerable, you can avoid vulnerabilities being added to your project. For more information about how dependency review works, see "[Reviewing dependency changes in a pull request](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-dependency-changes-in-a-pull-request)."
|
||||
|
||||
有关配置依赖项评审的详细信息,请参阅“[配置依赖项评审](/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-dependency-review)”。
|
||||
For more information about configuring dependency review, see "[Configuring dependency review](/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-dependency-review)."
|
||||
|
||||
{% data variables.product.prodname_dependabot_alerts %} 将会查找依赖项中存在的漏洞,但避免引入潜在问题比在以后修复它们要好得多。 有关 {% data variables.product.prodname_dependabot_alerts %} 的详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_alerts %}](/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies#dependabot-alerts-for-vulnerable-dependencies)”。
|
||||
{% data variables.product.prodname_dependabot_alerts %} will find vulnerabilities that are already in your dependencies, but it's much better to avoid introducing potential problems than to fix problems at a later date. For more information about {% data variables.product.prodname_dependabot_alerts %}, see "[About {% data variables.product.prodname_dependabot_alerts %}](/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies#dependabot-alerts-for-vulnerable-dependencies)."
|
||||
|
||||
依赖项审查支持与依赖关系图相同的语言和包管理生态系统。 有关详细信息,请参阅“[关于依赖项关系图](/github/visualizing-repository-data-with-graphs/about-the-dependency-graph#supported-package-ecosystems)”。
|
||||
Dependency review supports the same languages and package management ecosystems as the dependency graph. For more information, see "[About the dependency graph](/github/visualizing-repository-data-with-graphs/about-the-dependency-graph#supported-package-ecosystems)."
|
||||
|
||||
有关 {% data variables.product.product_name %} 上提供的供应链功能的详细信息,请参阅“[关于供应链安全性](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-supply-chain-security)”。
|
||||
For more information on supply chain features available on {% data variables.product.product_name %}, see "[About supply chain security](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-supply-chain-security)."
|
||||
|
||||
{% ifversion ghec or ghes %}
|
||||
## 启用依赖项审查
|
||||
## Enabling dependency review
|
||||
|
||||
启用依赖关系图时,依赖项审查功能可用。 有关详细信息,请参阅“{% ifversion ghec %} [启用依赖项关系图](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph#enabling-the-dependency-graph){% elsif ghes %}[为企业启用依赖项关系图](/admin/code-security/managing-supply-chain-security-for-your-enterprise/enabling-the-dependency-graph-for-your-enterprise){% endif %}”。
|
||||
The dependency review feature becomes available when you enable the dependency graph. For more information, see "{% ifversion ghec %}[Enabling the dependency graph](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph#enabling-the-dependency-graph){% elsif 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){% endif %}."
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.5 or ghae-issue-6396 %}
|
||||
## 强制实施依赖项审查
|
||||
{% ifversion fpt or ghec or ghes > 3.5 or ghae > 3.5 %}
|
||||
## Dependency review enforcement
|
||||
|
||||
{% data reusables.dependency-review.dependency-review-action-beta-note %}
|
||||
|
||||
该操作适用于所有 {% ifversion fpt or ghec %}公共存储库,以及启用了 {% data variables.product.prodname_GH_advanced_security %} 的专用 {% endif %}存储库。
|
||||
The action is available for all {% ifversion fpt or ghec %}public repositories, as well as private {% endif %}repositories that have {% data variables.product.prodname_GH_advanced_security %} enabled.
|
||||
|
||||
{% data reusables.dependency-review.action-enterprise %}
|
||||
|
||||
可以使用存储库中的 {% data variables.product.prodname_dependency_review_action %} 对拉取请求强制实施依赖项审查。 该操作会扫描拉取请求中包版本更改引入的易受攻击的依赖项版本,并警告你相关的安全漏洞。 这样可以更好地了解拉取请求中发生的变化,并帮助防止漏洞添加到存储库中。 有关详细信息,请参阅 [`dependency-review-action`](https://github.com/actions/dependency-review-action)。
|
||||
You can use the {% data variables.product.prodname_dependency_review_action %} in your repository to enforce dependency reviews on your pull requests. The action scans for vulnerable versions of dependencies introduced by package version changes in pull requests, and warns you about the associated security vulnerabilities. This gives you better visibility of what's changing in a pull request, and helps prevent vulnerabilities being added to your repository. For more information, see [`dependency-review-action`](https://github.com/actions/dependency-review-action).
|
||||
|
||||

|
||||

|
||||
|
||||
默认情况下,如果 {% data variables.product.prodname_dependency_review_action %} 检查发现任何易受攻击的包,它将失败。 当存储库所有者需要依赖项审查检查才能通过时,失败的检查将阻止拉取请求合并。 有关详细信息,请参阅“[关于受保护的分支](/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches#require-status-checks-before-merging)”。
|
||||
By default, the {% data variables.product.prodname_dependency_review_action %} check will fail if it discovers any vulnerable packages. A failed check blocks a pull request from being merged when the repository owner requires the dependency review check to pass. For more information, see "[About protected branches](/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches#require-status-checks-before-merging)."
|
||||
|
||||
该操作使用依赖项审查 REST API 来获取基本提交和头提交之间的依赖项更改差异。 可以使用依赖项审查 API 获取存储库上任意两个提交之间的依赖项更改(包括漏洞数据)的差异。 有关详细信息,请参阅“[依赖项审查](/rest/reference/dependency-graph#dependency-review)”。
|
||||
The action uses the Dependency Review REST API to get the diff of dependency changes between the base commit and head commit. You can use the Dependency Review API to get the diff of dependency changes, including vulnerability data, between any two commits on a repository. For more information, see "[Dependency review](/rest/reference/dependency-graph#dependency-review)."
|
||||
|
||||
{% ifversion dependency-review-action-configuration %} 可以配置 {% data variables.product.prodname_dependency_review_action %} 来更好地满足你的需求。 例如,可以指定将导致操作失败的严重级别{% ifversion dependency-review-action-licenses %},或者为要扫描的许可证设置允许或拒绝列表{% endif %}。 有关详细信息,请参阅“[配置依赖项审查](/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-dependency-review#configuring-the-dependency-review-github-action)”。 {% endif %}
|
||||
{% ifversion dependency-review-action-configuration %}
|
||||
You can configure the {% data variables.product.prodname_dependency_review_action %} to better suit your needs. For example, you can specify the severity level that will make the action fail{% ifversion dependency-review-action-licenses %}, or set an allow or deny list for licenses to scan{% endif %}. For more information, see "[Configuring dependency review](/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-dependency-review#configuring-the-dependency-review-github-action)."
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ The recommended formats explicitly define which versions are used for all direct
|
||||
| Maven | Java, Scala | `pom.xml` | `pom.xml` |
|
||||
| npm | JavaScript | `package-lock.json` | `package-lock.json`, `package.json`|
|
||||
| pip | Python | `requirements.txt`, `pipfile.lock` | `requirements.txt`, `pipfile`, `pipfile.lock`, `setup.py`<sup>[‡]</sup> |
|
||||
{%- ifversion fpt or ghec or ghes > 3.3 or ghae-issue-4752 %}
|
||||
{%- ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
| Python Poetry | Python | `poetry.lock` | `poetry.lock`, `pyproject.toml` |
|
||||
{%- endif %}
|
||||
| RubyGems | Ruby | `Gemfile.lock` | `Gemfile.lock`, `Gemfile`, `*.gemspec` |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 编辑 wiki 内容
|
||||
intro: 您可以将图片和内容链接添加到您的 wiki,并使用某些受支持的 MediaWiki 格式。
|
||||
title: Editing wiki content
|
||||
intro: 'You can add images and links to content in your wiki, and use some supported MediaWiki formats.'
|
||||
redirect_from:
|
||||
- /articles/adding-links-to-wikis
|
||||
- /articles/how-do-i-add-links-to-my-wiki
|
||||
@@ -19,51 +19,47 @@ versions:
|
||||
ghec: '*'
|
||||
topics:
|
||||
- Community
|
||||
ms.openlocfilehash: 0afae4335dbf6ff78c0b0e1a2bef4cebed637a5e
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147578938'
|
||||
---
|
||||
## 添加链接
|
||||
|
||||
您可以使用页面支持的标准标记或使用 MediaWiki 语法在 wiki 中创建链接。 例如:
|
||||
## Adding links
|
||||
|
||||
- 如果页面使用 Markdown 呈现,则链接语法为 `[Link Text](full-URL-of-wiki-page)`。
|
||||
- 使用 MediaWiki 语法时,链接语法为 `[[nameofwikipage|Link Text]]`。
|
||||
You can create links in wikis using the standard markup supported by your page, or using MediaWiki syntax. For example:
|
||||
|
||||
## 添加图像
|
||||
- If your pages are rendered with Markdown, the link syntax is `[Link Text](full-URL-of-wiki-page)`.
|
||||
- With MediaWiki syntax, the link syntax is `[[nameofwikipage|Link Text]]`.
|
||||
|
||||
Wikis 可显示 PNG、JPEG 和 GIF 图片。
|
||||
## Adding images
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-wiki %}
|
||||
3. 使用 Wiki 边栏,导航到要更改的页面,然后单击“编辑”。
|
||||
4. 在 Wiki 工具栏上,单击“图像”。
|
||||

|
||||
5. 在“Insert Image”(插入图像)对话框,输入 URL 和 alt 文本(由搜索引擎和屏幕阅读器使用)。
|
||||
6. 单击" **确定**"。
|
||||
Wikis can display PNG, JPEG, and GIF images.
|
||||
|
||||
### 链接到仓库中的图片
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-wiki %}
|
||||
3. Using the wiki sidebar, navigate to the page you want to change, and then click **Edit**.
|
||||
4. On the wiki toolbar, click **Image**.
|
||||

|
||||
5. In the "Insert Image" dialog box, type the image URL and the alt text (which is used by search engines and screen readers).
|
||||
6. Click **OK**.
|
||||
|
||||
您可以通过在浏览器中复制链接并将其用作图像路径,链接到 {% data variables.product.product_name %} 上仓库中的图像。 例如,使用 Markdown 在 wiki 中嵌入图像可能如下所示:
|
||||
### Linking to images in a repository
|
||||
|
||||
You can link to an image in a repository on {% data variables.product.product_name %} by copying the URL in your browser and using that as the path to the image. For example, embedding an image in your wiki using Markdown might look like this:
|
||||
|
||||
[[https://github.com/USERNAME/REPOSITORY/blob/main/img/octocat.png|alt=octocat]]
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.6 or ghae-issue-7647 %}
|
||||
## 添加数学表达式和关系图{% endif %}
|
||||
{% ifversion fpt or ghec or ghes > 3.6 or ghae > 3.6 %}
|
||||
## Adding mathematical expressions and diagrams{% endif %}
|
||||
|
||||
{% data reusables.getting-started.math-and-diagrams %}
|
||||
|
||||
## 受支持的 MediaWiki 格式
|
||||
## Supported MediaWiki formats
|
||||
|
||||
无论您的 wiki 页面以哪种标记语言编写,始终可使用某些 MediaWiki 语法。
|
||||
- 链接([AsciiDoc 除外](https://github.com/gollum/gollum/commit/d1cf698b456cd6a35a54c6a8e7b41d3068acec3b))
|
||||
- 借助于 `---` 的水平规则
|
||||
- 简明符号实体(例如 `δ` 或者 `€`)
|
||||
No matter which markup language your wiki page is written in, certain MediaWiki syntax will always be available to you.
|
||||
- Links ([except AsciiDoc](https://github.com/gollum/gollum/commit/d1cf698b456cd6a35a54c6a8e7b41d3068acec3b))
|
||||
- Horizontal rules via `---`
|
||||
- Shorthand symbol entities (such as `δ` or `€`)
|
||||
|
||||
出于安全和性能原因,某些语法不受支持。
|
||||
- [嵌入包含](https://www.mediawiki.org/wiki/Transclusion)
|
||||
- 定义列表
|
||||
- 缩进
|
||||
- 目录
|
||||
For security and performance reasons, some syntaxes are unsupported.
|
||||
- [Transclusion](https://www.mediawiki.org/wiki/Transclusion)
|
||||
- Definition lists
|
||||
- Indentation
|
||||
- Table of contents
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 关于 GitHub 的 API
|
||||
intro: '了解 {% data variables.product.prodname_dotcom %} 的 API 以扩展和自定义您的 {% data variables.product.prodname_dotcom %} 体验。'
|
||||
title: About GitHub's APIs
|
||||
intro: 'Learn about {% data variables.product.prodname_dotcom %}''s APIs to extend and customize your {% data variables.product.prodname_dotcom %} experience.'
|
||||
redirect_from:
|
||||
- /v3/versions
|
||||
- /articles/getting-started-with-the-api
|
||||
@@ -12,11 +12,74 @@ versions:
|
||||
ghec: '*'
|
||||
topics:
|
||||
- API
|
||||
ms.openlocfilehash: 6c4519222ce356e2b205b66f898a096ebacf8d9c
|
||||
ms.sourcegitcommit: 478f2931167988096ae6478a257f492ecaa11794
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/09/2022
|
||||
ms.locfileid: '147682642'
|
||||
---
|
||||
GitHub API 有两个稳定版本:[REST API](/rest) 和 [GraphQL API](/graphql)。
|
||||
|
||||
## About {% data variables.product.company_short %}'s APIs
|
||||
|
||||
{% data variables.product.company_short %} provides two APIs: a REST API and a GraphQL API. You can interact with both APIs using {% data variables.product.prodname_cli %}, curl, the official Octokit libraries, and third party libraries. Occasionally, a feature may be supported on one API but not the other.
|
||||
|
||||
You should choose the API that best aligns with your needs and that you are most comfortable using. This article discusses the benefits of each API.
|
||||
|
||||
For more information about the GraphQL API, see [the GraphQL documentation](/graphql). For more information about the REST API, see [the REST documentation](/rest).
|
||||
|
||||
## Choosing the GraphQL API
|
||||
|
||||
The GraphQL API returns exactly the data that you request. GraphQL also returns the data in a pre-known structure based on your request. In contrast, the REST API returns more data than you requested and returns it in a pre-determined structure. You can also accomplish the equivalent of multiple REST API request in a single GraphQL request. The ability to make fewer requests and fetch less data makes GraphQL appealing to developers of mobile applications.
|
||||
|
||||
For example, to get the {% data variables.product.product_name %} login of ten of your followers, and the login of ten followers of each of your followers, you can send a single request like:
|
||||
|
||||
```graphql
|
||||
{
|
||||
viewer {
|
||||
followers(first: 10) {
|
||||
nodes {
|
||||
login
|
||||
followers(first: 10) {
|
||||
nodes {
|
||||
login
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The response will be a JSON object that follows the structure of your request.
|
||||
|
||||
In contrast, to get this same information from the REST API, you would need to first make a request to `GET /user/followers`. The API would return the login of each follower, along with other data about the followers that you don't need. Then, for each follower, you would need to make a request to `GET /users/{username}/followers`. In total, you would need to make 11 requests to get the same information that you could get from a single GraphQL request, and you would receive excess data.
|
||||
|
||||
## Choosing the REST API
|
||||
|
||||
Because REST APIs have been around for longer than GraphQL APIs, some developers are more comfortable with the REST API. Since REST APIs use standard HTTP verbs and concepts, many developers are already familiar with the basic concepts to use the REST API.
|
||||
|
||||
For example, to create an issue in the `octocat/Spoon-Knife` repository, you would need to send a request to `POST /repos/octocat/Spoon-Knife/issues` with a JSON request body:
|
||||
|
||||
```json
|
||||
{
|
||||
"title": "Bug with feature X",
|
||||
"body": "If you do A, then B happens"
|
||||
}
|
||||
```
|
||||
|
||||
In contrast, to make an issue using the GraphQL API, you would need to get the node ID of the `octocat/Spoon-Knife` repository and then send a request like:
|
||||
|
||||
```graphql
|
||||
mutation {
|
||||
createIssue(
|
||||
input: {
|
||||
repositoryId: "MDEwOlJlcG9zaXRvcnkxMzAwMTky"
|
||||
title: "Bug with feature X"
|
||||
body: "If you do A, then B happens"}
|
||||
) {
|
||||
issue {
|
||||
number
|
||||
url
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Choosing both
|
||||
|
||||
You don't need to exclusively use one API over the other. Node IDs let you move between the REST API and GraphQL API. For more information, see "[Using global node IDs](/graphql/guides/using-global-node-ids)."
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -31,7 +31,7 @@ A {% data variables.product.prodname_GH_advanced_security %} license provides th
|
||||
- **Dependency review** - Show the full impact of changes to dependencies and see details of any vulnerable versions before you merge a pull request. For more information, see "[About dependency review](/code-security/supply-chain-security/about-dependency-review)."
|
||||
|
||||
{% ifversion ghes < 3.7 or ghae %}
|
||||
<!-- Ref: ghae-issue-7114 remove GHAE versioning from this section when the `security-overview-displayed-alerts` flag is toggled for GHAE -->
|
||||
<!-- Ref: ghae > 3.6 remove GHAE versioning from this section when the `security-overview-displayed-alerts` flag is toggled for GHAE -->
|
||||
- **Security overview** - Review the security configuration and alerts for an organization and identify the repositories at greatest risk. For more information, see "[About the security overview](/code-security/security-overview/about-the-security-overview)."
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 键盘快捷方式
|
||||
intro: '几乎 {% data variables.product.prodname_dotcom %} 上的每一页都有键盘快捷方式,可以更快地执行操作。'
|
||||
title: Keyboard shortcuts
|
||||
intro: 'Nearly every page on {% data variables.product.prodname_dotcom %} has a keyboard shortcut to perform actions faster.'
|
||||
redirect_from:
|
||||
- /articles/using-keyboard-shortcuts
|
||||
- /categories/75/articles
|
||||
@@ -13,217 +13,232 @@ versions:
|
||||
ghes: '*'
|
||||
ghae: '*'
|
||||
ghec: '*'
|
||||
ms.openlocfilehash: 857c4129e2e156025c8ee8f37a0c834242c0b216
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147423538'
|
||||
---
|
||||
## 关于键盘快捷键
|
||||
## About keyboard shortcuts
|
||||
|
||||
键入 <kbd>?</kbd> ({% data variables.product.prodname_dotcom %} 上)会显示一个对话框,其中列出了可用于该页面的键盘快捷方式。 您可以使用这些键盘快捷键对站点执行操作,而无需使用鼠标导航。
|
||||
Typing <kbd>?</kbd> on {% data variables.product.prodname_dotcom %} brings up a dialog box that lists the keyboard shortcuts available for that page. You can use these keyboard shortcuts to perform actions across the site without using your mouse to navigate.
|
||||
|
||||
{% ifversion keyboard-shortcut-accessibility-setting %} 可以在辅助功能设置中禁用字符键快捷方式,同时仍允许使用用于修改键的快捷方式。 有关详细信息,请参阅“[管理辅助功能设置](/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-personal-account-settings/managing-accessibility-settings)”。{% endif %}
|
||||
{% ifversion keyboard-shortcut-accessibility-setting %}
|
||||
You can disable character key shortcuts, while still allowing shortcuts that use modifier keys, in your accessibility settings. For more information, see "[Managing accessibility settings](/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-personal-account-settings/managing-accessibility-settings)."{% endif %}
|
||||
|
||||
下面是一些可用键盘快捷键的列表。
|
||||
{% ifversion command-palette %} {% data variables.product.prodname_command_palette %} 还可用于快速访问各种操作,而无需记住键盘快捷方式。 有关详细信息,请参阅“[{% data variables.product.prodname_command_palette %}](/get-started/using-github/github-command-palette)”。{% endif %}
|
||||
Below is a list of some of the available keyboard shortcuts.
|
||||
{% ifversion command-palette %}
|
||||
The {% data variables.product.prodname_command_palette %} also gives you quick access to a wide range of actions, without the need to remember keyboard shortcuts. For more information, see "[{% data variables.product.prodname_command_palette %}](/get-started/using-github/github-command-palette)."{% endif %}
|
||||
|
||||
## 站点快捷键
|
||||
## Site wide shortcuts
|
||||
|
||||
| 键盘快捷方式 | 说明
|
||||
| Keyboard shortcut | Description
|
||||
|-----------|------------
|
||||
|<kbd>S</kbd> 或 <kbd>/</kbd> | 聚焦于搜索栏。 有关详细信息,请参阅“[关于搜索 {% data variables.product.company_short %}](/search-github/getting-started-with-searching-on-github/about-searching-on-github)”。
|
||||
|<kbd>G</kbd> <kbd>N</kbd> | 转到您的通知。 有关详细信息,请参阅“[关于通知](/github/managing-subscriptions-and-notifications-on-github/about-notifications)”。
|
||||
|Esc | 当聚焦于用户、议题或拉取请求悬停卡时,关闭悬停卡并重新聚焦于悬停卡所在的元素
|
||||
{% ifversion command-palette %}|<kbd>Command</kbd>+<kbd>K</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>K</kbd> (Windows/Linux) | 打开 {% data variables.product.prodname_command_palette %}。 如果要编辑 Markdown 文本,请使用 <kbd>Command</kbd>+<kbd>Option</kbd>+<kbd>K</kbd> 或 <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>K</kbd> 打开命令面板。 有关详细信息,请参阅“[{% data variables.product.prodname_command_palette %}](/get-started/using-github/github-command-palette)”。{% endif %}
|
||||
|<kbd>S</kbd> or <kbd>/</kbd> | Focus the search bar. For more information, see "[About searching on {% data variables.product.company_short %}](/search-github/getting-started-with-searching-on-github/about-searching-on-github)."
|
||||
|<kbd>G</kbd> <kbd>N</kbd> | Go to your notifications. For more information, see "[About notifications](/github/managing-subscriptions-and-notifications-on-github/about-notifications)."
|
||||
|<kbd>Esc</kbd> | When focused on a user, issue, or pull request hovercard, closes the hovercard and refocuses on the element the hovercard is in
|
||||
{% ifversion command-palette %}|<kbd>Command</kbd>+<kbd>K</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>K</kbd> (Windows/Linux) | Opens the {% data variables.product.prodname_command_palette %}. If you are editing Markdown text, open the command palette with <kbd>Command</kbd>+<kbd>Option</kbd>+<kbd>K</kbd> or <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>K</kbd>. For more information, see "[{% data variables.product.prodname_command_palette %}](/get-started/using-github/github-command-palette)."{% endif %}
|
||||
|
||||
## 存储库
|
||||
## Repositories
|
||||
|
||||
| 键盘快捷方式 | 说明
|
||||
| Keyboard shortcut | Description
|
||||
|-----------|------------
|
||||
|<kbd>G</kbd> <kbd>C</kbd> | 转到“代码”选项卡
|
||||
|<kbd>G</kbd> <kbd>I</kbd> | 转到“问题”选项卡。有关详细信息,请参阅“[关于问题](/articles/about-issues)”。
|
||||
|<kbd>G</kbd> <kbd>P</kbd> | 转到“拉取请求”选项卡。有关详细信息,请参阅“[关于拉取请求](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)”。{% ifversion fpt or ghes or ghec %}
|
||||
|<kbd>G</kbd> <kbd>A</kbd> | 转到“操作”选项卡。有关详细信息,请参阅“[关于操作](/actions/getting-started-with-github-actions/about-github-actions)”。{% endif %}
|
||||
|<kbd>G</kbd> <kbd>B</kbd> | 转到“项目”选项卡。有关详细信息,请参阅“[关于项目板](/articles/about-project-boards)”。
|
||||
|<kbd>G</kbd> <kbd>W</kbd> | 转到“Wiki”选项卡。有关详细信息,请参阅“[关于 Wiki](/communities/documenting-your-project-with-wikis/about-wikis)”。{% ifversion discussions %}
|
||||
|<kbd>G</kbd> <kbd>G</kbd> | 转到“讨论”选项卡。有关详细信息,请参阅“[关于讨论](/discussions/collaborating-with-your-community-using-discussions/about-discussions)”。{% endif %}
|
||||
|<kbd>G</kbd> <kbd>C</kbd> | Go to the **Code** tab
|
||||
|<kbd>G</kbd> <kbd>I</kbd> | Go to the **Issues** tab. For more information, see "[About issues](/articles/about-issues)."
|
||||
|<kbd>G</kbd> <kbd>P</kbd> | Go to the **Pull requests** tab. For more information, see "[About pull requests](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)."{% ifversion fpt or ghes or ghec %}
|
||||
|<kbd>G</kbd> <kbd>A</kbd> | Go to the **Actions** tab. For more information, see "[About Actions](/actions/getting-started-with-github-actions/about-github-actions)."{% endif %}
|
||||
|<kbd>G</kbd> <kbd>B</kbd> | Go to the **Projects** tab. For more information, see "[About project boards](/articles/about-project-boards)."
|
||||
|<kbd>G</kbd> <kbd>W</kbd> | Go to the **Wiki** tab. For more information, see "[About wikis](/communities/documenting-your-project-with-wikis/about-wikis)."{% ifversion discussions %}
|
||||
|<kbd>G</kbd> <kbd>G</kbd> | Go to the **Discussions** tab. For more information, see "[About discussions](/discussions/collaborating-with-your-community-using-discussions/about-discussions)."{% endif %}
|
||||
|
||||
## 源代码编辑
|
||||
## Source code editing
|
||||
|
||||
| 键盘快捷方式 | 说明 |-----------|------------{% ifversion fpt or ghec %} |<kbd>.</kbd> | 在基于 Web 的编辑器中打开存储库或拉取请求。 有关详细信息,请参阅“[基于 Web 的编辑器](/codespaces/developing-in-codespaces/web-based-editor)”。{% endif %} |<kbd>Command</kbd>+<kbd>B</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>B</kbd> (Windows/Linux) | 插入 Markdown 格式将文本设为粗体 | <kbd>Command</kbd>+<kbd>I</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>I</kbd> (Windows/Linux) | 插入 Markdown 格式将文本设为斜体 | <kbd>Command</kbd>+<kbd>K</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>K</kbd> (Windows/Linux) | 插入 Markdown 格式创建链接{% ifversion fpt or ghec or ghae or ghes > 3.3 %} |<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>7</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>7</kbd> (Windows/Linux) | 插入 Markdown 格式创建有序列表 |<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>8</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>8</kbd> (Windows/Linux) | 插入 Markdown 格式创建无序列表 |<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>.</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>.</kbd> (Windows/Linux) | 插入 Markdown 格式创建引用{% endif %} |<kbd>E</kbd> | 在“编辑文件”选项卡中打开源代码文件 |<kbd>Command</kbd>+<kbd>F</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>F</kbd> (Windows/Linux) | 开始在文件编辑器中搜索 |<kbd>Command</kbd>+<kbd>G</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>G</kbd> (Windows/Linux) | 查找下一个 |<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>G</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>G</kbd> (Windows/Linux) | 查找上一个 |<kbd>Command</kbd>+<kbd>Option</kbd>+<kbd>F</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>F</kbd> (Windows/Linux) | 替换 |<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>Option</kbd>+<kbd>F</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>R</kbd> (Windows/Linux) | 全部替换 |<kbd>Alt</kbd>+<kbd>G</kbd> | 跳转到行 |<kbd>Command</kbd>+<kbd>Z</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Z</kbd> (Windows/Linux) | 撤消 |<kbd>Command</kbd>+<kbd>Y</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Y</kbd> (Windows/Linux) | 恢复 |<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> | 在“编辑文件”和“预览更改”选项卡之间切换 |<kbd>Command</kbd>+<kbd>S</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>S</kbd> (Windows/Linux) | 编写提交消息
|
||||
| Keyboard shortcut | Description
|
||||
|-----------|------------{% ifversion fpt or ghec %}
|
||||
|<kbd>.</kbd> | Opens a repository or pull request in the web-based editor. For more information, see "[Web-based editor](/codespaces/developing-in-codespaces/web-based-editor)."{% endif %}
|
||||
|<kbd>Command</kbd>+<kbd>B</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>B</kbd> (Windows/Linux) | Inserts Markdown formatting for bolding text
|
||||
|<kbd>Command</kbd>+<kbd>I</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>I</kbd> (Windows/Linux) | Inserts Markdown formatting for italicizing text
|
||||
|<kbd>Command</kbd>+<kbd>K</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>K</kbd> (Windows/Linux) | Inserts Markdown formatting for creating a link{% ifversion fpt or ghec or ghae or ghes > 3.3 %}
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>7</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>7</kbd> (Windows/Linux) | Inserts Markdown formatting for an ordered list
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>8</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>8</kbd> (Windows/Linux) | Inserts Markdown formatting for an unordered list
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>.</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>.</kbd> (Windows/Linux) | Inserts Markdown formatting for a quote{% endif %}
|
||||
|<kbd>E</kbd> | Open source code file in the **Edit file** tab
|
||||
|<kbd>Command</kbd>+<kbd>F</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>F</kbd> (Windows/Linux) | Start searching in file editor
|
||||
|<kbd>Command</kbd>+<kbd>G</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>G</kbd> (Windows/Linux) | Find next
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>G</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>G</kbd> (Windows/Linux) | Find previous
|
||||
|<kbd>Command</kbd>+<kbd>Option</kbd>+<kbd>F</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>F</kbd> (Windows/Linux) | Replace
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>Option</kbd>+<kbd>F</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>R</kbd> (Windows/Linux) | Replace all
|
||||
|<kbd>Alt</kbd>+<kbd>G</kbd> | Jump to line
|
||||
|<kbd>Command</kbd>+<kbd>Z</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Z</kbd> (Windows/Linux) | Undo
|
||||
|<kbd>Command</kbd>+<kbd>Y</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Y</kbd> (Windows/Linux) | Redo
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> | Toggles between the **Edit file** and **Preview changes** tabs
|
||||
|<kbd>Command</kbd>+<kbd>S</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>S</kbd> (Windows/Linux) | Write a commit message
|
||||
|
||||
有关更多键盘快捷方式的详细信息,请参阅 [CodeMirror 文档](https://codemirror.net/doc/manual.html#commands)。
|
||||
For more keyboard shortcuts, see the [CodeMirror documentation](https://codemirror.net/doc/manual.html#commands).
|
||||
|
||||
## 源代码浏览
|
||||
## Source code browsing
|
||||
|
||||
| 键盘快捷方式 | 说明
|
||||
| Keyboard shortcut | Description
|
||||
|-----------|------------
|
||||
|<kbd>T</kbd> | 激活文件查找器
|
||||
|<kbd>L</kbd> | 跳至代码中的某一行
|
||||
|<kbd>W</kbd> | 切换到新分支或标记
|
||||
|<kbd>是</kbd> | 将 URL 展开为其规范形式。 有关详细信息,请参阅“[获取文件的永久链接](/articles/getting-permanent-links-to-files)”。
|
||||
|<kbd>I</kbd> | 显示或隐藏有关差异的评论。 有关详细信息,请参阅“[评论拉取请求的差异](/articles/commenting-on-the-diff-of-a-pull-request)”。
|
||||
|<kbd>A</kbd> | 在差异上显示或隐藏注释
|
||||
|<kbd>B</kbd> | 打开追溯视图。 有关详细信息,请参阅“[跟踪文件中的更改](/articles/tracing-changes-in-a-file)”。
|
||||
|<kbd>T</kbd> | Activates the file finder
|
||||
|<kbd>L</kbd> | Jump to a line in your code
|
||||
|<kbd>W</kbd> | Switch to a new branch or tag
|
||||
|<kbd>Y</kbd> | Expand a URL to its canonical form. For more information, see "[Getting permanent links to files](/articles/getting-permanent-links-to-files)."
|
||||
|<kbd>I</kbd> | Show or hide comments on diffs. For more information, see "[Commenting on the diff of a pull request](/articles/commenting-on-the-diff-of-a-pull-request)."
|
||||
|<kbd>A</kbd> | Show or hide annotations on diffs
|
||||
|<kbd>B</kbd> | Open blame view. For more information, see "[Tracing changes in a file](/articles/tracing-changes-in-a-file)."
|
||||
|
||||
## 注释
|
||||
## Comments
|
||||
|
||||
| 键盘快捷方式 | 说明
|
||||
| Keyboard shortcut | Description
|
||||
|-----------|------------
|
||||
|<kbd>Command</kbd>+<kbd>B</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>B</kbd> (Windows/Linux) | 插入 Markdown 格式用于粗体文本
|
||||
|<kbd>Command</kbd>+<kbd>I</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>I</kbd> (Windows/Linux) | 插入 Markdown 格式用于斜体文本
|
||||
|<kbd>Command</kbd>+<kbd>E</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>E</kbd> (Windows/Linux) | 在行 {% ifversion fpt or ghae-issue-5434 or ghes or ghec %} 中插入代码或命令的 Markdown 格式
|
||||
|<kbd>Command</kbd>+<kbd>K</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>K</kbd> (Windows/Linux) | 插入 Markdown 格式以创建链接{% endif %}{% ifversion fpt or ghae-issue-7103 or ghes > 3.5 or ghec %}
|
||||
|<kbd>Command</kbd>+<kbd>V</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>V</kbd> (Windows/Linux) | 应用于突出显示的文本时创建 Markdown 链接{% endif %}
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux) | 在“撰写”和“预览”评论选项卡之间切换{% ifversion fpt or ghae or ghes > 3.4 or ghec %}
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>V</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>V</kbd> (Windows/Linux) | 将 HTML 链接粘贴为纯文本{% endif %}{% ifversion fpt or ghae or ghes > 3.2 or ghec %}
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>Option</kbd>+<kbd>V</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Alt</kbd>+<kbd>V</kbd> (Windows/Linux) | 将 HTML 链接粘贴为纯文本{% endif %}{% ifversion fpt or ghae or ghes > 3.2 or ghec %}
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>7</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>7</kbd> (Windows/Linux) | 为有序列表插入 Markdown 格式
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>8</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>8</kbd> (Windows/Linux) | 为无序列表插入 Markdown 格式{% endif %}
|
||||
|<kbd>Command</kbd>+<kbd>Enter</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Enter</kbd> (Windows/Linux) | 提交评论
|
||||
|Ctrl+. 然后按 <kbd>Ctrl</kbd>+<kbd>[保存的回复编号]</kbd> | 打开已保存回复菜单,然后使用已保存回复自动填写评论字段。 有关详细信息,请参阅“[关于已保存的回复](/articles/about-saved-replies)”。{% ifversion fpt or ghae or ghes > 3.2 or ghec %}
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>.</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>.</kbd> (Windows/Linux) | 为报价插入 Markdown 格式{% endif %}{% ifversion fpt or ghec %}
|
||||
|<kbd>Command</kbd>+<kbd>G</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>G</kbd> (Windows/Linux) | 插入建议。 有关详细信息,请参阅“[审查拉取请求中的建议更改](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request)”。 |{% endif %}
|
||||
|<kbd>R</kbd> | 在您的回复中引用所选的文本。 有关详细信息,请参阅“[基本撰写和格式设置语法](/articles/basic-writing-and-formatting-syntax#quoting-text)”。 |
|
||||
|<kbd>Command</kbd>+<kbd>B</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>B</kbd> (Windows/Linux) | Inserts Markdown formatting for bolding text
|
||||
|<kbd>Command</kbd>+<kbd>I</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>I</kbd> (Windows/Linux) | Inserts Markdown formatting for italicizing text
|
||||
|<kbd>Command</kbd>+<kbd>E</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>E</kbd> (Windows/Linux) | Inserts Markdown formatting for code or a command within a line{% ifversion fpt or ghae > 3.3 or ghes or ghec %}
|
||||
|<kbd>Command</kbd>+<kbd>K</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>K</kbd> (Windows/Linux) | Inserts Markdown formatting for creating a link{% endif %}{% ifversion fpt or ghae > 3.5 or ghes > 3.5 or ghec %}
|
||||
|<kbd>Command</kbd>+<kbd>V</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>V</kbd> (Windows/Linux) | Creates a Markdown link when applied over highlighted text{% endif %}
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux) | Toggles between the **Write** and **Preview** comment tabs{% ifversion fpt or ghae or ghes > 3.4 or ghec %}
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>V</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>V</kbd> (Windows/Linux) | Pastes HTML link as plain text{% endif %}{% ifversion fpt or ghae or ghes > 3.2 or ghec %}
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>Opt</kbd>+<kbd>V</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Alt</kbd>+<kbd>V</kbd> (Windows/Linux) | Pastes HTML link as plain text{% endif %}{% ifversion fpt or ghae or ghes > 3.2 or ghec %}
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>7</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>7</kbd> (Windows/Linux) | Inserts Markdown formatting for an ordered list
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>8</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>8</kbd> (Windows/Linux) | Inserts Markdown formatting for an unordered list{% endif %}
|
||||
|<kbd>Command</kbd>+<kbd>Enter</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Enter</kbd> (Windows/Linux) | Submits a comment
|
||||
|<kbd>Ctrl</kbd>+<kbd>.</kbd> and then <kbd>Ctrl</kbd>+<kbd>[saved reply number]</kbd> | Opens saved replies menu and then autofills comment field with a saved reply. For more information, see "[About saved replies](/articles/about-saved-replies)."{% ifversion fpt or ghae or ghes > 3.2 or ghec %}
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>.</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>.</kbd> (Windows/Linux) | Inserts Markdown formatting for a quote{% endif %}{% ifversion fpt or ghec %}
|
||||
|<kbd>Command</kbd>+<kbd>G</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>G</kbd> (Windows/Linux) | Insert a suggestion. For more information, see "[Reviewing proposed changes in a pull request](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request)." |{% endif %}
|
||||
|<kbd>R</kbd> | Quote the selected text in your reply. For more information, see "[Basic writing and formatting syntax](/articles/basic-writing-and-formatting-syntax#quoting-text)." |
|
||||
|
||||
## 议题和拉取请求列表
|
||||
## Issue and pull request lists
|
||||
|
||||
| 键盘快捷方式 | 说明
|
||||
| Keyboard shortcut | Description
|
||||
|-----------|------------
|
||||
|<kbd>C</kbd> | 创建问题
|
||||
|<kbd>Command</kbd>+<kbd>/</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>/</kbd> (Windows/Linux) | 将光标聚焦于议题或拉取请求搜索栏。 有关详细信息,请参阅“[筛选和搜索问题与拉取请求](/issues/tracking-your-work-with-issues/filtering-and-searching-issues-and-pull-requests)”。||
|
||||
|<kbd>U</kbd> | 按作者过滤
|
||||
|<kbd>L</kbd> | 按标签过滤或编辑标签。 有关详细信息,请参阅[按标签筛选问题和拉取请求](/articles/filtering-issues-and-pull-requests-by-labels)。
|
||||
|<kbd>Alt</kbd> 并单击 | 按标签过滤时,排除标签。 有关详细信息,请参阅[按标签筛选问题和拉取请求](/articles/filtering-issues-and-pull-requests-by-labels)。
|
||||
|<kbd>M</kbd> | 按里程碑过滤或编辑里程碑。 有关详细信息,请参阅“[按里程碑筛选问题和拉取请求](/articles/filtering-issues-and-pull-requests-by-milestone)”。
|
||||
|<kbd>A</kbd> | 按受理人过滤或编辑受理人。 有关详细信息,请参阅“[按被分派人筛选问题和拉取请求](/articles/filtering-issues-and-pull-requests-by-assignees)”。
|
||||
|<kbd>O</kbd> 或 <kbd>Enter</kbd> | 激活议题
|
||||
|<kbd>C</kbd> | Create an issue
|
||||
|<kbd>Command</kbd>+<kbd>/</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>/</kbd> (Windows/Linux) | Focus your cursor on the issues or pull requests search bar. For more information, see "[Filtering and searching issues and pull requests](/issues/tracking-your-work-with-issues/filtering-and-searching-issues-and-pull-requests)."||
|
||||
|<kbd>U</kbd> | Filter by author
|
||||
|<kbd>L</kbd> | Filter by or edit labels. For more information, see "[Filtering issues and pull requests by labels](/articles/filtering-issues-and-pull-requests-by-labels)."
|
||||
|<kbd>Alt</kbd> and click | While filtering by labels, exclude labels. For more information, see "[Filtering issues and pull requests by labels](/articles/filtering-issues-and-pull-requests-by-labels)."
|
||||
|<kbd>M</kbd> | Filter by or edit milestones. For more information, see "[Filtering issues and pull requests by milestone](/articles/filtering-issues-and-pull-requests-by-milestone)."
|
||||
|<kbd>A</kbd> | Filter by or edit assignee. For more information, see "[Filtering issues and pull requests by assignees](/articles/filtering-issues-and-pull-requests-by-assignees)."
|
||||
|<kbd>O</kbd> or <kbd>Enter</kbd> | Open issue
|
||||
|
||||
## 议题和拉取请求
|
||||
| 键盘快捷方式 | 说明
|
||||
## Issues and pull requests
|
||||
| Keyboard shortcut | Description
|
||||
|-----------|------------
|
||||
|<kbd>Q</kbd> | 请求审查者。 有关详细信息,请参阅“[请求拉取请求审查](/articles/requesting-a-pull-request-review/)”。
|
||||
|<kbd>M</kbd> | 设置里程碑。 有关详细信息,请参阅“[将里程碑与问题和拉取请求相关联](/articles/associating-milestones-with-issues-and-pull-requests/)”。
|
||||
|<kbd>L</kbd> | 应用标签。 有关详细信息,请参阅“[将标签应用于问题和拉取请求](/articles/applying-labels-to-issues-and-pull-requests/)”。
|
||||
|<kbd>A</kbd> | 设置受理人。 有关详细信息,请参阅“[向其他 {% data variables.product.company_short %} 用户分配问题和拉取请求](/articles/assigning-issues-and-pull-requests-to-other-github-users/)”。
|
||||
|<kbd>X</kbd> | 链接来自同一存储库的议题或拉取请求。 有关详细信息,请参阅“[将拉取请求链接到问题](/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue/)”。
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux) | 在“写入”和“预览”选项卡之间切换{% ifversion fpt or ghec %}
|
||||
|<kbd>Alt</kbd> 并单击 | 从任务列表创建问题时,按住 <kbd>Alt</kbd> 并单击任务右上角的 {% octicon "issue-opened" aria-label="The issue opened icon" %},以在当前选项卡中打开新问题表单。 有关详细信息,请参阅“[关于任务列表](/issues/tracking-your-work-with-issues/creating-issues/about-task-lists)”。
|
||||
|<kbd>Shift</kbd> 并单击 | 从任务列表创建问题时,按住 <kbd>Alt</kbd> 并单击任务右上角的 {% octicon "issue-opened" aria-label="The issue opened icon" %},以在新的选项卡中打开新问题表单。 有关详细信息,请参阅“[关于任务列表](/issues/tracking-your-work-with-issues/creating-issues/about-task-lists)”。
|
||||
|<kbd>Command</kbd> 并单击 (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd> 并单击 (Windows/Linux) | 从任务列表创建问题时,按住 <kbd>Command</kbd> 或 <kbd>Ctrl</kbd>+<kbd>Shift</kbd> 并单击任务右上角的 {% octicon "issue-opened" aria-label="The issue opened icon" %},以在新窗口中打开新问题表单。 有关详细信息,请参阅“[关于任务列表](/issues/tracking-your-work-with-issues/creating-issues/about-task-lists)”。{% endif %}
|
||||
|<kbd>Q</kbd> | Request a reviewer. For more information, see "[Requesting a pull request review](/articles/requesting-a-pull-request-review/)."
|
||||
|<kbd>M</kbd> | Set a milestone. For more information, see "[Associating milestones with issues and pull requests](/articles/associating-milestones-with-issues-and-pull-requests/)."
|
||||
|<kbd>L</kbd> | Apply a label. For more information, see "[Applying labels to issues and pull requests](/articles/applying-labels-to-issues-and-pull-requests/)."
|
||||
|<kbd>A</kbd> | Set an assignee. For more information, see "[Assigning issues and pull requests to other {% data variables.product.company_short %} users](/articles/assigning-issues-and-pull-requests-to-other-github-users/)."
|
||||
|<kbd>X</kbd> | Link an issue or pull request from the same repository. For more information, see "[Linking a pull request to an issue](/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue/)."
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux) | Toggles between the **Write** and **Preview** tabs{% ifversion fpt or ghec %}
|
||||
|<kbd>Alt</kbd> and click | When creating an issue from a task list, open the new issue form in the current tab by holding <kbd>Alt</kbd> and clicking the {% octicon "issue-opened" aria-label="The issue opened icon" %} in the upper-right corner of the task. For more information, see "[About task lists](/issues/tracking-your-work-with-issues/creating-issues/about-task-lists)."
|
||||
|<kbd>Shift</kbd> and click | When creating an issue from a task list, open the new issue form in a new tab by holding <kbd>Shift</kbd> and clicking the {% octicon "issue-opened" aria-label="The issue opened icon" %} in the upper-right corner of the task. For more information, see "[About task lists](/issues/tracking-your-work-with-issues/creating-issues/about-task-lists)."
|
||||
|<kbd>Command</kbd> and click (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd> and click (Windows/Linux) | When creating an issue from a task list, open the new issue form in the new window by holding <kbd>Command</kbd> or <kbd>Ctrl</kbd>+<kbd>Shift</kbd> and clicking the {% octicon "issue-opened" aria-label="The issue opened icon" %} in the upper-right corner of the task. For more information, see "[About task lists](/issues/tracking-your-work-with-issues/creating-issues/about-task-lists)."{% endif %}
|
||||
|
||||
## 拉取请求中的更改
|
||||
## Changes in pull requests
|
||||
|
||||
| 键盘快捷方式 | 说明
|
||||
| Keyboard shortcut | Description
|
||||
|-----------|------------
|
||||
|<kbd>C</kbd> | 在拉取请求中打开提交列表
|
||||
|<kbd>T</kbd> | 在拉取请求中打开已更改文件列表
|
||||
|<kbd>J</kbd> | 将所选内容在列表中向下移动
|
||||
|<kbd>K</kbd> | 将所选内容在列表中向上移动
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>Enter</kbd> | 添加一条有关拉取请求差异的评论 |
|
||||
|<kbd>Alt</kbd> 并单击 | 按住 <kbd>Alt</kbd> 并单击“显示已过期内容”或“隐藏已过期内容”,在折叠和展开拉取请求中所有过期的审查评论之间切换 。|
|
||||
|单击,然后按住 <kbd>Shift</kbd> 并单击 | 单击一个行号,按住 <kbd>Shift</kbd>,然后单击另一行号,对拉取请求的多行进行评论。 有关详细信息,请参阅“[评论拉取请求](/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)”。|
|
||||
|<kbd>C</kbd> | Open the list of commits in the pull request
|
||||
|<kbd>T</kbd> | Open the list of changed files in the pull request
|
||||
|<kbd>J</kbd> | Move selection down in the list
|
||||
|<kbd>K</kbd> | Move selection up in the list
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>Enter</kbd> | Add a single comment on a pull request diff |
|
||||
|<kbd>Alt</kbd> and click | Toggle between collapsing and expanding all outdated review comments in a pull request by holding down <kbd>Alt</kbd> and clicking **Show outdated** or **Hide outdated**.|
|
||||
|Click, then <kbd>Shift</kbd> and click | Comment on multiple lines of a pull request by clicking a line number, holding <kbd>Shift</kbd>, then clicking another line number. For more information, see "[Commenting on a pull request](/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)."|
|
||||
|
||||
{% ifversion projects-v2 %}
|
||||
|
||||
## {% data variables.projects.projects_v2_caps %}
|
||||
|
||||
### 导航项目
|
||||
### Navigating a project
|
||||
|
||||
| 键盘快捷方式 | 说明
|
||||
| Keyboard shortcut | Description
|
||||
|-----------|------------
|
||||
|<kbd>⌘</kbd>+<kbd>f</kbd> (Mac) 或 <kbd>Ctrl</kbd>+<kbd>f</kbd> (Windows/Linux) | 焦点筛选器字段
|
||||
|<kbd>←</kbd> | 将单元格焦点移到左侧
|
||||
|<kbd>→</kbd> | 将单元格焦点移到右侧
|
||||
|<kbd>↑</kbd> | 向上移动单元格焦点
|
||||
|<kbd>↓</kbd> | 向下移动单元格焦点
|
||||
|<kbd>⌘</kbd>+<kbd>f</kbd> (Mac) or <kbd>Ctrl</kbd>+<kbd>f</kbd> (Windows/Linux) | Focus filter field
|
||||
|<kbd>←</kbd> | Move cell focus to the left
|
||||
|<kbd>→</kbd> | Move cell focus to the right
|
||||
|<kbd>↑</kbd> | Move cell focus up
|
||||
|<kbd>↓</kbd> | Move cell focus down
|
||||
|
||||
### 操作项目
|
||||
### Manipulating a project
|
||||
|
||||
| 键盘快捷方式 | 说明
|
||||
| Keyboard shortcut | Description
|
||||
|-----------|------------
|
||||
|Enter | 切换聚焦单元格的编辑模式
|
||||
|<kbd>Esc 键</kbd> | 取消对聚焦单元格的编辑
|
||||
|<kbd>⌘</kbd>+<kbd>Shift</kbd>+<kbd>\</kbd> (Mac) 或 <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>\</kbd> (Windows/Linux) | 打开行操作菜单
|
||||
|<kbd>Shift</kbd>+<kbd>Space</kbd> | 选择项
|
||||
|<kbd>Space</kbd> | 打开选定项
|
||||
|<kbd>e</kbd> | 存档选定项
|
||||
|<kbd>Enter</kbd> | Toggle edit mode for the focused cell
|
||||
|<kbd>Escape</kbd> | Cancel editing for the focused cell
|
||||
|<kbd>⌘</kbd>+<kbd>Shift</kbd>+<kbd>\</kbd> (Mac) or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>\</kbd> (Windows/Linux) | Open row actions menu
|
||||
|<kbd>Shift</kbd>+<kbd>Space</kbd> | Select item
|
||||
|<kbd>Space</kbd> | Open selected item
|
||||
|<kbd>e</kbd> | Archive selected items
|
||||
|
||||
{% endif %}
|
||||
|
||||
## {% data variables.product.prodname_projects_v1_caps %}
|
||||
|
||||
### 移动列
|
||||
### Moving a column
|
||||
|
||||
| 键盘快捷方式 | 说明
|
||||
| Keyboard shortcut | Description
|
||||
|-----------|------------
|
||||
|<kbd>Enter</kbd> 或<kbd>空格</kbd> | 开始移动聚焦的列
|
||||
|Esc | 取消正在进行的移动
|
||||
|Enter | 完成正在进行的移动
|
||||
|<kbd>←</kbd> 或 <kbd>H</kbd> | 向左移动列
|
||||
|<kbd>Command</kbd>+<kbd>←</kbd> 或 <kbd>Command</kbd>+<kbd>H</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>←</kbd> 或 <kbd>Ctrl</kbd>+<kbd>H</kbd> (Windows/Linux) | 将列移动到最左侧的位置
|
||||
|<kbd>→</kbd> 或 <kbd>L</kbd> | 向右移动列
|
||||
|<kbd>Command</kbd>+<kbd>→</kbd> 或 <kbd>Command</kbd>+<kbd>L</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>→</kbd> 或 <kbd>Ctrl</kbd>+<kbd>L</kbd> (Windows/Linux) | 将列移动到最右侧的位置
|
||||
|<kbd>Enter</kbd> or <kbd>Space</kbd> | Start moving the focused column
|
||||
|<kbd>Esc</kbd> | Cancel the move in progress
|
||||
|<kbd>Enter</kbd> | Complete the move in progress
|
||||
|<kbd>←</kbd> or <kbd>H</kbd> | Move column to the left
|
||||
|<kbd>Command</kbd>+<kbd>←</kbd> or <kbd>Command</kbd>+<kbd>H</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>←</kbd> or <kbd>Ctrl</kbd>+<kbd>H</kbd> (Windows/Linux) | Move column to the leftmost position
|
||||
|<kbd>→</kbd> or <kbd>L</kbd> | Move column to the right
|
||||
|<kbd>Command</kbd>+<kbd>→</kbd> or <kbd>Command</kbd>+<kbd>L</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>→</kbd> or <kbd>Ctrl</kbd>+<kbd>L</kbd> (Windows/Linux) | Move column to the rightmost position
|
||||
|
||||
### 移动卡片
|
||||
### Moving a card
|
||||
|
||||
| 键盘快捷方式 | 说明
|
||||
| Keyboard shortcut | Description
|
||||
|-----------|------------
|
||||
|<kbd>Enter</kbd> 或<kbd>空格</kbd> | 开始移动聚焦的卡片
|
||||
|Esc | 取消正在进行的移动
|
||||
|Enter | 完成正在进行的移动
|
||||
|<kbd>↓</kbd> 或 <kbd>J</kbd> | 向下移动卡片
|
||||
|<kbd>Command</kbd>+<kbd>↓</kbd> 或 <kbd>Command</kbd>+<kbd>J</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>↓</kbd> 或 <kbd>Ctrl</kbd>+<kbd>J</kbd> (Windows/Linux) | 将卡片移动到该列的底部
|
||||
|<kbd>↑</kbd> 或 <kbd>K</kbd> | 向上移动卡片
|
||||
|<kbd>Command</kbd>+<kbd>↑</kbd> 或 <kbd>Command</kbd>+<kbd>K</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>↑</kbd> 或 <kbd>Ctrl</kbd>+<kbd>K</kbd> (Windows/Linux) | 将卡片移动到该列的顶部
|
||||
|<kbd>←</kbd> 或 <kbd>H</kbd> | 将卡片移动到左侧列的底部
|
||||
|<kbd>Shift</kbd>+<kbd>←</kbd> 或 <kbd>Shift</kbd>+<kbd>H</kbd> | 将卡片移动到左侧列的顶部
|
||||
|<kbd>Command</kbd>+<kbd>←</kbd> 或 <kbd>Command</kbd>+<kbd>H</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>←</kbd> 或 <kbd>Ctrl</kbd>+<kbd>H</kbd> (Windows/Linux) | 将卡片移动到最左侧列的底部
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>←</kbd> 或 <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>H</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>←</kbd> 或 <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>H</kbd> (Windows/Linux) | 将卡片移动到最左侧列的顶部
|
||||
|<kbd>→</kbd> | 将卡片移动到右侧列的底部
|
||||
|<kbd>Shift</kbd>+<kbd>→</kbd> 或 <kbd>Shift</kbd>+<kbd>L</kbd> | 将卡片移动到右侧列的顶部
|
||||
|<kbd>Command</kbd>+<kbd>→</kbd> 或 <kbd>Command</kbd>+<kbd>L</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>→</kbd> 或 <kbd>Ctrl</kbd>+<kbd>L</kbd> (Windows/Linux) | 将卡片移动到最右侧列的底部
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>→</kbd> 或 <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>L</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>→</kbd> 或 <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>L</kbd> (Windows/Linux) | 将卡片移动到最右侧列的底部
|
||||
|<kbd>Enter</kbd> or <kbd>Space</kbd> | Start moving the focused card
|
||||
|<kbd>Esc</kbd> | Cancel the move in progress
|
||||
|<kbd>Enter</kbd> | Complete the move in progress
|
||||
|<kbd>↓</kbd> or <kbd>J</kbd> | Move card down
|
||||
|<kbd>Command</kbd>+<kbd>↓</kbd> or <kbd>Command</kbd>+<kbd>J</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>↓</kbd> or <kbd>Ctrl</kbd>+<kbd>J</kbd> (Windows/Linux) | Move card to the bottom of the column
|
||||
|<kbd>↑</kbd> or <kbd>K</kbd> | Move card up
|
||||
|<kbd>Command</kbd>+<kbd>↑</kbd> or <kbd>Command</kbd>+<kbd>K</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>↑</kbd> or <kbd>Ctrl</kbd>+<kbd>K</kbd> (Windows/Linux) | Move card to the top of the column
|
||||
|<kbd>←</kbd> or <kbd>H</kbd> | Move card to the bottom of the column on the left
|
||||
|<kbd>Shift</kbd>+<kbd>←</kbd> or <kbd>Shift</kbd>+<kbd>H</kbd> | Move card to the top of the column on the left
|
||||
|<kbd>Command</kbd>+<kbd>←</kbd> or <kbd>Command</kbd>+<kbd>H</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>←</kbd> or <kbd>Ctrl</kbd>+<kbd>H</kbd> (Windows/Linux) | Move card to the bottom of the leftmost column
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>←</kbd> or <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>H</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>←</kbd> or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>H</kbd> (Windows/Linux) | Move card to the top of the leftmost column
|
||||
|<kbd>→</kbd> | Move card to the bottom of the column on the right
|
||||
|<kbd>Shift</kbd>+<kbd>→</kbd> or <kbd>Shift</kbd>+<kbd>L</kbd> | Move card to the top of the column on the right
|
||||
|<kbd>Command</kbd>+<kbd>→</kbd> or <kbd>Command</kbd>+<kbd>L</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>→</kbd> or <kbd>Ctrl</kbd>+<kbd>L</kbd> (Windows/Linux) | Move card to the bottom of the rightmost column
|
||||
|<kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>→</kbd> or <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>L</kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>→</kbd> or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>L</kbd> (Windows/Linux) | Move card to the bottom of the rightmost column
|
||||
|
||||
### 预览卡片
|
||||
### Previewing a card
|
||||
|
||||
| 键盘快捷方式 | 说明
|
||||
| Keyboard shortcut | Description
|
||||
|-----------|------------
|
||||
|Esc | 关闭卡片预览窗格
|
||||
|<kbd>Esc</kbd> | Close the card preview pane
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
## {% data variables.product.prodname_actions %}
|
||||
|
||||
| 键盘快捷方式 | 说明
|
||||
| Keyboard shortcut | Description
|
||||
|-----------|------------
|
||||
|<kbd>Command</kbd>+<kbd>空格</kbd> (Mac) 或 </br> <kbd>Ctrl</kbd>+<kbd>空格</kbd> (Windows/Linux) | 在工作流程编辑器中,获取对工作流程文件的建议。
|
||||
|<kbd>G</kbd> <kbd>F</kbd> | 转到工作流程文件
|
||||
|<kbd>Shift</kbd>+<kbd>T</kbd> 或 <kbd>T</kbd> | 切换日志中的时间戳
|
||||
|<kbd>Shift</kbd>+<kbd>F</kbd> 或 <kbd>F</kbd> | 切换全屏日志
|
||||
|Esc | 退出全屏日志
|
||||
|<kbd>Command</kbd>+<kbd>Space </kbd> (Mac) or </br> <kbd>Ctrl</kbd>+<kbd>Space</kbd> (Windows/Linux) | In the workflow editor, get suggestions for your workflow file.
|
||||
|<kbd>G</kbd> <kbd>F</kbd> | Go to the workflow file
|
||||
|<kbd>Shift</kbd>+<kbd>T</kbd> or <kbd>T</kbd> | Toggle timestamps in logs
|
||||
|<kbd>Shift</kbd>+<kbd>F</kbd> or <kbd>F</kbd> | Toggle full-screen logs
|
||||
|<kbd>Esc</kbd> | Exit full-screen logs
|
||||
|
||||
{% endif %}
|
||||
|
||||
## 通知
|
||||
## Notifications
|
||||
|
||||
| 键盘快捷方式 | 说明
|
||||
| Keyboard shortcut | Description
|
||||
|-----------|------------
|
||||
|<kbd>E</kbd> | 标记为完成
|
||||
|<kbd>Shift</kbd>+<kbd>U</kbd>| 标记为“未读”
|
||||
|<kbd>Shift</kbd>+<kbd>I</kbd>| 标记为已读
|
||||
|<kbd>Shift</kbd>+<kbd>M</kbd> | 取消订阅
|
||||
|<kbd>E</kbd> | Mark as done
|
||||
|<kbd>Shift</kbd>+<kbd>U</kbd>| Mark as unread
|
||||
|<kbd>Shift</kbd>+<kbd>I</kbd>| Mark as read
|
||||
|<kbd>Shift</kbd>+<kbd>M</kbd> | Unsubscribe
|
||||
|
||||
## 网络图
|
||||
## Network graph
|
||||
|
||||
| 键盘快捷方式 | 说明
|
||||
| Keyboard shortcut | Description
|
||||
|-----------|------------
|
||||
|<kbd>←</kbd> 或 <kbd>H</kbd> | 向左滚动
|
||||
|<kbd>→</kbd> 或 <kbd>L</kbd> | 向右滚动
|
||||
|<kbd>↑</kbd> 或 <kbd>K</kbd> | 向上滚动
|
||||
|<kbd>↓</kbd> 或 <kbd>J</kbd> | 向下滚动
|
||||
|<kbd>Shift</kbd>+<kbd>←</kbd> </br> <kbd>Shift</kbd>+<kbd>H</kbd> (Windows/Linux) | 一直向左滚动
|
||||
|<kbd>Shift</kbd>+<kbd>→</kbd> (Mac) 或 </br> <kbd>Shift</kbd>+<kbd>L</kbd> (Windows/Linux) | 一直向右滚动
|
||||
|<kbd>Shift</kbd>+<kbd>↑</kbd> (Mac) 或 </br> <kbd>Shift</kbd>+<kbd>K</kbd> (Windows/Linux) | 一直向上滚动
|
||||
|<kbd>Shift</kbd>+<kbd>↓</kbd> (Mac) 或 </br> <kbd>Shift</kbd>+<kbd>J</kbd> (Windows/Linux) | 一直向下滚动
|
||||
|<kbd>←</kbd> or <kbd>H</kbd> | Scroll left
|
||||
|<kbd>→</kbd> or <kbd>L</kbd> | Scroll right
|
||||
|<kbd>↑</kbd> or <kbd>K</kbd> | Scroll up
|
||||
|<kbd>↓</kbd> or <kbd>J</kbd> | Scroll down
|
||||
|<kbd>Shift</kbd>+<kbd>←</kbd> (Mac) or </br> <kbd>Shift</kbd>+<kbd>H</kbd> (Windows/Linux) | Scroll all the way left
|
||||
|<kbd>Shift</kbd>+<kbd>→</kbd> (Mac) or </br> <kbd>Shift</kbd>+<kbd>L</kbd> (Windows/Linux) | Scroll all the way right
|
||||
|<kbd>Shift</kbd>+<kbd>↑</kbd> (Mac) or </br> <kbd>Shift</kbd>+<kbd>K</kbd> (Windows/Linux) | Scroll all the way up
|
||||
|<kbd>Shift</kbd>+<kbd>↓</kbd> (Mac) or </br> <kbd>Shift</kbd>+<kbd>J</kbd> (Windows/Linux) | Scroll all the way down
|
||||
|
||||
@@ -116,9 +116,9 @@ Here are the currently supported color models.
|
||||
|
||||
## Links
|
||||
|
||||
You can create an inline link by wrapping link text in brackets `[ ]`, and then wrapping the URL in parentheses `( )`. You can also use the keyboard shortcut <kbd>Command</kbd>+<kbd>K</kbd> to create a link.{% ifversion fpt or ghae-issue-5434 or ghes > 3.3 or ghec %} When you have text selected, you can paste a URL from your clipboard to automatically create a link from the selection.{% endif %}
|
||||
You can create an inline link by wrapping link text in brackets `[ ]`, and then wrapping the URL in parentheses `( )`. You can also use the keyboard shortcut <kbd>Command</kbd>+<kbd>K</kbd> to create a link.{% ifversion fpt or ghae > 3.3 or ghes > 3.3 or ghec %} When you have text selected, you can paste a URL from your clipboard to automatically create a link from the selection.{% endif %}
|
||||
|
||||
{% ifversion fpt or ghae-issue-7103 or ghes > 3.5 or ghec %} You can also create a Markdown hyperlink by highlighting the text and using the keyboard shortcut <kbd>Command</kbd>+<kbd>V</kbd>. If you'd like to replace the text with the link, use the keyboard shortcut <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>V</kbd>.{% endif %}
|
||||
{% ifversion fpt or ghae > 3.5 or ghes > 3.5 or ghec %} You can also create a Markdown hyperlink by highlighting the text and using the keyboard shortcut <kbd>Command</kbd>+<kbd>V</kbd>. If you'd like to replace the text with the link, use the keyboard shortcut <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>V</kbd>.{% endif %}
|
||||
|
||||
`This site was built using [GitHub Pages](https://pages.github.com/).`
|
||||
|
||||
@@ -172,7 +172,7 @@ Here are some examples for using relative links to display an image.
|
||||
|
||||
For more information, see "[Relative Links](#relative-links)."
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5559 %}
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
### Specifying the theme an image is shown to
|
||||
|
||||
You can specify the theme an image is displayed for in Markdown by using the HTML `<picture>` element in combination with the `prefers-color-scheme` media feature. We distinguish between light and dark color modes, so there are two options available. You can use these options to display images optimized for dark or light backgrounds. This is particularly helpful for transparent PNG images.
|
||||
|
||||
@@ -1,37 +1,32 @@
|
||||
---
|
||||
title: 编写数学表达式
|
||||
intro: '使用 Markdown 在 {% data variables.product.company_short %} 上显示数学表达式。'
|
||||
title: Writing mathematical expressions
|
||||
intro: 'Use Markdown to display mathematical expressions on {% data variables.product.company_short %}.'
|
||||
versions:
|
||||
feature: math
|
||||
shortTitle: Mathematical expressions
|
||||
ms.openlocfilehash: b50cdde16f5496e65faf89f0692dc6201cccf15a
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147529749'
|
||||
---
|
||||
## 关于编写数学表达式
|
||||
|
||||
为了实现数学表达式的清晰传达,{% data variables.product.product_name %} 支持 Markdown 中 LaTeX 格式的数学表达式。 有关详细信息,请参阅 Wikibook 中的 [LaTeX/数学](http://en.wikibooks.org/wiki/LaTeX/Mathematics)。
|
||||
## About writing mathematical expressions
|
||||
|
||||
{% data variables.product.company_short %} 的数学呈现功能使用 MathJax;真是一种基于 JavaScript 的开源显示引擎。 MathJax 支持广泛的 LaTeX 宏,以及几个有用的辅助功能扩展。 有关详细信息,请参阅 [MathJax 文档](http://docs.mathjax.org/en/latest/input/tex/index.html#tex-and-latex-support)和 [MathJax 辅助功能扩展文档](https://mathjax.github.io/MathJax-a11y/docs/#reader-guide)。
|
||||
To enable clear communication of mathematical expressions, {% data variables.product.product_name %} supports LaTeX formatted math within Markdown. For more information, see [LaTeX/Mathematics](http://en.wikibooks.org/wiki/LaTeX/Mathematics) in Wikibooks.
|
||||
|
||||
数学表达式可在以下项中呈现:{% data variables.product.prodname_github_issues %}、{% data variables.product.prodname_discussions %}、拉取请求、{% ifversion fpt or ghec or ghes > 3.6 or ghae-issue-7647 %}Wiki {% endif %}和 Markdown 文件。
|
||||
{% data variables.product.company_short %}'s math rendering capability uses MathJax; an open source, JavaScript-based display engine. MathJax supports a wide range of LaTeX macros, and several useful accessibility extensions. For more information, see [the MathJax documentation](http://docs.mathjax.org/en/latest/input/tex/index.html#tex-and-latex-support) and [the MathJax Accessibility Extensions Documentation](https://mathjax.github.io/MathJax-a11y/docs/#reader-guide).
|
||||
|
||||
## 编写内联表达式
|
||||
Mathematical expressions rendering is available in {% data variables.product.prodname_github_issues %}, {% data variables.product.prodname_discussions %}, pull requests, {% ifversion fpt or ghec or ghes > 3.6 or ghae > 3.6 %}wikis, {% endif %}and Markdown files.
|
||||
|
||||
要在文本中包含内联数学表达式,请使用美元符号 `$` 分隔表达式。
|
||||
## Writing inline expressions
|
||||
|
||||
To include a math expression inline with your text, delimit the expression with a dollar symbol `$`.
|
||||
|
||||
```
|
||||
This sentence uses `$` delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
## 将表达式编写为块
|
||||
## Writing expressions as blocks
|
||||
|
||||
要以块的形式添加数学表达式,请启动一个新行,并使用两个美元符号 `$$` 分隔表达式。
|
||||
To add a math expression as a block, start a new line and delimit the expression with two dollar symbols `$$`.
|
||||
|
||||
```
|
||||
**The Cauchy-Schwarz Inequality**
|
||||
@@ -39,11 +34,11 @@ This sentence uses `$` delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$
|
||||
$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
{% ifversion math-fenced-blocks %}
|
||||
|
||||
或者,可以使用 <code>\`\`\`math</code> 代码块语法将数学表达式显示为块。 使用此语法时,无需使用 `$$` 分隔符。
|
||||
Alternatively, you can use the <code>\`\`\`math</code> code block syntax to display a math expression as a block. With this syntax, you don't need to use `$$` delimiters.
|
||||
|
||||
````
|
||||
**Here is some math!**
|
||||
@@ -53,32 +48,32 @@ $$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \
|
||||
```
|
||||
````
|
||||
|
||||

|
||||

|
||||
|
||||
{% endif %}
|
||||
|
||||
## 在数学表达式所在的行中和数学表达式内编写美元符号
|
||||
## Writing dollar signs in line with and within mathematical expressions
|
||||
|
||||
要在数学表达式所在的同一行中将美元符号显示为字符,需要对非分隔符 `$` 进行转义以确保行正确呈现。
|
||||
To display a dollar sign as a character in the same line as a mathematical expression, you need to escape the non-delimiter `$` to ensure the line renders correctly.
|
||||
|
||||
- 在数学表达式内,在显式 `$` 之前添加一个 `\` 符号。
|
||||
- Within a math expression, add a `\` symbol before the explicit `$`.
|
||||
|
||||
```
|
||||
This expression uses `\$` to display a dollar sign: $\sqrt{\$4}$
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
- 在数学表达式之外,但在同一行上,在显式 `$` 两边使用 span 标记。
|
||||
- Outside a math expression, but on the same line, use span tags around the explicit `$`.
|
||||
|
||||
```
|
||||
To split <span>$</span>100 in half, we calculate $100/2$
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
## 延伸阅读
|
||||
## Further reading
|
||||
|
||||
* [MathJax 网站](http://mathjax.org)
|
||||
* [Getting started with writing and formatting on GitHub(GitHub 写作和格式设置入门)](/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github)
|
||||
* [GitHub 支持的 Markdown 规范](https://github.github.com/gfm/)
|
||||
* [The MathJax website](http://mathjax.org)
|
||||
* [Getting started with writing and formatting on GitHub](/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github)
|
||||
* [GitHub Flavored Markdown Spec](https://github.github.com/gfm/)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 从 REST 迁移到 GraphQL
|
||||
intro: '了解从 {% data variables.product.prodname_dotcom %} 的 REST API 迁移到 {% data variables.product.prodname_dotcom %} 的 GraphQL API 的最佳实践和注意事项。'
|
||||
title: Migrating from REST to GraphQL
|
||||
intro: 'Learn best practices and considerations for migrating from {% data variables.product.prodname_dotcom %}''s REST API to {% data variables.product.prodname_dotcom %}''s GraphQL API.'
|
||||
redirect_from:
|
||||
- /v4/guides/migrating-from-rest
|
||||
- /graphql/guides/migrating-from-rest
|
||||
@@ -12,40 +12,37 @@ versions:
|
||||
topics:
|
||||
- API
|
||||
shortTitle: Migrate from REST to GraphQL
|
||||
ms.openlocfilehash: dbafde83c8acac664b6a0f712927af82c646d397
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '145066655'
|
||||
---
|
||||
## API 逻辑差异
|
||||
|
||||
从 REST 迁移到 GraphQL 代表了 API 逻辑的一次重大转变。 作为样式的 REST 与作为规范的 GraphQL 之间的差异使得很难—且通常不可取—以一对一方式将 REST API 调用替换为 GraphQL API 查询。 我们在下面提供了具体的迁移示例。
|
||||
## Differences in API logic
|
||||
|
||||
将代码从 [REST API](/rest) 迁移到 GraphQL API:
|
||||
{% data variables.product.company_short %} provides two APIs: a REST API and a GraphQL API. For more information about {% data variables.product.company_short %}'s APIs, see "[About {% data variables.product.company_short %}'s APIs](/developers/overview/about-githubs-apis)."
|
||||
|
||||
- 查看 [GraphQL 规范](https://graphql.github.io/graphql-spec/June2018/)
|
||||
- 查看 GitHub 的 [GraphQL 架构](/graphql/reference)
|
||||
- 考虑您当前的现有代码如何与 GitHub REST API 交互
|
||||
- 使用[全局节点 ID](/graphql/guides/using-global-node-ids) 引用 API 版本之间的对象
|
||||
Migrating from REST to GraphQL represents a significant shift in API logic. The differences between REST as a style and GraphQL as a specification make it difficult—and often undesirable—to replace REST API calls with GraphQL API queries on a one-to-one basis. We've included specific examples of migration below.
|
||||
|
||||
GraphQL 的重要优势包括:
|
||||
To migrate your code from the [REST API](/rest) to the GraphQL API:
|
||||
|
||||
- [仅获取你所需的数据](#example-getting-the-data-you-need-and-nothing-more)
|
||||
- [嵌套字段](#example-nesting)
|
||||
- [强类型化](#example-strong-typing)
|
||||
- Review the [GraphQL spec](https://graphql.github.io/graphql-spec/June2018/)
|
||||
- Review GitHub's [GraphQL schema](/graphql/reference)
|
||||
- Consider how any existing code you have currently interacts with the GitHub REST API
|
||||
- Use [Global Node IDs](/graphql/guides/using-global-node-ids) to reference objects between API versions
|
||||
|
||||
下面是每种优势的示例。
|
||||
Significant advantages of GraphQL include:
|
||||
|
||||
## 示例:仅获取您所需的数据
|
||||
- [Getting the data you need and nothing more](#example-getting-the-data-you-need-and-nothing-more)
|
||||
- [Nested fields](#example-nesting)
|
||||
- [Strong typing](#example-strong-typing)
|
||||
|
||||
单个 REST API 可检索组织成员列表:
|
||||
Here are examples of each.
|
||||
|
||||
## Example: Getting the data you need and nothing more
|
||||
|
||||
A single REST API call retrieves a list of your organization's members:
|
||||
```shell
|
||||
curl -v {% data variables.product.api_url_pre %}/orgs/:org/members
|
||||
```
|
||||
|
||||
如果您的目标是仅检索成员名称和头像链接,REST 有效负载中将包含多余数据。 但是,GraphQL 查询仅返回您指定的数据:
|
||||
The REST payload contains excessive data if your goal is to retrieve only member names and links to avatars. However, a GraphQL query returns only what you specify:
|
||||
|
||||
```graphql
|
||||
query {
|
||||
@@ -62,17 +59,17 @@ query {
|
||||
}
|
||||
```
|
||||
|
||||
考虑另一个示例:检索拉取请求列表并检查每个请求是否可合并。 对 REST API 的调用可检索拉取请求列表及其[摘要陈述](/rest#summary-representations):
|
||||
Consider another example: retrieving a list of pull requests and checking if each one is mergeable. A call to the REST API retrieves a list of pull requests and their [summary representations](/rest#summary-representations):
|
||||
```shell
|
||||
curl -v {% data variables.product.api_url_pre %}/repos/:owner/:repo/pulls
|
||||
```
|
||||
|
||||
确定拉取请求是否可合并需要分别检索每个拉取请求,查看其[详细陈述](/rest#detailed-representations)(大型有效负载),并检查它的 `mergeable` 属性是真还是假:
|
||||
Determining if a pull request is mergeable requires retrieving each pull request individually for its [detailed representation](/rest#detailed-representations) (a large payload) and checking whether its `mergeable` attribute is true or false:
|
||||
```shell
|
||||
curl -v {% data variables.product.api_url_pre %}/repos/:owner/:repo/pulls/:number
|
||||
```
|
||||
|
||||
使用 GraphQL,可以仅检索每个拉取请求的 `number` 和 `mergeable` 特性:
|
||||
With GraphQL, you could retrieve only the `number` and `mergeable` attributes for each pull request:
|
||||
|
||||
```graphql
|
||||
query {
|
||||
@@ -89,9 +86,9 @@ query {
|
||||
}
|
||||
```
|
||||
|
||||
## 示例:嵌套
|
||||
## Example: Nesting
|
||||
|
||||
通过嵌套字段查询,可将多个 REST 调用替换为更少的 GraphQL 查询。 例如,利用 REST AP 检索拉取请求及其提交、非评审注释和评审需要四个单独的调用:
|
||||
Querying with nested fields lets you replace multiple REST calls with fewer GraphQL queries. For example, retrieving a pull request along with its commits, non-review comments, and reviews using the **REST API** requires four separate calls:
|
||||
```shell
|
||||
curl -v {% data variables.product.api_url_pre %}/repos/:owner/:repo/pulls/:number
|
||||
curl -v {% data variables.product.api_url_pre %}/repos/:owner/:repo/pulls/:number/commits
|
||||
@@ -99,7 +96,7 @@ curl -v {% data variables.product.api_url_pre %}/repos/:owner/:repo/issues/:numb
|
||||
curl -v {% data variables.product.api_url_pre %}/repos/:owner/:repo/pulls/:number/reviews
|
||||
```
|
||||
|
||||
使用 GraphQL API,可以利用嵌套字段通过单个查询检索数据:
|
||||
Using the **GraphQL API**, you can retrieve the data with a single query using nested fields:
|
||||
|
||||
```graphql
|
||||
{
|
||||
@@ -137,13 +134,13 @@ curl -v {% data variables.product.api_url_pre %}/repos/:owner/:repo/pulls/:numbe
|
||||
}
|
||||
```
|
||||
|
||||
也可以通过[用变量替换](/graphql/guides/forming-calls-with-graphql#working-with-variables)拉取请求编号来扩大此查询的能力。
|
||||
You can also extend the power of this query by [substituting a variable](/graphql/guides/forming-calls-with-graphql#working-with-variables) for the pull request number.
|
||||
|
||||
## 示例:强类型化
|
||||
## Example: Strong typing
|
||||
|
||||
GraphQL 架构属于强类型化架构,可使数据处理更加安全。
|
||||
GraphQL schemas are strongly typed, making data handling safer.
|
||||
|
||||
考虑一个利用 GraphQL [突变](/graphql/reference/mutations)向问题或拉取请求添加注释,并错误地将 [`clientMutationId`](/graphql/reference/mutations#addcomment) 值指定为整数而非字符串的示例:
|
||||
Consider an example of adding a comment to an issue or pull request using a GraphQL [mutation](/graphql/reference/mutations), and mistakenly specifying an integer rather than a string for the value of [`clientMutationId`](/graphql/reference/mutations#addcomment):
|
||||
|
||||
```graphql
|
||||
mutation {
|
||||
@@ -166,7 +163,7 @@ mutation {
|
||||
}
|
||||
```
|
||||
|
||||
执行此查询将返回错误,并指定此操作的预期类型:
|
||||
Executing this query returns errors specifying the expected types for the operation:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -194,7 +191,7 @@ mutation {
|
||||
}
|
||||
```
|
||||
|
||||
用引号括住 `1234` 可将此值从整数转换为字符串,预期类型为:
|
||||
Wrapping `1234` in quotes transforms the value from an integer into a string, the expected type:
|
||||
|
||||
```graphql
|
||||
mutation {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 关于 GraphQL API
|
||||
intro: '{% data variables.product.prodname_dotcom %} GraphQL API 具有灵活性,而且能够准确定义您要获取的数据。'
|
||||
title: About the GraphQL API
|
||||
intro: 'The {% data variables.product.prodname_dotcom %} GraphQL API offers flexibility and the ability to define precisely the data you want to fetch.'
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghec: '*'
|
||||
@@ -8,55 +8,52 @@ versions:
|
||||
ghae: '*'
|
||||
topics:
|
||||
- API
|
||||
ms.openlocfilehash: 9b447925609425157d5d965370c09fdd12d30b56
|
||||
ms.sourcegitcommit: fb047f9450b41b24afc43d9512a5db2a2b750a2a
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/11/2022
|
||||
ms.locfileid: '145066002'
|
||||
---
|
||||
## 概述
|
||||
|
||||
下面是一些帮助您启动和运行 GraphQL API 的快速链接:
|
||||
## Overview
|
||||
|
||||
* [身份验证](/graphql/guides/forming-calls-with-graphql#authenticating-with-graphql)
|
||||
* [根终结点](/graphql/guides/forming-calls-with-graphql#the-graphql-endpoint)
|
||||
* [架构内省](/graphql/guides/introduction-to-graphql#discovering-the-graphql-api)
|
||||
* [速率限制](/graphql/overview/resource-limitations)
|
||||
* [从 REST 迁移](/graphql/guides/migrating-from-rest-to-graphql)
|
||||
Here are some quick links to get you up and running with the GraphQL API:
|
||||
|
||||
## 关于 GraphQL
|
||||
* [Authentication](/graphql/guides/forming-calls-with-graphql#authenticating-with-graphql)
|
||||
* [Root endpoint](/graphql/guides/forming-calls-with-graphql#the-graphql-endpoint)
|
||||
* [Schema introspection](/graphql/guides/introduction-to-graphql#discovering-the-graphql-api)
|
||||
* [Rate limits](/graphql/overview/resource-limitations)
|
||||
* [Migrating from REST](/graphql/guides/migrating-from-rest-to-graphql)
|
||||
|
||||
[GraphQL](https://graphql.github.io/) 数据查询语言是:
|
||||
For more information about {% data variables.product.company_short %}'s APIs, see "[About {% data variables.product.company_short %}'s APIs](/developers/overview/about-githubs-apis)."
|
||||
|
||||
* **[规范](https://graphql.github.io/graphql-spec/June2018/)。** 该规范确定 API 服务器上的[架构](/graphql/guides/introduction-to-graphql#schema) 的有效性。 架构可确定客户端调用的有效性。
|
||||
## About GraphQL
|
||||
|
||||
* **[强类型化](#about-the-graphql-schema-reference)。** 架构可定义 API 的类型系统和所有对象关系。
|
||||
The [GraphQL](https://graphql.github.io/) data query language is:
|
||||
|
||||
* **[内省](/graphql/guides/introduction-to-graphql#discovering-the-graphql-api)。** 客户端可查询架构,了解关于架构的详细信息。
|
||||
* **A [specification](https://graphql.github.io/graphql-spec/June2018/).** The spec determines the validity of the [schema](/graphql/guides/introduction-to-graphql#schema) on the API server. The schema determines the validity of client calls.
|
||||
|
||||
* **[分层](/graphql/guides/forming-calls-with-graphql)。** GraphQL 调用的形式可反映它返回的 JSON 数据的形式。 [嵌套字段](/graphql/guides/migrating-from-rest-to-graphql#example-nesting)可用于仅查询和接收单个往返向行程中指定的数据。
|
||||
* **[Strongly typed](#about-the-graphql-schema-reference).** The schema defines an API's type system and all object relationships.
|
||||
|
||||
* **应用程序层。** GraphQL 不是存储模型或数据库查询语言。 “图”是指架构中定义的图形结构,其中,[节点](/graphql/guides/introduction-to-graphql#node)定义对象,[边缘](/graphql/guides/introduction-to-graphql#edge)定义对象之间的关系。 API 可以根据架构定义遍历和返回应用数据,与数据的存储方式无关。
|
||||
* **[Introspective](/graphql/guides/introduction-to-graphql#discovering-the-graphql-api).** A client can query the schema for details about the schema.
|
||||
|
||||
## GitHub 为什么使用 GraphQL
|
||||
* **[Hierarchical](/graphql/guides/forming-calls-with-graphql).** The shape of a GraphQL call mirrors the shape of the JSON data it returns. [Nested fields](/graphql/guides/migrating-from-rest-to-graphql#example-nesting) let you query for and receive only the data you specify in a single round trip.
|
||||
|
||||
GitHub 选择 GraphQL,因为它可以为我们的集成商提供明显更高的灵活性。 与传统 REST API 终结点相比,精确定义所需数据且仅定义所需数据的能力是一个强大的优势——。 GraphQL 可用于将多个 REST 请求替换为单个调用,以获取指定的数据。
|
||||
* **An application layer.** GraphQL is not a storage model or a database query language. The _graph_ refers to graph structures defined in the schema, where [nodes](/graphql/guides/introduction-to-graphql#node) define objects and [edges](/graphql/guides/introduction-to-graphql#edge) define relationships between objects. The API traverses and returns application data based on the schema definitions, independent of how the data is stored.
|
||||
|
||||
有关 GitHub 为什么投资 GraphQL 的详细信息,请参阅原始[公告博客文章](https://github.blog/2016-09-14-the-github-graphql-api/)。
|
||||
## Why GitHub is using GraphQL
|
||||
|
||||
## 关于 GraphQL 架构引用
|
||||
GitHub chose GraphQL because it offers significantly more flexibility for our integrators. The ability to define precisely the data you want—and _only_ the data you want—is a powerful advantage over traditional REST API endpoints. GraphQL lets you replace multiple REST requests with _a single call_ to fetch the data you specify.
|
||||
|
||||
边栏中的文档是从 {% data variables.product.prodname_dotcom %} GraphQL [架构](/graphql/guides/introduction-to-graphql#discovering-the-graphql-api)生成的。 所有调用均根据架构验证和执行。 使用这些文档查找您可以调用的数据:
|
||||
For more details about why GitHub invested in GraphQL, see the original [announcement blog post](https://github.blog/2016-09-14-the-github-graphql-api/).
|
||||
|
||||
* 允许的操作:[查询](/graphql/reference/queries)和[突变](/graphql/reference/mutations)。
|
||||
## About the GraphQL schema reference
|
||||
|
||||
* 架构定义的类型:[标量](/graphql/reference/scalars)、[对象](/graphql/reference/objects)、[枚举类型](/graphql/reference/enums)、[接口](/graphql/reference/interfaces)、[联合](/graphql/reference/unions)和[输入对象](/graphql/reference/input-objects)。
|
||||
The docs in the sidebar are generated from the {% data variables.product.prodname_dotcom %} GraphQL [schema](/graphql/guides/introduction-to-graphql#discovering-the-graphql-api). All calls are validated and executed against the schema. Use these docs to find out what data you can call:
|
||||
|
||||
可以通过 [Explorer 文档边栏](/graphql/guides/using-the-explorer#accessing-the-sidebar-docs)访问同样的内容。 请注意,您可能需要依靠文档和架构验证才能成功调用 GraphQL API。
|
||||
* Allowed operations: [queries](/graphql/reference/queries) and [mutations](/graphql/reference/mutations).
|
||||
|
||||
有关其他信息,如身份验证和速率限制详细信息,请查看[指南](/graphql/guides)。
|
||||
* Schema-defined types: [scalars](/graphql/reference/scalars), [objects](/graphql/reference/objects), [enums](/graphql/reference/enums), [interfaces](/graphql/reference/interfaces), [unions](/graphql/reference/unions), and [input objects](/graphql/reference/input-objects).
|
||||
|
||||
## 请求支持
|
||||
You can access this same content via the [Explorer Docs sidebar](/graphql/guides/using-the-explorer#accessing-the-sidebar-docs). Note that you may need to rely on both the docs and the schema validation to successfully call the GraphQL API.
|
||||
|
||||
For other information, such as authentication and rate limit details, check out the [guides](/graphql/guides).
|
||||
|
||||
## Requesting support
|
||||
|
||||
{% data reusables.support.help_resources %}
|
||||
|
||||
@@ -1,32 +1,27 @@
|
||||
---
|
||||
title: '使用 API 管理 {% data variables.product.prodname_projects_v2 %}'
|
||||
shortTitle: Automating with the API
|
||||
intro: 可使用 GraphQL API 自动执行项目。
|
||||
title: 'Using the API to manage {% data variables.product.prodname_projects_v2 %}'
|
||||
shortTitle: 'Automating with the API'
|
||||
intro: 'You can use the GraphQL API to automate your projects.'
|
||||
miniTocMaxHeadingLevel: 3
|
||||
versions:
|
||||
feature: projects-v2
|
||||
feature: "projects-v2"
|
||||
redirect_from:
|
||||
- /issues/trying-out-the-new-projects-experience/using-the-api-to-manage-projects
|
||||
type: tutorial
|
||||
topics:
|
||||
- Projects
|
||||
allowTitleToDifferFromFilename: true
|
||||
ms.openlocfilehash: e1ec0d34e302d97fcb3a6c87f37c8214f3965c90
|
||||
ms.sourcegitcommit: 478f2931167988096ae6478a257f492ecaa11794
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/09/2022
|
||||
ms.locfileid: '147723255'
|
||||
---
|
||||
本文演示如何使用 GraphQL API 来管理项目。 有关如何在 {% data variables.product.prodname_actions %} 工作流中使用 API 的详细信息,请参阅“[使用 Actions 自动执行 {% data variables.product.prodname_projects_v2 %}](/issues/planning-and-tracking-with-projects/automating-your-project/automating-projects-using-actions)”。 有关可用数据类型的完整列表,请参阅“[参考](/graphql/reference)”。
|
||||
|
||||
This article demonstrates how to use the GraphQL API to manage a project. For more information about how to use the API in a {% data variables.product.prodname_actions %} workflow, see "[Automating {% data variables.product.prodname_projects_v2 %} using Actions](/issues/planning-and-tracking-with-projects/automating-your-project/automating-projects-using-actions)." For a full list of the available data types, see "[Reference](/graphql/reference)."
|
||||
|
||||
{% data reusables.projects.graphql-deprecation %}
|
||||
|
||||
## 身份验证
|
||||
## Authentication
|
||||
|
||||
{% curl %}
|
||||
|
||||
在所有下面的 cURL 示例中,将 `TOKEN` 替换为具有 `read:project` 范围(对于查询)或 `project` 范围(对于查询和突变)的令牌。 令牌可以是用户的个人访问令牌,也可以是 {% data variables.product.prodname_github_app %} 的安装访问令牌。 有关创建个人访问令牌的详细信息,请参阅“[创建个人访问令牌](/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token)”。 有关为 {% data variables.product.prodname_github_app %} 创建安装访问令牌的详细信息,请参阅“[使用 {% data variables.product.prodname_github_apps %} 进行身份验证](/developers/apps/building-github-apps/authenticating-with-github-apps#authenticating-as-a-github-app)”。
|
||||
In all of the following cURL examples, replace `TOKEN` with a token that has the `read:project` scope (for queries) or `project` scope (for queries and mutations). The token can be a personal access token for a user or an installation access token for a {% data variables.product.prodname_github_app %}. For more information about creating a personal access token, see "[Creating a personal access token](/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token)." For more information about creating an installation access token for a {% data variables.product.prodname_github_app %}, see "[Authenticating with {% data variables.product.prodname_github_apps %}](/developers/apps/building-github-apps/authenticating-with-github-apps#authenticating-as-a-github-app)."
|
||||
|
||||
{% endcurl %}
|
||||
|
||||
@@ -34,15 +29,15 @@ ms.locfileid: '147723255'
|
||||
|
||||
{% data reusables.cli.cli-learn-more %}
|
||||
|
||||
在运行 {% data variables.product.prodname_cli %} 命令之前,必须通过运行 `gh auth login --scopes "project"` 进行身份验证。 如果只需要阅读而不是编辑项目,则可以提供 `read:project` 范围而不是 `project`。 有关命令行身份验证的详细信息,请参阅“[gh auth login](https://cli.github.com/manual/gh_auth_login)”。
|
||||
Before running {% data variables.product.prodname_cli %} commands, you must authenticate by running `gh auth login --scopes "project"`. If you only need to read, but not edit, projects, you can provide the `read:project` scope instead of `project`. For more information on command line authentication, see "[gh auth login](https://cli.github.com/manual/gh_auth_login)."
|
||||
|
||||
{% endcli %}
|
||||
|
||||
{% cli %}
|
||||
|
||||
## 使用变量
|
||||
## Using variables
|
||||
|
||||
在以下所有示例中,您可以使用变量来简化脚本。 使用 `-F` 传递是数字、布尔值或空值的变量。 对其他变量使用 `-f`。 例如,
|
||||
In all of the following examples, you can use variables to simplify your scripts. Use `-F` to pass a variable that is a number, Boolean, or null. Use `-f` for other variables. For example,
|
||||
|
||||
```shell
|
||||
my_org="octo-org"
|
||||
@@ -57,19 +52,19 @@ gh api graphql -f query='
|
||||
}' -f organization=$my_org -F number=$my_num
|
||||
```
|
||||
|
||||
有关详细信息,请参阅“[使用 GraphQL 形成调用](/graphql/guides/forming-calls-with-graphql#working-with-variables)”。
|
||||
For more information, see "[Forming calls with GraphQL](/graphql/guides/forming-calls-with-graphql#working-with-variables)."
|
||||
|
||||
{% endcli %}
|
||||
|
||||
## 查找项目信息
|
||||
## Finding information about projects
|
||||
|
||||
使用查询获取项目数据。 有关详细信息,请参阅“[关于查询](/graphql/guides/forming-calls-with-graphql#about-queries)”。
|
||||
Use queries to get data about projects. For more information, see "[About queries](/graphql/guides/forming-calls-with-graphql#about-queries)."
|
||||
|
||||
### 查找组织项目的节点 ID
|
||||
### Finding the node ID of an organization project
|
||||
|
||||
要通过 API 更新您的项目,您需要知道项目的节点 ID。
|
||||
To update your project through the API, you will need to know the node ID of the project.
|
||||
|
||||
如果您知道组织名称和项目编号,则可以找到组织项目的节点 ID。 将 `ORGANIZATION` 替换为组织的名称。 例如,`octo-org`。 将 `NUMBER` 替换为项目编号。 要查找项目编号,请查看项目 URL。 例如,`https://github.com/orgs/octo-org/projects/5` 的项目编号为 5。
|
||||
You can find the node ID of an organization project if you know the organization name and project number. Replace `ORGANIZATION` with the name of your organization. For example, `octo-org`. Replace `NUMBER` with the project number. To find the project number, look at the project URL. For example, `https://github.com/orgs/octo-org/projects/5` has a project number of 5.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
@@ -93,7 +88,7 @@ gh api graphql -f query='
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
您也可以在组织中找到所有项目的节点 ID。 下面的示例将返回组织中前 20 个项目的节点 ID 和标题。 将 `ORGANIZATION` 替换为组织的名称。 例如,`octo-org`。
|
||||
You can also find the node ID of all projects in your organization. The following example will return the node ID and title of the first 20 projects in an organization. Replace `ORGANIZATION` with the name of your organization. For example, `octo-org`.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
@@ -120,11 +115,11 @@ gh api graphql -f query='
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
### 查找用户项目的节点 ID
|
||||
### Finding the node ID of a user project
|
||||
|
||||
要通过 API 更新您的项目,您需要知道项目的节点 ID。
|
||||
To update your project through the API, you will need to know the node ID of the project.
|
||||
|
||||
如果您知道项目编号,则可以找到用户项目的节点 ID。 请将 `USER` 替换为你的用户名。 例如,`octocat`。 将 `NUMBER` 替换为项目编号。 要查找项目编号,请查看项目 URL。 例如,`https://github.com/users/octocat/projects/5` 的项目编号为 5。
|
||||
You can find the node ID of a user project if you know the project number. Replace `USER` with your user name. For example, `octocat`. Replace `NUMBER` with your project number. To find the project number, look at the project URL. For example, `https://github.com/users/octocat/projects/5` has a project number of 5.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
@@ -148,7 +143,7 @@ gh api graphql -f query='
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
您还可以找到所有项目的节点 ID。 以下示例将返回前 20 个项目的节点 ID 和标题。 将 `USER` 替换为你的用户名。 例如,`octocat`。
|
||||
You can also find the node ID for all of your projects. The following example will return the node ID and title of your first 20 projects. Replace `USER` with your username. For example, `octocat`.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
@@ -175,11 +170,11 @@ gh api graphql -f query='
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
### 查找字段的节点 ID
|
||||
### Finding the node ID of a field
|
||||
|
||||
要更新字段的值,您需要知道字段的节点 ID。 此外,您还需要知道单个选择字段的选项 ID 和迭代字段的迭代 ID。
|
||||
To update the value of a field, you will need to know the node ID of the field. Additionally, you will need to know the ID of the options for single select fields and the ID of the iterations for iteration fields.
|
||||
|
||||
以下示例将返回项目中前 20 个字段的 ID、名称、设置和配置。 将 `PROJECT_ID` 替换为项目的节点 ID。
|
||||
The following example will return the ID, name, settings, and configuration for the first 20 fields in a project. Replace `PROJECT_ID` with the node ID of your project.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
@@ -228,7 +223,7 @@ gh api graphql -f query='
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
响应将如以下示例中所示:
|
||||
The response will look similar to the following example:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -281,9 +276,9 @@ gh api graphql -f query='
|
||||
}
|
||||
```
|
||||
|
||||
每个字段都有一个 ID 和名称。 单选字段作为 `ProjectV2SingleSelectField` 对象返回,并有一个 `options` 字段,可以在其中找到单选每个选项的 ID。 迭代字段作为 `ProjectV2IterationField` 对象返回,并具有一个 `configuration` 字段,其中包括一个 `iterations` 字段,该字段包含有关每次迭代的 ID 和信息。
|
||||
Each field has an ID and name. Single select fields are returned as a `ProjectV2SingleSelectField` object and have an `options` field where you can find the ID of each option for the single select. Iteration fields are returned as a `ProjectV2IterationField` object and have a `configuration` field which includes an `iterations` field containing the ID and information about each iteration.
|
||||
|
||||
如果只需要字段的名称和 ID,而不需要有关迭代或单个选择字段选项的信息,则可以使用 `ProjectV2FieldCommon` 对象。
|
||||
If you just need the name and ID of a field, and do not need information about iterations or a single select field's options, you can make use of the `ProjectV2FieldCommon` object.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
@@ -314,7 +309,7 @@ gh api graphql -f query='
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
使用 `ProjectV2FieldCommon` 对象时的响应类似于以下示例:
|
||||
The response when using the `ProjectV2FieldCommon` object will look similar to the following example:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -349,11 +344,11 @@ gh api graphql -f query='
|
||||
}
|
||||
```
|
||||
|
||||
### 查找项目中各项的信息
|
||||
### Finding information about items in a project
|
||||
|
||||
您可以查询 API 来查找项目中各项的信息。
|
||||
You can query the API to find information about items in your project.
|
||||
|
||||
以下示例将返回项目中的前 20 个问题、拉取请求和草稿问题。 对于问题和拉取请求,它还将返回标题和前 10 个被分派人。 对于草稿问题,它将返回标题和正文。 该示例还将返回项目前 8 个字段中任何文本、日期或单个选择字段的字段名称和值。 将 `PROJECT_ID` 替换为项目的节点 ID。
|
||||
The following example will return the first 20 issues, pull requests, and draft issues in a project. For issues and pull requests, it will also return title and the first 10 assignees. For draft issue, it will return the title and body. The example will also return the field name and value for any text, date, or single select fields in the first 8 fields of the project. Replace `PROJECT_ID` with the node ID of your project.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
@@ -431,21 +426,21 @@ gh api graphql -f query='
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
项目可能包含用户无权查看的项。 在这种情况下,项目类型将返回为 `REDACTED`。
|
||||
A project may contain items that a user does not have permission to view. In this case, the item type will be returned as `REDACTED`.
|
||||
|
||||
## 更新项目
|
||||
## Updating projects
|
||||
|
||||
使用突变来更新项目。 有关详细信息,请参阅“[关于变更](/graphql/guides/forming-calls-with-graphql#about-mutations)”。
|
||||
Use mutations to update projects. For more information, see "[About mutations](/graphql/guides/forming-calls-with-graphql#about-mutations)."
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:你不能在同一调用中添加和更新项。 你必须使用 `addProjectV2ItemById` 来添加项,然后使用 `updateProjectV2ItemFieldValue` 来更新项。
|
||||
**Note:** You cannot add and update an item in the same call. You must use `addProjectV2ItemById` to add the item and then use `updateProjectV2ItemFieldValue` to update the item.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
### 添加项到项目
|
||||
### Adding an item to a project
|
||||
|
||||
以下示例将向您的项目添加议题或拉取请求。 将 `PROJECT_ID` 替换为项目的节点 ID。 将 `CONTENT_ID` 替换为议题的节点 ID 或你想要添加的拉取请求。
|
||||
The following example will add an issue or pull request to your project. Replace `PROJECT_ID` with the node ID of your project. Replace `CONTENT_ID` with the node ID of the issue or pull request that you want to add.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
@@ -469,7 +464,7 @@ gh api graphql -f query='
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
响应将包含新建项目的节点 ID。
|
||||
The response will contain the node ID of the newly created item.
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -483,11 +478,11 @@ gh api graphql -f query='
|
||||
}
|
||||
```
|
||||
|
||||
如果您尝试添加已经存在的项,则返回现有项 ID。
|
||||
If you try to add an item that already exists, the existing item ID is returned instead.
|
||||
|
||||
### 向项目添加草稿问题
|
||||
### Adding a draft issue to a project
|
||||
|
||||
以下示例将向项目添加草稿问题。 将 `PROJECT_ID` 替换为项目的节点 ID。 将 `TITLE` 和 `BODY` 替换为新草稿问题所需的内容。
|
||||
The following example will add a draft issue to your project. Replace `PROJECT_ID` with the node ID of your project. Replace `TITLE` and `BODY` with the content you want for the new draft issue.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
@@ -511,7 +506,7 @@ gh api graphql -f query='
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
响应将包含新建的草稿问题的节点 ID。
|
||||
The response will contain the node ID of the newly created draft issue.
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -525,9 +520,9 @@ gh api graphql -f query='
|
||||
}
|
||||
```
|
||||
|
||||
### 更新项目的设置
|
||||
### Updating a project's settings
|
||||
|
||||
以下示例将更新项目的设置。 将 `PROJECT_ID` 替换为项目的节点 ID。 将 `public` 设置为 `true`,以便在 {% data variables.product.product_name %} 上公开你的项目。 修改 `readme` 以对项目的 README 进行更改。
|
||||
The following example will update your project's settings. Replace `PROJECT_ID` with the node ID of your project. Set `public` to `true` to make your project public on {% data variables.product.product_name %}. Modify `readme` to make changes to your project's README.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
@@ -562,9 +557,9 @@ gh api graphql -f query='
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
### 更新自定义文本、数字或日期字段
|
||||
### Updating a custom text, number, or date field
|
||||
|
||||
以下示例将更新项目的文本字段的值。 将 `PROJECT_ID` 替换为项目的节点 ID。 将 `ITEM_ID` 替换为你想要更新的项的节点 ID。 将 `FIELD_ID` 替换为你想要更新的字段的 ID。
|
||||
The following example will update the value of a text field for an item. Replace `PROJECT_ID` with the node ID of your project. Replace `ITEM_ID` with the node ID of the item you want to update. Replace `FIELD_ID` with the ID of the field that you want to update.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
@@ -599,7 +594,7 @@ gh api graphql -f query='
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:你不能使用 `updateProjectV2ItemFieldValue` 更改 `Assignees`、`Labels`、`Milestone` 或 `Repository`,因为这些字段是拉取请求和议题,而不是项目项的属性。 相反,可以使用以下突变:
|
||||
**Note:** You cannot use `updateProjectV2ItemFieldValue` to change `Assignees`, `Labels`, `Milestone`, or `Repository` because these fields are properties of pull requests and issues, not of project items. Instead, you may use the following mutations:
|
||||
|
||||
- [addAssigneesToAssignable](/graphql/reference/mutations#addassigneestoassignable)
|
||||
- [removeAssigneesFromAssignable](/graphql/reference/mutations#removeassigneesfromassignable)
|
||||
@@ -611,14 +606,14 @@ gh api graphql -f query='
|
||||
|
||||
{% endnote %}
|
||||
|
||||
### 更新单选字段
|
||||
### Updating a single select field
|
||||
|
||||
下面的示例将更新项的单选字段值。
|
||||
The following example will update the value of a single select field for an item.
|
||||
|
||||
- `PROJECT_ID` - 将此值替换为项目的节点 ID。
|
||||
- `ITEM_ID` - 将此值替换为你想要更新的项的节点 ID。
|
||||
- `FIELD_ID` - 将此值替换为你想要更新的单选字段的 ID。
|
||||
- `OPTION_ID` - 将此值替换为所需单选选项的 ID。
|
||||
- `PROJECT_ID` - Replace this with the node ID of your project.
|
||||
- `ITEM_ID` - Replace this with the node ID of the item you want to update.
|
||||
- `FIELD_ID` - Replace this with the ID of the single select field that you want to update.
|
||||
- `OPTION_ID` - Replace this with the ID of the desired single select option.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
@@ -651,14 +646,14 @@ gh api graphql -f query='
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
### 更新迭代字段
|
||||
### Updating an iteration field
|
||||
|
||||
下面的示例将更新项的迭代字段值。
|
||||
The following example will update the value of an iteration field for an item.
|
||||
|
||||
- `PROJECT_ID` - 将此值替换为项目的节点 ID。
|
||||
- `ITEM_ID` - 将此值替换为你想要更新的项的节点 ID。
|
||||
- `FIELD_ID` - 将此值替换为你想要更新的迭代字段的 ID。
|
||||
- `ITERATION_ID` - 将此值替换为所需迭代的 ID。 这可以是活动的或已完成的迭代。
|
||||
- `PROJECT_ID` - Replace this with the node ID of your project.
|
||||
- `ITEM_ID` - Replace this with the node ID of the item you want to update.
|
||||
- `FIELD_ID` - Replace this with the ID of the iteration field that you want to update.
|
||||
- `ITERATION_ID` - Replace this with the ID of the desired iteration. This can be either an active or completed iteration.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
@@ -691,9 +686,9 @@ gh api graphql -f query='
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
### 从项目中删除项
|
||||
### Deleting an item from a project
|
||||
|
||||
下面的示例将从项目中删除一个项。 将 `PROJECT_ID` 替换为项目的节点 ID。 将 `ITEM_ID` 替换为你想要删除的项的节点 ID。
|
||||
The following example will delete an item from a project. Replace `PROJECT_ID` with the node ID of your project. Replace `ITEM_ID` with the node ID of the item you want to delete.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
@@ -720,6 +715,61 @@ gh api graphql -f query='
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
## 使用 Webhook
|
||||
## Managing projects
|
||||
|
||||
可使用 Webhook 来订阅项目中发生的事件。 例如,编辑某项时,{% data variables.product.product_name %} 可以将 HTTP POST 有效负载发送到 Webhook 的配置 URL,从而在服务器上触发自动化。 有关 Webhook 的详细信息,请参阅“[关于 Webhook](/developers/webhooks-and-events/webhooks/about-webhooks)”。 要详细了解 [ Webhook 事件,请参阅“`projects_v2_item`Webhook 事件和有效负载](/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#projects_v2_item)”。
|
||||
### Creating projects
|
||||
|
||||
You can use a mutation to create a new project. For more information, see "[About mutations](/graphql/guides/forming-calls-with-graphql#about-mutations)."
|
||||
|
||||
To create a new project using the API, you'll need to provide a name for the project and the node ID of a {% data variables.product.product_name %} user or organization who will become the project's owner.
|
||||
|
||||
You can find the node ID of a {% data variables.product.product_name %} user or organization if you know the username. Replace <code>GITHUB_OWNER</code> with the {% data variables.product.product_name %} username of the new project owner.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
curl --request GET \
|
||||
--url https://api.github.com/users/<em>GITHUB_OWNER</em> \
|
||||
--header 'Authorization: token <em>TOKEN</em>' \
|
||||
--header 'Accept: application/vnd.github+json'
|
||||
```
|
||||
{% endcurl %}
|
||||
|
||||
{% cli %}
|
||||
```shell
|
||||
gh api -H "Accept: application/vnd.github+json" /users/<em>GITHUB_OWNER</em>
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
To create the project, replace `OWNER_ID` with the node ID of the new project owner and replace `PROJECT_NAME` with a name for the project.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
curl --request POST \
|
||||
--url https://api.github.com/graphql \
|
||||
--header 'Authorization: token <em>TOKEN</em>' \
|
||||
--data '{"query":"mutation {createProjectV2(input: {ownerId: \"<em>OWNER_ID</em>\" title: \"<em>PROJECT_NAME</em>\"}) {projectV2 {id}}}"}'
|
||||
```
|
||||
{% endcurl %}
|
||||
|
||||
{% cli %}
|
||||
```shell
|
||||
gh api graphql -f query='
|
||||
mutation{
|
||||
createProjectV2(
|
||||
input: {
|
||||
ownerId: "<em>OWNER_ID</em>",
|
||||
title: "<em>PROJECT_NAME</em>"
|
||||
}
|
||||
){
|
||||
projectV2 {
|
||||
id
|
||||
}
|
||||
}
|
||||
}'
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
|
||||
## Using webhooks
|
||||
|
||||
You can use webhooks to subscribe to events taking place in your project. For example, when an item is edited, {% data variables.product.product_name %} can send a HTTP POST payload to the webhook's configured URL which can trigger automation on your server. For more information about webhooks, see "[About webhooks](/developers/webhooks-and-events/webhooks/about-webhooks)." To learn more about the `projects_v2_item` webhook event, see "[Webhook events and payloads](/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#projects_v2_item)."
|
||||
|
||||
@@ -4,7 +4,7 @@ intro: 可以创建一个分支以直接从问题页面处理问题,方便快
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghes: '>=3.5'
|
||||
ghae: issue-6234
|
||||
ghae: '>= 3.5'
|
||||
ghec: '*'
|
||||
allowTitleToDifferFromFilename: true
|
||||
topics:
|
||||
|
||||
@@ -69,7 +69,7 @@ You can manually link up to ten issues to each pull request. The issue and pull
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-pr %}
|
||||
3. In the list of pull requests, click the pull request that you'd like to link to an issue.
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6234 %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
4. In the right sidebar, in the "Development" section click {% octicon "gear" aria-label="The Gear icon" %}.
|
||||
{% else %}
|
||||
4. In the right sidebar, click **Linked issues**.
|
||||
|
||||
@@ -831,7 +831,7 @@ For more information, see "[Managing the publication of {% data variables.produc
|
||||
{% data reusables.actions.actions-audit-events-workflow %}
|
||||
## Further reading
|
||||
|
||||
- "[Keeping your organization secure](/articles/keeping-your-organization-secure)"{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5146 %}
|
||||
- "[Keeping your organization secure](/articles/keeping-your-organization-secure)"{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
{%- ifversion fpt or ghec %}
|
||||
- "[Exporting member information for your organization](/organizations/managing-membership-in-your-organization/exporting-member-information-for-your-organization)"{% endif %}
|
||||
{%- endif %}
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 审查组织安装的集成
|
||||
intro: 您可以审查组织安装的集成的权限级别,并配置每个集成对组织仓库的访问权限。
|
||||
title: Reviewing your organization's installed integrations
|
||||
intro: You can review the permission levels for your organization's installed integrations and configure each integration's access to organization repositories.
|
||||
redirect_from:
|
||||
- /articles/reviewing-your-organization-s-installed-integrations
|
||||
- /articles/reviewing-your-organizations-installed-integrations
|
||||
@@ -15,22 +15,20 @@ topics:
|
||||
- Organizations
|
||||
- Teams
|
||||
shortTitle: Review installed integrations
|
||||
ms.openlocfilehash: 66645e6ebb4305a34cd7735269d77881ea2ed5ee
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '145127517'
|
||||
---
|
||||
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5658 %}
|
||||
1. 在边栏的“集成”部分,单击“{% octicon "apps" aria-label="The apps icon" %} {% data variables.product.prodname_github_apps %}”。
|
||||
|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.profile.org_settings %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
1. In the "Integrations" section of the sidebar, click **{% octicon "apps" aria-label="The apps icon" %} {% data variables.product.prodname_github_apps %}**.
|
||||
{% else %}
|
||||
1. 在左侧边栏中,单击“已安装的 {% data variables.product.prodname_github_apps %}”。
|
||||
 {% endif %}
|
||||
2. 在要审阅的 {% data variables.product.prodname_github_app %} 旁边,单击“配置”。
|
||||

|
||||
6. 审查 {% data variables.product.prodname_github_app %}的权限和仓库访问权限。
|
||||

|
||||
- 若要授予 {% data variables.product.prodname_github_app %} 对所有组织存储库的访问权限,请选择“所有存储库”。
|
||||
- 若要选择特定存储库以授予应用程序访问权限,请选择“仅选择存储库”,然后键入存储库名。
|
||||
7. 单击“保存” 。
|
||||
1. In the left sidebar, click **Installed {% data variables.product.prodname_github_apps %}**.
|
||||

|
||||
{% endif %}
|
||||
2. Next to the {% data variables.product.prodname_github_app %} you'd like to review, click **Configure**.
|
||||

|
||||
6. Review the {% data variables.product.prodname_github_app %}'s permissions and repository access.
|
||||

|
||||
- To give the {% data variables.product.prodname_github_app %} access to all of your organization's repositories, select **All repositories**.
|
||||
- To choose specific repositories to give the application access to, select **Only select repositories**, then type a repository name.
|
||||
7. Click **Save**.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 添加外部协作者到组织的仓库
|
||||
intro: 您可以允许不属于您组织成员的人员访问您的组织拥有的仓库。
|
||||
title: Adding outside collaborators to repositories in your organization
|
||||
intro: You can allow people who aren't members of your organization to access repositories that your organization owns.
|
||||
redirect_from:
|
||||
- /articles/adding-outside-collaborators-to-repositories-in-your-organization
|
||||
- /github/setting-up-and-managing-organizations-and-teams/adding-outside-collaborators-to-repositories-in-your-organization
|
||||
@@ -14,35 +14,39 @@ topics:
|
||||
- Teams
|
||||
shortTitle: Add outside collaborator
|
||||
permissions: People with admin access to a repository can add an outside collaborator to the repository.
|
||||
ms.openlocfilehash: caac79aba845f433effd3a3461e739d07cee135b
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '145127483'
|
||||
---
|
||||
## 关于外部协作者
|
||||
|
||||
外部协作者是指不是您组织的成员,但有权访问您组织的一个或多个仓库的人员。 您可以选择要为每个外部协作者授予的访问权限级别。 {% data reusables.organizations.outside_collaborator_forks %}
|
||||
## About outside collaborators
|
||||
|
||||
An outside collaborator is a person who is not a member of your organization, but has access to one or more of your organization's repositories. You can choose the level of access to grant for each outside collaborator. {% data reusables.organizations.outside_collaborator_forks %}
|
||||
|
||||
{% data reusables.organizations.outside-collaborators-use-seats %}
|
||||
|
||||
{% ifversion fpt %} 使用 {% data variables.product.prodname_ghe_cloud %} 的组织可以限制邀请协作者的能力。 有关详细信息,请参阅 {% data variables.product.prodname_ghe_cloud %} 文档中的“[设置添加外部协作者的权限](/enterprise-cloud@latest/organizations/managing-organization-settings/setting-permissions-for-adding-outside-collaborators)”。
|
||||
{% else %} 组织所有者可以限制邀请协作者的能力。 有关详细信息,请参阅“[设置添加外部协作者的权限](/organizations/managing-organization-settings/setting-permissions-for-adding-outside-collaborators)”。
|
||||
{% ifversion fpt %}
|
||||
Organizations that use {% data variables.product.prodname_ghe_cloud %} can restrict the ability to invite collaborators. For more information, see "[Setting permissions for adding outside collaborators](/enterprise-cloud@latest/organizations/managing-organization-settings/setting-permissions-for-adding-outside-collaborators)" in the {% data variables.product.prodname_ghe_cloud %} documentation.
|
||||
{% else %}
|
||||
An organization owner can restrict the ability to invite collaborators. For more information, see "[Setting permissions for adding outside collaborators](/organizations/managing-organization-settings/setting-permissions-for-adding-outside-collaborators)."
|
||||
{% endif %}
|
||||
|
||||
{% ifversion ghes %} 要将某人添加为存储库的外部协作者,此人必须在 {% data variables.product.product_location %} 上拥有个人帐户。 如果您的企业使用外部身份验证系统(如 SAML 或 LDAP),则要添加的人员必须通过该系统登录才能创建帐户。 如果此人无权访问身份验证系统,并且为你的企业启用了内置身份验证,则网站管理员可以为该人员创建个人帐户。 有关详细信息,请参阅“[配置内置身份验证](/admin/identity-and-access-management/using-built-in-authentication/configuring-built-in-authentication)”。
|
||||
{% ifversion ghes %}
|
||||
Before you can add someone as an outside collaborator on a repository, the person must have a personal account on {% data variables.product.product_location %}. If your enterprise uses an external authentication system such as SAML or LDAP, the person you want to add must sign in through that system to create an account. If the person does not have access to the authentication system and built-in authentication is enabled for your enterprise, a site administrator can create an account for the person. For more information, see "[Configuring built-in authentication](/admin/identity-and-access-management/using-built-in-authentication/configuring-built-in-authentication)."
|
||||
{% endif %}
|
||||
|
||||
{% ifversion not ghae %} 如果你的组织需要双因素身份验证,则在接受你的邀请以在存储库上进行协作之前,所有外部协作者都必须启用双因素身份验证。 有关详细信息,请参阅“[要求在组织中进行双因素身份验证](/organizations/keeping-your-organization-secure/managing-two-factor-authentication-for-your-organization/requiring-two-factor-authentication-in-your-organization)”。
|
||||
{% ifversion not ghae %}
|
||||
If your organization requires two-factor authentication, all outside collaborators must enable two-factor authentication before accepting your invitation to collaborate on a repository. For more information, see "[Requiring two-factor authentication in your organization](/organizations/keeping-your-organization-secure/managing-two-factor-authentication-for-your-organization/requiring-two-factor-authentication-in-your-organization)."
|
||||
{% endif %}
|
||||
|
||||
## 添加外部协作者到仓库
|
||||
## Adding outside collaborators to a repository
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5974 %} 你可以在存储库设置中授予外部协作者对存储库的访问权限。 有关详细信息,请参阅“[管理有权访问存储库的团队和人员](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository#inviting-a-team-or-person)”。 {% else %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %}
|
||||
5. 在左侧边栏中,单击“协作者和团队”。
|
||||

|
||||
6. 在“协作者”下,键入要授权其访问存储库的人员的名称,然后单击“添加协作者”。
|
||||

|
||||
7. 在新协作者的姓名旁边,使用下拉菜单并选择适当的访问权限级别。
|
||||
 {% endif %}
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
You can give outside collaborators access to a repository in your repository settings. For more information, see "[Managing teams and people with access to your repository](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository#inviting-a-team-or-person)."
|
||||
{% else %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
5. In the left sidebar, click **Collaborators & teams**.
|
||||

|
||||
6. Under "Collaborators", type the name of the person you'd like to give access to the repository, then click **Add collaborator**.
|
||||

|
||||
7. Next to the new collaborator's name, use the drop-down menu and select the appropriate access level.
|
||||

|
||||
{% endif %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 管理个人对组织仓库的访问
|
||||
intro: 您可以管理个人对组织拥有的仓库的访问。
|
||||
title: Managing an individual's access to an organization repository
|
||||
intro: You can manage a person's access to a repository owned by your organization.
|
||||
redirect_from:
|
||||
- /articles/managing-an-individual-s-access-to-an-organization-repository-early-access-program
|
||||
- /articles/managing-an-individual-s-access-to-an-organization-repository
|
||||
@@ -16,42 +16,43 @@ topics:
|
||||
- Teams
|
||||
shortTitle: Manage individual access
|
||||
permissions: People with admin access to a repository can manage access to the repository.
|
||||
ms.openlocfilehash: 90a9df66f0cd4089634b2d29dd798b37629bbb7b
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '145127478'
|
||||
---
|
||||
## 关于对组织仓库的访问
|
||||
|
||||
从组织中的仓库删除协作者时,该协作者会失去对仓库的读写权限。 如果仓库是私有的,并且协作者对仓库进行了复刻,则其复刻也会被检测到,但协作者仍然保留仓库的任何本地克隆副本。
|
||||
## About access to organization repositories
|
||||
|
||||
When you remove a collaborator from a repository in your organization, the collaborator loses read and write access to the repository. If the repository is private and the collaborator has forked the repository, then their fork is also deleted, but the collaborator will still retain any local clones of your repository.
|
||||
|
||||
{% data reusables.repositories.deleted_forks_from_private_repositories_warning %}
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5974 %}
|
||||
## 管理个人对组织仓库的访问
|
||||
您可以在仓库设置中授予个人对仓库的访问权限,或更改个人对仓库的访问权限级别。 有关详细信息,请参阅“[管理有权访问存储库的团队和人员](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository)”。
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
## Managing an individual's access to an organization repository
|
||||
You can give a person access to a repository or change a person's level of access to a repository in your repository settings. For more information, see "[Managing teams and people with access to your repository](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository)."
|
||||
{% else %}
|
||||
## 授予用户对仓库的访问权限
|
||||
## Giving a person access to a repository
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.navigate-to-manage-access %} {% data reusables.organizations.invite-teams-or-people %}
|
||||
1. 在搜索字段中,开始输入要邀请的人员的名称,然后单击匹配列表中的名称。
|
||||

|
||||
6. 在“选择角色”下,选择要分配给此人的存储库角色,然后单击“将姓名添加到存储库”。
|
||||

|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.navigate-to-manage-access %}
|
||||
{% data reusables.organizations.invite-teams-or-people %}
|
||||
1. In the search field, start typing the name of the person to invite, then click a name in the list of matches.
|
||||

|
||||
6. Under "Choose a role", select the repository role to assign the person, then click **Add NAME to REPOSITORY**.
|
||||

|
||||
|
||||
## 管理个人对组织仓库的访问
|
||||
## Managing an individual's access to an organization repository
|
||||
|
||||
{% data reusables.profile.access_org %} {% data reusables.user-settings.access_org %} {% data reusables.organizations.people %}
|
||||
4. 单击“成员”或“外部协作者”以管理具有不同访问权限类型的人员 。 
|
||||
5. 在要管理的人员名称右侧,使用 {% octicon "gear" aria-label="The Settings gear" %} 下拉菜单,然后单击“管理”。
|
||||

|
||||
6. 在“管理访问权限”页面上的存储库旁边,单击“管理访问权限”。
|
||||

|
||||
7. 检查个人对指定仓库的访问权限,例如他们是协作者还是通过团队成员资格来访问仓库。
|
||||
 {% endif %}
|
||||
## 延伸阅读
|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.user-settings.access_org %}
|
||||
{% data reusables.organizations.people %}
|
||||
4. Click either **Members** or **Outside collaborators** to manage people with different types of access. 
|
||||
5. To the right of the name of the person you'd like to manage, use the {% octicon "gear" aria-label="The Settings gear" %} drop-down menu, and click **Manage**.
|
||||

|
||||
6. On the "Manage access" page, next to the repository, click **Manage access**.
|
||||

|
||||
7. Review the person's access to a given repository, such as whether they're a collaborator or have access to the repository via team membership.
|
||||

|
||||
{% endif %}
|
||||
## Further reading
|
||||
|
||||
{% ifversion fpt or ghec %}-“[限制与存储库的交互](/articles/limiting-interactions-with-your-repository)”{% endif %}
|
||||
- [组织的存储库角色](/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization)
|
||||
{% ifversion fpt or ghec %}- "[Limiting interactions with your repository](/articles/limiting-interactions-with-your-repository)"{% endif %}
|
||||
- "[Repository roles for an organization](/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization)"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 管理团队对组织仓库的访问
|
||||
intro: 您可以向团队授予仓库访问权限,删除团队的仓库访问权限,或者更改团队对仓库的权限级别。
|
||||
title: Managing team access to an organization repository
|
||||
intro: 'You can give a team access to a repository, remove a team''s access to a repository, or change a team''s permission level for a repository.'
|
||||
redirect_from:
|
||||
- /articles/managing-team-access-to-an-organization-repository-early-access-program
|
||||
- /articles/managing-team-access-to-an-organization-repository
|
||||
@@ -14,53 +14,60 @@ topics:
|
||||
- Organizations
|
||||
- Teams
|
||||
shortTitle: Manage team access
|
||||
ms.openlocfilehash: 34f912f4d5c55df30629b7b56200bef25281bf2d
|
||||
ms.sourcegitcommit: 72e1c60459a610944184ca00e3ae60bf1f5fc6db
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/09/2022
|
||||
ms.locfileid: '147876046'
|
||||
---
|
||||
对仓库具有管理员权限的人员可以管理团队对仓库的访问权限。 如果团队能够直接访问存储库,团队维护员可以更改其对存储库的访问权限。 如果团队对存储库的访问权限继承自父团队,维护员可以选择重置当前权限以匹配父团队的权限。
|
||||
|
||||
People with admin access to a repository can manage team access to the repository. Team maintainers can remove a team's access to a repository if the team has direct access to it. If the team's access to the repository is inherited from a parent team, maintainers can choose to reset the current permission to match the parent team's permission.
|
||||
|
||||
{% warning %}
|
||||
|
||||
警告:
|
||||
- 如果团队能够直接访问仓库,您可以更改其权限级别。 如果团队对仓库的访问权限继承自父团队,则您必须更改团队对仓库的访问权限。
|
||||
- 如果您添加或删除父团队的仓库访问权限,则其每个子团队也会获得或失去相应的仓库访问权限。 有关详细信息,请参阅“[关于团队](/articles/about-teams)”。
|
||||
**Warnings:**
|
||||
- You can change a team's permission level if the team has direct access to a repository. If the team's access to the repository is inherited from a parent team, you must change the parent team's access to the repository.
|
||||
- If you add or remove repository access for a parent team, each of that parent's child teams will also receive or lose access to the repository. For more information, see "[About teams](/articles/about-teams)."
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
## 授予团队对仓库的访问权限
|
||||
## Giving a team access to a repository
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5974 %} 可在存储库设置中授予团队对存储库的访问权限,或更改团队对存储库的访问权限级别。 有关详细信息,请参阅“[管理有权访问存储库的团队和人员](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository#inviting-a-team-or-person)”。 {% else %} {% data reusables.profile.access_org %} {% data reusables.user-settings.access_org %} {% data reusables.organizations.specific_team %} {% data reusables.organizations.team-repositories-tab %}
|
||||
5. 在存储库列表上方,单击“添加存储库”。
|
||||

|
||||
6. 输入存储库的名称,然后单击“将存储库添加到团队”。
|
||||

|
||||
7. 也可选择在仓库名称右侧使用下拉菜单,为团队选择不同的权限级别。
|
||||
 {% endif %}
|
||||
## 删除团队对仓库的访问权限
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
You can give a team access to a repository or change a team's level of access to a repository in your repository settings. For more information, see "[Managing teams and people with access to your repository](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository#inviting-a-team-or-person)."
|
||||
{% else %}
|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.user-settings.access_org %}
|
||||
{% data reusables.organizations.specific_team %}
|
||||
{% data reusables.organizations.team-repositories-tab %}
|
||||
5. Above the list of repositories, click **Add repository**.
|
||||

|
||||
6. Type the name of a repository, then click **Add repository to team**.
|
||||

|
||||
7. Optionally, to the right of the repository name, use the drop-down menu and choose a different permission level for the team.
|
||||

|
||||
{% endif %}
|
||||
## Removing a team's access to a repository
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5974 %} 可在存储库设置中删除团队对组织存储库的访问权限。 有关详细信息,请参阅“[管理有权访问存储库的团队和人员](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository#removing-access-for-a-team-or-person)”。
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
You can remove a team's access to an organization repository in your repository settings. For more information, see "[Managing teams and people with access to your repository](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository#removing-access-for-a-team-or-person)."
|
||||
|
||||
如果团队可以直接访问仓库,您可以删除该团队对仓库的访问。 如果团队对仓库的访问权限继承自父团队,则必须删除父团队对仓库的访问权限才可删除其子团队的相应权限。
|
||||
If a team has direct access to a repository, you can remove that team's access to the repository. If a team's access to the repository is inherited from a parent team, you must remove the repository from the parent team in order to remove the repository from child teams.
|
||||
|
||||
{% data reusables.repositories.deleted_forks_from_private_repositories_warning %}
|
||||
|
||||
{% else %}
|
||||
|
||||
如果团队能够直接访问仓库,您可以更改其对仓库的访问权限。 如果团队对仓库的访问权限继承自父团队,则必须删除父团队对仓库的访问权限才可删除其子团队的相应权限。
|
||||
You can remove a team's access to a repository if the team has direct access to a repository. If a team's access to the repository is inherited from a parent team, you must remove the repository from the parent team in order to remove the repository from child teams.
|
||||
|
||||
{% data reusables.repositories.deleted_forks_from_private_repositories_warning %}
|
||||
|
||||
{% data reusables.profile.access_org %} {% data reusables.user-settings.access_org %} {% data reusables.organizations.specific_team %} {% data reusables.organizations.team-repositories-tab %}
|
||||
5. 选择要从团队删除的仓库。
|
||||

|
||||
6. 在存储库列表上方,使用下拉菜单,然后单击“从团队删除”。
|
||||

|
||||
7. 检查要从团队删除的存储库,然后单击“删除存储库”。
|
||||
 {% endif %}
|
||||
## 延伸阅读
|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.user-settings.access_org %}
|
||||
{% data reusables.organizations.specific_team %}
|
||||
{% data reusables.organizations.team-repositories-tab %}
|
||||
5. Select the repository or repositories you'd like to remove from the team.
|
||||

|
||||
6. Above the list of repositories, use the drop-down menu, and click **Remove from team**.
|
||||

|
||||
7. Review the repository or repositories that will be removed from the team, then click **Remove repositories**.
|
||||

|
||||
{% endif %}
|
||||
## Further reading
|
||||
|
||||
- [组织的存储库角色](/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization)
|
||||
- "[Repository roles for an organization](/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization)"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 从组织仓库中删除外部协作者
|
||||
intro: 所有者和仓库管理员可以删除外部协作者对仓库的访问权限。
|
||||
title: Removing an outside collaborator from an organization repository
|
||||
intro: Owners and repository admins can remove an outside collaborator's access to a repository.
|
||||
redirect_from:
|
||||
- /articles/removing-an-outside-collaborator-from-an-organization-repository
|
||||
- /github/setting-up-and-managing-organizations-and-teams/removing-an-outside-collaborator-from-an-organization-repository
|
||||
@@ -13,55 +13,57 @@ topics:
|
||||
- Organizations
|
||||
- Teams
|
||||
shortTitle: Remove collaborator
|
||||
ms.openlocfilehash: 71c8017b79425570e4ee7c2d2c7d3ac695c5c531
|
||||
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/10/2022
|
||||
ms.locfileid: '145127466'
|
||||
---
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
|
||||
{% warning %}
|
||||
|
||||
**警告:**
|
||||
- 从私有仓库删除外部协作者后,付费许可数不会自动降级。 要在从组织中删除用户后减少付费的许可证数,请按照“[降级组织的付费席位](/articles/downgrading-your-organization-s-paid-seats)”中的步骤操作。
|
||||
**Warning:**
|
||||
- When removing an outside collaborator from a private repository, the paid license count does not automatically downgrade. To pay for fewer licenses after removing users from your organization, follow the steps in "[Downgrading your organization's paid seats](/articles/downgrading-your-organization-s-paid-seats)."
|
||||
|
||||
- 您负责确保无法访问仓库的人员删除任何机密信息或知识产权。
|
||||
- You are responsible for ensuring that people who have lost access to a repository delete any confidential information or intellectual property.
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
尽管删除协作者时将删除私有仓库的复刻,但此人员将仍保留您仓库的任何本地克隆。
|
||||
While forks of private repositories are deleted when a collaborator is removed, the person will still retain any local clones of your repository.
|
||||
|
||||
## 从组织中的所有仓库删除外部协作者
|
||||
## Removing outside collaborators from all repositories in an organization
|
||||
|
||||
{% data reusables.profile.access_org %} {% data reusables.user-settings.access_org %} {% data reusables.organizations.people %} {% data reusables.organizations.people_tab_outside_collaborators %}
|
||||
5. 选择您想要从组织中删除的一个或多个外部协作者。
|
||||

|
||||
6. 在外部协作者列表上方,使用下拉菜单,然后单击“从所有存储库中删除”。
|
||||

|
||||
7. 查看将从组织中删除的一个或多个外部协作者,然后单击“删除外部协作者”。
|
||||

|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.user-settings.access_org %}
|
||||
{% data reusables.organizations.people %}
|
||||
{% data reusables.organizations.people_tab_outside_collaborators %}
|
||||
5. Select the outside collaborator or outside collaborators you'd like to remove from the organization.
|
||||

|
||||
6. Above the list of outside collaborators, use the drop-down menu, and click **Remove from all repositories**.
|
||||

|
||||
7. Review the outside collaborator or outside collaborators who will be removed from the organization, then click **Remove outside collaborators**.
|
||||

|
||||
|
||||
## 从组织的特定仓库中删除外部协作者
|
||||
## Removing an outside collaborator from a particular repository in an organization
|
||||
|
||||
如果只是想要从组织的特定仓库中删除外部协作者,则可以一次删除此人员对一个特定仓库的访问权限。
|
||||
If you only want to remove an outside collaborator from certain repositories in your organization, you can remove this person's access to one specific repository at a time.
|
||||
|
||||
{% data reusables.profile.access_org %} {% data reusables.user-settings.access_org %} {% data reusables.organizations.people %} {% data reusables.organizations.people_tab_outside_collaborators %}
|
||||
5. 在想要删除的人员用户名右侧,使用 {% octicon "gear" aria-label="The Settings gear" %} 下拉菜单,并单击“管理”。
|
||||

|
||||
6. 在想要从中删除外部协作者的存储库的右侧,单击“管理访问权限”。
|
||||

|
||||
7. 若要完全删除外部协作者对存储库的访问权限,请在右上角单击“删除对此存储库的访问权限”。
|
||||

|
||||
8. 若要确认,请单击“删除访问权限”。
|
||||

|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.user-settings.access_org %}
|
||||
{% data reusables.organizations.people %}
|
||||
{% data reusables.organizations.people_tab_outside_collaborators %}
|
||||
5. To the right of the username of the person you want to remove, use the {% octicon "gear" aria-label="The Settings gear" %} drop-down menu, and click **Manage**.
|
||||

|
||||
6. To the right of the repository that you want to remove the outside collaborator from, click **Manage access**.
|
||||

|
||||
7. To completely remove the outside collaborator's access to the repository, in the upper right corner, click **Remove access to this repository**.
|
||||

|
||||
8. To confirm, click **Remove access**.
|
||||

|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5974 %} 还可以在存储库设置的访问概述中从存储库中删除外部协作者。 有关详细信息,请参阅“[管理有权访问存储库的团队和人员](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository#removing-access-for-a-team-or-person)”。
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
You can also remove an outside collaborator from a repository in the access overview in your repository settings. For more information, see "[Managing teams and people with access to your repository](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository#removing-access-for-a-team-or-person)."
|
||||
{% endif %}
|
||||
## 延伸阅读
|
||||
## Further reading
|
||||
|
||||
- [将外部协作者添加到组织中的存储库](/articles/adding-outside-collaborators-to-repositories-in-your-organization)
|
||||
- [将组织成员转换为外部协作者](/articles/converting-an-organization-member-to-an-outside-collaborator)
|
||||
- "[Adding outside collaborators to repositories in your organization](/articles/adding-outside-collaborators-to-repositories-in-your-organization)"
|
||||
- "[Converting an organization member to an outside collaborator](/articles/converting-an-organization-member-to-an-outside-collaborator)"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 组织的存储库角色
|
||||
intro: 您可以通过细化角色自定义组织中每个仓库的权限,从而为每个用户提供所需的功能和任务权限。
|
||||
title: Repository roles for an organization
|
||||
intro: 'You can customize access to each repository in your organization by assigning granular roles, giving people access to the features and tasks they need.'
|
||||
miniTocMaxHeadingLevel: 3
|
||||
redirect_from:
|
||||
- /articles/repository-permission-levels-for-an-organization-early-access-program
|
||||
@@ -16,159 +16,160 @@ topics:
|
||||
- Organizations
|
||||
- Teams
|
||||
shortTitle: Repository roles
|
||||
ms.openlocfilehash: dbb5075dfc57e01e0658138b65d6231fb12f1071
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147526700'
|
||||
---
|
||||
## 组织的存储库角色
|
||||
|
||||
您可以通过分配角色,为组织成员、外部协作者和人员团队提供对组织仓库不同级别的权限。 选择最适合每个人或团队在项目中的职能的角色,而不是提供超过其需求的项目权限。
|
||||
## Repository roles for organizations
|
||||
|
||||
组织存储库的角色从低到高的权限级别分别为:
|
||||
- **读取**:建议提供给要查看或讨论项目的非代码参与者
|
||||
- **会审**:建议提供给需要主动管理问题和拉取请求,但没有写入权限的参与者
|
||||
- **写入**:建议提供给积极推送内容到项目的参与者
|
||||
- **维护**:建议提供给需要管理存储库而又无法访问敏感或破坏性操作的项目经理
|
||||
- **管理员**:建议提供给需要对项目具有完全访问权限的人员,包括管理安全性或删除存储库等敏感和破坏性操作
|
||||
You can give organization members, outside collaborators, and teams of people different levels of access to repositories owned by an organization by assigning them to roles. Choose the role that best fits each person or team's function in your project without giving people more access to the project than they need.
|
||||
|
||||
{% ifversion fpt %} 如果组织使用 {% data variables.product.prodname_ghe_cloud %},则可以创建自定义存储库角色。 有关详细信息,请参阅 {% data variables.product.prodname_ghe_cloud %} 文档中的“[管理组织的自定义存储库角色](/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization)”。
|
||||
{% elsif ghec or ghes > 3.4 or ghae-issue-6271 %} 可以创建自定义存储库角色。 有关详细信息,请参阅“[管理组织的自定义存储库角色](/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization)”。
|
||||
From least access to most access, the roles for an organization repository are:
|
||||
- **Read**: Recommended for non-code contributors who want to view or discuss your project
|
||||
- **Triage**: Recommended for contributors who need to proactively manage issues and pull requests without write access
|
||||
- **Write**: Recommended for contributors who actively push to your project
|
||||
- **Maintain**: Recommended for project managers who need to manage the repository without access to sensitive or destructive actions
|
||||
- **Admin**: Recommended for people who need full access to the project, including sensitive and destructive actions like managing security or deleting a repository
|
||||
|
||||
{% ifversion fpt %}
|
||||
If your organization uses {% data variables.product.prodname_ghe_cloud %}, you can create custom repository roles. For more information, see "[Managing custom repository roles for an organization](/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization)" in the {% data variables.product.prodname_ghe_cloud %} documentation.
|
||||
{% elsif ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
You can create custom repository roles. For more information, see "[Managing custom repository roles for an organization](/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization)."
|
||||
{% endif %}
|
||||
|
||||
组织所有者可以在访问组织的任何仓库时设置适用于组织所有成员的基本权限。 有关详细信息,请参阅“[为组织设置基本权限](/organizations/managing-access-to-your-organizations-repositories/setting-base-permissions-for-an-organization#setting-base-permissions)”。
|
||||
Organization owners can set base permissions that apply to all members of an organization when accessing any of the organization's repositories. For more information, see "[Setting base permissions for an organization](/organizations/managing-access-to-your-organizations-repositories/setting-base-permissions-for-an-organization#setting-base-permissions)."
|
||||
|
||||
组织所有者还可以选择进一步限制对整个组织中某些设置和操作的权限。 有关特定设置的选项的详细信息,请参阅“[管理组织设置](/articles/managing-organization-settings)”。
|
||||
Organization owners can also choose to further limit access to certain settings and actions across the organization. For more information on options for specific settings, see "[Managing organization settings](/articles/managing-organization-settings)."
|
||||
|
||||
除了管理组织级设置之外,组织所有者对组织拥有的每个存储库都具有管理员权限。 有关详细信息,请参阅“[组织中的角色](/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization)”。
|
||||
In addition to managing organization-level settings, organization owners have admin access to every repository owned by the organization. For more information, see "[Roles in an organization](/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization)."
|
||||
|
||||
{% warning %}
|
||||
|
||||
警告:当有人向存储库添加部署密钥时,拥有私钥的任何用户都可以读取或写入存储库(具体取决于密钥设置),即使他们后来从组织中删除也是如此。
|
||||
**Warning:** When someone adds a deploy key to a repository, any user who has the private key can read from or write to the repository (depending on the key settings), even if they're later removed from the organization.
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
## 每个角色的权限
|
||||
## Permissions for each role
|
||||
|
||||
{% ifversion fpt %} 下面列出的一些功能仅限于使用 {% data variables.product.prodname_ghe_cloud %} 的组织。 {% data reusables.enterprise.link-to-ghec-trial %} {% endif %}
|
||||
{% ifversion fpt %}
|
||||
Some of the features listed below are limited to organizations using {% data variables.product.prodname_ghe_cloud %}. {% data reusables.enterprise.link-to-ghec-trial %}
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghes or ghec %} {% note %}
|
||||
{% ifversion fpt or ghes or ghec %}
|
||||
{% note %}
|
||||
|
||||
注意:下面的“[安全功能的访问要求](#access-requirements-for-security-features)”中列出了使用安全功能所需的角色。
|
||||
**Note:** The roles required to use security features are listed in "[Access requirements for security features](#access-requirements-for-security-features)" below.
|
||||
|
||||
{% endnote %} {% endif %}
|
||||
{% endnote %}
|
||||
{% endif %}
|
||||
|
||||
| 仓库操作 | 读取 | 会审 | 写入 | 维护 | 管理员 |
|
||||
| Repository action | Read | Triage | Write | Maintain | Admin |
|
||||
|:---|:---:|:---:|:---:|:---:|:---:|
|
||||
| 管理[个人](/organizations/managing-access-to-your-organizations-repositories/managing-an-individuals-access-to-an-organization-repository)、[团队](/organizations/managing-access-to-your-organizations-repositories/managing-team-access-to-an-organization-repository)和[外部协作者](/organizations/managing-access-to-your-organizations-repositories/adding-outside-collaborators-to-repositories-in-your-organization)对存储库的访问 | | | | | ✔️ |
|
||||
| 从人员或团队的已分配仓库拉取 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| 复刻人员或团队的已分配仓库 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| 编辑和删除自己的评论 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| 打开议题 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| 关闭自己打开的议题 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| 重新打开自己关闭的议题 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| 受理议题 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| 从团队已分配仓库的复刻发送拉取请求 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| 提交拉取请求审查 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| 查看已发布的版本 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |{% ifversion fpt or ghec %}
|
||||
| 查看 [GitHub Actions 工作流运行](/actions/automating-your-workflow-with-github-actions/managing-a-workflow-run) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |{% endif %}
|
||||
| 编辑公共仓库中的 Wiki | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| 编辑私有仓库中的 Wiki | | | ✔️ | ✔️ | ✔️ |{% ifversion fpt or ghec %}
|
||||
| [举报滥用或垃圾内容](/communities/maintaining-your-safety-on-github/reporting-abuse-or-spam) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |{% endif %}
|
||||
| 应用/忽略标签 | | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| 创建、编辑、删除标签 | | | ✔️ | ✔️ | ✔️ |
|
||||
| 关闭、重新打开和分配所有议题与拉取请求 | | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| [针对拉取请求启用和禁用自动合并](/github/administering-a-repository/managing-auto-merge-for-pull-requests-in-your-repository) | | | ✔️ | ✔️ | ✔️ |
|
||||
| 应用里程碑 | | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| 标记[重复问题和拉取请求](/articles/about-duplicate-issues-and-pull-requests)| | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| 请求[拉取请求审查](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/requesting-a-pull-request-review) | | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| 合并[拉取请求](/github/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges) | | | ✔️ | ✔️ | ✔️ |
|
||||
| 推送到(写入)人员或团队的已分配仓库 | | | ✔️ | ✔️ | ✔️ |
|
||||
| 编辑和删除任何人对提交、拉取请求和议题的评论 | | | ✔️ | ✔️ | ✔️ |
|
||||
| [隐藏任何人的评论](/communities/moderating-comments-and-conversations/managing-disruptive-comments) | | | ✔️ | ✔️ | ✔️ |
|
||||
| [锁定对话](/communities/moderating-comments-and-conversations/locking-conversations) | | | ✔️ | ✔️ | ✔️ |
|
||||
| 转移问题(有关详细信息,请参阅“[将问题转移到其他存储库](/articles/transferring-an-issue-to-another-repository)”) | | | ✔️ | ✔️ | ✔️ |
|
||||
| [作为存储库的指定代码所有者](/articles/about-code-owners) | | | ✔️ | ✔️ | ✔️ |
|
||||
| [将拉取请求草稿标记为可供审查](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request) | | | ✔️ | ✔️ | ✔️ |
|
||||
| [将拉取请求转换为草稿](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request) | | | ✔️ | ✔️ | ✔️ |
|
||||
| 提交影响拉取请求可合并性的审查 | | | ✔️ | ✔️ | ✔️ |
|
||||
| [将建议的更改应用于](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/incorporating-feedback-in-your-pull-request)拉取请求 | | | ✔️ | ✔️ | ✔️ |
|
||||
| 创建[状态检查](/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks) | | | ✔️ | ✔️ | ✔️ |{% ifversion fpt or ghec %}
|
||||
| 创建、编辑、运行、重新运行和取消 [GitHub Actions 工作流](/actions/automating-your-workflow-with-github-actions/) | | | ✔️ | ✔️ | ✔️ |{% endif %}
|
||||
| 创建和编辑发行版 | | | ✔️ | ✔️ | ✔️ |
|
||||
| 查看发行版草稿 | | | ✔️ | ✔️ | ✔️ |
|
||||
| 编辑仓库的说明 | | | | ✔️ | ✔️ |{% ifversion fpt or ghae or ghec %}
|
||||
| [查看和安装包](/packages/publishing-and-managing-packages) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| [发布包](/packages/publishing-and-managing-packages/publishing-a-package) | | | ✔️ | ✔️ | ✔️ |
|
||||
| [删除和恢复包](/packages/learn-github-packages/deleting-and-restoring-a-package) | | | | | ✔️ | {% endif %}
|
||||
| 管理[主题](/articles/classifying-your-repository-with-topics) | | | | ✔️ | ✔️ |
|
||||
| 启用 wiki 和限制 wiki 编辑器 | | | | ✔️ | ✔️ |
|
||||
| 启用项目板 | | | | ✔️ | ✔️ |
|
||||
| 配置[拉取请求合并](/articles/configuring-pull-request-merges) | | | | ✔️ | ✔️ |
|
||||
| [为 {% data variables.product.prodname_pages %} 配置发布源](/articles/configuring-a-publishing-source-for-github-pages) | | | | ✔️ | ✔️ |
|
||||
| [管理分支保护规则](/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule) | | | | | ✔️ |
|
||||
| [推送到受保护的分支](/articles/about-protected-branches) | | | | ✔️ | ✔️ |
|
||||
| 合并受保护分支上的拉取请求(即使没有批准审查) | | | | | ✔️ |{% ifversion fpt or ghes > 3.4 or ghae-issue-6337 or ghec %}
|
||||
| 创建与[标记保护规则](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/configuring-tag-protection-rules)匹配的标记 | | | | ✔️ | ✔️ |
|
||||
| 删除与[标记保护规则](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/configuring-tag-protection-rules)匹配的标记 | | | | | ✔️ |{% endif %}
|
||||
| [创建和编辑存储库社交卡](/articles/customizing-your-repositorys-social-media-preview) | | | | ✔️ | ✔️ |{% ifversion fpt or ghec %}
|
||||
| 限制[存储库中的交互](/communities/moderating-comments-and-conversations/limiting-interactions-in-your-repository)| | | | ✔️ | ✔️ |{% endif %}
|
||||
| 删除问题(请参阅“[删除问题](/articles/deleting-an-issue)”) | | | | | ✔️ |
|
||||
| [定义存储库的代码所有者](/articles/about-code-owners) | | | | | ✔️ |
|
||||
| 将存储库添加到团队(有关详细信息,请参阅“[管理团队对组织存储库的访问](/organizations/managing-access-to-your-organizations-repositories/managing-team-access-to-an-organization-repository#giving-a-team-access-to-a-repository)”) | | | | | ✔️ |
|
||||
| [管理外部协作者对存储库的访问](/articles/adding-outside-collaborators-to-repositories-in-your-organization) | | | | | ✔️ |
|
||||
| [更改存储库的可见性](/articles/restricting-repository-visibility-changes-in-your-organization) | | | | | ✔️ |
|
||||
| 将存储库设为模板(请参阅“[创建模板存储库](/articles/creating-a-template-repository)”) | | | | | ✔️ |
|
||||
| 更改仓库设置 | | | | | ✔️ |
|
||||
| 管理团队和协作者对仓库的权限 | | | | | ✔️ |
|
||||
| 编辑仓库的默认分支 | | | | | ✔️ |
|
||||
| 重命名存储库的默认分支(请参阅“[重命名分支](/github/administering-a-repository/renaming-a-branch)”) | | | | | ✔️ |
|
||||
| 重命名存储库默认分支以外的其他分支(请参阅“[重命名分支](/github/administering-a-repository/renaming-a-branch)”) | | | ✔️ | ✔️ | ✔️ |
|
||||
| 管理 web 挂钩和部署密钥 | | | | | ✔️ |{% ifversion fpt or ghec %}
|
||||
| [管理专用存储库的数据使用设置](/get-started/privacy-on-github/managing-data-use-settings-for-your-private-repository) | | | | | ✔️ |{% endif %}
|
||||
| [管理存储库的分支创建策略](/github/administering-a-repository/managing-the-forking-policy-for-your-repository) | | | | | ✔️ |
|
||||
| [将存储库转移到组织中](/articles/restricting-repository-creation-in-your-organization) | | | | | ✔️ |
|
||||
| [从组织中删除或转移存储库](/articles/setting-permissions-for-deleting-or-transferring-repositories) | | | | | ✔️ |
|
||||
| [存档存储库](/articles/about-archiving-repositories) | | | | | ✔️ |{% ifversion fpt or ghec %}
|
||||
| 显示赞助按钮(请参阅“[在存储库中显示赞助按钮](/articles/displaying-a-sponsor-button-in-your-repository)”) | | | | | ✔️ |{% endif %}
|
||||
| 创建对外部资源的自动链接引用,例如 Jira 或 Zendesk(请参阅“[配置自动链接以引用外部资源](/articles/configuring-autolinks-to-reference-external-resources)”) | | | | | ✔️ |{% ifversion discussions %}
|
||||
| 在存储库中[启用 {% data variables.product.prodname_discussions %}](/github/administering-a-repository/enabling-or-disabling-github-discussions-for-a-repository) | | | | ✔️ | ✔️ |
|
||||
| 为 {% data variables.product.prodname_discussions %} [创建和编辑类别](/discussions/managing-discussions-for-your-community/managing-categories-for-discussions) | | | | ✔️ | ✔️ |
|
||||
| [将讨论移至其他类别](/discussions/managing-discussions-for-your-community/managing-discussions) | | | ✔️ | ✔️ | ✔️ |
|
||||
| [将讨论转移](/discussions/managing-discussions-for-your-community/managing-discussions)到新的存储库| | | ✔️ | ✔️ | ✔️ |
|
||||
| [管理置顶的讨论](/discussions/managing-discussions-for-your-community/managing-discussions) | | | ✔️ | ✔️ | ✔️ |
|
||||
| [将问题批量转化为讨论](/discussions/managing-discussions-for-your-community/managing-discussions) | | | ✔️ | ✔️ | ✔️ |
|
||||
| [锁定和解锁讨论](/discussions/managing-discussions-for-your-community/moderating-discussions) | | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| [单独将问题转化为讨论](/discussions/managing-discussions-for-your-community/moderating-discussions) | | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| [创建新讨论并对现有讨论发表评论](/discussions/collaborating-with-your-community-using-discussions/participating-in-a-discussion) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| [删除讨论](/discussions/managing-discussions-for-your-community/managing-discussions#deleting-a-discussion) | | ✔️ | | ✔️ | ✔️ |{% endif %}{% ifversion fpt or ghec %}
|
||||
| 创建[代码空间](/codespaces/about-codespaces) | | | ✔️ | ✔️ | ✔️ |{% endif %}
|
||||
| Manage [individual](/organizations/managing-access-to-your-organizations-repositories/managing-an-individuals-access-to-an-organization-repository), [team](/organizations/managing-access-to-your-organizations-repositories/managing-team-access-to-an-organization-repository), and [outside collaborator](/organizations/managing-access-to-your-organizations-repositories/adding-outside-collaborators-to-repositories-in-your-organization) access to the repository | | | | | **✔️** |
|
||||
| Pull from the person or team's assigned repositories | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| Fork the person or team's assigned repositories | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| Edit and delete their own comments | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| Open issues | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| Close issues they opened themselves | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| Reopen issues they closed themselves | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| Have an issue assigned to them | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| Send pull requests from forks of the team's assigned repositories | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| Submit reviews on pull requests | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| View published releases | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |{% ifversion fpt or ghec %}
|
||||
| View [GitHub Actions workflow runs](/actions/automating-your-workflow-with-github-actions/managing-a-workflow-run) | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |{% endif %}
|
||||
| Edit wikis in public repositories | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| Edit wikis in private repositories | | | **✔️** | **✔️** | **✔️** |{% ifversion fpt or ghec %}
|
||||
| [Report abusive or spammy content](/communities/maintaining-your-safety-on-github/reporting-abuse-or-spam) | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |{% endif %}
|
||||
| Apply/dismiss labels | | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| Create, edit, delete labels | | | **✔️** | **✔️** | **✔️** |
|
||||
| Close, reopen, and assign all issues and pull requests | | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| [Enable and disable auto-merge on a pull request](/github/administering-a-repository/managing-auto-merge-for-pull-requests-in-your-repository) | | | **✔️** | **✔️** | **✔️** |
|
||||
| Apply milestones | | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| Mark [duplicate issues and pull requests](/articles/about-duplicate-issues-and-pull-requests)| | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| Request [pull request reviews](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/requesting-a-pull-request-review) | | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| Merge a [pull request](/github/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges) | | | **✔️** | **✔️** | **✔️** |
|
||||
| Push to (write) the person or team's assigned repositories | | | **✔️** | **✔️** | **✔️** |
|
||||
| Edit and delete anyone's comments on commits, pull requests, and issues | | | **✔️** | **✔️** | **✔️** |
|
||||
| [Hide anyone's comments](/communities/moderating-comments-and-conversations/managing-disruptive-comments) | | | **✔️** | **✔️** | **✔️** |
|
||||
| [Lock conversations](/communities/moderating-comments-and-conversations/locking-conversations) | | | **✔️** | **✔️** | **✔️** |
|
||||
| Transfer issues (see "[Transferring an issue to another repository](/articles/transferring-an-issue-to-another-repository)" for details) | | | **✔️** | **✔️** | **✔️** |
|
||||
| [Act as a designated code owner for a repository](/articles/about-code-owners) | | | **✔️** | **✔️** | **✔️** |
|
||||
| [Mark a draft pull request as ready for review](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request) | | | **✔️** | **✔️** | **✔️** |
|
||||
| [Convert a pull request to a draft](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request) | | | **✔️** | **✔️** | **✔️** |
|
||||
| Submit reviews that affect a pull request's mergeability | | | **✔️** | **✔️** | **✔️** |
|
||||
| [Apply suggested changes](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/incorporating-feedback-in-your-pull-request) to pull requests | | | **✔️** | **✔️** | **✔️** |
|
||||
| Create [status checks](/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks) | | | **✔️** | **✔️** | **✔️** |{% ifversion fpt or ghec %}
|
||||
| Create, edit, run, re-run, and cancel [GitHub Actions workflows](/actions/automating-your-workflow-with-github-actions/) | | | **✔️** | **✔️** | **✔️** |{% endif %}
|
||||
| Create and edit releases | | | **✔️** | **✔️** | **✔️** |
|
||||
| View draft releases | | | **✔️** | **✔️** | **✔️** |
|
||||
| Edit a repository's description | | | | **✔️** | **✔️** |{% ifversion fpt or ghae or ghec %}
|
||||
| [View and install packages](/packages/publishing-and-managing-packages) | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| [Publish packages](/packages/publishing-and-managing-packages/publishing-a-package) | | | **✔️** | **✔️** | **✔️** |
|
||||
| [Delete and restore packages](/packages/learn-github-packages/deleting-and-restoring-a-package) | | | | | **✔️** | {% endif %}
|
||||
| Manage [topics](/articles/classifying-your-repository-with-topics) | | | | **✔️** | **✔️** |
|
||||
| Enable wikis and restrict wiki editors | | | | **✔️** | **✔️** |
|
||||
| Enable project boards | | | | **✔️** | **✔️** |
|
||||
| Configure [pull request merges](/articles/configuring-pull-request-merges) | | | | **✔️** | **✔️** |
|
||||
| Configure [a publishing source for {% data variables.product.prodname_pages %}](/articles/configuring-a-publishing-source-for-github-pages) | | | | **✔️** | **✔️** |
|
||||
| [Manage branch protection rules](/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule) | | | | | **✔️** |
|
||||
| [Push to protected branches](/articles/about-protected-branches) | | | | **✔️** | **✔️** |
|
||||
| Merge pull requests on protected branches, even if there are no approving reviews | | | | | **✔️** |{% ifversion fpt or ghes > 3.4 or ghae > 3.4 or ghec %}
|
||||
| Create tags that match a [tag protection rule](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/configuring-tag-protection-rules) | | | | **✔️** | **✔️** |
|
||||
| Delete tags that match a [tag protection rule](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/configuring-tag-protection-rules) | | | | | **✔️** |{% endif %}
|
||||
| [Create and edit repository social cards](/articles/customizing-your-repositorys-social-media-preview) | | | | **✔️** | **✔️** |{% ifversion fpt or ghec %}
|
||||
| Limit [interactions in a repository](/communities/moderating-comments-and-conversations/limiting-interactions-in-your-repository)| | | | **✔️** | **✔️** |{% endif %}
|
||||
| Delete an issue (see "[Deleting an issue](/articles/deleting-an-issue)") | | | | | **✔️** |
|
||||
| [Define code owners for a repository](/articles/about-code-owners) | | | | | **✔️** |
|
||||
| Add a repository to a team (see "[Managing team access to an organization repository](/organizations/managing-access-to-your-organizations-repositories/managing-team-access-to-an-organization-repository#giving-a-team-access-to-a-repository)" for details) | | | | | **✔️** |
|
||||
| [Manage outside collaborator access to a repository](/articles/adding-outside-collaborators-to-repositories-in-your-organization) | | | | | **✔️** |
|
||||
| [Change a repository's visibility](/articles/restricting-repository-visibility-changes-in-your-organization) | | | | | **✔️** |
|
||||
| Make a repository a template (see "[Creating a template repository](/articles/creating-a-template-repository)") | | | | | **✔️** |
|
||||
| Change a repository's settings | | | | | **✔️** |
|
||||
| Manage team and collaborator access to the repository | | | | | **✔️** |
|
||||
| Edit the repository's default branch | | | | | **✔️** |
|
||||
| Rename the repository's default branch (see "[Renaming a branch](/github/administering-a-repository/renaming-a-branch)") | | | | | **✔️** |
|
||||
| Rename a branch other than the repository's default branch (see "[Renaming a branch](/github/administering-a-repository/renaming-a-branch)") | | | **✔️** | **✔️** | **✔️** |
|
||||
| Manage webhooks and deploy keys | | | | | **✔️** |{% ifversion fpt or ghec %}
|
||||
| [Manage data use settings for your private repository](/get-started/privacy-on-github/managing-data-use-settings-for-your-private-repository) | | | | | **✔️** |{% endif %}
|
||||
| [Manage the forking policy for a repository](/github/administering-a-repository/managing-the-forking-policy-for-your-repository) | | | | | **✔️** |
|
||||
| [Transfer repositories into the organization](/articles/restricting-repository-creation-in-your-organization) | | | | | **✔️** |
|
||||
| [Delete or transfer repositories out of the organization](/articles/setting-permissions-for-deleting-or-transferring-repositories) | | | | | **✔️** |
|
||||
| [Archive repositories](/articles/about-archiving-repositories) | | | | | **✔️** |{% ifversion fpt or ghec %}
|
||||
| Display a sponsor button (see "[Displaying a sponsor button in your repository](/articles/displaying-a-sponsor-button-in-your-repository)") | | | | | **✔️** |{% endif %}
|
||||
| Create autolink references to external resources, like Jira or Zendesk (see "[Configuring autolinks to reference external resources](/articles/configuring-autolinks-to-reference-external-resources)") | | | | | **✔️** |{% ifversion discussions %}
|
||||
| [Enable {% data variables.product.prodname_discussions %}](/github/administering-a-repository/enabling-or-disabling-github-discussions-for-a-repository) in a repository | | | | **✔️** | **✔️** |
|
||||
| [Create and edit categories](/discussions/managing-discussions-for-your-community/managing-categories-for-discussions) for {% data variables.product.prodname_discussions %} | | | | **✔️** | **✔️** |
|
||||
| [Move a discussion to a different category](/discussions/managing-discussions-for-your-community/managing-discussions) | | | **✔️** | **✔️** | **✔️** |
|
||||
| [Transfer a discussion](/discussions/managing-discussions-for-your-community/managing-discussions) to a new repository| | | **✔️** | **✔️** | **✔️** |
|
||||
| [Manage pinned discussions](/discussions/managing-discussions-for-your-community/managing-discussions) | | | **✔️** | **✔️** | **✔️** |
|
||||
| [Convert issues to discussions in bulk](/discussions/managing-discussions-for-your-community/managing-discussions) | | | **✔️** | **✔️** | **✔️** |
|
||||
| [Lock and unlock discussions](/discussions/managing-discussions-for-your-community/moderating-discussions) | | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| [Individually convert issues to discussions](/discussions/managing-discussions-for-your-community/moderating-discussions) | | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| [Create new discussions and comment on existing discussions](/discussions/collaborating-with-your-community-using-discussions/participating-in-a-discussion) | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| [Delete a discussion](/discussions/managing-discussions-for-your-community/managing-discussions#deleting-a-discussion) | | **✔️** | | **✔️** | **✔️** |{% endif %}{% ifversion fpt or ghec %}
|
||||
| Create [codespaces](/codespaces/about-codespaces) | | | **✔️** | **✔️** | **✔️** |{% endif %}
|
||||
|
||||
### 安全功能的访问要求
|
||||
### Access requirements for security features
|
||||
|
||||
在本节中,您可以找到一些安全功能所需的访问权限,例如 {% data variables.product.prodname_advanced_security %} 功能。
|
||||
In this section, you can find the access required for security features, such as {% data variables.product.prodname_advanced_security %} features.
|
||||
|
||||
| 仓库操作 | 读取 | 会审 | 写入 | 维护 | 管理员 |
|
||||
| Repository action | Read | Triage | Write | Maintain | Admin |
|
||||
|:---|:---:|:---:|:---:|:---:|:---:|
|
||||
| 接收存储库中[不安全的依赖项的 {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/about-alerts-for-vulnerable-dependencies) | | | | | ✔️ |
|
||||
| [忽略 {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/viewing-and-updating-vulnerable-dependencies-in-your-repository) | | | | | ✔️ |{% ifversion ghes or ghae or ghec %}<!--Not available for FPT-->
|
||||
| [指定其他人员或团队接收安全警报](/github/administering-a-repository/managing-security-and-analysis-settings-for-your-repository#granting-access-to-security-alerts) | | | | | ✔️ |{% endif %}{% ifversion fpt or ghec %}
|
||||
| 创建[安全通告](/code-security/security-advisories/about-github-security-advisories) | | | | | ✔️ |{% endif %}{% ifversion ghes or ghae or ghec %} <!--Not available for FPT-->
|
||||
| 管理对 {% data variables.product.prodname_GH_advanced_security %} 功能的访问(请参阅“[管理组织的安全和分析设置](/organizations/keeping-your-organization-secure/managing-security-and-analysis-settings-for-your-organization)”) | | | | | ✔️ |{% endif %}{% ifversion fpt or ghec %}<!--Set at site-level for GHES and GHAE-->
|
||||
| 为专用存储库[启用依赖项关系图](/code-security/supply-chain-security/exploring-the-dependencies-of-a-repository) | | | | | ✔️ |{% endif %}{% ifversion ghes or ghae or ghec %}
|
||||
| [查看依赖项审查](/code-security/supply-chain-security/about-dependency-review) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |{% endif %}
|
||||
| [查看拉取请求上的 {% data variables.product.prodname_code_scanning %} 警报](/github/finding-security-vulnerabilities-and-errors-in-your-code/triaging-code-scanning-alerts-in-pull-requests) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| [列出、忽略和删除 {% data variables.product.prodname_code_scanning %} 警报](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-code-scanning-alerts-for-your-repository) | | | ✔️ | ✔️ | ✔️ |
|
||||
| [查看存储库中的 {% data variables.product.prodname_secret_scanning %} 警报](/github/administering-a-repository/managing-alerts-from-secret-scanning) | | | ✔️{% ifversion not ghae %}<sup>[1]</sup>{% endif %} | ✔️{% ifversion not ghae %}<sup>[1]</sup>{% endif %} | ✔️ |{% ifversion ghes or ghae or ghec %}<!--Not available for FPT-->
|
||||
| [解决、撤销或重新打开 {% data variables.product.prodname_secret_scanning %} 警报](/github/administering-a-repository/managing-alerts-from-secret-scanning) | | | ✔️{% ifversion not ghae %}<sup>[1]</sup>{% endif %} | ✔️{% ifversion not ghae %}<sup>[1]</sup>{% endif %} | ✔️ |{% endif %}{% ifversion ghes or ghae or ghec %}
|
||||
| [指定其他人员或团队接收存储库中的 {% data variables.product.prodname_secret_scanning %} 警报](/github/administering-a-repository/managing-security-and-analysis-settings-for-your-repository#granting-access-to-security-alerts) | | | | | ✔️ |{% endif %}
|
||||
| Receive [{% data variables.product.prodname_dependabot_alerts %} for insecure dependencies](/code-security/supply-chain-security/about-alerts-for-vulnerable-dependencies) in a repository | | | | | **✔️** |
|
||||
| [Dismiss {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/viewing-and-updating-vulnerable-dependencies-in-your-repository) | | | | | **✔️** |{% ifversion ghes or ghae or ghec %}<!--Not available for FPT-->
|
||||
| [Designate additional people or teams to receive security alerts](/github/administering-a-repository/managing-security-and-analysis-settings-for-your-repository#granting-access-to-security-alerts) | | | | | **✔️** |{% endif %}{% ifversion fpt or ghec %}
|
||||
| Create [security advisories](/code-security/security-advisories/about-github-security-advisories) | | | | | **✔️** |{% endif %}{% ifversion ghes or ghae or ghec %} <!--Not available for FPT-->
|
||||
| Manage access to {% data variables.product.prodname_GH_advanced_security %} features (see "[Managing security and analysis settings for your organization](/organizations/keeping-your-organization-secure/managing-security-and-analysis-settings-for-your-organization)") | | | | | **✔️** |{% endif %}{% ifversion fpt or ghec %}<!--Set at site-level for GHES and GHAE-->
|
||||
| [Enable the dependency graph](/code-security/supply-chain-security/exploring-the-dependencies-of-a-repository) for a private repository | | | | | **✔️** |{% endif %}{% ifversion ghes or ghae or ghec %}
|
||||
| [View dependency reviews](/code-security/supply-chain-security/about-dependency-review) | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |{% endif %}
|
||||
| [View {% data variables.product.prodname_code_scanning %} alerts on pull requests](/github/finding-security-vulnerabilities-and-errors-in-your-code/triaging-code-scanning-alerts-in-pull-requests) | **✔️** | **✔️** | **✔️** | **✔️** | **✔️** |
|
||||
| [List, dismiss, and delete {% data variables.product.prodname_code_scanning %} alerts](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-code-scanning-alerts-for-your-repository) | | | **✔️** | **✔️** | **✔️** |
|
||||
| [View {% data variables.product.prodname_secret_scanning %} alerts in a repository](/github/administering-a-repository/managing-alerts-from-secret-scanning) | | | **✔️**{% ifversion not ghae %}<sup>[1]</sup>{% endif %} | **✔️**{% ifversion not ghae %}<sup>[1]</sup>{% endif %} | **✔️** |{% ifversion ghes or ghae or ghec %}<!--Not available for FPT-->
|
||||
| [Resolve, revoke, or re-open {% data variables.product.prodname_secret_scanning %} alerts](/github/administering-a-repository/managing-alerts-from-secret-scanning) | | | **✔️**{% ifversion not ghae %}<sup>[1]</sup>{% endif %} | **✔️**{% ifversion not ghae %}<sup>[1]</sup>{% endif %} | **✔️** |{% endif %}{% ifversion ghes or ghae or ghec %}
|
||||
| [Designate additional people or teams to receive {% data variables.product.prodname_secret_scanning %} alerts](/github/administering-a-repository/managing-security-and-analysis-settings-for-your-repository#granting-access-to-security-alerts) in repositories | | | | | **✔️** |{% endif %}
|
||||
|
||||
[1] 仓库作者和维护者只能看到他们自己提交的警报信息。
|
||||
[1] Repository writers and maintainers can only see alert information for their own commits.
|
||||
|
||||
## 延伸阅读
|
||||
## Further reading
|
||||
|
||||
- [管理对组织存储库的访问](/articles/managing-access-to-your-organization-s-repositories)
|
||||
- [将外部协作者添加到组织中的存储库](/articles/adding-outside-collaborators-to-repositories-in-your-organization)
|
||||
- [组织的项目板权限](/articles/project-board-permissions-for-an-organization)
|
||||
- "[Managing access to your organization's repositories](/articles/managing-access-to-your-organization-s-repositories)"
|
||||
- "[Adding outside collaborators to repositories in your organization](/articles/adding-outside-collaborators-to-repositories-in-your-organization)"
|
||||
- "[Project board permissions for an organization](/articles/project-board-permissions-for-an-organization)"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 查看具有仓库访问权限的人员
|
||||
intro: '您可以查看{% ifversion ghec or ghes or ghae %} 和导出{% endif %} 拥有组织内仓库访问权限的人员列表。'
|
||||
title: Viewing people with access to your repository
|
||||
intro: 'You can view{% ifversion ghec or ghes or ghae %} and export{% endif %} a list of people with access to a repository within an organization.'
|
||||
redirect_from:
|
||||
- /articles/viewing-people-with-access-to-your-repository
|
||||
- /github/setting-up-and-managing-organizations-and-teams/viewing-people-with-access-to-your-repository
|
||||
@@ -14,34 +14,45 @@ topics:
|
||||
- Teams
|
||||
shortTitle: View people with access
|
||||
permissions: Organization owners can view people with access to a repository.
|
||||
ms.openlocfilehash: 01ee5b1844e32b4ba631fda67babaa9e9f8a982e
|
||||
ms.sourcegitcommit: fb047f9450b41b24afc43d9512a5db2a2b750a2a
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/11/2022
|
||||
ms.locfileid: '147066632'
|
||||
---
|
||||
## 关于有权访问您的存储库的人员列表
|
||||
|
||||
您可以使用此信息来帮助离职人员、收集合规性数据以及其他常规安全检查。
|
||||
## About the list of people with access to your repository
|
||||
|
||||
{% ifversion fpt %} 使用 {% data variables.product.prodname_ghe_cloud %} 的组织还可以导出有权访问存储库的人员的 CSV 列表。 有关详细信息,请参阅 [{% data variables.product.prodname_ghe_cloud %} 文档](/enterprise-cloud@latest/organizations/managing-access-to-your-organizations-repositories/viewing-people-with-access-to-your-repository)。
|
||||
You can use this information to help off-board people, gather data for compliance, and other general security checkups.
|
||||
|
||||
{% ifversion fpt %}
|
||||
Organizations that use {% data variables.product.prodname_ghe_cloud %} can also export a CSV list of people who have access to a repository. For more information, see [the {% data variables.product.prodname_ghe_cloud %} documentation](/enterprise-cloud@latest/organizations/managing-access-to-your-organizations-repositories/viewing-people-with-access-to-your-repository).
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5974 %}  {% else %}  {% endif %}
|
||||
## 查看具有仓库访问权限的人员
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||

|
||||
{% else %}
|
||||

|
||||
{% endif %}
|
||||
## Viewing people with access to your repository
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5974 %} 你可以在存储库设置中查看团队和具有存储库访问权限的团队和人员的组合概述。 有关详细信息,请参阅“[管理有权访问存储库的团队和人员](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository#about-access-management-for-repositories)”。 {% else %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.accessing-repository-graphs %} {% data reusables.repositories.accessing-repository-people %} {% endif %}
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
You can see a combined overview of teams and people with access to your repository in your repository settings. For more information, see "[Managing teams and people with access to your repository](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository#about-access-management-for-repositories)."
|
||||
{% else %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.accessing-repository-graphs %}
|
||||
{% data reusables.repositories.accessing-repository-people %}
|
||||
{% endif %}
|
||||
|
||||
{% ifversion ghec or ghes or ghae %}
|
||||
## 导出具有您的仓库访问权限人员的列表
|
||||
## Exporting a list of people with access to your repository
|
||||
|
||||
{% ifversion ghec %} {% note %}
|
||||
{% ifversion ghec %}
|
||||
{% note %}
|
||||
|
||||
**注意:** 只有使用 {% data variables.product.prodname_ghe_cloud %} 的组织才能导出有权访问存储库的人员列表。 {% data reusables.enterprise.link-to-ghec-trial %}
|
||||
**Note:** Only organizations that use {% data variables.product.prodname_ghe_cloud %} can export a list of people with access to a repository. {% data reusables.enterprise.link-to-ghec-trial %}
|
||||
|
||||
{% endnote %} {% endif %}
|
||||
{% endnote %}
|
||||
{% endif %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.accessing-repository-graphs %} {% data reusables.repositories.accessing-repository-people %}
|
||||
4. 单击“导出 CSV”。
|
||||
 {% endif %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.accessing-repository-graphs %}
|
||||
{% data reusables.repositories.accessing-repository-people %}
|
||||
4. Click **Export CSV**.
|
||||

|
||||
{% endif %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: '在组织中禁用{% ifversion projects-v2 %}项目{% else %}项目板{% endif %}'
|
||||
intro: '组织所有者可以在组织中关闭{% ifversion projects-v2 %}组织范围的{% data variables.projects.projects_v2 %}、组织范围的{% data variables.projects.projects_v1_boards %}和存储库级别的{% data variables.projects.projects_v1_boards %}{% else %}组织范围的项目板和存储库项目板{% endif %}。'
|
||||
title: 'Disabling {% ifversion projects-v2 %}projects{% else %}project boards{% endif %} in your organization'
|
||||
intro: 'Organization owners can turn off {% ifversion projects-v2 %}organization-wide {% data variables.projects.projects_v2 %}, organization-wide {% data variables.projects.projects_v1_boards %}, and repository-level {% data variables.projects.projects_v1_boards %}{% else %}organization-wide project boards and repository project boards{% endif %} in an organization.'
|
||||
redirect_from:
|
||||
- /github/managing-your-work-on-github/managing-project-boards/disabling-project-boards-in-your-organization
|
||||
- /articles/disabling-project-boards-in-your-organization
|
||||
@@ -14,36 +14,32 @@ topics:
|
||||
- Pull requests
|
||||
shortTitle: Disable projects
|
||||
allowTitleToDifferFromFilename: true
|
||||
ms.openlocfilehash: e1e2aed1e7c689bee83dabc4a6750f8976206f4a
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147423322'
|
||||
---
|
||||
禁用组织范围的项目板后,将无法在组织级别创建新的项目板,并且将无法通过其先前的 URL 访问任何现有组织级别项目板。 组织仓库中的项目板不受影响。 {% ifversion projects-v2 %}这些设置适用于 {% data variables.projects.projects_v2 %} 和 {% data variables.projects.projects_v1_boards %}。{% endif %}
|
||||
After you disable organization-wide project boards, it won’t be possible to create new project boards at the organization level, and any existing organization-level project boards will become inaccessible at their previous URLs. Project boards in repositories in the organization are not affected. {% ifversion projects-v2 %}These settings apply to {% data variables.projects.projects_v2 %} and {% data variables.projects.projects_v1_boards %}.{% endif %}
|
||||
|
||||
在组织中禁用仓库项目板后,将无法在任何组织仓库中创建新项目板,并且将无法通过其先前的 URL 访问组织仓库中的任何现有项目板。 组织级别的项目板不受影响。
|
||||
After you disable repository project boards in an organization, it won't be possible to create new project boards in any repositories in the organization, and any existing project boards in repositories in the organization will become inaccessible at their previous URLs. Project boards at the organization level are not affected.
|
||||
|
||||
|
||||
禁用项目板后,在时间表或[审核日志](/organizations/keeping-your-organization-secure/reviewing-the-audit-log-for-your-organization)中将不再看到项目板信息。
|
||||
When you disable project boards, you will no longer see project board information in timelines or [audit logs](/organizations/keeping-your-organization-secure/reviewing-the-audit-log-for-your-organization).
|
||||
|
||||
|
||||
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5658 %}
|
||||
1. 在边栏的“代码规划和自动化”部分,单击“{% octicon "table" aria-label="The table icon" %} 项目”。
|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.profile.org_settings %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
1. In the "Code planning, and automation" section of the sidebar, click **{% octicon "table" aria-label="The table icon" %} Projects**.
|
||||
{% endif %}
|
||||
1. 决定是否禁用组织范围的项目板,禁用组织中的仓库项目板,或两者均禁用。 然后,在“项目”(项目)下:
|
||||
- 若要禁用组织范围的项目板,请取消选择“启用组织的项目”。
|
||||
- 若要在组织中禁用存储库项目板,请取消选择“启用所有存储库的项目”。
|
||||

|
||||
1. 单击“ **保存**”。
|
||||
1. Decide whether to disable organization-wide project boards, disable repository project boards in the organization, or both. Then, under "Projects":
|
||||
- To disable organization-wide project boards, unselect **Enable projects for the organization**.
|
||||
- To disable repository project boards in the organization, unselect **Enable projects for all repositories**.
|
||||

|
||||
1. Click **Save**.
|
||||
|
||||
{% data reusables.organizations.disable_project_board_results %}
|
||||
|
||||
## 延伸阅读
|
||||
## Further reading
|
||||
|
||||
{% ifversion projects-v2 %}- [关于 {% data variables.product.prodname_projects_v2 %}](/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects){% endif %}
|
||||
- [关于 {% data variables.product.prodname_projects_v1 %}](/articles/about-project-boards)
|
||||
- [关闭 {% data variables.projects.projects_v1_board %}](/articles/closing-a-project-board)
|
||||
- [删除 {% data variables.projects.projects_v1_board %}](/articles/deleting-a-project-board)
|
||||
- [禁用 {% data variables.projects.projects_v1_boards %} in a repository](/articles/disabling-project-boards-in-a-repository)
|
||||
{% ifversion projects-v2 %}- "[About {% data variables.product.prodname_projects_v2 %}](/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)"{% endif %}
|
||||
- "[About {% data variables.product.prodname_projects_v1 %}](/articles/about-project-boards)"
|
||||
- "[Closing a {% data variables.projects.projects_v1_board %}](/articles/closing-a-project-board)"
|
||||
- "[Deleting a {% data variables.projects.projects_v1_board %}](/articles/deleting-a-project-board)"
|
||||
- "[Disabling {% data variables.projects.projects_v1_boards %} in a repository](/articles/disabling-project-boards-in-a-repository)"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 集成 Jira 与组织项目板
|
||||
intro: 您可以将 Jira Cloud 与组织帐户集成,以扫描提交和拉取请求,在任何提及的 Jira 议题中创建相关的元数据和超链接。
|
||||
title: Integrating Jira with your organization project board
|
||||
intro: 'You can integrate Jira Cloud with your organization account to scan commits and pull requests, creating relevant metadata and hyperlinks in any mentioned Jira issues.'
|
||||
redirect_from:
|
||||
- /articles/integrating-jira-with-your-organization-project-board
|
||||
- /github/setting-up-and-managing-organizations-and-teams/integrating-jira-with-your-organization-project-board
|
||||
@@ -8,33 +8,31 @@ versions:
|
||||
ghes: '*'
|
||||
ghae: '*'
|
||||
shortTitle: Integrate Jira
|
||||
ms.openlocfilehash: 0b773dc865373ab006f7c596b50ac81af5d6636a
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '145109460'
|
||||
---
|
||||
{% ifversion ghes > 3.4 or ghae-issue-5658 %} {% data reusables.profile.access_org %} {% data reusables.profile.org_settings %}
|
||||
1. 在左侧边栏中,选择“{% octicon "code" aria-label="The code icon" %} 开发人员设置”,然后单击“OAuth 应用” 。
|
||||

|
||||
1. 单击“新建 OAuth 应用”。
|
||||
{% else %} {% data reusables.user-settings.access_settings %}
|
||||
1. 在左侧边栏的“组织设置”下,单击组织的名称。
|
||||

|
||||
1. 在左侧边栏中的“开发人员设置”下,单击“OAuth 应用程序” 。
|
||||

|
||||
1. 单击“注册新应用程序”。
|
||||
{% ifversion ghes > 3.4 or ghae > 3.4 %}
|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.profile.org_settings %}
|
||||
1. In the left sidebar, select **{% octicon "code" aria-label="The code icon" %} Developer settings**, then click **OAuth Apps**.
|
||||

|
||||
1. Click **New OAuth App**.
|
||||
{% else %}
|
||||
{% data reusables.user-settings.access_settings %}
|
||||
1. In the left sidebar under **Organization settings**, click the name of your organization.
|
||||

|
||||
1. In the left sidebar under **Developer settings**, click **OAuth applications**.
|
||||

|
||||
1. Click **Register a new application**.
|
||||
{% endif %}
|
||||
1. 在“应用程序名称”下,键入“Jira”。
|
||||
2. 在“主页 URL”下,键入 Jira 实例的完整 URL。
|
||||
3. 在“授权回叫 URL”下,键入 Jira 实例的完整 URL。
|
||||
4. 单击“注册应用程序”。
|
||||

|
||||
9. 在“组织拥有的应用程序”下,记下“客户端 ID”和“客户端密码”值。
|
||||
 {% data reusables.user-settings.jira_help_docs %}
|
||||
1. Under **Application name**, type "Jira".
|
||||
2. Under **Homepage URL**, type the full URL to your Jira instance.
|
||||
3. Under **Authorization callback URL**, type the full URL to your Jira instance.
|
||||
4. Click **Register application**.
|
||||

|
||||
9. Under **Organization owned applications**, note the "Client ID" and "Client Secret" values.
|
||||

|
||||
{% data reusables.user-settings.jira_help_docs %}
|
||||
|
||||
## 延伸阅读
|
||||
## Further reading
|
||||
|
||||
- [将 Jira 与个人项目集成](/articles/integrating-jira-with-your-personal-projects)
|
||||
- <a href="https://confluence.atlassian.com/adminjiracloud/connect-jira-cloud-to-github-814188429.html" data-proofer-ignore>将 Jira Cloud 连接到 GitHub</a>(Atlassian 文档)
|
||||
- ["Integrating Jira with your personal projects"](/articles/integrating-jira-with-your-personal-projects)
|
||||
- <a href="https://confluence.atlassian.com/adminjiracloud/connect-jira-cloud-to-github-814188429.html" data-proofer-ignore>Connect Jira Cloud to GitHub</a> (Atlassian documentation)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 管理组织中的安全管理员
|
||||
intro: 通过将团队分配给安全管理员角色,您可以为安全团队提供他们对组织所需的最少访问权限。
|
||||
title: Managing security managers in your organization
|
||||
intro: You can give your security team the least access they need to your organization by assigning a team to the security manager role.
|
||||
versions:
|
||||
feature: security-managers
|
||||
topics:
|
||||
@@ -8,48 +8,48 @@ topics:
|
||||
- Teams
|
||||
shortTitle: Security manager role
|
||||
permissions: Organization owners can assign the security manager role.
|
||||
ms.openlocfilehash: c29dd20a123ccb20a32d40896064e11d59643bd9
|
||||
ms.sourcegitcommit: 80842b4e4c500daa051eff0ccd7cde91c2d4bb36
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/12/2022
|
||||
ms.locfileid: '145065962'
|
||||
---
|
||||
|
||||
{% data reusables.organizations.security-manager-beta-note %}
|
||||
|
||||
{% data reusables.organizations.about-security-managers %}
|
||||
|
||||
## 安全管理员角色的权限
|
||||
## Permissions for the security manager role
|
||||
|
||||
具有安全管理员角色的团队成员仅具有有效管理组织安全性所需的权限。
|
||||
Members of a team with the security manager role have only the permissions required to effectively manage security for the organization.
|
||||
|
||||
- 除了任何现有的存储库访问外,还可以读取组织中的所有存储库
|
||||
- 对组织中所有安全警报的写入访问权限 {% ifversion not fpt %}
|
||||
- 访问组织的安全概述 {% endif %}
|
||||
- 能够在组织级配置安全设置{% ifversion not fpt %},包括启用或禁用 {% data variables.product.prodname_GH_advanced_security %}{% endif %}
|
||||
- 能够在存储库级配置安全设置{% ifversion not fpt %},包括启用或禁用 {% data variables.product.prodname_GH_advanced_security %}{% endif %}
|
||||
- Read access on all repositories in the organization, in addition to any existing repository access
|
||||
- Write access on all security alerts in the organization {% ifversion not fpt %}
|
||||
- Access to the organization's security overview {% endif %}
|
||||
- The ability to configure security settings at the organization level{% ifversion not fpt %}, including the ability to enable or disable {% data variables.product.prodname_GH_advanced_security %}{% endif %}
|
||||
- The ability to configure security settings at the repository level{% ifversion not fpt %}, including the ability to enable or disable {% data variables.product.prodname_GH_advanced_security %}{% endif %}
|
||||
|
||||
{% ifversion fpt %} 其他功能(包括组织的安全概述)在将 {% data variables.product.prodname_ghe_cloud %} 与 {% data variables.product.prodname_advanced_security %} 一起使用的组织中可用。 有关详细信息,请参阅 [{% data variables.product.prodname_ghe_cloud %} 文档](/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization)。
|
||||
{% ifversion fpt %}
|
||||
Additional functionality, including a security overview for the organization, is available in organizations that use {% data variables.product.prodname_ghe_cloud %} with {% data variables.product.prodname_advanced_security %}. For more information, see the [{% data variables.product.prodname_ghe_cloud %} documentation](/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization).
|
||||
{% endif %}
|
||||
|
||||
如果团队具有安全管理员角色,则对团队和特定存储库具有管理员访问权限的人员可以更改团队对该存储库的访问级别,但不能删除访问权限。 有关详细信息,请参阅“[管理团队对组织存储库的访问](/organizations/managing-access-to-your-organizations-repositories/managing-team-access-to-an-organization-repository){% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5974 %}”和“[管理有权访问存储库的团队和人员](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository)”。{% else %}."{% endif %}
|
||||
If a team has the security manager role, people with admin access to the team and a specific repository can change the team's level of access to that repository but cannot remove the access. For more information, see "[Managing team access to an organization repository](/organizations/managing-access-to-your-organizations-repositories/managing-team-access-to-an-organization-repository){% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}" and "[Managing teams and people with access to your repository](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository)."{% else %}."{% endif %}
|
||||
|
||||

|
||||

|
||||
|
||||
## 将安全管理员角色分配给组织中的团队
|
||||
您可以将安全管理员角色分配给组织中最多 10 个团队。
|
||||
## Assigning the security manager role to a team in your organization
|
||||
You can assign the security manager role to a maximum of 10 teams in your organization.
|
||||
|
||||
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.organizations.security-and-analysis %}
|
||||
1. 在“安全管理员”下,搜索并选择要授予该角色的团队。 您选择的每个团队都将显示在搜索栏下方的列表中。
|
||||

|
||||
## 从组织中的团队中删除安全管理员角色
|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.profile.org_settings %}
|
||||
{% data reusables.organizations.security-and-analysis %}
|
||||
1. Under **Security managers**, search for and select the team to give the role. Each team you select will appear in a list below the search bar.
|
||||

|
||||
## Removing the security manager role from a team in your organization
|
||||
|
||||
{% warning %}
|
||||
|
||||
警告:从团队中删除安全管理员角色将删除团队在整个组织中管理安全警报和设置的能力,但团队将保留对分配角色时授予的存储库读取访问权限。 您必须手动删除任何不需要的读取访问权限。 有关详细信息,请参阅“[管理团队对组织存储库的访问](/organizations/managing-access-to-your-organizations-repositories/managing-team-access-to-an-organization-repository#removing-a-teams-access-to-a-repository)”。
|
||||
**Warning:** Removing the security manager role from a team will remove the team's ability to manage security alerts and settings across the organization, but the team will retain read access to repositories that was granted when the role was assigned. You must remove any unwanted read access manually. For more information, see "[Managing team access to an organization repository](/organizations/managing-access-to-your-organizations-repositories/managing-team-access-to-an-organization-repository#removing-a-teams-access-to-a-repository)."
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.organizations.security-and-analysis %}
|
||||
1. 在“安全管理员”下,在要删除为安全管理员的团队右侧,单击“{% octicon "x" aria-label="The X icon" %}”。
|
||||

|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.profile.org_settings %}
|
||||
{% data reusables.organizations.security-and-analysis %}
|
||||
1. Under **Security managers**, to the right of the team you want to remove as security managers, click {% octicon "x" aria-label="The X icon" %}.
|
||||

|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 管理团队的代码审查设置
|
||||
intro: 您可以通过在请求团队审阅拉取请求时限制通知来减少团队的干扰。
|
||||
title: Managing code review settings for your team
|
||||
intro: You can decrease noise for your team by limiting notifications when your team is requested to review a pull request.
|
||||
redirect_from:
|
||||
- /github/setting-up-and-managing-organizations-and-teams/managing-code-review-assignment-for-your-team
|
||||
- /organizations/organizing-members-into-teams/managing-code-review-assignment-for-your-team
|
||||
@@ -15,78 +15,89 @@ topics:
|
||||
- Teams
|
||||
shortTitle: Code review settings
|
||||
permissions: Team maintainers and organization owners can configure code review settings.
|
||||
ms.openlocfilehash: 701ebf6a2306a8c8a734905d752c4b44c225ace6
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '146180165'
|
||||
---
|
||||
## 关于代码审查设置
|
||||
|
||||
{% ifversion only-notify-requested-members %} 为减少团队的干扰并阐明拉取请求审查的个人责任,可配置代码审查设置。
|
||||
|
||||
- 团队通知
|
||||
- 自动分配
|
||||
|
||||
## 关于团队通知
|
||||
|
||||
如果选择仅通知请求的团队成员,则在请求团队审阅拉取请求时,如果还请求审阅整个团队的特定成员,则可以禁用向整个团队发送通知。 当存储库将团队配置为代码所有者时,这尤其有用,但存储库的参与者通常知道作为其拉取请求的正确审查者的特定个人。 有关详细信息,请参阅“[关于代码所有者](/github/creating-cloning-and-archiving-repositories/about-code-owners)”。
|
||||
|
||||
## 关于自动分配
|
||||
{% endif %}
|
||||
|
||||
启用自动分配后,每当请求您的团队审阅拉取请求时,该团队都会被删除为审阅者,并且会在团队的位置分配指定的团队成员子集。 代码审查分配允许您决定在请求团队审查时是通知整个团队,还是只通知一部分团队成员。
|
||||
|
||||
当自动请求代码所有者进行审阅时,除非将分支保护规则配置为要求代码所有者进行审阅,否则仍将删除团队并将其替换为个人。 如果存在此类分支保护规则,则无法删除团队请求,因此还会显示单个请求。
|
||||
|
||||
### 路由算法
|
||||
|
||||
代码审查分配根据两种可能的算法之一自动选择和分配审查者。
|
||||
|
||||
循环算法根据最近收到最少审查请求的人员选择审查者,侧重于在团队所有成员之间的轮替,而不管他们目前拥有多少未完成的审查。
|
||||
|
||||
负载平衡算法根据每个成员最近的审查请求总数选择审查者,并考虑每个成员未完成的审查数。 负载平衡算法努力确保每个团队成员在任意 30 天内审查相同数量的拉取请求。
|
||||
|
||||
任何将状态设置为“忙碌”的团队成员将不会被选中进行审核。 如果所有团队成员都忙碌,拉取请求仍将分配给团队本身。 有关用户状态的详细信息,请参阅“[设置状态](/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/personalizing-your-profile#setting-a-status)”。
|
||||
## About code review settings
|
||||
|
||||
{% ifversion only-notify-requested-members %}
|
||||
## 配置团队通知
|
||||
To reduce noise for your team and clarify individual responsibility for pull request reviews, you can configure code review settings.
|
||||
|
||||
{% data reusables.profile.access_org %} {% data reusables.user-settings.access_org %} {% data reusables.organizations.specific_team %} {% data reusables.organizations.team_settings %} {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5658 %}
|
||||
1. 在左侧边栏中,单击“{% octicon "code-review" aria-label="The code-review icon" %} 代码审查”。
|
||||
{% else %}
|
||||
1. 在左侧边栏中,单击“代码审查”
|
||||
 {% endif %}
|
||||
1. 选择“仅通知请求的团队成员。”
|
||||

|
||||
1. 单击“保存更改”。
|
||||
- Team notifications
|
||||
- Auto assignment
|
||||
|
||||
## About team notifications
|
||||
|
||||
When you choose to only notify requested team members, you disable sending notifications to the entire team when the team is requested to review a pull request if a specific member of that team is also requested for review. This is especially useful when a repository is configured with teams as code owners, but contributors to the repository often know a specific individual that would be the correct reviewer for their pull request. For more information, see "[About code owners](/github/creating-cloning-and-archiving-repositories/about-code-owners)."
|
||||
|
||||
## About auto assignment
|
||||
{% endif %}
|
||||
|
||||
## 配置自动分配
|
||||
{% data reusables.profile.access_org %} {% data reusables.user-settings.access_org %} {% data reusables.organizations.specific_team %} {% data reusables.organizations.team_settings %} {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5658 %}
|
||||
1. 在左侧边栏中,单击“{% octicon "code-review" aria-label="The code-review icon" %} 代码审查”。
|
||||
{% else %}
|
||||
1. 在左侧边栏中,单击“代码审查”
|
||||
 {% endif %}
|
||||
1. 选择“启用自动分配”。
|
||||

|
||||
1. 在“How many team members should be assigned to review?(应分配多少团队成员进行审查?)”下,使用下拉菜单选择多个要分配给每个拉取请求的审查者。
|
||||

|
||||
1. 在“Routing algorithm(路由算法)”下,使用下拉菜单选择要使用的算法。 有关详细信息,请参阅“[路由算法](#routing-algorithms)”。
|
||||

|
||||
1. (可选)要始终跳过某些团队成员,请选择“永不分配某些团队成员”。 然后,选择要始终跳过的一个或多个团队成员。
|
||||
 {% ifversion ghes < 3.4 %}
|
||||
1. (可选)要对每个拉取请求审查只通知代码审查分配所选择的团队成员,在“通知”下选择“分配团队成员时不通知整个团队”。
|
||||
{%- endif %} {% ifversion fpt or ghec or ghae-issue-5108 or ghes > 3.2 %}
|
||||
1. (可选)在分配请求时,要将子团队成员作为潜在审查者,请选择“子团队成员”。
|
||||
1. (可选)要根据可分配的成员总数计算已请求审查的成员,选择“计算现有请求”。
|
||||
1. (可选)在分配团队成员时,要从团队中删除审查请求,请选择“团队审查请求”。
|
||||
{%- endif %}
|
||||
1. 单击“保存更改”。
|
||||
When you enable auto assignment, any time your team has been requested to review a pull request, the team is removed as a reviewer and a specified subset of team members are assigned in the team's place. Code review assignments allow you to decide whether the whole team or just a subset of team members are notified when a team is requested for review.
|
||||
|
||||
## 禁用自动分配
|
||||
{% data reusables.profile.access_org %} {% data reusables.user-settings.access_org %} {% data reusables.organizations.specific_team %} {% data reusables.organizations.team_settings %}
|
||||
1. 选择“启用自动分配”以删除复选标记。
|
||||

|
||||
1. 单击“保存更改”。
|
||||
When code owners are automatically requested for review, the team is still removed and replaced with individuals unless a branch protection rule is configured to require review from code owners. If such a branch protection rule is in place, the team request cannot be removed and so the individual request will appear in addition.
|
||||
|
||||
### Routing algorithms
|
||||
|
||||
Code review assignments automatically choose and assign reviewers based on one of two possible algorithms.
|
||||
|
||||
The round robin algorithm chooses reviewers based on who's received the least recent review request, focusing on alternating between all members of the team regardless of the number of outstanding reviews they currently have.
|
||||
|
||||
The load balance algorithm chooses reviewers based on each member's total number of recent review requests and considers the number of outstanding reviews for each member. The load balance algorithm tries to ensure that each team member reviews an equal number of pull requests in any 30 day period.
|
||||
|
||||
Any team members that have set their status to "Busy" will not be selected for review. If all team members are busy, the pull request will remain assigned to the team itself. For more information about user statuses, see "[Setting a status](/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/personalizing-your-profile#setting-a-status)."
|
||||
|
||||
{% ifversion only-notify-requested-members %}
|
||||
## Configuring team notifications
|
||||
|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.user-settings.access_org %}
|
||||
{% data reusables.organizations.specific_team %}
|
||||
{% data reusables.organizations.team_settings %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
1. In the left sidebar, click **{% octicon "code-review" aria-label="The code-review icon" %} Code review**.
|
||||
{% else %}
|
||||
1. In the left sidebar, click **Code review**
|
||||

|
||||
{% endif %}
|
||||
1. Select **Only notify requested team members.**
|
||||

|
||||
1. Click **Save changes**.
|
||||
{% endif %}
|
||||
|
||||
## Configuring auto assignment
|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.user-settings.access_org %}
|
||||
{% data reusables.organizations.specific_team %}
|
||||
{% data reusables.organizations.team_settings %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
1. In the left sidebar, click **{% octicon "code-review" aria-label="The code-review icon" %} Code review**.
|
||||
{% else %}
|
||||
1. In the left sidebar, click **Code review**
|
||||

|
||||
{% endif %}
|
||||
1. Select **Enable auto assignment**.
|
||||

|
||||
1. Under "How many team members should be assigned to review?", use the drop-down menu and choose a number of reviewers to be assigned to each pull request.
|
||||

|
||||
1. Under "Routing algorithm", use the drop-down menu and choose which algorithm you'd like to use. For more information, see "[Routing algorithms](#routing-algorithms)."
|
||||

|
||||
1. Optionally, to always skip certain members of the team, select **Never assign certain team members**. Then, select one or more team members you'd like to always skip.
|
||||

|
||||
{% ifversion ghes < 3.4 %}
|
||||
1. Optionally, to only notify the team members chosen by code review assignment for each pull review request, under "Notifications" select **If assigning team members, don't notify the entire team.**
|
||||
{%- endif %}
|
||||
{% ifversion fpt or ghec or ghae > 3.3 or ghes > 3.2 %}
|
||||
1. Optionally, to include members of child teams as potential reviewers when assigning requests, select **Child team members**.
|
||||
1. Optionally, to count any members whose review has already been requested against the total number of members to assign, select **Count existing requests**.
|
||||
1. Optionally, to remove the review request from the team when assigning team members, select **Team review request**.
|
||||
{%- endif %}
|
||||
1. Click **Save changes**.
|
||||
|
||||
## Disabling auto assignment
|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.user-settings.access_org %}
|
||||
{% data reusables.organizations.specific_team %}
|
||||
{% data reusables.organizations.team_settings %}
|
||||
1. Select **Enable auto assignment** to remove the checkmark.
|
||||

|
||||
1. Click **Save changes**.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 创建和删除仓库中的分支
|
||||
intro: '您可以直接在 {% data variables.product.product_name %} 上创建或删除分支。'
|
||||
title: Creating and deleting branches within your repository
|
||||
intro: 'You can create or delete branches directly on {% data variables.product.product_name %}.'
|
||||
redirect_from:
|
||||
- /github/collaborating-with-issues-and-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-and-deleting-branches-within-your-repository
|
||||
- /articles/deleting-branches-in-a-pull-request
|
||||
@@ -14,70 +14,69 @@ versions:
|
||||
topics:
|
||||
- Pull requests
|
||||
shortTitle: Create & delete branches
|
||||
ms.openlocfilehash: 44b56d8a1884e5cbfe0832f291cdc244b57a3810
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147526628'
|
||||
---
|
||||
## 创建分支
|
||||
可以在 {% data variables.product.product_name %} 上以不同的方式创建分支。
|
||||
|
||||
## Creating a branch
|
||||
You can create a branch in different ways on {% data variables.product.product_name %}.
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:只能在具有推送访问权限的存储库中创建分支。
|
||||
**Note:** You can only create a branch in a repository to which you have push access.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
{% ifversion create-branch-from-overview %}
|
||||
### 通过分支概述创建分支
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.navigate-to-branches %}
|
||||
1. 单击“新建分支”。
|
||||

|
||||
2. 在对话框中,输入分支名称,并可选择性地更改分支源。
|
||||
如果存储库是一个分支,还可以选择上游存储库作为分支源。
|
||||

|
||||
3. 单击“创建分支”。
|
||||
 {% endif %}
|
||||
|
||||
### 使用分支下拉列表创建分支
|
||||
### Creating a branch via the branches overview
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
1. (可选)如果要从存储库的默认分支以外的分支创建新分支,请单击“{% octicon "git-branch" aria-label="The branch icon" %} 分支”,然后选择另一个分支。
|
||||

|
||||
1. 单击分支选择器菜单。
|
||||

|
||||
1. 键入新分支的唯一名称,然后选择“创建分支”。
|
||||

|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 %}
|
||||
### 为问题创建分支
|
||||
可以创建一个分支以直接从问题页面处理问题,方便快捷。 有关详细信息,请参阅“[创建分支以处理问题](/issues/tracking-your-work-with-issues/creating-a-branch-for-an-issue)”。
|
||||
{% data reusables.repositories.navigate-to-branches %}
|
||||
1. Click **New branch**.
|
||||

|
||||
2. In the dialog box, enter the branch name and optionally change the branch source.
|
||||
If the repository is a fork, you also have the option to select the upstream repository as the branch source.
|
||||

|
||||
3. Click **Create branch**.
|
||||

|
||||
{% endif %}
|
||||
|
||||
## 删除分支
|
||||
### Creating a branch using the branch dropdown
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
1. Optionally, if you want to create the new branch from a branch other than the default branch of the repository, click {% octicon "git-branch" aria-label="The branch icon" %} **Branches** then choose another branch.
|
||||

|
||||
1. Click the branch selector menu.
|
||||

|
||||
1. Type a unique name for your new branch, then select **Create branch**.
|
||||

|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 %}
|
||||
### Creating a branch for an issue
|
||||
You can create a branch to work on an issue directly from the issue page and get started right away. For more information, see "[Creating a branch to work on an issue](/issues/tracking-your-work-with-issues/creating-a-branch-for-an-issue)".
|
||||
{% endif %}
|
||||
|
||||
## Deleting a branch
|
||||
|
||||
{% data reusables.pull_requests.automatically-delete-branches %}
|
||||
|
||||
{% note %}
|
||||
|
||||
**注意:** 如果要删除的分支是存储库的默认分支,则在删除该分支之前必须选择新的默认分支。 有关详细信息,请参阅“[更改默认分支](/github/administering-a-repository/changing-the-default-branch)”。
|
||||
**Note:** If the branch you want to delete is the repository's default branch, you must choose a new default branch before deleting the branch. For more information, see "[Changing the default branch](/github/administering-a-repository/changing-the-default-branch)."
|
||||
|
||||
{% endnote %}
|
||||
|
||||
如果要删除的分支与打开的拉取请求关联,则在删除该分支之前必须合并或关闭拉取请求。 有关详细信息,请参阅“[合并拉取请求](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request)”或“[关闭拉取请求](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/closing-a-pull-request)”。
|
||||
If the branch you want to delete is associated with an open pull request, you must merge or close the pull request before deleting the branch. For more information, see "[Merging a pull request](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request)" or "[Closing a pull request](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/closing-a-pull-request)."
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.navigate-to-branches %}
|
||||
1. 滚动到要删除的分支,然后单击 {% octicon "trash" aria-label="The trash icon to delete the branch" %}。
|
||||
{% ifversion fpt or ghes > 3.5 or ghae-issue-6763 or ghec %}
|
||||
1. 如果尝试删除与至少一个打开的拉取请求关联的分支,必须确认要关闭拉取请求。
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.navigate-to-branches %}
|
||||
1. Scroll to the branch that you want to delete, then click {% octicon "trash" aria-label="The trash icon to delete the branch" %}.
|
||||
 {% ifversion fpt or ghes > 3.5 or ghae > 3.5 or ghec %}
|
||||
1. If you try to delete a branch that is associated with at least one open pull request, you must confirm that you intend to close the pull request(s).
|
||||
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% data reusables.pull_requests.retargeted-on-branch-deletion %} 有关详细信息,请参阅“[关于分支](/github/collaborating-with-issues-and-pull-requests/about-branches#working-with-branches)”。
|
||||
{% data reusables.pull_requests.retargeted-on-branch-deletion %}
|
||||
For more information, see "[About branches](/github/collaborating-with-issues-and-pull-requests/about-branches#working-with-branches)."
|
||||
|
||||
## 延伸阅读
|
||||
## Further reading
|
||||
|
||||
- [关于分支](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches)
|
||||
- [查看存储库中的分支](/github/administering-a-repository/viewing-branches-in-your-repository)
|
||||
- [删除和恢复拉取请求中的分支](/github/administering-a-repository/deleting-and-restoring-branches-in-a-pull-request)
|
||||
- "[About branches](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches)"
|
||||
- "[Viewing branches in your repository](/github/administering-a-repository/viewing-branches-in-your-repository)"
|
||||
- "[Deleting and restoring branches in a pull request](/github/administering-a-repository/deleting-and-restoring-branches-in-a-pull-request)"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 使拉取请求与基础分支保持同步
|
||||
intro: 打开拉取请求后,可以使用基础分支中所做的任何更改更新头分支(其中包含你所做的更改)。
|
||||
title: Keeping your pull request in sync with the base branch
|
||||
intro: 'After you open a pull request, you can update the head branch, which contains your changes, with any changes that have been made in the base branch.'
|
||||
permissions: People with write permissions to the repository to which the head branch of the pull request belongs can update the head branch with changes that have been made in the base branch.
|
||||
versions:
|
||||
fpt: '*'
|
||||
@@ -10,48 +10,47 @@ versions:
|
||||
topics:
|
||||
- Pull requests
|
||||
shortTitle: Update the head branch
|
||||
ms.openlocfilehash: d7819b45cf3290c09e3b231825e494fd1d82daea
|
||||
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/10/2022
|
||||
ms.locfileid: '145130091'
|
||||
---
|
||||
## 关于使拉取请求保持同步
|
||||
|
||||
在合并拉取请求之前,其他更改可能会合并到基础分支中,从而导致拉取请求的头分支不同步。使用来自基础分支的最新更改更新拉取请求有助于在合并之前发现问题。
|
||||
## About keeping your pull request in sync
|
||||
|
||||
可以从命令行或拉取请求页更新拉取请求的头分支。 当所有这些均为 true 时,将显示“更新分支”按钮:
|
||||
Before merging your pull requests, other changes may get merged into the base branch causing your pull request's head branch to be out of sync. Updating your pull request with the latest changes from the base branch can help catch problems prior to merging.
|
||||
|
||||
* 拉取请求分支和基础分支之间没有合并冲突。
|
||||
* 拉取请求分支未与基础分支保持同步。
|
||||
* 基础分支在合并 {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6069 %} 之前要求分支是最新的,或启用始终建议更新分支的设置{% endif %}。
|
||||
You can update a pull request's head branch from the command line or the pull request page. The **Update branch** button is displayed when all of these are true:
|
||||
|
||||
有关详细信息,请参阅“[合并之前需要检查状态](/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches) {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6069 %}”和“[管理更新拉取请求分支的建议](/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-suggestions-to-update-pull-request-branches) {% endif %}”。
|
||||
* There are no merge conflicts between the pull request branch and the base branch.
|
||||
* The pull request branch is not up to date with the base branch.
|
||||
* The base branch requires branches to be up to date before merging{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %} or the setting to always suggest updating branches is enabled{% endif %}.
|
||||
|
||||
如果对基础分支的更改导致拉取请求分支中的合并冲突,则在所有冲突都解决之前,你将无法更新分支。 有关详细信息,请参阅“[关于合并冲突](/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/about-merge-conflicts)”。
|
||||
For more information, see "[Require status checks before merging](/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches){% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}" and "[Managing suggestions to update pull request branches](/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-suggestions-to-update-pull-request-branches){% endif %}."
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6069 %} 从拉取请求页面,可以使用传统合并或变基来更新拉取请求的分支。 传统的合并会导致合并提交,将基础分支合并到拉取请求的头分支。 变基将你的分支中的更改应用到最新版本的基础分支上。 结果是具有线性历史记录的分支,因为不会创建合并提交。
|
||||
{% else %} 从拉取请求页更新分支执行传统合并。 生成的合并提交将基础分支合并到拉取请求的头分支中。
|
||||
If there are changes to the base branch that cause merge conflicts in your pull request branch, you will not be able to update the branch until all conflicts are resolved. For more information, see "[About merge conflicts](/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/about-merge-conflicts)."
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
From the pull request page you can update your pull request's branch using a traditional merge or by rebasing. A traditional merge results in a merge commit that merges the base branch into the head branch of the pull request. Rebasing applies the changes from _your_ branch onto the latest version of the base branch. The result is a branch with a linear history, since no merge commit is created.
|
||||
{% else %}
|
||||
Updating your branch from the pull request page performs a traditional merge. The resulting merge commit merges the base branch into the head branch of the pull request.
|
||||
{% endif %}
|
||||
|
||||
## 更新拉取请求分支
|
||||
## Updating your pull request branch
|
||||
|
||||
{% data reusables.repositories.sidebar-pr %}
|
||||
|
||||
1. 在“拉取请求”列表中,单击要更新的拉取请求。
|
||||
1. In the "Pull requests" list, click the pull request you'd like to update.
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6069 %}
|
||||
1. 在页面底部附近的合并部分中,可以:
|
||||
- 单击“更新分支”执行传统合并。
|
||||

|
||||
- 单击“更新分支”下拉菜单,单击“使用变基更新”,然后单击“变基分支”以通过对基础分支变基来更新 。
|
||||
 {% else %}
|
||||
1. 在页面底部附近的合并部分中,单击“更新分支”执行传统合并。
|
||||
 {% endif %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
1. In the merge section near the bottom of the page, you can:
|
||||
- Click **Update branch** to perform a traditional merge.
|
||||

|
||||
- Click the update branch drop down menu, click **Update with rebase**, and then click **Rebase branch** to update by rebasing on the base branch.
|
||||

|
||||
{% else %}
|
||||
1. In the merge section near the bottom of the page, click **Update branch** to perform a traditional merge.
|
||||

|
||||
{% endif %}
|
||||
|
||||
## 延伸阅读
|
||||
## Further reading
|
||||
|
||||
- [关于拉取请求](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)
|
||||
- [更改拉取请求的阶段](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request)
|
||||
- [提交对从分支创建的拉取请求分支的更改](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/committing-changes-to-a-pull-request-branch-created-from-a-fork)
|
||||
- "[About pull requests](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)"
|
||||
- "[Changing the stage of a pull request](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request)"
|
||||
- "[Committing changes to a pull request branch created from a fork](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/committing-changes-to-a-pull-request-branch-created-from-a-fork)"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 审查拉取请求中的依赖项更改
|
||||
intro: 如果拉取请求包含对依赖项的更改,您可以查看已更改内容摘要以及任何依赖项中是否存在已知漏洞。
|
||||
title: Reviewing dependency changes in a pull request
|
||||
intro: 'If a pull request contains changes to dependencies, you can view a summary of what has changed and whether there are known vulnerabilities in any of the dependencies.'
|
||||
product: '{% data reusables.gated-features.dependency-review %}'
|
||||
versions:
|
||||
fpt: '*'
|
||||
@@ -19,73 +19,72 @@ redirect_from:
|
||||
- /github/collaborating-with-issues-and-pull-requests/reviewing-dependency-changes-in-a-pull-request
|
||||
- /github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-dependency-changes-in-a-pull-request
|
||||
shortTitle: Review dependency changes
|
||||
ms.openlocfilehash: 3887db045b68f7adeca275db0449a12547453771
|
||||
ms.sourcegitcommit: 770ed406ec075528ec9c9695aa4bfdc8c8b25fd3
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/12/2022
|
||||
ms.locfileid: '147888426'
|
||||
---
|
||||
<!--Marketing-LINK: From /features/security/software-supply-chain page "Sign up for the dependency review beta" and "Reviewing dependency changes in a pull request".-->
|
||||
|
||||
{% data reusables.dependency-review.beta %}
|
||||
|
||||
## 关于依赖项评审
|
||||
## About dependency review
|
||||
|
||||
{% data reusables.dependency-review.feature-overview %}
|
||||
|
||||
{% ifversion ghec %}在私有存储库中使用依赖项审查之前,必须启用依赖项关系图。 有关详细信息,请参阅“[探索存储库的依赖项](/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 %}
|
||||
{% ifversion ghec %}Before you can use dependency review in a private repository, you must enable the dependency graph. 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)."{% endif %}
|
||||
|
||||
{% ifversion ghes %} 在使用依赖项审查之前,必须启用依赖项关系图并将 {% data variables.product.product_location %} 连接到 {% data variables.product.prodname_dotcom_the_website %}。 有关详细信息,请参阅“[为 {% data variables.product.prodname_ghe_server %} 上的易受攻击依赖项启用警报](/admin/configuration/managing-connections-between-github-enterprise-server-and-github-enterprise-cloud/enabling-alerts-for-vulnerable-dependencies-on-github-enterprise-server)”。{% endif %}
|
||||
{% ifversion ghes %} Before you can use dependency review, you must enable the dependency graph and connect {% data variables.product.product_location %} to {% data variables.product.prodname_dotcom_the_website %}. For more information, see "[Enabling alerts for vulnerable dependencies on {% data variables.product.prodname_ghe_server %}](/admin/configuration/managing-connections-between-github-enterprise-server-and-github-enterprise-cloud/enabling-alerts-for-vulnerable-dependencies-on-github-enterprise-server)."{% endif %}
|
||||
|
||||
依赖关系审核允许您“左移”。 您可以使用所提供的预测信息在易受攻击的依赖项进入生产之前捕获它们。 有关详细信息,请参阅“[关于依赖项审查](/code-security/supply-chain-security/about-dependency-review)”。
|
||||
Dependency review allows you to "shift left". You can use the provided predictive information to catch vulnerable dependencies before they hit production. For more information, see "[About dependency review](/code-security/supply-chain-security/about-dependency-review)."
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.5 or ghae-issue-6396 %}
|
||||
{% ifversion fpt or ghec or ghes > 3.5 or ghae > 3.5 %}
|
||||
|
||||
可使用 {% data variables.product.prodname_dependency_review_action %} 来帮助对存储库中的拉取请求强制实施依赖项审查。 {% data reusables.dependency-review.dependency-review-action-overview %}
|
||||
You can use the {% data variables.product.prodname_dependency_review_action %} to help enforce dependency reviews on pull requests in your repository. {% data reusables.dependency-review.dependency-review-action-overview %}
|
||||
|
||||
{% ifversion dependency-review-action-configuration %} 可通过指定要捕获的依赖项漏洞类型,配置 {% data variables.product.prodname_dependency_review_action %} 来更好地满足需求。 有关详细信息,请参阅“[配置依赖项审查](/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-dependency-review#configuring-the-dependency-review-github-action)”。 {% endif %}
|
||||
{% ifversion dependency-review-action-configuration %}
|
||||
You can configure the {% data variables.product.prodname_dependency_review_action %} to better suit your needs by specifying the type of dependency vulnerability you wish to catch. For more information, see "[Configuring dependency review](/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-dependency-review#configuring-the-dependency-review-github-action)."
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
## 审查拉取请求中的依赖项
|
||||
## Reviewing dependencies in a pull request
|
||||
|
||||
{% data reusables.repositories.sidebar-pr %} {% data reusables.repositories.choose-pr-review %} {% data reusables.repositories.changed-files %}
|
||||
{% data reusables.repositories.sidebar-pr %}
|
||||
{% data reusables.repositories.choose-pr-review %}
|
||||
{% data reusables.repositories.changed-files %}
|
||||
|
||||
1. 如果拉取请求包含许多文件,请使用“文件筛选器”下拉菜单折叠所有不记录依赖项的文件。 这将有助于您将审查的重点放在依赖项更改上。
|
||||
1. If the pull request contains many files, use the **File filter** drop-down menu to collapse all files that don't record dependencies. This will make it easier to focus your review on the dependency changes.
|
||||
|
||||
 依赖项审查提供关于大型锁定文件中已更改内容的更清晰视图,源差异在默认情况下不会呈现。
|
||||

|
||||
The dependency review provides a clearer view of what has changed in large lock files, where the source diff is not rendered by default.
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:依赖项审查多差异不适用于已提交的静态 JavaScript 文件,如 `jquery.js`。
|
||||
**Note:** Dependency review rich diffs are not available for committed static JavaScript files like `jquery.js`.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
1. 在清单或锁定文件标头的右侧,单击 {% octicon "file" aria-label="The rich diff icon" %} 多差异按钮以显示依赖项审查。
|
||||
1. On the right of the header for a manifest or lock file, display the dependency review by clicking the **{% octicon "file" aria-label="The rich diff icon" %}** rich diff button.
|
||||
|
||||

|
||||

|
||||
|
||||
2. 检查依赖项审查中列出的依赖项。
|
||||
2. Check the dependencies listed in the dependency review.
|
||||
|
||||

|
||||

|
||||
|
||||
任何已添加或更改的有漏洞依赖项先按严重程度排序,然后按依赖项名称排序。 这意味着严重程度最高的依赖项始终处于依赖项审查的顶部。 其他依赖项按其名称的字母顺序排列。
|
||||
Any added or changed dependencies that have vulnerabilities are listed first, ordered by severity and then by dependency name. This means that the highest severity dependencies are always at the top of a dependency review. Other dependencies are listed alphabetically by dependency name.
|
||||
|
||||
每个依赖项旁边的图标指示该依赖项在此拉取请求中是否已添加 (<span style="color:#22863a">{% octicon "diff-added" aria-label="Dependency added icon" %}</span>)、更新 (<span style="color:#b08800">{% octicon "diff-modified" aria-label="Dependency modified icon" %}</span>) 或删除 (<span style="color:#cb2431">{% octicon "diff-removed" aria-label="Dependency removed icon" %}</span>)。
|
||||
The icon beside each dependency indicates whether the dependency has been added (<span style="color:#22863a">{% octicon "diff-added" aria-label="Dependency added icon" %}</span>), updated (<span style="color:#b08800">{% octicon "diff-modified" aria-label="Dependency modified icon" %}</span>), or removed (<span style="color:#cb2431">{% octicon "diff-removed" aria-label="Dependency removed icon" %}</span>) in this pull request.
|
||||
|
||||
其他信息包括:
|
||||
Other information includes:
|
||||
|
||||
* 新、更新或删除的依赖项的版本或版本范围。
|
||||
* 对于依赖项的特定版本:
|
||||
* 依赖项的发布时间。
|
||||
* 依赖此软件的项目数量。 此信息取自依赖关系图。 检查依赖项的数量可以帮助您避免意外添加错误的依赖项。
|
||||
* 此依赖项使用的许可(如果此信息可用)。 如果要避免在项目中使用具有某些许可的代码,此选项非常有用。
|
||||
* The version, or version range, of the new, updated, or deleted dependency.
|
||||
* For a specific version of a dependency:
|
||||
* The age of that release of the dependency.
|
||||
* The number of projects that are dependent on this software. This information is taken from the dependency graph. Checking the number of dependents can help you avoid accidentally adding the wrong dependency.
|
||||
* The license used by this dependency, if this information is available. This is useful if you want to avoid code with certain licenses being used in your project.
|
||||
|
||||
如果依赖项具有已知漏洞,则警告消息包括:
|
||||
Where a dependency has a known vulnerability, the warning message includes:
|
||||
|
||||
* 漏洞的简要说明。
|
||||
* 通用漏洞披露 (CVE) 或 {% data variables.product.prodname_security_advisories %} (GHSA) 标识号。 您可以单击此 ID 以查找有关漏洞的更多信息。
|
||||
* 漏洞的严重程度。
|
||||
* 修复漏洞的依赖项版本。 审查某人的拉取请求时,您可以要求参与者将依赖项更新到修补版本或更新版本。
|
||||
* A brief description of the vulnerability.
|
||||
* A Common Vulnerabilities and Exposures (CVE) or {% data variables.product.prodname_security_advisories %} (GHSA) identification number. You can click this ID to find out more about the vulnerability.
|
||||
* The severity of the vulnerability.
|
||||
* The version of the dependency in which the vulnerability was fixed. If you are reviewing a pull request for someone, you might ask the contributor to update the dependency to the patched version, or a later release.
|
||||
|
||||
{% data reusables.repositories.return-to-source-diff %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 存档仓库
|
||||
intro: 您可以存档仓库,将其设为对所有用户只读,并且指出不再主动维护它。 您也可以取消存档已经存档的仓库。
|
||||
title: Archiving repositories
|
||||
intro: You can archive a repository to make it read-only for all users and indicate that it's no longer actively maintained. You can also unarchive repositories that have been archived.
|
||||
redirect_from:
|
||||
- /articles/archiving-repositories
|
||||
- /github/creating-cloning-and-archiving-repositories/archiving-repositories
|
||||
@@ -15,43 +15,43 @@ versions:
|
||||
ghec: '*'
|
||||
topics:
|
||||
- Repositories
|
||||
ms.openlocfilehash: a9d5b33b94e6067bb4decfa8f47da8aa25860da4
|
||||
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/11/2022
|
||||
ms.locfileid: '145129429'
|
||||
---
|
||||
## 关于存储库存档
|
||||
|
||||
{% ifversion fpt or ghec %} {% note %}
|
||||
## About repository archival
|
||||
|
||||
注意:如果原本有各存储库计费计划,仍然需要对存档的存储库付费。 如果不想对存档的仓库付费,则必须升级到新产品。 有关详细信息,请参阅“[{% data variables.product.prodname_dotcom %} 的产品](/articles/github-s-products)”。
|
||||
{% ifversion fpt or ghec %}
|
||||
{% note %}
|
||||
|
||||
{% endnote %} {% endif %}
|
||||
**Note:** If you have a legacy per-repository billing plan, you will still be charged for your archived repository. If you don't want to be charged for an archived repository, you must upgrade to a new product. For more information, see "[{% data variables.product.prodname_dotcom %}'s products](/articles/github-s-products)."
|
||||
|
||||
{% ifversion ghec or ghes > 3.4 or ghae-issue-6329 %} {% note %}
|
||||
{% endnote %}
|
||||
{% endif %}
|
||||
|
||||
注意:使用 {% data variables.product.prodname_GH_advanced_security %} 的客户可以在存档的存储库上启用 {% data variables.product.prodname_secret_scanning %}。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_secret_scanning %}](/code-security/secret-scanning/about-secret-scanning#about-secret-scanning-for-private-repositories)”。
|
||||
{% ifversion ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
{% note %}
|
||||
|
||||
{% endnote %} {% endif %}
|
||||
**Note:** Customers who use {% data variables.product.prodname_GH_advanced_security %} can enable {% data variables.product.prodname_secret_scanning %} on archived repositories. For more information, see "[About {% data variables.product.prodname_secret_scanning %}](/code-security/secret-scanning/about-secret-scanning#about-secret-scanning-for-private-repositories)."
|
||||
|
||||
{% endnote %}
|
||||
{% endif %}
|
||||
|
||||
{% data reusables.repositories.archiving-repositories-recommendation %}
|
||||
|
||||
在仓库存档后,便无法添加或删除协作者或团队。 具有仓库访问权限的贡献者只能对项目复刻或标星。
|
||||
Once a repository is archived, you cannot add or remove collaborators or teams. Contributors with access to the repository can only fork or star your project.
|
||||
|
||||
当仓库存档后,其议题、拉取请求、代码、标签、里程碑、项目、wiki、版本、提交、标记、分支、反应、代码扫描警报、评论和权限都会变成只读。 要更改存档的仓库,必须先对仓库取消存档。
|
||||
When a repository is archived, its issues, pull requests, code, labels, milestones, projects, wiki, releases, commits, tags, branches, reactions, code scanning alerts, comments and permissions become read-only. To make changes in an archived repository, you must unarchive the repository first.
|
||||
|
||||
您可以搜索已存档的仓库。 有关详细信息,请参阅“[搜索存储库](/search-github/searching-on-github/searching-for-repositories/#search-based-on-whether-a-repository-is-archived)”。 更多信息请参阅“<a href="/articles/searching-for-repositories/#search-based-on-whether-a-repository-is-archived">搜索仓库</a>”。 有关详细信息,请参阅“[搜索问题和拉取请求](/search-github/searching-on-github/searching-issues-and-pull-requests/#search-based-on-whether-a-repository-is-archived)”。
|
||||
You can search for archived repositories. For more information, see "[Searching for repositories](/search-github/searching-on-github/searching-for-repositories/#search-based-on-whether-a-repository-is-archived)." You can also search for issues and pull requests within archived repositories. For more information, see "[Searching issues and pull requests](/search-github/searching-on-github/searching-issues-and-pull-requests/#search-based-on-whether-a-repository-is-archived)."
|
||||
|
||||
## 存档仓库
|
||||
## Archiving a repository
|
||||
|
||||
{% data reusables.repositories.archiving-repositories-recommendation %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %}
|
||||
3. 在“危险区域”下,单击“存档此存储库”或“取消存档此存储库” 。
|
||||

|
||||
4. 阅读警告。
|
||||
5. 输入要存档或取消存档的仓库的名称。
|
||||

|
||||
6. 单击“我了解后果,存档此存储库”。
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
3. Under "Danger Zone", click **Archive this repository** or **Unarchive this repository**.
|
||||

|
||||
4. Read the warnings.
|
||||
5. Type the name of the repository you want to archive or unarchive.
|
||||

|
||||
6. Click **I understand the consequences, archive this repository**.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 为拉取请求配置提交合并
|
||||
intro: '对于存储库中 {% data variables.product.product_location %} 上的所有拉取请求合并,你可以使用合并提交来实施、允许或禁用合并。'
|
||||
title: Configuring commit merging for pull requests
|
||||
intro: 'You can enforce, allow, or disable merging with a merge commit for all pull request merges on {% data variables.product.product_location %} in your repository.'
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghes: '*'
|
||||
@@ -9,23 +9,24 @@ versions:
|
||||
topics:
|
||||
- Repositories
|
||||
shortTitle: Configure commit merging
|
||||
ms.openlocfilehash: 322f74168935175a75f3a8f19cc4faca2cde174b
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147580726'
|
||||
---
|
||||
{% data reusables.pull_requests.configure_pull_request_merges_intro %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %}
|
||||
1. 在{% ifversion fpt or ghec or ghes > 3.5 or ghae-issue-6069 %}“拉取请求”{% else %}“合并按钮”{% endif %}下,选择“允许合并提交”。 这允许参与者将拉取请求与提交的完整历史记录合并。{% ifversion default-merge-squash-commit-message %}{% endif %}{% ifversion ghes = 3.6 %}{% endif %} {% ifversion ghes < 3.6 %} {% endif %} {% ifversion default-merge-squash-commit-message %}
|
||||
1. (可选)在“允许合并提交”下,使用下拉列表选择合并时向参与者显示的提交消息的格式。 默认消息包括拉取请求编号和标题。 例如,`Merge pull request #123 from patch-1`。 还可以选择仅使用拉取请求标题或拉取请求标题和说明。
|
||||
 {% endif %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
1. Under {% ifversion fpt or ghec or ghes > 3.5 or ghae > 3.4 %}"Pull Requests"{% else %}"Merge button"{% endif %}, select **Allow merge commits**. This allows contributors to merge a pull request with a full history of commits.{% ifversion default-merge-squash-commit-message %}
|
||||
{% endif %}{% ifversion ghes = 3.6 %}
|
||||
{% endif %}
|
||||
{% ifversion ghes < 3.6 %}
|
||||
{% endif %}
|
||||
{% ifversion default-merge-squash-commit-message %}
|
||||
1. Optionally, under **Allow merge commits**, use the dropdown to choose the format of the commit message presented to contributors when merging. The default message includes the pull request number and title. For example, `Merge pull request #123 from patch-1`. You can also choose to use just the pull request title, or the pull request title and description.
|
||||

|
||||
{% endif %}
|
||||
|
||||
如果选择多个合并方法,协作者可以选择合并拉取请求时要使用的合并提交类型。 {% data reusables.repositories.squash-and-rebase-linear-commit-history %}
|
||||
If you select more than one merge method, collaborators can choose which type of merge commit to use when they merge a pull request. {% data reusables.repositories.squash-and-rebase-linear-commit-history %}
|
||||
|
||||
## 延伸阅读
|
||||
## Further reading
|
||||
|
||||
- [关于拉取请求合并](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges)
|
||||
- [合并拉取请求](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request)
|
||||
- "[About pull request merges](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges)"
|
||||
- "[Merging a pull request](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request)"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 为拉取请求配置提交变基
|
||||
intro: '对于仓库中 {% data variables.product.product_location %} 上的所有拉取请求合并,您可以实施、允许或禁用提交变基。'
|
||||
title: Configuring commit rebasing for pull requests
|
||||
intro: 'You can enforce, allow, or disable commit rebasing for all pull request merges on {% data variables.product.product_location %} in your repository.'
|
||||
redirect_from:
|
||||
- /articles/configuring-commit-rebasing-for-pull-requests
|
||||
- /github/administering-a-repository/configuring-commit-rebasing-for-pull-requests
|
||||
@@ -13,17 +13,16 @@ versions:
|
||||
topics:
|
||||
- Repositories
|
||||
shortTitle: Configure commit rebasing
|
||||
ms.openlocfilehash: e2614349b5baab9be33d1fe6d80a99a78811d8df
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147580525'
|
||||
---
|
||||
{% data reusables.pull_requests.configure_pull_request_merges_intro %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %}
|
||||
3. 在{% ifversion fpt or ghec or ghes > 3.5 or ghae-issue-6069 %}“拉取请求”{% else %}“合并按钮”{% endif %}下,选择“允许变基合并”。 这将允许贡献者通过将其个人提交变基到基本分支来合并拉取请求。
|
||||
{% ifversion default-merge-squash-commit-message %}{% endif %}{% ifversion ghes = 3.6 %}{% endif %} {% ifversion ghes < 3.6 %} {% endif %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
3. Under {% ifversion fpt or ghec or ghes > 3.5 or ghae > 3.4 %}"Pull Requests"{% else %}"Merge button"{% endif %}, select **Allow rebase merging**. This allows contributors to merge a pull request by rebasing their individual commits onto the base branch.
|
||||
{% ifversion default-merge-squash-commit-message %}
|
||||
{% endif %}{% ifversion ghes = 3.6 %}
|
||||
{% endif %}
|
||||
{% ifversion ghes < 3.6 %}
|
||||
{% endif %}
|
||||
|
||||
如果您还选择了另一种合并方法,则贡献者在合并拉取请求时能够选择合并提交的类型。 {% data reusables.repositories.squash-and-rebase-linear-commit-history %}
|
||||
If you also select another merge method, collaborators will be able to choose the type of merge commit when merging a pull request. {% data reusables.repositories.squash-and-rebase-linear-commit-history %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 为拉取请求配置提交压缩
|
||||
intro: '对于仓库中 {% data variables.product.product_location %} 上的所有拉取请求合并,您可以实施、允许或禁用提交压缩。'
|
||||
title: Configuring commit squashing for pull requests
|
||||
intro: 'You can enforce, allow, or disable commit squashing for all pull request merges on {% data variables.product.product_location %} in your repository.'
|
||||
redirect_from:
|
||||
- /articles/configuring-commit-squashing-for-pull-requests
|
||||
- /github/administering-a-repository/configuring-commit-squashing-for-pull-requests
|
||||
@@ -13,25 +13,26 @@ versions:
|
||||
topics:
|
||||
- Repositories
|
||||
shortTitle: Configure commit squashing
|
||||
ms.openlocfilehash: 8d53a558163b6a847fa4fb509399b1e7b7c6c05c
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147580709'
|
||||
---
|
||||
{% data reusables.pull_requests.configure_pull_request_merges_intro %}
|
||||
|
||||
{% data reusables.pull_requests.default-commit-message-squash-merge %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %}
|
||||
1. 在{% ifversion fpt or ghec or ghes > 3.5 or ghae-issue-6069 %}“拉取请求”{% else %}“合并按钮”{% endif %}下,选择“允许压缩合并”。 这将允许贡献者通过将所有提交压缩到单个提交中来合并拉取请求。 合并时向参与者显示的默认提交消息是提交标题和消息(如果拉取请求仅包含 1 个提交),或拉取请求标题和提交列表(如果拉取请求包含 2 个或更多提交)。 {% ifversion ghes = 3.6 %} 若要始终使用拉取请求的标题,而不考虑拉取请求中的提交数,请选择“默认为压缩合并提交的拉取请求标题”。{% endif %}{% ifversion default-merge-squash-commit-message %} {% endif %}{% ifversion ghes = 3.6 %} {% endif %} {% ifversion ghes < 3.6 %} {% endif %} {% ifversion default-merge-squash-commit-message %}
|
||||
1. (可选)在“允许压缩合并”下,使用下拉列表选择合并时向参与者显示的默认压缩提交消息的格式。 默认消息使用提交标题和消息(如果拉取请求仅包含 1 个提交),或拉取请求标题和提交列表(如果拉取请求包含 2 个或更多提交)。 还可以选择仅使用拉取请求标题、拉取请求标题和提交详细信息,或拉取请求标题和说明。
|
||||
 {% endif %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
1. Under {% ifversion fpt or ghec or ghes > 3.5 or ghae > 3.4 %}"Pull Requests"{% else %}"Merge button"{% endif %}, select **Allow squash merging**. This allows contributors to merge a pull request by squashing all commits into a single commit. The default commit message presented to contributors when merging is the commit title and message if the pull request contains only 1 commit, or the pull request title and list of commits if the pull request contains 2 or more commits. {% ifversion ghes = 3.6 %} To always use the title of the pull request regardless of the number of commits in the pull request select **Default to PR title for squash merge commits**.{% endif %}{% ifversion default-merge-squash-commit-message %}
|
||||
{% endif %}{% ifversion ghes = 3.6 %}
|
||||
{% endif %}
|
||||
{% ifversion ghes < 3.6 %}
|
||||
{% endif %}
|
||||
{% ifversion default-merge-squash-commit-message %}
|
||||
1. Optionally, under **Allow squash merging**, use the dropdown to choose the format of the default squash commit message presented to contributors when merging. The default message uses the commit title and message if the pull request contains only 1 commit, or the pull request title and list of commits if the pull request contains 2 or more commits. You can also choose to use just the pull request title, the pull request title and commit details, or the pull request title and description.
|
||||

|
||||
{% endif %}
|
||||
|
||||
如果选择多个合并方法,协作者可以选择合并拉取请求时要使用的合并提交类型。 {% data reusables.repositories.squash-and-rebase-linear-commit-history %}
|
||||
If you select more than one merge method, collaborators can choose which type of merge commit to use when they merge a pull request. {% data reusables.repositories.squash-and-rebase-linear-commit-history %}
|
||||
|
||||
## 延伸阅读
|
||||
## Further reading
|
||||
|
||||
- [关于拉取请求合并](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges)
|
||||
- [合并拉取请求](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request)
|
||||
- "[About pull request merges](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges)"
|
||||
- "[Merging a pull request](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request)"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 管理仓库中拉取请求的自动合并
|
||||
intro: 您可以允许或禁止仓库中拉取请求的自动合并。
|
||||
title: Managing auto-merge for pull requests in your repository
|
||||
intro: You can allow or disallow auto-merge for pull requests in your repository.
|
||||
product: '{% data reusables.gated-features.auto-merge %}'
|
||||
versions:
|
||||
fpt: '*'
|
||||
@@ -14,21 +14,16 @@ redirect_from:
|
||||
- /github/administering-a-repository/managing-auto-merge-for-pull-requests-in-your-repository
|
||||
- /github/administering-a-repository/configuring-pull-request-merges/managing-auto-merge-for-pull-requests-in-your-repository
|
||||
shortTitle: Manage auto merge
|
||||
ms.openlocfilehash: 4d0f0d465ea3c8551dc909d56620a06ee9864c1c
|
||||
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/11/2022
|
||||
ms.locfileid: '147883439'
|
||||
---
|
||||
## 关于自动合并
|
||||
## About auto-merge
|
||||
|
||||
如果您允许自动合并仓库中的拉取请求,则具有写入权限的用户可以配置仓库中的单个拉取请求在满足所有合并要求时自动合并。 如果没有写入权限的人员将更改推送到已启用自动合并的拉取请求,将对该拉取请求禁用自动合并。 有关详细信息,请参阅“[自动合并拉取请求](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request)”。
|
||||
If you allow auto-merge for pull requests in your repository, people with write permissions can configure individual pull requests in the repository to merge automatically when all merge requirements are met. If someone who does not have write permissions pushes changes to a pull request that has auto-merge enabled, auto-merge will be disabled for that pull request. For more information, see "[Automatically merging a pull request](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request)."
|
||||
|
||||
## 管理自动合并
|
||||
## Managing auto-merge
|
||||
|
||||
{% data reusables.pull_requests.auto-merge-requires-branch-protection %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %}
|
||||
1. 在{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6069 %}“拉取请求”{% else %}“合并按钮”{% endif %}下,选择或取消选择“允许自动合并”。
|
||||

|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
1. Under {% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}"Pull Requests"{% else %}"Merge button"{% endif %}, select or deselect **Allow auto-merge**.
|
||||

|
||||
|
||||
@@ -1,30 +1,26 @@
|
||||
---
|
||||
title: 管理更新拉取请求分支的建议
|
||||
intro: 用户可以在拉取请求分支未随基本分支保持最新时始终更新该分支。
|
||||
title: Managing suggestions to update pull request branches
|
||||
intro: You can give users the ability to always update a pull request branch when it is not up to date with the base branch.
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghes: '> 3.4'
|
||||
ghae: issue-6069
|
||||
ghae: '>= 3.5'
|
||||
ghec: '*'
|
||||
topics:
|
||||
- Repositories
|
||||
shortTitle: Manage branch updates
|
||||
permissions: People with maintainer permissions can enable or disable the setting to suggest updating pull request branches.
|
||||
ms.openlocfilehash: a29e2e9d11b24287cdad71b71f617a58e64df297
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147578608'
|
||||
---
|
||||
## 关于更新拉取请求分支的建议
|
||||
|
||||
如果启用此设置以始终建议更新存储库中的拉取请求分支,则当拉取请求的头分支与基本分支不同步时,具有写入权限的用户将始终能够在拉取请求页面上更新拉取请求的头分支。 如果未启用,则仅当基本分支要求分支在合并之前保持最新且分支不是最新的时,更新功能才可用。 有关详细信息,请参阅“[使拉取请求与基本分支保持同步](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch)”。
|
||||
## About suggestions to update a pull request branch
|
||||
|
||||
If you enable the setting to always suggest updating pull request branches in your repository, people with write permissions will always have the ability, on the pull request page, to update a pull request's head branch when it's not up to date with the base branch. When not enabled, the ability to update is only available when the base branch requires branches to be up to date before merging and the branch is not up to date. For more information, see "[Keeping your pull request in sync with the base branch](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch)."
|
||||
|
||||
{% data reusables.enterprise.3-5-missing-feature %}
|
||||
|
||||
## 管理更新拉取请求分支的建议
|
||||
## Managing suggestions to update a pull request branch
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %}
|
||||
3. 在“拉取请求”下,选择或取消选择“始终建议更新请求分支”。
|
||||

|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
3. Under "Pull Requests", select or unselect **Always suggest updating pull request branches**.
|
||||

|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 管理分支的自动删除
|
||||
intro: 您可让头部分支在仓库中的拉取请求合并后自动删除。
|
||||
title: Managing the automatic deletion of branches
|
||||
intro: You can have head branches automatically deleted after pull requests are merged in your repository.
|
||||
redirect_from:
|
||||
- /articles/managing-the-automatic-deletion-of-branches
|
||||
- /github/administering-a-repository/managing-the-automatic-deletion-of-branches
|
||||
@@ -13,19 +13,14 @@ versions:
|
||||
topics:
|
||||
- Repositories
|
||||
shortTitle: Automatic branch deletion
|
||||
ms.openlocfilehash: feaeb7c2178beab4dc23a310df6924c6e1c52e0f
|
||||
ms.sourcegitcommit: fb047f9450b41b24afc43d9512a5db2a2b750a2a
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/11/2022
|
||||
ms.locfileid: '147882455'
|
||||
---
|
||||
对仓库具有管理员权限的任何人都可启用或禁用分支的自动删除。
|
||||
Anyone with admin permissions to a repository can enable or disable the automatic deletion of branches.
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %}
|
||||
3. 在 {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6069 %}“拉取请求”{% else %}“合并按钮”{% endif %}下,选择或取消选择“自动删除主分支”。
|
||||

|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
3. Under {% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}"Pull Requests"{% else %}"Merge button"{% endif %}, select or unselect **Automatically delete head branches**.
|
||||

|
||||
|
||||
## 延伸阅读
|
||||
- [合并拉取请求](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request)
|
||||
- [在存储库中创建和删除分支](/articles/creating-and-deleting-branches-within-your-repository)
|
||||
## Further reading
|
||||
- "[Merging a pull request](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request)"
|
||||
- "[Creating and deleting branches within your repository](/articles/creating-and-deleting-branches-within-your-repository)"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 关于受保护分支
|
||||
intro: 您可以通过设置分支保护规则来保护重要分支,这些规则定义协作者是否可以删除或强制推送到分支以及设置任何分支推送要求,例如通过状态检查或线性提交历史记录。
|
||||
title: About protected branches
|
||||
intro: 'You can protect important branches by setting branch protection rules, which define whether collaborators can delete or force push to the branch and set requirements for any pushes to the branch, such as passing status checks or a linear commit history.'
|
||||
product: '{% data reusables.gated-features.protected-branches %}'
|
||||
redirect_from:
|
||||
- /articles/about-protected-branches
|
||||
@@ -24,166 +24,177 @@ versions:
|
||||
ghec: '*'
|
||||
topics:
|
||||
- Repositories
|
||||
ms.openlocfilehash: 14a0875de13a453824dd692c2eea02c1ff585883
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147614333'
|
||||
---
|
||||
## 关于分支保护规则
|
||||
## About branch protection rules
|
||||
|
||||
您可以通过创建分支保护规则,实施某些工作流程或要求,以规定协作者如何向您仓库中的分支推送更改,包括将拉取请求合并到分支。
|
||||
You can enforce certain workflows or requirements before a collaborator can push changes to a branch in your repository, including merging a pull request into the branch, by creating a branch protection rule.
|
||||
|
||||
默认情况下,每个分支保护规则都禁止强制推送到匹配的分支并阻止删除匹配的分支。 您可以选择禁用这些限制并启用其他分支保护设置。
|
||||
By default, each branch protection rule disables force pushes to the matching branches and prevents the matching branches from being deleted. You can optionally disable these restrictions and enable additional branch protection settings.
|
||||
|
||||
{% ifversion bypass-branch-protections %} 默认情况下,分支保护规则的限制不适用于对存储库具有管理员权限的人员或具有“绕过分支保护”权限的自定义角色。 也可以选择将限制应用于具有“绕过分支保护”权限的管理员和角色。 有关详细信息,请参阅“[管理组织的自定义存储库角色](/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization)”。
|
||||
{% else %} 默认情况下,分支保护规则的限制不适用于对仓库具有管理员权限的人。 还可以选择包括管理员。{% endif %}
|
||||
{% ifversion bypass-branch-protections %}
|
||||
By default, the restrictions of a branch protection rule don't apply to people with admin permissions to the repository or custom roles with the "bypass branch protections" permission. You can optionally apply the restrictions to administrators and roles with the "bypass branch protections" permission, too. For more information, see "[Managing custom repository roles for an organization](/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization)".
|
||||
{% else %}
|
||||
By default, the restrictions of a branch protection rule don't apply to people with admin permissions to the repository. You can optionally choose to include administrators, too.{% endif %}
|
||||
|
||||
{% data reusables.repositories.branch-rules-example %} 有关分支名称模式的详细信息,请参阅“[管理分支保护规则](/github/administering-a-repository/managing-a-branch-protection-rule)”。
|
||||
{% data reusables.repositories.branch-rules-example %} For more information about branch name patterns, see "[Managing a branch protection rule](/github/administering-a-repository/managing-a-branch-protection-rule)."
|
||||
|
||||
{% data reusables.pull_requests.you-can-auto-merge %}
|
||||
|
||||
## 关于分支保护设置
|
||||
## About branch protection settings
|
||||
|
||||
对于每个分支保护规则,您可以选择启用或禁用以下设置。
|
||||
- [在合并前需要拉取请求审查](#require-pull-request-reviews-before-merging)
|
||||
- [合并前必需状态检查](#require-status-checks-before-merging)
|
||||
- [合并前需要对话解决](#require-conversation-resolution-before-merging)
|
||||
- [需要签名提交](#require-signed-commits)
|
||||
- [需要线性历史记录](#require-linear-history) {% ifversion fpt or ghec %}
|
||||
- [需要合并队列](#require-merge-queue) {% endif %} {%- ifversion required-deployments %}
|
||||
- [合并前要求部署成功](#require-deployments-to-succeed-before-merging) {%- endif %} {% ifversion bypass-branch-protections %}- [不允许绕过上述设置](#do-not-allow-bypassing-the-above-settings){% else %}- [包括管理员](#include-administrators){% endif %}
|
||||
- [限制可推送到匹配分支的人员](#restrict-who-can-push-to-matching-branches)
|
||||
- [允许强制推送](#allow-force-pushes)
|
||||
- [允许删除](#allow-deletions)
|
||||
For each branch protection rule, you can choose to enable or disable the following settings.
|
||||
- [Require pull request reviews before merging](#require-pull-request-reviews-before-merging)
|
||||
- [Require status checks before merging](#require-status-checks-before-merging)
|
||||
- [Require conversation resolution before merging](#require-conversation-resolution-before-merging)
|
||||
- [Require signed commits](#require-signed-commits)
|
||||
- [Require linear history](#require-linear-history)
|
||||
{% ifversion fpt or ghec %}
|
||||
- [Require merge queue](#require-merge-queue)
|
||||
{% endif %}
|
||||
{%- ifversion required-deployments %}
|
||||
- [Require deployments to succeed before merging](#require-deployments-to-succeed-before-merging)
|
||||
{%- endif %}
|
||||
{% ifversion bypass-branch-protections %}- [Do not allow bypassing the above settings](#do-not-allow-bypassing-the-above-settings){% else %}- [Include administrators](#include-administrators){% endif %}
|
||||
- [Restrict who can push to matching branches](#restrict-who-can-push-to-matching-branches)
|
||||
- [Allow force pushes](#allow-force-pushes)
|
||||
- [Allow deletions](#allow-deletions)
|
||||
|
||||
有关如何设置分支保护的详细信息,请参阅“[管理分支保护规则](/github/administering-a-repository/managing-a-branch-protection-rule)”。
|
||||
For more information on how to set up branch protection, see "[Managing a branch protection rule](/github/administering-a-repository/managing-a-branch-protection-rule)."
|
||||
|
||||
### 合并前必需拉取请求审查
|
||||
### Require pull request reviews before merging
|
||||
|
||||
{% data reusables.pull_requests.required-reviews-for-prs-summary %}
|
||||
|
||||
如果启用必需审查,则协作者只能通过由所需数量的具有写入权限之审查者批准的拉取请求向受保护分支推送更改。
|
||||
If you enable required reviews, collaborators can only push changes to a protected branch via a pull request that is approved by the required number of reviewers with write permissions.
|
||||
|
||||
如果某个具有管理员权限的人员在审查中选择“请求更改”选项,则拉取请求必须经此人批准后才可合并。 如果申请更改拉取请求的审查者没有空,则具有仓库写入权限的任何人都可忽略阻止审查。
|
||||
If a person with admin permissions chooses the **Request changes** option in a review, then that person must approve the pull request before the pull request can be merged. If a reviewer who requests changes on a pull request isn't available, anyone with write permissions for the repository can dismiss the blocking review.
|
||||
|
||||
{% data reusables.repositories.review-policy-overlapping-commits %}
|
||||
|
||||
如果协作者尝试将待处理或被拒绝审查的拉取请求合并到受保护分支,则该协作者将收到错误消息。
|
||||
If a collaborator attempts to merge a pull request with pending or rejected reviews into the protected branch, the collaborator will receive an error message.
|
||||
|
||||
```shell
|
||||
remote: error: GH006: Protected branch update failed for refs/heads/main.
|
||||
remote: error: Changes have been requested.
|
||||
```
|
||||
|
||||
(可选)您可以选择在推送提交时忽略旧拉取请求批准。 如果有人将修改代码的提交推送到已批准的拉取请求,则该批准将被忽略,拉取请求无法合并。 这不适用于协作者推送不修改代码的提交,例如将基础分值合并到拉取请求的分支。 有关基分支的信息,请参阅“[关于拉取请求](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)”。
|
||||
Optionally, you can choose to dismiss stale pull request approvals when commits are pushed. If anyone pushes a commit that modifies code to an approved pull request, the approval will be dismissed, and the pull request cannot be merged. This doesn't apply if the collaborator pushes commits that don't modify code, like merging the base branch into the pull request's branch. For information about the base branch, see "[About pull requests](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)."
|
||||
|
||||
(可选)您可以限制特定人员或团队忽略拉取请求审查的权限。 有关详细信息,请参阅“[消除拉取请求审查](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/dismissing-a-pull-request-review)”。
|
||||
Optionally, you can restrict the ability to dismiss pull request reviews to specific people or teams. For more information, see "[Dismissing a pull request review](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/dismissing-a-pull-request-review)."
|
||||
|
||||
(可选)您可以选择要求代码所有者进行审查。 如果这样做,则任何影响代码的拉取请求都必须得到代码所有者的批准,才能合并到受保护分支。
|
||||
Optionally, you can choose to require reviews from code owners. If you do, any pull request that affects code with a code owner must be approved by that code owner before the pull request can be merged into the protected branch.
|
||||
|
||||
### 合并前必需状态检查
|
||||
### Require status checks before merging
|
||||
|
||||
必需状态检查确保在协作者可以对受保护分支进行更改前,所有必需的 CI 测试都已通过。 更多信息请参阅“<a href="/articles/configuring-protected-branches/">配置受保护分支</a>”和“<a href="/articles/enabling-required-status-checks">启用必需状态检查</a>”。 有关详细信息,请参阅“[关于状态检查](/github/collaborating-with-issues-and-pull-requests/about-status-checks)”。
|
||||
Required status checks ensure that all required CI tests are passing before collaborators can make changes to a protected branch. Required status checks can be checks or statuses. For more information, see "[About status checks](/github/collaborating-with-issues-and-pull-requests/about-status-checks)."
|
||||
|
||||
必须配置仓库使用状态 API 后才可启用必需状态检查。 有关详细信息,请参阅 REST 文档中的“[存储库](/rest/reference/commits#commit-statuses)”。
|
||||
Before you can enable required status checks, you must configure the repository to use the status API. For more information, see "[Repositories](/rest/reference/commits#commit-statuses)" in the REST documentation.
|
||||
|
||||
启用必需状态检查后,必须通过所有必需状态检查,协作者才能将更改合并到受保护分支。 所有必需状态检查通过后,必须将任何提交推送到另一个分支,然后合并或直接推送到受保护分支。
|
||||
After enabling required status checks, all required status checks must pass before collaborators can merge changes into the protected branch. After all required status checks pass, any commits must either be pushed to another branch and then merged or pushed directly to the protected branch.
|
||||
|
||||
任何对存储库具有写入权限的人员或集成都可以在存储库中设置任何状态检查的状态{% ifversion fpt or ghes > 3.3 or ghae-issue-5379 or ghec %},但在某些情况下,你可能只想接受来自特定 {% data variables.product.prodname_github_app %} 的状态检查。 添加所需的状态检查时,可以选择最近将此检查设置为预期状态更新源的应用。{% endif %} 如果状态由任何其他人员或集成设置,则不允许合并。 如果选择“任何来源”,您仍然可以手动验证合并框中列出的每个状态的作者。
|
||||
Any person or integration with write permissions to a repository can set the state of any status check in the repository{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}, but in some cases you may only want to accept a status check from a specific {% data variables.product.prodname_github_app %}. When you add a required status check, you can select an app that has recently set this check as the expected source of status updates.{% endif %} If the status is set by any other person or integration, merging won't be allowed. If you select "any source", you can still manually verify the author of each status, listed in the merge box.
|
||||
|
||||
您可以将必需状态检查设置为“宽松”或“严格”。 您选择的必需状态检查类型确定合并之前是否需要使用基础分支将您的分支保持最新状态。
|
||||
You can set up required status checks to either be "loose" or "strict." The type of required status check you choose determines whether your branch is required to be up to date with the base branch before merging.
|
||||
|
||||
| 必需状态检查的类型 | 设置 | 合并要求 | 注意事项 |
|
||||
| Type of required status check | Setting | Merge requirements | Considerations |
|
||||
| --- | --- | --- | --- |
|
||||
| **Strict** | 选中“合并前要求分支保持最新状态”复选框。 | 在合并之前,必须利用基分支使分支保持最新状态。 | 这是必需状态检查的默认行为。 可能需要更多构建,因为在其他协作者将拉取请求合并到受保护基础分支后,您需要使头部分支保持最新状态。|
|
||||
| 宽松 | 未选中“合并前要求分支保持最新状态”复选框 。 | 在合并之前,不必利用基分支使分支保持最新状态。 | 您将需要更少的构建,因为在其他协作者合并拉取请求后,您不需要使头部分支保持最新状态。 如果存在与基础分支不兼容的变更,则在合并分支后,状态检查可能会失败。 |
|
||||
| **已禁用** | 未选中“合并前要求通过状态检查”复选框 。 | 分支没有合并限制。 | 如果未启用必需状态检查,协作者可以随时合并分支,无论它是否使用基础分支保持最新状态。 这增加了不兼容变更的可能性。
|
||||
| **Strict** | The **Require branches to be up to date before merging** checkbox is checked. | The branch **must** be up to date with the base branch before merging. | This is the default behavior for required status checks. More builds may be required, as you'll need to bring the head branch up to date after other collaborators merge pull requests to the protected base branch.|
|
||||
| **Loose** | The **Require branches to be up to date before merging** checkbox is **not** checked. | The branch **does not** have to be up to date with the base branch before merging. | You'll have fewer required builds, as you won't need to bring the head branch up to date after other collaborators merge pull requests. Status checks may fail after you merge your branch if there are incompatible changes with the base branch. |
|
||||
| **Disabled** | The **Require status checks to pass before merging** checkbox is **not** checked. | The branch has no merge restrictions. | If required status checks aren't enabled, collaborators can merge the branch at any time, regardless of whether it is up to date with the base branch. This increases the possibility of incompatible changes.
|
||||
|
||||
有关故障排除信息,请参阅“[对所需状态检查进行故障排除](/github/administering-a-repository/troubleshooting-required-status-checks)”。
|
||||
For troubleshooting information, see "[Troubleshooting required status checks](/github/administering-a-repository/troubleshooting-required-status-checks)."
|
||||
|
||||
### 合并前需要对话解决
|
||||
### Require conversation resolution before merging
|
||||
|
||||
在合并到受保护的分支之前,所有对拉取请求的评论都需要解决。 这确保所有评论在合并前都得到解决或确认。
|
||||
Requires all comments on the pull request to be resolved before it can be merged to a protected branch. This ensures that all comments are addressed or acknowledged before merge.
|
||||
|
||||
### 要求签名提交
|
||||
### Require signed commits
|
||||
|
||||
如果你在分支上启用所需的提交签名,参与者{% ifversion fpt or ghec %}和机器人{% endif %}只能将已签名和验证的提交推送到分支。 有关详细信息,请参阅“[关于提交签名验证](/articles/about-commit-signature-verification)”。
|
||||
When you enable required commit signing on a branch, contributors {% ifversion fpt or ghec %}and bots{% endif %} can only push commits that have been signed and verified to the branch. For more information, see "[About commit signature verification](/articles/about-commit-signature-verification)."
|
||||
|
||||
{% note %}
|
||||
|
||||
{% ifversion fpt or ghec %} 注意:
|
||||
{% ifversion fpt or ghec %}
|
||||
**Notes:**
|
||||
|
||||
* 如果您已经启用了警戒模式,这表明您的提交总是会签名,允许在需要签名提交的分支上提交 {% data variables.product.prodname_dotcom %} 识别为“部分验证”的任何提交。 有关警戒模式的详细信息,请参阅“[显示所有提交的验证状态](/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits)”。
|
||||
* 如果协作者将未签名的提交推送到要求提交签名的分支,则协作者需要变基提交以包含验证的签名,然后将重写的提交强制推送到分支。
|
||||
* If you have enabled vigilant mode, which indicates that your commits will always be signed, any commits that {% data variables.product.prodname_dotcom %} identifies as "Partially verified" are permitted on branches that require signed commits. For more information about vigilant mode, see "[Displaying verification statuses for all of your commits](/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits)."
|
||||
* If a collaborator pushes an unsigned commit to a branch that requires commit signatures, the collaborator will need to rebase the commit to include a verified signature, then force push the rewritten commit to the branch.
|
||||
|
||||
{% else %} 注意:如果协作者将未签名的提交推送到要求提交签名的分支,则协作者需要变基提交以包含验证的签名,然后将重写的提交强制推送到分支。
|
||||
{% else %}
|
||||
**Note:** If a collaborator pushes an unsigned commit to a branch that requires commit signatures, the collaborator will need to rebase the commit to include a verified signature, then force push the rewritten commit to the branch.
|
||||
{% endif %}
|
||||
|
||||
{% endnote %}
|
||||
|
||||
如果提交已进行签名和验证,则始终可以将本地提交推送到分支。 {% ifversion fpt or ghec %}你也可以使用 {% data variables.product.product_name %} 上的拉取请求将已签名和验证的提交合并到分支。 但除非你是拉取请求的作者,否则不能将拉取请求压缩并合并到 {% data variables.product.product_name %} 上的分支。{% else %} 但你不能将拉取请求合并到 {% data variables.product.product_name %} 上的分支。{% endif %} 你可以在本地{% ifversion fpt or ghec %}压缩和{% endif %}合并拉取请求。 有关详细信息,请参阅“[在本地签出拉取请求](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally)”。
|
||||
You can always push local commits to the branch if the commits are signed and verified. {% ifversion fpt or ghec %}You can also merge signed and verified commits into the branch using a pull request on {% data variables.product.product_name %}. However, you cannot squash and merge a pull request into the branch on {% data variables.product.product_name %} unless you are the author of the pull request.{% else %} However, you cannot merge pull requests into the branch on {% data variables.product.product_name %}.{% endif %} You can {% ifversion fpt or ghec %}squash and {% endif %}merge pull requests locally. For more information, see "[Checking out pull requests locally](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally)."
|
||||
|
||||
{% ifversion fpt or ghec %} 有关详细信息,请参阅“[关于 {% data variables.product.prodname_dotcom %} 上的合并方法](/github/administering-a-repository/about-merge-methods-on-github)”。{% endif %}
|
||||
{% ifversion fpt or ghec %} For more information about merge methods, see "[About merge methods on {% data variables.product.prodname_dotcom %}](/github/administering-a-repository/about-merge-methods-on-github)."{% endif %}
|
||||
|
||||
### 需要线性历史记录
|
||||
### Require linear history
|
||||
|
||||
强制实施线性提交历史记录可阻止协作者将合并提交推送到分支。 这意味着合并到受保护分支的任何拉取请求都必须使用压缩合并或变基合并。 严格的线性提交历史记录可以帮助团队更容易回溯更改。 有关合并方法的详细信息,请参阅“[关于拉取请求合并](/github/collaborating-with-issues-and-pull-requests/about-pull-request-merges)”。
|
||||
Enforcing a linear commit history prevents collaborators from pushing merge commits to the branch. This means that any pull requests merged into the protected branch must use a squash merge or a rebase merge. A strictly linear commit history can help teams reverse changes more easily. For more information about merge methods, see "[About pull request merges](/github/collaborating-with-issues-and-pull-requests/about-pull-request-merges)."
|
||||
|
||||
在需要线性提交历史记录之前,仓库必须允许压缩合并或变基合并。 有关详细信息,请参阅“[配置拉取请求合并](/github/administering-a-repository/configuring-pull-request-merges)”。
|
||||
Before you can require a linear commit history, your repository must allow squash merging or rebase merging. For more information, see "[Configuring pull request merges](/github/administering-a-repository/configuring-pull-request-merges)."
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
### 需要合并队列
|
||||
### Require merge queue
|
||||
|
||||
{% data reusables.pull_requests.merge-queue-beta %} {% data reusables.pull_requests.merge-queue-overview %}
|
||||
{% data reusables.pull_requests.merge-queue-beta %}
|
||||
{% data reusables.pull_requests.merge-queue-overview %}
|
||||
|
||||
{% data reusables.pull_requests.merge-queue-merging-method %} {% data reusables.pull_requests.merge-queue-references %}
|
||||
{% data reusables.pull_requests.merge-queue-merging-method %}
|
||||
{% data reusables.pull_requests.merge-queue-references %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
### 在合并前要求部署成功
|
||||
### Require deployments to succeed before merging
|
||||
|
||||
在合并分支之前,可以要求将更改成功部署到特定环境。 例如,可以使用此规则确保在更改合并到默认分支之前成功部署到过渡环境。
|
||||
You can require that changes are successfully deployed to specific environments before a branch can be merged. For example, you can use this rule to ensure that changes are successfully deployed to a staging environment before the changes merge to your default branch.
|
||||
|
||||
{% ifversion bypass-branch-protections %}### 不允许绕过上述设置{% else %}
|
||||
### 包括管理员{% endif %}
|
||||
{% ifversion bypass-branch-protections %}### Do not allow bypassing the above settings{% else %}
|
||||
### Include administrators{% endif %}
|
||||
|
||||
{% ifversion bypass-branch-protections %} 默认情况下,分支保护规则的限制不适用于对存储库具有管理员权限的人员或在存储库中具有“绕过分支保护”权限的自定义角色。
|
||||
{% ifversion bypass-branch-protections %}
|
||||
By default, the restrictions of a branch protection rule do not apply to people with admin permissions to the repository or custom roles with the "bypass branch protections" permission in a repository.
|
||||
|
||||
也可以启用此设置以将限制应用于具有“绕过分支保护”权限的管理员和角色。 有关详细信息,请参阅“[管理组织的自定义存储库角色](/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization)”。
|
||||
{% else %} 默认情况下,受保护分支规则不适用于对仓库具有管理员权限的人。 可以启用此设置将管理员纳入受保护分支规则。{% endif %}
|
||||
You can enable this setting to apply the restrictions to admins and roles with the "bypass branch protections" permission, too. For more information, see "[Managing custom repository roles for an organization](/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization)".
|
||||
{% else %}
|
||||
By default, protected branch rules do not apply to people with admin permissions to a repository. You can enable this setting to include administrators in your protected branch rules.{% endif %}
|
||||
|
||||
### 限制谁可以推送到匹配的分支
|
||||
### Restrict who can push to matching branches
|
||||
|
||||
{% ifversion fpt or ghec %} 如果你的存储库为使用 {% data variables.product.prodname_team %} 或 {% data variables.product.prodname_ghe_cloud %} 的组织所有,你可以启用分支限制。
|
||||
{% ifversion fpt or ghec %}
|
||||
You can enable branch restrictions if your repository is owned by an organization using {% data variables.product.prodname_team %} or {% data variables.product.prodname_ghe_cloud %}.
|
||||
{% endif %}
|
||||
|
||||
启用分支限制时,只有已授予权限的用户、团队或应用程序才能推送到受保护的分支。 您可以在受保护分支的设置中查看和编辑对受保护分支具有推送权限的用户、团队或应用程序。 当需要状态检查时,如果所需的检查失败,仍会阻止有权推送到受保护分支的人员、团队和应用合并为一个分支。 当需要拉取请求时,有权推送到受保护分支的人员、团队和应用仍需要创建拉取请求。
|
||||
When you enable branch restrictions, only users, teams, or apps that have been given permission can push to the protected branch. You can view and edit the users, teams, or apps with push access to a protected branch in the protected branch's settings. When status checks are required, the people, teams, and apps that have permission to push to a protected branch will still be prevented from merging into the branch when the required checks fail. People, teams, and apps that have permission to push to a protected branch will still need to create a pull request when pull requests are required.
|
||||
|
||||
{% ifversion restrict-pushes-create-branch %}(可选)可以将相同的限制应用于创建与规则匹配的分支。 例如,如果创建一个仅允许特定团队推送到包含单词 `release` 的任何分支的规则,则只有该团队的成员才能创建包含单词 `release` 的新分支。
|
||||
{% ifversion restrict-pushes-create-branch %}
|
||||
Optionally, you can apply the same restrictions to the creation of branches that match the rule. For example, if you create a rule that only allows a certain team to push to any branches that contain the word `release`, only members of that team would be able to create a new branch that contains the word `release`.
|
||||
{% endif %}
|
||||
|
||||
只能向对存储库具有写入权限的用户、团队或已安装的 {% data variables.product.prodname_github_apps %} 授予推送到受保护分支或创建匹配分支的权限。 对存储库具有管理员权限的人员和应用程序始终能够推送到受保护分支或创建匹配分支。
|
||||
You can only give push access to a protected branch, or give permission to create a matching branch, to users, teams, or installed {% data variables.product.prodname_github_apps %} with write access to a repository. People and apps with admin permissions to a repository are always able to push to a protected branch or create a matching branch.
|
||||
|
||||
### 允许强制推送
|
||||
### Allow force pushes
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5624 %} 默认情况下,{% data variables.product.product_name %} 会阻止对所有受保护分支的强制推送。 启用强制推送到受保护分支时,可以选择两个可以强制推送的组之一:
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
By default, {% data variables.product.product_name %} blocks force pushes on all protected branches. When you enable force pushes to a protected branch, you can choose one of two groups who can force push:
|
||||
|
||||
1. 允许至少具有存储库写入权限的每个人强制推送到分支,包括具有管理员权限的人员。
|
||||
1. 仅允许特定人员或团队强制推送到分支。
|
||||
1. Allow everyone with at least write permissions to the repository to force push to the branch, including those with admin permissions.
|
||||
1. Allow only specific people or teams to force push to the branch.
|
||||
|
||||
如果有人强制推送到分支,则强制推送可能会覆盖其他协作者基于其工作的承诺。 用户可能有合并冲突或损坏的拉取请求。
|
||||
If someone force pushes to a branch, the force push may overwrite commits that other collaborators based their work on. People may have merge conflicts or corrupted pull requests.
|
||||
|
||||
{% else %} 默认情况下,{% data variables.product.product_name %} 会阻止对所有受保护分支的强制推送。 对受保护分支启用强制推送时,只要具有仓库写入权限,任何人(包括具有管理员权限的人)都可以强制推送到该分支。 如果有人强制推送到分支,则强制推送可能会覆盖其他协作者基于其工作的承诺。 用户可能有合并冲突或损坏的拉取请求。
|
||||
{% else %}
|
||||
By default, {% data variables.product.product_name %} blocks force pushes on all protected branches. When you enable force pushes to a protected branch, anyone with at least write permissions to the repository can force push to the branch, including those with admin permissions. If someone force pushes to a branch, the force push may overwrite commits that other collaborators based their work on. People may have merge conflicts or corrupted pull requests.
|
||||
{% endif %}
|
||||
|
||||
启用强制推送不会覆盖任何其他分支保护规则。 例如,如果分支需要线性提交历史记录,则无法强制推送合并提交到该分支。
|
||||
Enabling force pushes will not override any other branch protection rules. For example, if a branch requires a linear commit history, you cannot force push merge commits to that branch.
|
||||
|
||||
{% ifversion ghes or ghae %}如果站点管理员阻止了强制推送到存储库中的所有分支,则你无法对受保护分支启用强制推送。 有关详细信息,请参阅“[阻止对个人帐户或组织拥有的存储库进行强制推送](/enterprise/admin/developer-workflow/blocking-force-pushes-to-repositories-owned-by-a-user-account-or-organization)”。
|
||||
{% ifversion ghes or ghae %}You cannot enable force pushes for a protected branch if a site administrator has blocked force pushes to all branches in your repository. For more information, see "[Blocking force pushes to repositories owned by a personal account or organization](/enterprise/admin/developer-workflow/blocking-force-pushes-to-repositories-owned-by-a-user-account-or-organization)."
|
||||
|
||||
如果站点管理员只阻止强制推送到默认分支,您仍然可以为任何其他受保护分支启用强制推送。{% endif %}
|
||||
If a site administrator has blocked force pushes to the default branch only, you can still enable force pushes for any other protected branch.{% endif %}
|
||||
|
||||
### 允许删除
|
||||
### Allow deletions
|
||||
|
||||
默认情况下,您不能删除受保护的分支。 启用删除受保护分支后,任何对仓库至少拥有写入权限的人都可以删除分支。
|
||||
By default, you cannot delete a protected branch. When you enable deletion of a protected branch, anyone with at least write permissions to the repository can delete the branch.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 管理分支保护规则
|
||||
intro: 可创建分支保护规则,为一个或多个分支强制实施某些工作流,例如要求进行审批评审或通过状态检查来确保所有拉取请求都已合并到受保护的分支的。
|
||||
title: Managing a branch protection rule
|
||||
intro: 'You can create a branch protection rule to enforce certain workflows for one or more branches, such as requiring an approving review or passing status checks for all pull requests merged into the protected branch.'
|
||||
product: '{% data reusables.gated-features.protected-branches %}'
|
||||
redirect_from:
|
||||
- /articles/configuring-protected-branches
|
||||
@@ -27,102 +27,117 @@ permissions: People with admin permissions to a repository can manage branch pro
|
||||
topics:
|
||||
- Repositories
|
||||
shortTitle: Branch protection rule
|
||||
ms.openlocfilehash: aed3ab7599d8c74c16d95e4667e94aa3264c9491
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147614173'
|
||||
---
|
||||
## 关于分支保护规则
|
||||
## About branch protection rules
|
||||
|
||||
{% data reusables.repositories.branch-rules-example %}
|
||||
|
||||
可以使用通配符语法 `*` 为存储库中所有当前和未来的分支创建规则。 由于 {% data variables.product.company_short %} 对 `File.fnmatch` 语法使用 `File::FNM_PATHNAME` 标志,因此通配符与目录分隔符 (`/`) 不匹配。 例如,`qa/*` 将匹配所有以 `qa/` 开头并包含单个斜杠的分支。 可以用 `qa/**/*` 包含多个斜杠,也可以用 `qa**/**/*` 扩展 `qa` 字符串,以使规则更具包容性。 有关分支规则语法选项的详细信息,请参阅 [fnmatch 文档](https://ruby-doc.org/core-2.5.1/File.html#method-c-fnmatch)。
|
||||
You can create a rule for all current and future branches in your repository with the wildcard syntax `*`. Because {% data variables.product.company_short %} uses the `File::FNM_PATHNAME` flag for the `File.fnmatch` syntax, the wildcard does not match directory separators (`/`). For example, `qa/*` will match all branches beginning with `qa/` and containing a single slash. You can include multiple slashes with `qa/**/*`, and you can extend the `qa` string with `qa**/**/*` to make the rule more inclusive. For more information about syntax options for branch rules, see the [fnmatch documentation](https://ruby-doc.org/core-2.5.1/File.html#method-c-fnmatch).
|
||||
|
||||
如果仓库有多个影响相同分支的受保护分支规则,则包含特定分支名称的规则具有最高优先级。 如果有多个受保护分支规则引用相同的特定规则名称,则最先创建的分支规则优先级更高。
|
||||
If a repository has multiple protected branch rules that affect the same branches, the rules that include a specific branch name have the highest priority. If there is more than one protected branch rule that references the same specific branch name, then the branch rule created first will have higher priority.
|
||||
|
||||
提及特殊字符的受保护分支规则,如 `*`、`?` 或 `]`,将按其创建的顺序应用,因此含有这些字符的规则创建时间越早,优先级越高。
|
||||
Protected branch rules that mention a special character, such as `*`, `?`, or `]`, are applied in the order they were created, so older rules with these characters have a higher priority.
|
||||
|
||||
要创建对现有分支规则的例外,您可以创建优先级更高的新分支保护规则,例如针对特定分支名称的分支规则。
|
||||
To create an exception to an existing branch rule, you can create a new branch protection rule that is higher priority, such as a branch rule for a specific branch name.
|
||||
|
||||
有关每个可用分支保护设置的详细信息,请参阅“[关于受保护的分支](/github/administering-a-repository/about-protected-branches)”。
|
||||
For more information about each of the available branch protection settings, see "[About protected branches](/github/administering-a-repository/about-protected-branches)."
|
||||
|
||||
## 创建分支保护规则
|
||||
## Creating a branch protection rule
|
||||
|
||||
创建分支规则时,指定的分支不必是仓库中现有的分支。
|
||||
When you create a branch rule, the branch you specify doesn't have to exist yet in the repository.
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.repository-branches %} {% data reusables.repositories.add-branch-protection-rules %} {% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5506 %}
|
||||
1. (可选)启用所需的拉取请求。
|
||||
- 在“保护匹配分支”下,选择“合并前需要拉取请求”。
|
||||

|
||||
- (可选)若需要在合并拉取请求之前审批,选择“需要审批”,单击“合并前所需的审批数”下拉菜单,然后选择希望分支上要求的审批审阅数 。
|
||||
 {% else %}
|
||||
1. (可选)启用必需拉取请求审查。
|
||||
- 在“保护匹配分支”下,选择“合并前需要拉取请求审阅”。
|
||||

|
||||
- 单击“必需的审批审阅”下拉菜单,然后选择分支上要求的审批审阅数。
|
||||
 {% endif %}
|
||||
- (可选)若要在将代码修改提交推送到分支时关闭拉取请求审批审阅,选择“推送新提交时关闭旧拉取请求审批”。
|
||||

|
||||
- (可选)若要在拉取请求影响具有指定所有者的代码时要求代码所有者审阅,请选择“要求代码所有者审阅”。 有关详细信息,请参阅“[关于代码所有者](/github/creating-cloning-and-archiving-repositories/about-code-owners)”。
|
||||
 {% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5611 %}
|
||||
- (可选)若要让特定参与者在需要时将代码推送到分支而不创建拉取请求,选择“允许指定参与者绕过所需的拉取请求”。 然后,搜索并选择应被允许跳过创建拉取请求的参与者。
|
||||
![“允许特定参与者绕过拉取请求要求”复选框]{% ifversion integration-branch-protection-exceptions %}(/assets/images/help/repository/PR-bypass-requirements-with-apps.png){% else %}(/assets/images/help/repository/PR-bypass-requirements.png){% endif %} {% endif %}
|
||||
- (可选)如果存储库是组织的一部分,选择“限制可以关闭拉取请求审阅的人员”。 然后,搜索并选择有权忽略拉取请求审查的参与者。 有关详细信息,请参阅“[关闭拉取请求审阅](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/dismissing-a-pull-request-review)”。
|
||||
![“限制可以关闭拉取请求审查的人员”复选框]{% ifversion integration-branch-protection-exceptions %}(/assets/images/help/repository/PR-review-required-dismissals-with-apps.png){% else %}(/assets/images/help/repository/PR-review-required-dismissals.png){% endif %}
|
||||
1. (可选)启用必需状态检查。 有关详细信息,请参阅“[关于状态检查](/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks)”。
|
||||
- 选择“合并前需要通过状态检查”。
|
||||

|
||||
- (可选)若要确保使用受保护分支上的最新代码测试拉取请求,选择“要求分支在合并前保持最新”。
|
||||

|
||||
- 搜索状态检查,选择您想要求的检查。
|
||||

|
||||
1. (可选)选择“合并前需要对话解决”。
|
||||

|
||||
1. (可选)选择“需要签名提交”。
|
||||

|
||||
1. (可选)选择“需要线性历史记录”。
|
||||
 {%- ifversion fpt or ghec %}
|
||||
1. (可选)若要使用合并队列合并拉取请求,选择“需要合并队列”。 {% data reusables.pull_requests.merge-queue-references %}  {% tip %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.repository-branches %}
|
||||
{% data reusables.repositories.add-branch-protection-rules %}
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
1. Optionally, enable required pull requests.
|
||||
- Under "Protect matching branches", select **Require a pull request before merging**.
|
||||

|
||||
- Optionally, to require approvals before a pull request can be merged, select **Require approvals**, click the **Required number of approvals before merging** drop-down menu, then select the number of approving reviews you would like to require on the branch.
|
||||

|
||||
{% else %}
|
||||
1. Optionally, enable required pull request reviews.
|
||||
- Under "Protect matching branches", select **Require pull request reviews before merging**.
|
||||

|
||||
- Click the **Required approving reviews** drop-down menu, then select the number of approving reviews you would like to require on the branch.
|
||||

|
||||
{% endif %}
|
||||
- Optionally, to dismiss a pull request approval review when a code-modifying commit is pushed to the branch, select **Dismiss stale pull request approvals when new commits are pushed**.
|
||||

|
||||
- Optionally, to require review from a code owner when the pull request affects code that has a designated owner, select **Require review from Code Owners**. For more information, see "[About code owners](/github/creating-cloning-and-archiving-repositories/about-code-owners)."
|
||||

|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
- Optionally, to allow specific actors to push code to the branch without creating pull requests when they're required, select **Allow specified actors to bypass required pull requests**. Then, search for and select the actors who should be allowed to skip creating a pull request.
|
||||
![Allow specific actors to bypass pull request requirements checkbox]{% ifversion integration-branch-protection-exceptions %}(/assets/images/help/repository/PR-bypass-requirements-with-apps.png){% else %}(/assets/images/help/repository/PR-bypass-requirements.png){% endif %}
|
||||
{% endif %}
|
||||
- Optionally, if the repository is part of an organization, select **Restrict who can dismiss pull request reviews**. Then, search for and select the actors who are allowed to dismiss pull request reviews. For more information, see "[Dismissing a pull request review](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/dismissing-a-pull-request-review)."
|
||||
![Restrict who can dismiss pull request reviews checkbox]{% ifversion integration-branch-protection-exceptions %}(/assets/images/help/repository/PR-review-required-dismissals-with-apps.png){% else %}(/assets/images/help/repository/PR-review-required-dismissals.png){% endif %}
|
||||
1. Optionally, enable required status checks. For more information, see "[About status checks](/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks)."
|
||||
- Select **Require status checks to pass before merging**.
|
||||

|
||||
- Optionally, to ensure that pull requests are tested with the latest code on the protected branch, select **Require branches to be up to date before merging**.
|
||||

|
||||
- Search for status checks, selecting the checks you want to require.
|
||||

|
||||
1. Optionally, select **Require conversation resolution before merging**.
|
||||

|
||||
1. Optionally, select **Require signed commits**.
|
||||

|
||||
1. Optionally, select **Require linear history**.
|
||||

|
||||
{%- ifversion fpt or ghec %}
|
||||
1. Optionally, to merge pull requests using a merge queue, select **Require merge queue**. {% data reusables.pull_requests.merge-queue-references %}
|
||||

|
||||
{% tip %}
|
||||
|
||||
**提示:** 拉取请求合并队列功能目前为有限的公开 beta 版本,可能会发生更改。 组织所有者可以通过加入[候补名单](https://github.com/features/merge-queue/signup)来申请提前访问 beta 版。
|
||||
**Tip:** The pull request merge queue feature is currently in limited public beta and subject to change. Organizations owners can request early access to the beta by joining the [waitlist](https://github.com/features/merge-queue/signup).
|
||||
|
||||
{% endtip %} {%- endif %} {%- ifversion required-deployments %}
|
||||
1. (可选)若要选择在合并之前必须将更改成功部署到哪些环境,选择“需要在合并之前部署成功”,然后选择环境。
|
||||
 {%- endif %}
|
||||
1. (可选)选择“{% ifversion bypass-branch-protections %}不允许绕过上述设置”。
|
||||
{% else %}**会将上述规则应用于管理员**。
|
||||
{% endif %}
|
||||
1. (可选){% ifversion fpt or ghec %}如果你的存储库为使用 {% data variables.product.prodname_team %} 或 {% data variables.product.prodname_ghe_cloud %} 的组织所有,{% endif %}请启用分支限制。
|
||||
- 选择“限制可推送到匹配分支的人员”。
|
||||
{% ifversion restrict-pushes-create-branch %}
|
||||
- (可选)若要限制匹配分支的创建,请选择“限制创建匹配分支的推送”。
|
||||
{% endif %}
|
||||
- 搜索并选择有权限推送到受保护分支或创建匹配分支的人员、团队或应用。
|
||||
![分支限制搜索]{% ifversion restrict-pushes-create-branch %}(/assets/images/help/repository/restrict-branch-search-with-create.png){% else %}(/assets/images/help/repository/restrict-branch-search.png){% endif %}
|
||||
1. (可选)在“适用于包括管理员在内的所有人的规则”下,选择“允许强制推送”。
|
||||
 {% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5624 %} 然后,选择可以强制推送到分支的人员。
|
||||
- 选择“所有人”,允许至少具有存储库写入权限的人强制推送到分支,包括具有管理员权限的人员。
|
||||
- 选择“指定可以强制推送的人员”,仅允许特定参与者强制推送到分支。 然后,搜索并选择这些参与者。
|
||||
![用于指定可以强制推送的人员的选项的屏幕截图]{% ifversion integration-branch-protection-exceptions %}(/assets/images/help/repository/allow-force-pushes-specify-who-with-apps.png){% else %}(/assets/images/help/repository/allow-force-pushes-specify-who.png){% endif %} {% endif %}
|
||||
{% endtip %}
|
||||
{%- endif %}
|
||||
{%- ifversion required-deployments %}
|
||||
1. Optionally, to choose which environments the changes must be successfully deployed to before merging, select **Require deployments to succeed before merging**, then select the environments.
|
||||

|
||||
{%- endif %}
|
||||
1. Optionally, select {% ifversion bypass-branch-protections %}**Do not allow bypassing the above settings**.
|
||||
{% else %}**Apply the rules above to administrators**.
|
||||
{% endif %}
|
||||
1. Optionally,{% ifversion fpt or ghec %} if your repository is owned by an organization using {% data variables.product.prodname_team %} or {% data variables.product.prodname_ghe_cloud %},{% endif %} enable branch restrictions.
|
||||
- Select **Restrict who can push to matching branches**.
|
||||
{% ifversion restrict-pushes-create-branch %}
|
||||
- Optionally, to also restrict the creation of matching branches, select **Restrict pushes that create matching branches**.
|
||||
{% endif %}
|
||||
- Search for and select the people, teams, or apps who will have permission to push to the protected branch or create a matching branch.
|
||||
![Branch restriction search]{% ifversion restrict-pushes-create-branch %}(/assets/images/help/repository/restrict-branch-search-with-create.png){% else %}(/assets/images/help/repository/restrict-branch-search.png){% endif %}
|
||||
1. Optionally, under "Rules applied to everyone including administrators", select **Allow force pushes**.
|
||||

|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
||||
Then, choose who can force push to the branch.
|
||||
- Select **Everyone** to allow everyone with at least write permissions to the repository to force push to the branch, including those with admin permissions.
|
||||
- Select **Specify who can force push** to allow only specific actors to force push to the branch. Then, search for and select those actors.
|
||||
![Screenshot of the options to specify who can force push]{% ifversion integration-branch-protection-exceptions %}(/assets/images/help/repository/allow-force-pushes-specify-who-with-apps.png){% else %}(/assets/images/help/repository/allow-force-pushes-specify-who.png){% endif %}
|
||||
{% endif %}
|
||||
|
||||
有关强制推送的详细信息,请参阅“[允许强制推送](/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches/#allow-force-pushes)”。
|
||||
1. (可选)选择“允许删除”。
|
||||

|
||||
1. 单击“创建”。
|
||||
For more information about force pushes, see "[Allow force pushes](/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches/#allow-force-pushes)."
|
||||
1. Optionally, select **Allow deletions**.
|
||||

|
||||
1. Click **Create**.
|
||||
|
||||
## 编辑分支保护规则
|
||||
## Editing a branch protection rule
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.repository-branches %}
|
||||
1. 在要编辑的分支保护规则的右侧,单击“编辑”。
|
||||

|
||||
1. 对分支保护规则进行所需的更改。
|
||||
1. 单击“保存更改”。
|
||||

|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.repository-branches %}
|
||||
1. To the right of the branch protection rule you want to edit, click **Edit**.
|
||||

|
||||
1. Make your desired changes to the branch protection rule.
|
||||
1. Click **Save changes**.
|
||||

|
||||
|
||||
## 删除分支保护规则
|
||||
## Deleting a branch protection rule
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.repository-branches %}
|
||||
1. 在要删除的分支保护规则的右侧,单击“删除”。
|
||||

|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.repository-branches %}
|
||||
1. To the right of the branch protection rule you want to delete, click **Delete**.
|
||||

|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 必需状态检查故障排除
|
||||
intro: 您可以检查必需状态检查的常见错误并解决问题,
|
||||
title: Troubleshooting required status checks
|
||||
intro: You can check for common errors and resolve issues with required status checks.
|
||||
product: '{% data reusables.gated-features.protected-branches %}'
|
||||
versions:
|
||||
fpt: '*'
|
||||
@@ -13,24 +13,18 @@ redirect_from:
|
||||
- /github/administering-a-repository/troubleshooting-required-status-checks
|
||||
- /github/administering-a-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks
|
||||
shortTitle: Required status checks
|
||||
ms.openlocfilehash: 89752b777160df26cc6f650964aac56727f90223
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '145129404'
|
||||
---
|
||||
如果您有名称相同的检查和状态,并且选择该名称作为必需状态检查,则检查和状态都是必需的。 有关详细信息,请参阅“[检查](/rest/reference/checks)”。
|
||||
If you have a check and a status with the same name, and you select that name as a required status check, both the check and the status are required. For more information, see "[Checks](/rest/reference/checks)."
|
||||
|
||||
在启用必需状态检查后,您的分支在合并之前可能需要使用基础分支更新。 这可确保您的分支已经使用基本分支的最新代码做过测试。 如果您的分支过期,则需要将基本分支合并到您的分支。 有关详细信息,请参阅“[关于受保护的分支](/github/administering-a-repository/about-protected-branches#require-status-checks-before-merging)”。
|
||||
After you enable required status checks, your branch may need to be up-to-date with the base branch before merging. This ensures that your branch has been tested with the latest code from the base branch. If your branch is out of date, you'll need to merge the base branch into your branch. For more information, see "[About protected branches](/github/administering-a-repository/about-protected-branches#require-status-checks-before-merging)."
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:也可以使用 Git 变基以基础分支更新分支。 有关详细信息,请参阅“[关于 Git 变基](/github/getting-started-with-github/about-git-rebase)”。
|
||||
**Note:** You can also bring your branch up to date with the base branch using Git rebase. For more information, see "[About Git rebase](/github/getting-started-with-github/about-git-rebase)."
|
||||
|
||||
{% endnote %}
|
||||
|
||||
在通过所有必需状态检查之前,无法向受保护分支推送本地更改。 反而会收到类似如下的错误消息。
|
||||
You won't be able to push local changes to a protected branch until all required status checks pass. Instead, you'll receive an error message similar to the following.
|
||||
|
||||
```shell
|
||||
remote: error: GH006: Protected branch update failed for refs/heads/main.
|
||||
@@ -38,29 +32,29 @@ remote: error: Required status check "ci-build" is failing
|
||||
```
|
||||
{% note %}
|
||||
|
||||
注意:最新且通过所需状态检查的拉取请求可以在本地合并,并推送到受保护的分支。 此操作无需对合并提交本身运行状态检查。
|
||||
**Note:** Pull requests that are up-to-date and pass required status checks can be merged locally and pushed to the protected branch. This can be done without status checks running on the merge commit itself.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
## 头部提交与测试合并提交之间的冲突
|
||||
## Conflicts between head commit and test merge commit
|
||||
|
||||
有时,测试合并提交与头部提交的状态检查结果存在冲突。 如果测试合并提交具有状态,则测试合并提交必须通过。 否则,必须传递头部提交的状态后才可合并该分支。 有关测试合并提交的详细信息,请参阅“[拉取](/rest/reference/pulls#get-a-pull-request)”。
|
||||
Sometimes, the results of the status checks for the test merge commit and head commit will conflict. If the test merge commit has a status, the test merge commit must pass. Otherwise, the status of the head commit must pass before you can merge the branch. For more information about test merge commits, see "[Pulls](/rest/reference/pulls#get-a-pull-request)."
|
||||
|
||||

|
||||

|
||||
|
||||
## 处理已跳过但需要检查
|
||||
## Handling skipped but required checks
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:如果因[路径筛选](/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore)、[分支筛选](/actions/using-workflows/workflow-syntax-for-github-actions#onpull_requestpull_request_targetbranchesbranches-ignore)或[提交消息](/actions/managing-workflow-runs/skipping-workflow-runs)而跳过某工作流,则与该工作流关联的检查将保持为“挂起”状态。 要求这些检查成功的拉取请求将被阻止合并。
|
||||
**Note:** If a workflow is skipped due to [path filtering](/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore), [branch filtering](/actions/using-workflows/workflow-syntax-for-github-actions#onpull_requestpull_request_targetbranchesbranches-ignore) or a [commit message](/actions/managing-workflow-runs/skipping-workflow-runs), then checks associated with that workflow will remain in a "Pending" state. A pull request that requires those checks to be successful will be blocked from merging.
|
||||
|
||||
如果由于某条件而跳过工作流中的作业,该作业状态将报告为“成功”。 有关详细信息,请参阅[跳过工作流运行](/actions/managing-workflow-runs/skipping-workflow-runs)和[使用条件控制作业执行](/actions/using-jobs/using-conditions-to-control-job-execution)。
|
||||
If a job in a workflow is skipped due to a conditional, it will report its status as "Success". For more information see [Skipping workflow runs](/actions/managing-workflow-runs/skipping-workflow-runs) and [Using conditions to control job execution](/actions/using-jobs/using-conditions-to-control-job-execution).
|
||||
|
||||
{% endnote %}
|
||||
|
||||
### 示例
|
||||
### Example
|
||||
|
||||
以下示例显示了要求 `build` 作业为“成功”完成状态的工作流,但如果拉取请求未更改 `scripts` 目录中的任何文件,则将跳过该工作流。
|
||||
The following example shows a workflow that requires a "Successful" completion status for the `build` job, but the workflow will be skipped if the pull request does not change any files in the `scripts` directory.
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
@@ -86,11 +80,11 @@ jobs:
|
||||
- run: npm test
|
||||
```
|
||||
|
||||
由于[路径筛选](/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore),仅更改存储库根目录中文件的拉取请求不会触发此工作流,并且将被阻止合并。 您将在拉取请求上看到以下状态:
|
||||
Due to [path filtering](/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore), a pull request that only changes a file in the root of the repository will not trigger this workflow and is blocked from merging. You would see the following status on the pull request:
|
||||
|
||||

|
||||

|
||||
|
||||
您可以通过创建具有相同名称的通用工作流程来解决此问题,该工作流程在任何情况下都将返回 true,类似于下面的工作流程:
|
||||
You can fix this by creating a generic workflow, with the same name, that will return true in any case similar to the workflow below :
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
@@ -105,19 +99,19 @@ jobs:
|
||||
steps:
|
||||
- run: 'echo "No build required" '
|
||||
```
|
||||
现在,只要有人发送不会更改第一个工作流中 `paths` 下列出的文件的拉取请求,检查将始终通过。
|
||||
Now the checks will always pass whenever someone sends a pull request that doesn't change the files listed under `paths` in the first workflow.
|
||||
|
||||

|
||||

|
||||
|
||||
{% note %}
|
||||
|
||||
**注意:**
|
||||
* 请确保两个工作流文件中 `name` 键和所需的作业名称相同。 有关详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流语法”](/actions/reference/workflow-syntax-for-github-actions)。
|
||||
* 上面的示例使用 {% data variables.product.prodname_actions %} 但此解决方法也适用于与 {% data variables.product.company_short %} 集成的其他 CI/CD 提供程序。
|
||||
**Notes:**
|
||||
* Make sure that the `name` key and required job name in both the workflow files are the same. For more information, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/reference/workflow-syntax-for-github-actions)".
|
||||
* The example above uses {% data variables.product.prodname_actions %} but this workaround is also applicable to other CI/CD providers that integrate with {% data variables.product.company_short %}.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-5379 or ghec %}受保护的分支也可能要求从特定的 {% data variables.product.prodname_github_app %} 进行状态检查。 如果看到类似于以下内容的消息,则应验证合并框中列出的检查项是否由预期的应用设置。
|
||||
{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}It's also possible for a protected branch to require a status check from a specific {% data variables.product.prodname_github_app %}. If you see a message similar to the following, then you should verify that the check listed in the merge box was set by the expected app.
|
||||
|
||||
```
|
||||
Required status check "build" was not set by the expected {% data variables.product.prodname_github_app %}.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 管理存储库的 GitHub Actions 设置
|
||||
intro: '您可以对特定仓库禁用或配置 {% data variables.product.prodname_actions %}。'
|
||||
title: Managing GitHub Actions settings for a repository
|
||||
intro: 'You can disable or configure {% data variables.product.prodname_actions %} for a specific repository.'
|
||||
redirect_from:
|
||||
- /github/administering-a-repository/configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-repository
|
||||
- /github/administering-a-repository/managing-repository-settings/configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-repository
|
||||
@@ -18,150 +18,175 @@ topics:
|
||||
- Pull requests
|
||||
shortTitle: Manage GitHub Actions settings
|
||||
miniTocMaxHeadingLevel: 3
|
||||
ms.openlocfilehash: 80bce0a3f43ccac75215bd738922dc5d79868793
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147061126'
|
||||
---
|
||||
{% 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 repository
|
||||
|
||||
您可以对您的仓库启用 {% 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 your repository. {% data reusables.actions.enabled-actions-description %} You can disable {% data variables.product.prodname_actions %} for your repository altogether. {% data reusables.actions.disabled-actions-description %}
|
||||
|
||||
## 管理仓库的 {% data variables.product.prodname_actions %} 权限
|
||||
Alternatively, you can enable {% data variables.product.prodname_actions %} in your repository 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 %}。
|
||||
## Managing {% data variables.product.prodname_actions %} permissions for your repository
|
||||
|
||||
You can disable {% data variables.product.prodname_actions %} for a repository, or set a policy that configures which actions{% ifversion actions-workflow-policy %} and reusable workflows{% endif %} can be used in the repository.
|
||||
|
||||
{% note %}
|
||||
|
||||
注意:如果你的组织有覆盖策略或由具有覆盖策略的企业帐户管理,则可能无法管理这些设置。 有关详细信息,请参阅“[为组织禁用或限制 {% data variables.product.prodname_actions %}](/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization)”或“[在企业中对 {% 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 has an overriding policy or is managed by an enterprise that has overriding policy. 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)" or "[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.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.settings-sidebar-actions-general %}
|
||||
1. 在“Actions permissions(操作权限)”下,选择一个选项。
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.settings-sidebar-actions-general %}
|
||||
1. Under "Actions permissions", select an option.
|
||||
|
||||
{% indented_data_reference reusables.actions.actions-use-policy-settings spaces=3 %}
|
||||
|
||||
{% ifversion actions-workflow-policy %}  {%- else %}  {%- endif %}
|
||||
1. 单击“ **保存**”。
|
||||
{% ifversion actions-workflow-policy %}
|
||||

|
||||
{%- else %}
|
||||

|
||||
{%- endif %}
|
||||
1. Click **Save**.
|
||||
|
||||
{% data reusables.actions.allow-specific-actions-intro %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.settings-sidebar-actions-general %}
|
||||
1. 在“操作权限”下,选择 {% data reusables.actions.policy-label-for-select-actions-workflows %} 并将所需的操作添加到列表中。
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.settings-sidebar-actions-general %}
|
||||
1. Under "Actions permissions", select {% data reusables.actions.policy-label-for-select-actions-workflows %} and add your required actions to the list.
|
||||
|
||||
{% ifversion actions-workflow-policy%}  {%- elsif ghes %}  {%- else %}  {%- endif %}
|
||||
1. 单击“ **保存**”。
|
||||
{% ifversion actions-workflow-policy%}
|
||||

|
||||
{%- elsif ghes %}
|
||||

|
||||
{%- else %}
|
||||

|
||||
{%- endif %}
|
||||
1. Click **Save**.
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
## 在公共存储库中控制从分支到工作流的更改
|
||||
## Controlling changes from forks to workflows in public repositories
|
||||
|
||||
{% data reusables.actions.workflow-run-approve-public-fork %}
|
||||
|
||||
您可以使用以下过程为存储库配置此行为。 修改此设置会覆盖组织或企业级别的配置集。
|
||||
You can configure this behavior for a repository using the procedure below. Modifying this setting overrides the configuration set at the organization or enterprise level.
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.settings-sidebar-actions-general %} {% data reusables.actions.workflows-from-public-fork-setting %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.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 %}
|
||||
|
||||
## 为专用存储库的分支启用工作流
|
||||
## Enabling workflows for forks of private repositories
|
||||
|
||||
{% data reusables.actions.private-repository-forks-overview %}
|
||||
|
||||
如果为 {% ifversion ghec or ghae or ghes %}企业或{% endif %} 组织禁用了某个策略,则无法为存储库启用该策略。
|
||||
If a policy is disabled for an {% ifversion ghec or ghae or ghes %}enterprise or{% endif %} organization, it cannot be enabled for a repository.
|
||||
|
||||
{% data reusables.actions.private-repository-forks-options %}
|
||||
|
||||
### 为专用存储库配置分支策略
|
||||
### Configuring the fork policy for a private repository
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.settings-sidebar-actions-general %} {% data reusables.actions.private-repository-forks-configure %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.settings-sidebar-actions-general %}
|
||||
{% data reusables.actions.private-repository-forks-configure %}
|
||||
|
||||
## 为存储库设置 `GITHUB_TOKEN` 的权限
|
||||
## Setting the permissions of the `GITHUB_TOKEN` for your repository
|
||||
|
||||
{% data reusables.actions.workflow-permissions-intro %}
|
||||
|
||||
默认权限也可以在组织设置中配置。 如果你的存储库属于某个组织并且在组织设置中选择了更严格的默认值,则会在存储库设置中自动选择相同的选项,并禁用许可选项。
|
||||
The default permissions can also be configured in the organization settings. If your repository belongs to an organization and a more restrictive default has been selected in the organization settings, the same option is selected in your repository settings and the permissive option is disabled.
|
||||
|
||||
{% data reusables.actions.workflow-permissions-modifying %}
|
||||
|
||||
### 配置默认 `GITHUB_TOKEN` 权限
|
||||
|
||||
{% ifversion allow-actions-to-approve-pr-with-ent-repo %} 默认情况下,当你在个人帐户中创建新存储库时,`GITHUB_TOKEN` 仅对 `contents` 范围具有读取权限。 如果在组织中创建新存储库,则设置继承自组织设置中配置的内容。
|
||||
{% endif %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.settings-sidebar-actions-general %}
|
||||
1. 在“工作流权限”下,选择是要让 `GITHUB_TOKEN` 对所有范围具有读写访问权限,还是仅对 `contents` 范围具有读取访问。
|
||||
|
||||

|
||||
|
||||
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 repository in your personal account, `GITHUB_TOKEN` only has read access for the `contents` scope. If you create a new repository in an organization, the setting is inherited from what is configured in the organization settings.
|
||||
{% endif %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% 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.
|
||||
|
||||

|
||||
|
||||
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 repository in your personal account, workflows are not allowed to create or approve pull requests. If you create a new repository in an organization, the setting is inherited from what is configured in the organization settings.
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.settings-sidebar-actions-general %}
|
||||
1. 在“工作流权限”下,使用“允许 GitHub Actions 创建和批准拉取请求”设置配置 `GITHUB_TOKEN` 是否可以创建和批准拉取请求。
|
||||
|
||||

|
||||
1. 单击“保存”以应用设置。
|
||||
{% endif %}
|
||||
|
||||
{% ifversion ghes > 3.3 or ghae-issue-4757 or ghec %}
|
||||
## 允许访问内部存储库中的组件
|
||||
|
||||
企业成员可以使用内部存储库来处理项目,而无需公开共享信息。 有关信息,请参阅[关于存储库](/repositories/creating-and-managing-repositories/about-repositories#about-internal-repositories)。
|
||||
|
||||
你可以使用以下步骤配置是否可以从存储库外部访问内部存储库中的{% ifversion internal-actions%}操作和{% endif %}工作流。{% ifversion internal-actions %}有关详细信息,请参阅“[与企业共享操作和工作流](/actions/creating-actions/sharing-actions-and-workflows-with-your-enterprise)”。 或者,您可以使用 REST API 来设置或获取访问级别的详细信息。 有关详细信息,请参阅“[获取存储库外部工作流的访问级别](/rest/reference/actions#get-the-level-of-access-for-workflows-outside-of-the-repository#get-the-level-of-access-for-workflows-outside-of-the-repository)”和“[设置存储库外部工作流的访问级别](/rest/reference/actions#get-the-level-of-access-for-workflows-outside-of-the-repository#set-the-level-of-access-for-workflows-outside-of-the-repository)”。{% endif %}
|
||||
|
||||
1. 在 {% data variables.product.prodname_dotcom %} 上,导航到内部仓库的主页面。
|
||||
1. 在存储库名称下,单击 {% octicon "gear" aria-label="The gear icon" %}“设置”。
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.settings-sidebar-actions-general %}
|
||||
1. 在“访问”下,选择其中一个访问设置:
|
||||
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.
|
||||
|
||||
{% ifversion ghes > 3.4 or ghae-issue-6090 or ghec %}{% else %}{% endif %}
|
||||
|
||||
* 无法访问- 其他存储库中的工作流无法访问此存储库。
|
||||
* 可从 'ORGANIZATION NAME' 组织中的存储库访问 - {% ifversion ghes > 3.4 or ghae-issue-6090 or ghec %}属于 'ORGANIZATION NAME' 组织的其他存储库中的工作流可以访问此存储库中的操作和工作流。 仅允许从私有或内部存储库进行访问。{% else %}如果其他存储库中的工作流程属于同一组织,并且其可见性是私有或内部,则可以使用此存储库中的工作流程。{% endif %}
|
||||
* 可从 'ENTERPRISE NAME' 企业中的存储库访问 - {% ifversion ghes > 3.4 or ghae-issue-6090 or ghec %}属于 'ENTERPRISE NAME' 企业的其他存储库中的工作流可以访问此存储库中的操作和工作流。 仅允许从私有或内部存储库进行访问。{% else %}如果其他存储库中的工作流程属于同一企业,并且其可见性是私有或内部,则可以使用此存储库中的工作流程。{% endif %}
|
||||
1. 单击“保存”以应用设置。
|
||||

|
||||
1. Click **Save** to apply the settings.
|
||||
{% endif %}
|
||||
|
||||
## 为仓库中构件和日志的 {% data variables.product.prodname_actions %} 配置保留期
|
||||
{% ifversion ghes > 3.3 or ghae > 3.3 or ghec %}
|
||||
## Allowing access to components in an internal repository
|
||||
|
||||
您可以为仓库中的 {% data variables.product.prodname_actions %} 构件和日志配置保留期。
|
||||
Members of your enterprise can use internal repositories to work on projects without sharing information publicly. For information, see "[About repositories](/repositories/creating-and-managing-repositories/about-repositories#about-internal-repositories)."
|
||||
|
||||
You can use the steps below to configure whether {% ifversion internal-actions%}actions and {% endif %}workflows in an internal repository can be accessed from outside the repository.{% ifversion internal-actions %} For more information, see "[Sharing actions and workflows with your enterprise](/actions/creating-actions/sharing-actions-and-workflows-with-your-enterprise)." Alternatively, you can use the REST API to set, or get details of, the level of access. For more information, see "[Get the level of access for workflows outside of the repository](/rest/reference/actions#get-the-level-of-access-for-workflows-outside-of-the-repository#get-the-level-of-access-for-workflows-outside-of-the-repository)" and "[Set the level of access for workflows outside of the repository](/rest/reference/actions#get-the-level-of-access-for-workflows-outside-of-the-repository#set-the-level-of-access-for-workflows-outside-of-the-repository)."{% endif %}
|
||||
|
||||
1. On {% data variables.product.prodname_dotcom %}, navigate to the main page of the internal repository.
|
||||
1. Under your repository name, click {% octicon "gear" aria-label="The gear icon" %} **Settings**.
|
||||
{% data reusables.repositories.settings-sidebar-actions-general %}
|
||||
1. Under **Access**, choose one of the access settings:
|
||||
|
||||
{% ifversion ghes > 3.4 or ghae > 3.4 or ghec %}{% else %}{% endif %}
|
||||
|
||||
* **Not accessible** - Workflows in other repositories cannot access this repository.
|
||||
* **Accessible from repositories in the 'ORGANIZATION NAME' organization** - {% ifversion ghes > 3.4 or ghae > 3.4 or ghec %}Workflows in other repositories that are part of the 'ORGANIZATION NAME' organization can access the actions and workflows in this repository. Access is allowed only from private or internal repositories.{% else %}Workflows in other repositories can use workflows in this repository if they are part of the same organization and their visibility is private or internal.{% endif %}
|
||||
* **Accessible from repositories in the 'ENTERPRISE NAME' enterprise** - {% ifversion ghes > 3.4 or ghae > 3.4 or ghec %}Workflows in other repositories that are part of the 'ENTERPRISE NAME' enterprise can access the actions and workflows in this repository. Access is allowed only from private or internal repositories.{% else %}Workflows in other repositories can use workflows in this repository if they are part of the same enterprise and their visibility is private or internal.{% endif %}
|
||||
1. Click **Save** to apply the settings.
|
||||
{% endif %}
|
||||
|
||||
## Configuring the retention period for {% data variables.product.prodname_actions %} artifacts and logs in your repository
|
||||
|
||||
You can configure the retention period for {% data variables.product.prodname_actions %} artifacts and logs in your repository.
|
||||
|
||||
{% data reusables.actions.about-artifact-log-retention %}
|
||||
|
||||
您还可以为工作流程创建的特定构件自定义保留期。 有关详细信息,请参阅“[设置项目的保持期](/actions/managing-workflow-runs/removing-workflow-artifacts#setting-the-retention-period-for-an-artifact)”。
|
||||
You can also define a custom retention period for a specific artifact created by a workflow. For more information, see "[Setting the retention period for an artifact](/actions/managing-workflow-runs/removing-workflow-artifacts#setting-the-retention-period-for-an-artifact)."
|
||||
|
||||
## 设置仓库的保留期
|
||||
## Setting the retention period for a repository
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.settings-sidebar-actions-general %} {% data reusables.actions.change-retention-period-for-artifacts-logs %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.settings-sidebar-actions-general %}
|
||||
{% data reusables.actions.change-retention-period-for-artifacts-logs %}
|
||||
|
||||
{% ifversion actions-cache-policy-apis %}
|
||||
|
||||
## 为存储库配置缓存存储
|
||||
## Configuring cache storage for a repository
|
||||
|
||||
{% data reusables.actions.cache-default-size %}但是,如果企业所有者更改了这些默认大小,则这些默认大小可能有所不同。 {% data reusables.actions.cache-eviction-process %}
|
||||
{% data reusables.actions.cache-default-size %} However, these default sizes might be different if an enterprise owner has changed them. {% data reusables.actions.cache-eviction-process %}
|
||||
|
||||
可以将存储库的总缓存存储大小设置为企业策略设置允许的最大大小。
|
||||
You can set a total cache storage size for your repository up to the maximum size allowed by the enterprise policy setting.
|
||||
|
||||
{% data variables.product.prodname_actions %} 缓存存储的策略设置目前只能使用 REST API 进行修改:
|
||||
The repository 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-a-repository)”。
|
||||
* 若要更改存储库的缓存存储限制,请参阅“[设置存储库的 GitHub Actions 缓存使用策略](/rest/actions/cache#set-github-actions-cache-usage-policy-for-a-repository)”。
|
||||
* To view the current cache storage limit for a repository, see "[Get GitHub Actions cache usage policy for a repository](/rest/actions/cache#get-github-actions-cache-usage-policy-for-a-repository)."
|
||||
* To change the cache storage limit for a repository, see "[Set GitHub Actions cache usage policy for a repository](/rest/actions/cache#set-github-actions-cache-usage-policy-for-a-repository)."
|
||||
|
||||
{% data reusables.actions.cache-no-org-policy %}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 管理存储库的安全和分析设置
|
||||
intro: '您可以控制功能以保护 {% data variables.product.prodname_dotcom %} 上项目的安全并分析其中的代码。'
|
||||
title: Managing security and analysis settings for your repository
|
||||
intro: 'You can control features that secure and analyze the code in your project on {% data variables.product.prodname_dotcom %}.'
|
||||
permissions: People with admin permissions to a repository can manage security and analysis settings for the repository.
|
||||
redirect_from:
|
||||
- /articles/managing-alerts-for-vulnerable-dependencies-in-your-organization-s-repositories
|
||||
@@ -23,69 +23,103 @@ topics:
|
||||
- Secret scanning
|
||||
- Repositories
|
||||
shortTitle: Security & analysis
|
||||
ms.openlocfilehash: 95e0b3c0c8e03c8a903dad8220542502ce73bf5c
|
||||
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
|
||||
ms.translationtype: HT
|
||||
ms.contentlocale: zh-CN
|
||||
ms.lasthandoff: 09/05/2022
|
||||
ms.locfileid: '147060336'
|
||||
---
|
||||
{% ifversion fpt or ghec %}
|
||||
## 为公共仓库启用或禁用安全和分析功能
|
||||
## Enabling or disabling security and analysis features for public repositories
|
||||
|
||||
您可以管理公共仓库的一部分安全和分析功能。 其他功能是永久启用的,包括依赖项图和密码扫描。
|
||||
You can manage a subset of security and analysis features for public repositories. Other features are permanently enabled, including dependency graph and secret scanning.
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.navigate-to-code-security-and-analysis %}
|
||||
4. 在“代码安全和分析”下,单击该功能右侧的“禁用”或“启用” 。
|
||||
 {% endif %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.navigate-to-code-security-and-analysis %}
|
||||
4. Under "Code security and analysis", to the right of the feature, click **Disable** or **Enable**.
|
||||

|
||||
{% endif %}
|
||||
|
||||
## 为专用存储库启用或禁用安全和分析功能{% ifversion fpt or ghec %}{% endif %}
|
||||
## Enabling or disabling security and analysis features{% ifversion fpt or ghec %} for private repositories{% endif %}
|
||||
|
||||
您可以管理{% ifversion fpt or ghec %}私有或内部 {% endif %}仓库的安全性和分析功能。{% ifversion ghes or ghec %} 如果您的组织属于拥有 {% data variables.product.prodname_GH_advanced_security %} 许可证的企业,则额外选项可用。 {% data reusables.advanced-security.more-info-ghas %} {% elsif fpt %} 结合使用 {% data variables.product.prodname_ghe_cloud %} 与 {% data variables.product.prodname_advanced_security %} 的组织有额外选项可用。 有关详细信息,请参阅 [{% data variables.product.prodname_ghe_cloud %} 文档](/enterprise-cloud@latest//repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-security-and-analysis-settings-for-your-repository#enabling-or-disabling-security-and-analysis-features-for-private-repositories)。
|
||||
You can manage the security and analysis features for your {% ifversion fpt or ghec %}private or internal {% endif %}repository.{% ifversion ghes or ghec %} If your organization belongs to an enterprise with a license for {% data variables.product.prodname_GH_advanced_security %} then extra options are available. {% data reusables.advanced-security.more-info-ghas %}
|
||||
{% elsif fpt %} Organizations that use {% data variables.product.prodname_ghe_cloud %} with {% data variables.product.prodname_advanced_security %} have extra options available. For more information, see the [{% data variables.product.prodname_ghe_cloud %} documentation](/enterprise-cloud@latest//repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-security-and-analysis-settings-for-your-repository#enabling-or-disabling-security-and-analysis-features-for-private-repositories).
|
||||
{% endif %}
|
||||
|
||||
{% data reusables.security.security-and-analysis-features-enable-read-only %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.navigate-to-code-security-and-analysis %} {% ifversion fpt or ghes or ghec %}
|
||||
4. 在“代码安全和分析”下,单击该功能右侧的“禁用”或“启用” 。 {% ifversion not fpt %}如果你的企业没有 {% data variables.product.prodname_advanced_security %} 的可用许可证,“{% data variables.product.prodname_GH_advanced_security %}”的控件将处于禁用状态。{% endif %}{% ifversion fpt %}{% elsif ghec %}{% elsif ghes > 3.6 or ghae-issue-7044 %}<!--Insert screenshot for GHES 3.7 when available-->{% elsif ghes = 3.2 %}{% else %}{% endif %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.navigate-to-code-security-and-analysis %}
|
||||
{% ifversion fpt or ghes or ghec %}
|
||||
4. Under "Code security and analysis", to the right of the feature, click **Disable** or **Enable**. {% ifversion not fpt %}The control for "{% data variables.product.prodname_GH_advanced_security %}" is disabled if your enterprise has no available licenses for {% data variables.product.prodname_advanced_security %}.{% endif %}{% ifversion fpt %}
|
||||
{% elsif ghec %}
|
||||
{% elsif ghes > 3.6 or ghae > 3.6 %}<!--Insert screenshot for GHES 3.7 when available-->{% elsif ghes = 3.2 %}
|
||||
{% else %}
|
||||
{% endif %}
|
||||
|
||||
{% ifversion not fpt %} {% note %}
|
||||
{% ifversion not fpt %}
|
||||
{% note %}
|
||||
|
||||
注意:如果你禁用 {% data variables.product.prodname_GH_advanced_security %},{% ifversion ghec %}依赖项审核、{% endif %}{% data variables.product.prodname_secret_scanning %} 和 {% data variables.product.prodname_code_scanning %} 都将处于禁用状态。 任何工作流程、SARIF上传或 {% data variables.product.prodname_code_scanning %} 的 API 调用都将失败。
|
||||
**Note:** If you disable {% data variables.product.prodname_GH_advanced_security %}, {% ifversion ghec %}dependency review, {% endif %}{% data variables.product.prodname_secret_scanning %} and {% data variables.product.prodname_code_scanning %} are disabled. Any workflows, SARIF uploads, or API calls for {% data variables.product.prodname_code_scanning %} will fail.
|
||||
{% endnote %}{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% ifversion ghae %}
|
||||
4. 在“代码安全和分析”下,单击该功能右侧的“禁用”或“启用” 。 在启用“{% data variables.product.prodname_secret_scanning %}”之前,您可能需要先启用 {% data variables.product.prodname_GH_advanced_security %}。
|
||||
 {% endif %}
|
||||
4. Under "Code security and analysis", to the right of the feature, click **Disable** or **Enable**. Before you can enable "{% data variables.product.prodname_secret_scanning %}" for your repository, you may need to enable {% data variables.product.prodname_GH_advanced_security %}.
|
||||

|
||||
{% endif %}
|
||||
|
||||
## 授予对安全警报的访问权限
|
||||
## Granting access to security alerts
|
||||
|
||||
对存储库具有管理员访问权限的人员可以看到存储库的安全警报,如果存储库归组织所有,则组织所有者也可见。 您可以授予其他团队和人员访问警报。
|
||||
Security alerts for a repository are visible to people with admin access to the repository and, when the repository is owned by an organization, organization owners. You can give additional teams and people access to the alerts.
|
||||
|
||||
{% note %}
|
||||
|
||||
组织所有者和仓库管理员只能向具有仓库写入权限的人员授予安全警报的查看权限,如 {% data variables.product.prodname_secret_scanning %} 警报。
|
||||
Organization owners and repository administrators can only grant access to view security alerts, such as {% data variables.product.prodname_secret_scanning %} alerts, to people or teams who have write access to the repo.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.navigate-to-code-security-and-analysis %}
|
||||
4. 在“Access to alerts(访问警报)”下,在搜索字段中开始键入您要查找的个人或团队的名称,然后单击匹配列表中的名称。
|
||||
{% ifversion fpt or ghec or ghes > 3.2 %}  {% endif %} {% ifversion ghes < 3.3 %}  {% endif %} {% ifversion ghae %}  {% endif %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.navigate-to-code-security-and-analysis %}
|
||||
4. Under "Access to alerts", in the search field, start typing the name of the person or team you'd like to find, then click a name in the list of matches.
|
||||
{% ifversion fpt or ghec or ghes > 3.2 %}
|
||||

|
||||
{% endif %}
|
||||
{% ifversion ghes < 3.3 %}
|
||||

|
||||
{% endif %}
|
||||
{% ifversion ghae %}
|
||||

|
||||
{% endif %}
|
||||
|
||||
5. 单击“保存更改”。
|
||||
{% ifversion fpt or ghes > 3.2 or ghec %}  {% endif %} {% ifversion ghes < 3.3 %}  {% endif %} {% ifversion ghae %}  {% endif %}
|
||||
5. Click **Save changes**.
|
||||
{% ifversion fpt or ghes > 3.2 or ghec %}
|
||||

|
||||
{% endif %}
|
||||
{% ifversion ghes < 3.3 %}
|
||||

|
||||
{% endif %}
|
||||
{% ifversion ghae %}
|
||||

|
||||
{% endif %}
|
||||
|
||||
## 删除对安全警报的访问权限
|
||||
## Removing access to security alerts
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.navigate-to-code-security-and-analysis %}
|
||||
4. 在“Access to alerts(访问警报)”下,在要删除其访问权限的个人或团队的右侧,单击 {% octicon "x" aria-label="X symbol" %}。
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.navigate-to-code-security-and-analysis %}
|
||||
4. Under "Access to alerts", to the right of the person or team whose access you'd like to remove, click {% octicon "x" aria-label="X symbol" %}.
|
||||
{% ifversion fpt or ghec or ghes > 3.2 %}
|
||||
 {% endif %} {% ifversion ghes < 3.3 %}  {% endif %} {% ifversion ghae %}  {% endif %}
|
||||
5. 单击“保存更改”。
|
||||

|
||||
{% endif %}
|
||||
{% ifversion ghes < 3.3 %}
|
||||

|
||||
{% endif %}
|
||||
{% ifversion ghae %}
|
||||

|
||||
{% endif %}
|
||||
5. Click **Save changes**.
|
||||
|
||||
## 延伸阅读
|
||||
## Further reading
|
||||
|
||||
- [保护存储库](/code-security/getting-started/securing-your-repository)
|
||||
- [管理组织的安全和分析设置](/organizations/keeping-your-organization-secure/managing-security-and-analysis-settings-for-your-organization)
|
||||
- "[Securing your repository](/code-security/getting-started/securing-your-repository)"
|
||||
- "[Managing security and analysis settings for your organization](/organizations/keeping-your-organization-secure/managing-security-and-analysis-settings-for-your-organization)"
|
||||
|
||||
@@ -34,7 +34,7 @@ This procedure demonstrates how to configure autolinks to reference external res
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5658 %}
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
|
||||
1. In the "Integrations" section of the sidebar, click **{% octicon "cross-reference" aria-label="The cross-reference icon" %} Autolink references**.
|
||||
{% else %}
|
||||
1. In the left sidebar, click **Autolink references**.
|
||||
|
||||
@@ -5,7 +5,7 @@ intro: 可以为存储库配置标记保护规则,防止参与者创建或删
|
||||
product: '{% data reusables.gated-features.tag-protection-rules %}'
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghae: issue-6337
|
||||
ghae: '>= 3.5'
|
||||
ghec: '*'
|
||||
ghes: '>3.4'
|
||||
ms.openlocfilehash: 3b7b84cb26d8994c89222b2e4f642592fd45b72f
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user