New translation batch for cn (#26672)
* Add crowdin translations * Run script/i18n/homogenize-frontmatter.js * Run script/i18n/lint-translation-files.js --check rendering * run script/i18n/reset-files-with-broken-liquid-tags.js --language=cn * run script/i18n/reset-known-broken-translation-files.js * Check in cn CSV report Co-authored-by: Rachael Sewell <rachmari@github.com>
This commit is contained in:
@@ -23,8 +23,16 @@ translations/zh-CN/content/actions/security-guides/security-hardening-for-github
|
||||
translations/zh-CN/content/actions/using-github-hosted-runners/about-github-hosted-runners.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/using-workflows/reusing-workflows.md,rendering error
|
||||
translations/zh-CN/content/actions/using-workflows/storing-workflow-data-as-artifacts.md,broken liquid tags
|
||||
translations/zh-CN/content/actions/using-workflows/using-github-cli-in-workflows.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/code-security/managing-github-advanced-security-for-your-enterprise/configuring-code-scanning-for-your-appliance.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/code-security/managing-github-advanced-security-for-your-enterprise/configuring-secret-scanning-for-your-appliance.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/code-security/managing-supply-chain-security-for-your-enterprise/about-supply-chain-security-for-your-enterprise.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/configuration/configuring-github-connect/about-github-connect.md,rendering error
|
||||
translations/zh-CN/content/admin/configuration/configuring-github-connect/enabling-automatic-user-license-sync-for-your-enterprise.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/configuration/configuring-github-connect/enabling-unified-contributions-for-your-enterprise.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/configuration/configuring-github-connect/enabling-unified-search-for-your-enterprise.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/configuration/configuring-github-connect/managing-github-connect.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/configuration/configuring-network-settings/configuring-an-outbound-web-proxy-server.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/configuration/configuring-network-settings/network-ports.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/accessing-the-management-console.md,broken liquid tags
|
||||
@@ -47,10 +55,12 @@ translations/zh-CN/content/admin/github-actions/enabling-github-actions-for-gith
|
||||
translations/zh-CN/content/admin/github-actions/enabling-github-actions-for-github-enterprise-server/enabling-github-actions-with-azure-blob-storage.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/github-actions/enabling-github-actions-for-github-enterprise-server/enabling-github-actions-with-minio-gateway-for-nas-storage.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/github-actions/enabling-github-actions-for-github-enterprise-server/index.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/github-actions/enabling-github-actions-for-github-enterprise-server/managing-self-hosted-runners-for-dependabot-updates.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,broken liquid tags
|
||||
translations/zh-CN/content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-ae.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-enterprise-cloud.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-enterprise-server.md,broken liquid tags
|
||||
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,broken liquid tags
|
||||
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/github-actions/index.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/github-actions/managing-access-to-actions-from-githubcom/about-using-actions-in-your-enterprise.md,broken liquid tags
|
||||
@@ -59,11 +69,14 @@ translations/zh-CN/content/admin/github-actions/managing-access-to-actions-from-
|
||||
translations/zh-CN/content/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/github-actions/managing-access-to-actions-from-githubcom/using-the-latest-version-of-the-official-bundled-actions.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/github-actions/using-github-actions-in-github-ae/index.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/identity-and-access-management/authenticating-users-for-your-github-enterprise-server-instance/using-saml.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/identity-and-access-management/managing-iam-for-your-enterprise/configuring-saml-single-sign-on-for-your-enterprise.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/identity-and-access-management/managing-iam-for-your-enterprise/configuring-user-provisioning-for-your-enterprise.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/identity-and-access-management/managing-iam-for-your-enterprise/index.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/identity-and-access-management/managing-iam-with-enterprise-managed-users/about-enterprise-managed-users.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/identity-and-access-management/managing-iam-with-enterprise-managed-users/configuring-scim-provisioning-for-enterprise-managed-users-with-okta.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/identity-and-access-management/managing-iam-with-enterprise-managed-users/configuring-scim-provisioning-for-enterprise-managed-users.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/identity-and-access-management/managing-iam-with-enterprise-managed-users/managing-team-memberships-with-identity-provider-groups.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/index.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/installation/setting-up-a-github-enterprise-server-instance/installing-github-enterprise-server-on-aws.md,broken liquid tags
|
||||
translations/zh-CN/content/admin/overview/about-enterprise-accounts.md,Listed in localization-support#489
|
||||
@@ -110,6 +123,7 @@ translations/zh-CN/content/billing/managing-your-license-for-github-enterprise/d
|
||||
translations/zh-CN/content/billing/managing-your-license-for-github-enterprise/syncing-license-usage-between-github-enterprise-server-and-github-enterprise-cloud.md,rendering error
|
||||
translations/zh-CN/content/billing/managing-your-license-for-github-enterprise/uploading-a-new-license-to-github-enterprise-server.md,broken liquid tags
|
||||
translations/zh-CN/content/billing/managing-your-license-for-github-enterprise/viewing-license-usage-for-github-enterprise.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,broken liquid tags
|
||||
translations/zh-CN/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning.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
|
||||
@@ -177,6 +191,7 @@ translations/zh-CN/content/education/explore-the-benefits-of-teaching-and-learni
|
||||
translations/zh-CN/content/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/about-using-makecode-arcade-with-github-classroom.md,broken liquid tags
|
||||
translations/zh-CN/content/education/manage-coursework-with-github-classroom/learn-with-github-classroom/view-autograding-results.md,broken liquid tags
|
||||
translations/zh-CN/content/get-started/customizing-your-github-workflow/exploring-integrations/about-github-marketplace.md,broken liquid tags
|
||||
translations/zh-CN/content/get-started/customizing-your-github-workflow/index.md,broken liquid tags
|
||||
translations/zh-CN/content/get-started/getting-started-with-git/about-remote-repositories.md,broken liquid tags
|
||||
translations/zh-CN/content/get-started/getting-started-with-git/updating-credentials-from-the-macos-keychain.md,broken liquid tags
|
||||
translations/zh-CN/content/get-started/learning-about-github/about-github-advanced-security.md,broken liquid tags
|
||||
@@ -201,6 +216,8 @@ translations/zh-CN/content/get-started/using-github/github-command-palette.md,br
|
||||
translations/zh-CN/content/get-started/using-github/github-mobile.md,broken liquid tags
|
||||
translations/zh-CN/content/get-started/writing-on-github/editing-and-sharing-content-with-gists/creating-gists.md,broken liquid tags
|
||||
translations/zh-CN/content/issues/using-labels-and-milestones-to-track-work/managing-labels.md,broken liquid tags
|
||||
translations/zh-CN/content/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-security-and-analysis-settings-for-your-organization.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/organizations/managing-membership-in-your-organization/can-i-create-accounts-for-people-in-my-organization.md,broken liquid tags
|
||||
translations/zh-CN/content/organizations/managing-membership-in-your-organization/inviting-users-to-join-your-organization.md,broken liquid tags
|
||||
translations/zh-CN/content/organizations/managing-membership-in-your-organization/reinstating-a-former-member-of-your-organization.md,broken liquid tags
|
||||
@@ -243,6 +260,7 @@ translations/zh-CN/content/search-github/getting-started-with-searching-on-githu
|
||||
translations/zh-CN/content/sponsors/getting-started-with-github-sponsors/about-github-sponsors.md,broken liquid tags
|
||||
translations/zh-CN/content/sponsors/receiving-sponsorships-through-github-sponsors/about-github-sponsors-for-open-source-contributors.md,broken liquid tags
|
||||
translations/zh-CN/content/support/contacting-github-support/creating-a-support-ticket.md,broken liquid tags
|
||||
translations/zh-CN/content/support/contacting-github-support/viewing-and-updating-support-tickets.md,broken liquid tags
|
||||
translations/zh-CN/content/support/learning-about-github-support/about-github-premium-support.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-ticket-priority.md,broken liquid tags
|
||||
@@ -285,7 +303,7 @@ translations/zh-CN/data/reusables/rest-reference/activity/events.md,broken liqui
|
||||
translations/zh-CN/data/reusables/rest-reference/apps/marketplace.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/rest-reference/packages/packages.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/saml/you-must-periodically-authenticate.md,Listed in localization-support#489
|
||||
translations/zh-CN/data/reusables/saml/you-must-periodically-authenticate.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/saml/you-must-periodically-authenticate.md,rendering error
|
||||
translations/zh-CN/data/reusables/scim/after-you-configure-saml.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/secret-scanning/enterprise-enable-secret-scanning.md,broken liquid tags
|
||||
translations/zh-CN/data/reusables/sponsors/feedback.md,broken liquid tags
|
||||
|
||||
|
@@ -35,7 +35,7 @@ shortTitle: 查看组织中的人员
|
||||
|
||||
如果您的组织由企业帐户管理,则可以查看管理企业所有组织的帐单设置和策略的企业所有者。 有关企业帐户的详细信息,请参阅“[{% data variables.product.prodname_dotcom %} 帐户类型](/get-started/learning-about-github/types-of-github-accounts)”。
|
||||
|
||||
您还可以查看企业所有者是否在组织中具有特定角色。 企业所有者也可以是组织成员、任何其他组织角色或与组织无关。
|
||||
您还可以查看企业所有者是否在组织中具有特定角色。 Enterprise owners can also be an organization member, any other organization role, or be un-affiliated with the organization.
|
||||
|
||||
{% note %}
|
||||
|
||||
@@ -43,11 +43,11 @@ shortTitle: 查看组织中的人员
|
||||
|
||||
{% endnote %}
|
||||
|
||||
| **企业角色** | **组织角色** | **组织访问或影响** |
|
||||
| -------- | ----------- | ------------------------------ |
|
||||
| 企业所有者 | 非附属或无官方组织角色 | 无法访问组织内容或存储库,但可管理影响组织的企业设置和策略。 |
|
||||
| 企业所有者 | 组织所有者 | 能够配置组织设置并通过团队等管理对组织资源的访问。 |
|
||||
| 企业所有者 | 组织成员 | 能够访问组织资源和内容(如存储库),而无需访问组织的设置。 |
|
||||
| **企业角色** | **组织角色** | **组织访问或影响** |
|
||||
| -------- | ---------------------------------------------- | ------------------------------ |
|
||||
| 企业所有者 | Un-affiliated or no official organization role | 无法访问组织内容或存储库,但可管理影响组织的企业设置和策略。 |
|
||||
| 企业所有者 | 组织所有者 | 能够配置组织设置并通过团队等管理对组织资源的访问。 |
|
||||
| 企业所有者 | 组织成员 | 能够访问组织资源和内容(如存储库),而无需访问组织的设置。 |
|
||||
|
||||
要查看组织中的所有角色,请参阅“[组织中的角色](/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization)”。 {% ifversion ghec %} 组织成员还可以具有特定存储库的自定义角色。 更多信息请参阅“[管理组织的自定义仓库角色](/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization)”。{% endif %}
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ shortTitle: 构建和测试 Java & Ant
|
||||
|
||||
您也可以通过在仓库的 `.github/workflow` 目录中创建新文件来手动添加此工作流程。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Java CI
|
||||
|
||||
@@ -59,16 +58,15 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v2
|
||||
uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
- name: Build with Ant
|
||||
run: ant -noinput -buildfile build.xml
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
此工作流程执行以下步骤:
|
||||
|
||||
@@ -90,18 +88,16 @@ jobs:
|
||||
|
||||
如果使用不同的命令来构建项目,或者想要运行不同的目标,则可以指定这些命令。 例如,您可能想要运行在 `_build-ci.xml_` 文件中配置的 `jar` 目标。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
- name: Run the Ant jar target
|
||||
run: ant -noinput -buildfile build-ci.xml jar
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 将工作流数据打包为构件
|
||||
|
||||
@@ -109,19 +105,17 @@ steps:
|
||||
|
||||
Ant 通常会在 `build/jar` 目录中创建 JAR、EAR 或 WAR 等输出文件。 您可以使用 `upload-artifact` 操作上传该目录的内容。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
|
||||
- run: ant -noinput -buildfile build.xml
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: Package
|
||||
path: build/jar
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
@@ -60,16 +60,16 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v2
|
||||
uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
|
||||
- name: Build with Gradle
|
||||
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
|
||||
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
|
||||
with:
|
||||
arguments: build
|
||||
```
|
||||
@@ -95,22 +95,20 @@ jobs:
|
||||
|
||||
如果使用不同的命令来构建项目,或者想要使用不同的任务,则可以指定这些命令。 例如,您可能想要运行在 _ci.gradle_ 文件中配置的 `package` 任务。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
|
||||
- name: Run the Gradle package task
|
||||
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
|
||||
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
|
||||
with:
|
||||
arguments: -b ci.gradle package
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 缓存依赖项
|
||||
|
||||
@@ -124,23 +122,21 @@ steps:
|
||||
|
||||
Gradle 通常会在 `build/libs` 目录中创建 JAR、EAR 或 WAR 等输出文件。 您可以使用 `upload-artifact` 操作上传该目录的内容。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
|
||||
- name: Build with Gradle
|
||||
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
|
||||
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
|
||||
with:
|
||||
arguments: build
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: Package
|
||||
path: build/libs
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
@@ -48,7 +48,6 @@ shortTitle: 使用 Maven 构建和测试 Java
|
||||
|
||||
您也可以通过在仓库的 `.github/workflow` 目录中创建新文件来手动添加此工作流程。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Java CI
|
||||
|
||||
@@ -59,16 +58,15 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v2
|
||||
uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
- name: Build with Maven
|
||||
run: mvn --batch-mode --update-snapshots verify
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
此工作流程执行以下步骤:
|
||||
|
||||
@@ -90,29 +88,26 @@ jobs:
|
||||
|
||||
如果使用不同的命令来构建项目,或者想要使用不同的目标,则可以指定这些命令。 例如,您可能想要运行在 _pom-ci.xml_ 文件中配置的 `verify` 目标。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
- name: Run the Maven verify phase
|
||||
run: mvn --batch-mode --update-snapshots verify
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 缓存依赖项
|
||||
|
||||
使用 {% data variables.product.prodname_dotcom %} 托管的运行器时,您可以缓存依赖项以加速工作流程运行。 运行成功后,您的本地 Maven 仓库将存储在 GitHub Actions 基础架构中。 在未来的工作流程运行中,缓存将会恢复,因此不需要从远程 Maven 仓库下载依赖项。 您可以简单地使用 [`setup-java` 操作](https://github.com/marketplace/actions/setup-java-jdk)缓存依赖项,也可使用 [`cache` 操作](https://github.com/actions/cache)进行自定义和更高级的配置。
|
||||
使用 {% data variables.product.prodname_dotcom %} 托管的运行器时,您可以缓存依赖项以加速工作流程运行。 运行成功后,您的本地 Maven 仓库将存储在 GitHub 操作基础架构中。 在未来的工作流程运行中,缓存将会恢复,因此不需要从远程 Maven 仓库下载依赖项。 您可以简单地使用 [`setup-java` 操作](https://github.com/marketplace/actions/setup-java-jdk)缓存依赖项,也可使用 [`cache` 操作](https://github.com/actions/cache)进行自定义和更高级的配置。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v2
|
||||
uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
@@ -120,7 +115,6 @@ steps:
|
||||
- name: Build with Maven
|
||||
run: mvn --batch-mode --update-snapshots verify
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
此工作流程将保存本地 Maven 存储库的内容,位于运行器主目录的 `.m2` 目录。 缓存密钥是 _pom.xml_ 的哈希内容,因此更改 _pom.xml_ 将使缓存失效。
|
||||
|
||||
@@ -130,19 +124,17 @@ steps:
|
||||
|
||||
Maven 通常会在 `target` 目录中创建 JAR、EAR 或 WAR 等输出文件。 要将这些项目上传为构件,可以将它们复制到包含要上传的构件的新目录中。 例如,您可以创建一个名为 `staging` 的目录。 然后您可以使用 `upload-artifact` 操作上传该目录的内容。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
- run: mvn --batch-mode --update-snapshots verify
|
||||
- run: mkdir staging && cp target/*.jar staging
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: Package
|
||||
path: staging
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
@@ -34,8 +34,6 @@ shortTitle: 构建和测试 .NET
|
||||
|
||||
要快速开始,请将入门工作流程添加到仓库的 `.github/workflows` 目录中。
|
||||
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
name: dotnet package
|
||||
|
||||
@@ -50,11 +48,11 @@ jobs:
|
||||
dotnet-version: ['3.0', '3.1.x', '5.0.x' ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
|
||||
uses: actions/setup-dotnet@v1.7.2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Setup .NET Core SDK {% raw %}${{ matrix.dotnet-version }}{% endraw %}
|
||||
uses: {% data reusables.actions.action-setup-dotnet %}
|
||||
with:
|
||||
dotnet-version: ${{ matrix.dotnet-version }}
|
||||
dotnet-version: {% raw %}${{ matrix.dotnet-version }}{% endraw %}
|
||||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
@@ -63,8 +61,6 @@ jobs:
|
||||
run: dotnet test --no-restore --verbosity normal
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
|
||||
## 指定 .NET 版本
|
||||
|
||||
要在 {% data variables.product.prodname_dotcom %} 托管的运行器上使用预安装的 .NET Core SDK 版本,请使用 `setup-dotnet` 操作。 此操作从每个运行器上的工具缓存中查找特定版本的 .NET,并将必要的二进制文件添加到 `PATH`。 这些更改将持续用于作业的其余部分。
|
||||
@@ -73,7 +69,6 @@ jobs:
|
||||
|
||||
### 使用多个 .NET 版本
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: dotnet package
|
||||
|
||||
@@ -88,47 +83,42 @@ jobs:
|
||||
dotnet-version: [ '3.0', '3.1.x', '5.0.x' ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup dotnet ${{ matrix.dotnet-version }}
|
||||
uses: actions/setup-dotnet@v1
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Setup dotnet {% raw %}${{ matrix.dotnet-version }}{% endraw %}
|
||||
uses: {% data reusables.actions.action-setup-dotnet %}
|
||||
with:
|
||||
dotnet-version: ${{ matrix.dotnet-version }}
|
||||
dotnet-version: {% raw %}${{ matrix.dotnet-version }}{% endraw %}
|
||||
# You can test your matrix by printing the current dotnet version
|
||||
- name: Display dotnet version
|
||||
run: dotnet --version
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### 使用特定的 .NET 版本
|
||||
|
||||
您可以将作业配置为使用 .NET 的特定版本,例如 3.1.3 `3.1.3`。 或者,您也可以使用语义版本语法来获得最新的次要版本。 此示例使用 .NET 3 最新的次要版本。
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
- name: Setup .NET 3.x
|
||||
uses: actions/setup-dotnet@v1
|
||||
uses: {% data reusables.actions.action-setup-dotnet %}
|
||||
with:
|
||||
# Semantic version range syntax or exact version of a dotnet version
|
||||
dotnet-version: '3.x'
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 安装依赖项
|
||||
|
||||
{% data variables.product.prodname_dotcom %} 托管的运行器安装了 NuGet 软件包管理器。 在构建和测试代码之前,您可以使用 dotnet CLI 从 NuGet 软件包注册表安装依赖项。 例如,下面的 YAML 安装 `Newtonsoft` 软件包。
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
uses: {% data reusables.actions.action-setup-dotnet %}
|
||||
with:
|
||||
dotnet-version: '3.1.x'
|
||||
- name: Install dependencies
|
||||
run: dotnet add package Newtonsoft.Json --version 12.0.1
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
{% ifversion fpt or ghec %}
|
||||
|
||||
@@ -138,25 +128,23 @@ steps:
|
||||
|
||||
更多信息请参阅“[缓存依赖项以加快工作流程](/actions/guides/caching-dependencies-to-speed-up-workflows)”。
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
uses: {% data reusables.actions.action-setup-dotnet %}
|
||||
with:
|
||||
dotnet-version: '3.1.x'
|
||||
- uses: actions/cache@v2
|
||||
- uses: {% data reusables.actions.action-cache %}
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
# Look to see if there is a cache hit for the corresponding requirements file
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
||||
key: {% raw %}${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nuget
|
||||
${{ runner.os }}-nuget{% endraw %}
|
||||
- name: Install dependencies
|
||||
run: dotnet add package Newtonsoft.Json --version 12.0.1
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
{% note %}
|
||||
|
||||
@@ -170,12 +158,11 @@ steps:
|
||||
|
||||
您可以使用与本地相同的命令来构建和测试代码。 此示例演示如何在作业中使用 `dotnet build` 和 `dotnet test`:
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
uses: {% data reusables.actions.action-setup-dotnet %}
|
||||
with:
|
||||
dotnet-version: '3.1.x'
|
||||
- name: Install dependencies
|
||||
@@ -185,7 +172,6 @@ steps:
|
||||
- name: Test with the dotnet CLI
|
||||
run: dotnet test
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 将工作流数据打包为构件
|
||||
|
||||
@@ -193,7 +179,7 @@ steps:
|
||||
|
||||
更多信息请参阅“[使用构件持久化工作流程](/github/automating-your-workflow-with-github-actions/persisting-workflow-data-using-artifacts)”。
|
||||
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
name: dotnet package
|
||||
|
||||
@@ -208,24 +194,23 @@ jobs:
|
||||
dotnet-version: [ '3.0', '3.1.x', '5.0.x' ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
uses: {% data reusables.actions.action-setup-dotnet %}
|
||||
with:
|
||||
dotnet-version: ${{ matrix.dotnet-version }}
|
||||
dotnet-version: {% raw %}${{ matrix.dotnet-version }}{% endraw %}
|
||||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
- name: Test with dotnet
|
||||
run: dotnet test --logger trx --results-directory "TestResults-${{ matrix.dotnet-version }}"
|
||||
run: dotnet test --logger trx --results-directory {% raw %}"TestResults-${{ matrix.dotnet-version }}"{% endraw %}
|
||||
- name: Upload dotnet test results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: dotnet-results-${{ matrix.dotnet-version }}
|
||||
path: TestResults-${{ matrix.dotnet-version }}
|
||||
name: {% raw %}dotnet-results-${{ matrix.dotnet-version }}{% endraw %}
|
||||
path: {% raw %}TestResults-${{ matrix.dotnet-version }}{% endraw %}
|
||||
# Use always() to always run this step to publish test results when there are test failures
|
||||
if: ${{ always() }}
|
||||
if: {% raw %}${{ always() }}{% endraw %}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 发布到包注册表
|
||||
|
||||
@@ -245,8 +230,8 @@ jobs:
|
||||
packages: write
|
||||
contents: read{% endif %}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-dotnet@v1
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: {% data reusables.actions.action-setup-dotnet %}
|
||||
with:
|
||||
dotnet-version: '3.1.x' # SDK Version to use.
|
||||
source-url: https://nuget.pkg.github.com/<owner>/index.json
|
||||
|
||||
@@ -42,7 +42,6 @@ hasExperimentalAlternative: true
|
||||
|
||||
要快速开始,请将入门工作流程添加到仓库的 `.github/workflows` 目录中。 下面显示的工作流假定仓库的默认分支是 `main`。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Node.js CI
|
||||
|
||||
@@ -62,16 +61,15 @@ jobs:
|
||||
node-version: [10.x, 12.x, 14.x, 15.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Use Node.js {% raw %}${{ matrix.node-version }}{% endraw %}
|
||||
uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
node-version: {% raw %}${{ matrix.node-version }}{% endraw %}
|
||||
- run: npm ci
|
||||
- run: npm run build --if-present
|
||||
- run: npm test
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
{% data reusables.actions.example-github-runner %}
|
||||
|
||||
@@ -85,20 +83,18 @@ jobs:
|
||||
|
||||
每个作业都可以使用 `matrix` 上下文访问矩阵 `node-version` 阵列中定义的值。 `setup-node` 操作使用上下文作为 `node-version` 输入。 `setup-node` 操作在构建和测试代码之前使用不同的 Node.js 版本配置每个作业。 有关矩阵策略和上下文的更多信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流程语法](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix)”和“[上下文](/actions/learn-github-actions/contexts)”。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [10.x, 12.x, 14.x, 15.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Use Node.js {% raw %}${{ matrix.node-version }}{% endraw %}
|
||||
uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
node-version: {% raw %}${{ matrix.node-version }}{% endraw %}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
您也可以构建和测试精确的 Node.js 版本。
|
||||
|
||||
@@ -110,7 +106,6 @@ strategy:
|
||||
|
||||
或者,您也可以使用单个版本的 Node.js 构建和测试。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Node.js CI
|
||||
|
||||
@@ -122,16 +117,15 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v2
|
||||
uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: '12.x'
|
||||
- run: npm ci
|
||||
- run: npm run build --if-present
|
||||
- run: npm test
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
如果不指定 Node.js 版本,{% data variables.product.prodname_dotcom %} 将使用环境的默认 Node.js 版本。
|
||||
{% ifversion ghae %} {% data reusables.actions.self-hosted-runners-software %}
|
||||
@@ -150,9 +144,9 @@ jobs:
|
||||
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v2
|
||||
uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: '12.x'
|
||||
- name: Install dependencies
|
||||
@@ -161,18 +155,16 @@ steps:
|
||||
|
||||
使用 `npm ci` 将版本安装到 *package-lock.json* 或 *npm-shrinkwraw.json* 文件并阻止更新锁定文件。 使用 `npm ci` 通常比运行 `npm install` 更快。 更多信息请参阅 [`npm ci`](https://docs.npmjs.com/cli/ci.html) 和“[引入 `npm ci` 以进行更快、更可靠的构建](https://blog.npmjs.org/post/171556855892/introducing-npm-ci-for-faster-more-reliable)”。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v2
|
||||
uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: '12.x'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### 使用 Yarn 的示例
|
||||
|
||||
@@ -180,9 +172,9 @@ steps:
|
||||
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v2
|
||||
uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: '12.x'
|
||||
- name: Install dependencies
|
||||
@@ -193,9 +185,9 @@ steps:
|
||||
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v2
|
||||
uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: '12.x'
|
||||
- name: Install dependencies
|
||||
@@ -212,12 +204,11 @@ steps:
|
||||
|
||||
在安装依赖项之前,使用 `setup-node` 操作创建 *.npmrc* 文件。 该操作有两个输入参数。 `node-version` 参数设置 Node.js 版本,`registry-url` 参数设置默认注册表。 如果包注册表使用作用域,您必须使用 `scope` 参数。 更多信息请参阅 [`npm-scope`](https://docs.npmjs.com/misc/scope)。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v2
|
||||
uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
always-auth: true
|
||||
node-version: '12.x'
|
||||
@@ -226,9 +217,8 @@ steps:
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||
NODE_AUTH_TOKEN: {% raw %}${{ secrets.NPM_TOKEN }}{% endraw %}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
上面的示例创建了一个包含以下内容的 *.npmrc* 文件:
|
||||
|
||||
@@ -243,10 +233,11 @@ always-auth=true
|
||||
使用 {% data variables.product.prodname_dotcom %} 托管的运行器时,您可以使用 [`setup-node` 操作](https://github.com/actions/setup-node)缓存和恢复依赖项。
|
||||
|
||||
以下示例缓存 npm 的依赖项。
|
||||
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'npm'
|
||||
@@ -258,8 +249,8 @@ steps:
|
||||
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'yarn'
|
||||
@@ -275,11 +266,11 @@ steps:
|
||||
# NOTE: pnpm caching support requires pnpm version >= 6.10.0
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
|
||||
with:
|
||||
version: 6.10.0
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'pnpm'
|
||||
@@ -295,9 +286,9 @@ steps:
|
||||
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v2
|
||||
uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: '12.x'
|
||||
- run: npm install
|
||||
|
||||
@@ -47,7 +47,6 @@ shortTitle: 构建和测试 PowerShell
|
||||
|
||||
此示例工作流程文件必须添加到您仓库的 `.github/workflows/` 目录:
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: Test PowerShell on Ubuntu
|
||||
on: push
|
||||
@@ -58,7 +57,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Perform a Pester test from the command-line
|
||||
shell: pwsh
|
||||
run: Test-Path resultsfile.log | Should -Be $true
|
||||
@@ -67,7 +66,6 @@ jobs:
|
||||
run: |
|
||||
Invoke-Pester Unit.Tests.ps1 -Passthru
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
* `shell: pwsh` - 配置作业在运行 `run` 命令时使用 PowerShell。
|
||||
* `run: Test-Path resultsfile.log` - 检查仓库的根目录中是否存在名为 `resultsfile.log` 的文件。
|
||||
@@ -110,21 +108,19 @@ jobs:
|
||||
|
||||
例如,以下作业将安装 `SqlServer` 和 `PSScriptAnalyzer` 模块:
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
jobs:
|
||||
install-dependencies:
|
||||
name: Install dependencies
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Install from PSGallery
|
||||
shell: pwsh
|
||||
run: |
|
||||
Set-PSRepository PSGallery -InstallationPolicy Trusted
|
||||
Install-Module SqlServer, PSScriptAnalyzer
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
{% note %}
|
||||
|
||||
@@ -138,16 +134,15 @@ jobs:
|
||||
|
||||
PowerShell 根据运行器的操作系统将其依赖项缓存在不同的位置。 例如,以下 Ubuntu 示例中使用的 `path` 位置在 Windows 操作系统中是不同的。
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Setup PowerShell module cache
|
||||
id: cacher
|
||||
uses: actions/cache@v2
|
||||
uses: {% data reusables.actions.action-cache %}
|
||||
with:
|
||||
path: "~/.local/share/powershell/Modules"
|
||||
key: ${{ runner.os }}-SqlServer-PSScriptAnalyzer
|
||||
key: {% raw %}${{ runner.os }}-SqlServer-PSScriptAnalyzer{% endraw %}
|
||||
- name: Install required PowerShell modules
|
||||
if: steps.cacher.outputs.cache-hit != 'true'
|
||||
shell: pwsh
|
||||
@@ -155,7 +150,6 @@ steps:
|
||||
Set-PSRepository PSGallery -InstallationPolicy Trusted
|
||||
Install-Module SqlServer, PSScriptAnalyzer -ErrorAction Stop
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 测试代码
|
||||
|
||||
@@ -165,13 +159,12 @@ steps:
|
||||
|
||||
下面的示例安装 `PSScriptAnalyzer` 并用它来将所有 `ps1` 文件链接在仓库中。 更多信息请参阅 [GitHub 上的 PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer)。
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
lint-with-PSScriptAnalyzer:
|
||||
name: Install and run PSScriptAnalyzer
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Install PSScriptAnalyzer module
|
||||
shell: pwsh
|
||||
run: |
|
||||
@@ -189,7 +182,6 @@ steps:
|
||||
Write-Output "There were $($errors.Count) errors and $($warnings.Count) warnings total."
|
||||
}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 将工作流数据打包为构件
|
||||
|
||||
@@ -197,7 +189,6 @@ steps:
|
||||
|
||||
下面的示例演示如何使用 `upload-artifact` 操作来存档从 `Invoke-Pester` 获得的测试结果。 更多信息请参阅 [`upload-artifact` 操作](https://github.com/actions/upload-artifact)。
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: Upload artifact from Ubuntu
|
||||
|
||||
@@ -208,18 +199,17 @@ jobs:
|
||||
name: Run Pester and upload results
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Test with Pester
|
||||
shell: pwsh
|
||||
run: Invoke-Pester Unit.Tests.ps1 -Passthru | Export-CliXml -Path Unit.Tests.xml
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: ubuntu-Unit-Tests
|
||||
path: Unit.Tests.xml
|
||||
if: ${{ always() }}
|
||||
if: {% raw %}${{ always() }}{% endraw %}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
`always()` 函数配置作业在测试失败时也继续处理。 更多信息请参阅“[always](/actions/reference/context-and-expression-syntax-for-github-actions#always)”。
|
||||
|
||||
@@ -229,7 +219,6 @@ jobs:
|
||||
|
||||
下面的示例创建软件包并使用 `Publish-Module` 将其发布到PowerShell Gallery:
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: Publish PowerShell Module
|
||||
|
||||
@@ -241,13 +230,12 @@ jobs:
|
||||
publish-to-gallery:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Build and publish
|
||||
env:
|
||||
NUGET_KEY: ${{ secrets.NUGET_KEY }}
|
||||
NUGET_KEY: {% raw %}${{ secrets.NUGET_KEY }}{% endraw %}
|
||||
shell: pwsh
|
||||
run: |
|
||||
./build.ps1 -Path /tmp/samplemodule
|
||||
Publish-Module -Path /tmp/samplemodule -NuGetApiKey $env:NUGET_KEY -Verbose
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
@@ -48,7 +48,6 @@ hasExperimentalAlternative: true
|
||||
|
||||
要快速开始,请将入门工作流程添加到仓库的 `.github/workflows` 目录中。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Python package
|
||||
|
||||
@@ -63,11 +62,11 @@ jobs:
|
||||
python-version: ["3.6", "3.7", "3.8", "3.9"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up Python {% raw %}${{ matrix.python-version }}{% endraw %}
|
||||
uses: {% data reusables.actions.action-setup-python %}
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
python-version: {% raw %}${{ matrix.python-version }}{% endraw %}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
@@ -83,7 +82,6 @@ jobs:
|
||||
run: |
|
||||
pytest
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 指定 Python 版本
|
||||
|
||||
@@ -99,19 +97,12 @@ jobs:
|
||||
| **Python 工具缓存** | `/opt/hostedtoolcache/Python/*` | `/Users/runner/hostedtoolcache/Python/*` | `C:\hostedtoolcache\windows\Python\*` |
|
||||
| **PyPy 工具缓存** | `/opt/hostedtoolcache/PyPy/*` | `/Users/runner/hostedtoolcache/PyPy/*` | `C:\hostedtoolcache\windows\PyPy\*` |
|
||||
|
||||
如果您正在使用自托管的运行器,则可以配置运行器使用 `setup-python` 操作来管理您的依赖项。 更多信息请参阅 `setup-python` 自述文件中的
|
||||
|
||||
将 setup-python 与自托管运行器一起使用</code>。</p>
|
||||
如果您正在使用自托管的运行器,则可以配置运行器使用 `setup-python` 操作来管理您的依赖项。 更多信息请参阅 `setup-python` 自述文件中的 [将 setup-python 与自托管运行器一起使用](https://github.com/actions/setup-python#using-setup-python-with-a-self-hosted-runner)。
|
||||
|
||||
{% data variables.product.prodname_dotcom %} 支持语义版本控制语法。 更多信息请参阅“[使用语义版本控制](https://docs.npmjs.com/about-semantic-versioning#using-semantic-versioning-to-specify-update-types-your-package-can-accept)”和“[语义版本控制规范](https://semver.org/)”。
|
||||
|
||||
|
||||
|
||||
### 使用多个 Python 版本
|
||||
|
||||
{% raw %}
|
||||
|
||||
|
||||
```yaml{:copy}
|
||||
name: Python package
|
||||
|
||||
@@ -123,33 +114,25 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
# You can use PyPy versions in python-version.
|
||||
# For example, pypy2 and pypy3
|
||||
# For example, {% if actions-node16-action %}pypy-2.7 and pypy-3.8{% else %}pypy2 and pypy3{% endif %}
|
||||
matrix:
|
||||
python-version: ["2.7", "3.6", "3.7", "3.8", "3.9"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up Python {% raw %}${{ matrix.python-version }}{% endraw %}
|
||||
uses: {% data reusables.actions.action-setup-python %}
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
python-version: {% raw %}${{ matrix.python-version }}{% endraw %}
|
||||
# You can test your matrix by printing the current Python version
|
||||
- name: Display Python version
|
||||
run: python -c "import sys; print(sys.version)"
|
||||
```
|
||||
|
||||
|
||||
{% endraw %}
|
||||
|
||||
|
||||
|
||||
### 使用特定的 Python 版本
|
||||
|
||||
您可以配置 python 的特定版本。 例如,3.8。 或者,您也可以使用语义版本语法来获得最新的次要版本。 此示例使用 Python 3 最新的次要版本。
|
||||
|
||||
{% raw %}
|
||||
|
||||
|
||||
```yaml{:copy}
|
||||
name: Python package
|
||||
|
||||
@@ -161,9 +144,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up Python 3.x
|
||||
uses: actions/setup-python@v2
|
||||
uses: {% data reusables.actions.action-setup-python %}
|
||||
with:
|
||||
# Semantic version range syntax or exact version of a Python version
|
||||
python-version: '3.x'
|
||||
@@ -174,20 +157,12 @@ jobs:
|
||||
run: python -c "import sys; print(sys.version)"
|
||||
```
|
||||
|
||||
|
||||
{% endraw %}
|
||||
|
||||
|
||||
|
||||
### 排除版本
|
||||
|
||||
如果指定不可用的 Python 版本,`setup-python` 将会失败,且显示如下错误:`##[error]Version 3.4 with arch x64 not found`。 错误消息包含可用的版本。
|
||||
|
||||
如果存在您不想运行的 Python 配置,您也可以在工作流程中使用 `exclude` 关键字。 更多信息请参阅“[{% data variables.product.prodname_actions %} 的工作流程语法](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategy)”。
|
||||
|
||||
{% raw %}
|
||||
|
||||
|
||||
```yaml{:copy}
|
||||
name: Python package
|
||||
|
||||
@@ -196,11 +171,11 @@ on: [push]
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
runs-on: {% raw %}${{ matrix.os }}{% endraw %}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
python-version: ["3.6", "3.7", "3.8", "3.9", pypy2, pypy3]
|
||||
python-version: ["3.6", "3.7", "3.8", "3.9", {% if actions-node16-action %}pypy-2.7, pypy-3.8{% else %}pypy2, pypy3{% endif %}]
|
||||
exclude:
|
||||
- os: macos-latest
|
||||
python-version: "3.6"
|
||||
@@ -208,11 +183,6 @@ jobs:
|
||||
python-version: "3.6"
|
||||
```
|
||||
|
||||
|
||||
{% endraw %}
|
||||
|
||||
|
||||
|
||||
### 使用默认 Python 版本
|
||||
|
||||
建议使用 `setup-python` 配置工作流程中使用的 Python 版本,因为它有助于使您的依赖关系变得明朗。 如果不使用 `setup-python`,调用 `python` 时将在任何 shell 中使用 `PATH` 中设置的 Python 默认版本。 {% data variables.product.prodname_dotcom %} 托管的运行器之间有不同的 Python 默认版本,这可能导致非预期的更改或使用的版本比预期更旧。
|
||||
@@ -223,46 +193,32 @@ jobs:
|
||||
| Windows | 不包括工具缓存中的 Python 版本,Windows 未随附同等版本的系统 Python。 为保持与其他运行器一致的行为,并允许 Python 在没有 `setup-python` 操作的情况下开箱即用,{% data variables.product.prodname_dotcom %} 将从工具缓存中添加几个版本到 `PATH`。 |
|
||||
| macOS | 除了作为工具缓存一部分的版本外,macOS 运行器还安装了多个版本的系统 Python。 系统 Python 版本位于 `/usr/local/Cellar/python/*` 目录中。 |
|
||||
|
||||
|
||||
|
||||
|
||||
## 安装依赖项
|
||||
|
||||
{% data variables.product.prodname_dotcom %} 托管的运行器安装了 pip 软件包管理器。 在构建和测试代码之前,您可以使用 pip 从 PyPI 软件包注册表安装依赖项。 例如,下面的 YAML 安装或升级 `pip` 软件包安装程序以及 `setuptools` 和 `wheel` 软件包。
|
||||
|
||||
使用 {% data variables.product.prodname_dotcom %} 托管的运行器时,您还可以缓存依赖项以加速工作流程。 更多信息请参阅“<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">缓存依赖项以加快工作流程</a>”。
|
||||
|
||||
{% raw %}
|
||||
|
||||
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: {% data reusables.actions.action-setup-python %}
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install dependencies
|
||||
run: python -m pip install --upgrade pip setuptools wheel
|
||||
```
|
||||
|
||||
|
||||
{% endraw %}
|
||||
|
||||
|
||||
|
||||
### 要求文件
|
||||
|
||||
在更新 `pip` 后,下一步通常是从 *requires.txt* 安装依赖项。 更多信息请参阅 [pip](https://pip.pypa.io/en/stable/cli/pip_install/#example-requirements-file)。
|
||||
|
||||
{% raw %}
|
||||
|
||||
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: {% data reusables.actions.action-setup-python %}
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install dependencies
|
||||
@@ -271,23 +227,16 @@ steps:
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
|
||||
{% endraw %}
|
||||
|
||||
|
||||
|
||||
### 缓存依赖项
|
||||
|
||||
使用 {% data variables.product.prodname_dotcom %} 托管的运行器时,您可以使用 [`setup-python` 操作](https://github.com/actions/setup-python)缓存和恢复依赖项。
|
||||
|
||||
以下示例缓存 pip 的依赖项。
|
||||
|
||||
|
||||
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: {% data reusables.actions.action-setup-python %}
|
||||
with:
|
||||
python-version: '3.9'
|
||||
cache: 'pip'
|
||||
@@ -295,31 +244,23 @@ steps:
|
||||
- run: pip test
|
||||
```
|
||||
|
||||
|
||||
默认情况下, `setup-python` 操作会在整个存储库中搜索依赖项文件(对于 pip 为`requirements.txt`,对于 pipenv 为 `Pipfile.lock`)。 更多信息请参阅 `setup-python` 操作自述文件中的“<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">缓存包依赖项</a>”。
|
||||
默认情况下, `setup-python` 操作会在整个存储库中搜索依赖项文件(对于 pip 为`requirements.txt`,对于 pipenv 为 `Pipfile.lock`)。 更多信息请参阅 `setup-python` 操作自述文件中的“<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">缓存包依赖项</a>”。
|
||||
|
||||
如果您有自定义要求或需要更精确的缓存控制,则可以使用 [`cache` 操作](https://github.com/marketplace/actions/cache)。 Pip 根据运行器的操作系统将依赖项缓存在不同的位置。 您需要缓存的路径可能不同于上面的 Ubuntu 示例,具体取决于您使用的操作系统。 更多信息请参阅 `cache` 操作存储库中的 [Python 缓存示例](https://github.com/actions/cache/blob/main/examples.md#python---pip)。
|
||||
|
||||
|
||||
|
||||
## 测试代码
|
||||
|
||||
您可以使用与本地相同的命令来构建和测试代码。
|
||||
|
||||
|
||||
|
||||
### 使用 pytest 和 pytest-cov 测试
|
||||
|
||||
此示例安装或升级 `pytest` 和 `pest-cov`。 然后进行测试并以 JUnit 格式输出,而代码覆盖结果则以 Cobertura 输出。 更多信息请参阅 [JUnit](https://junit.org/junit5/) 和 [Cobertura](https://cobertura.github.io/cobertura/)。
|
||||
|
||||
{% raw %}
|
||||
|
||||
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: {% data reusables.actions.action-setup-python %}
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install dependencies
|
||||
@@ -333,23 +274,15 @@ steps:
|
||||
pytest tests.py --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
|
||||
```
|
||||
|
||||
|
||||
{% endraw %}
|
||||
|
||||
|
||||
|
||||
### 使用 Flake8 嵌入代码
|
||||
|
||||
下面的示例安装或升级 `flake8` 并用它来嵌入所有文件。 更多信息请参阅 [Flake8](http://flake8.pycqa.org/en/latest/)。
|
||||
|
||||
{% raw %}
|
||||
|
||||
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: {% data reusables.actions.action-setup-python %}
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install dependencies
|
||||
@@ -363,20 +296,12 @@ steps:
|
||||
continue-on-error: true
|
||||
```
|
||||
|
||||
|
||||
{% endraw %}
|
||||
|
||||
嵌入步骤设置了 `continue-on-error: true`。 这可防止在嵌入步骤不成功时工作流程失败。 解决所有嵌入错误后,您可以删除此选项,以便工作流程捕获新问题。
|
||||
|
||||
|
||||
|
||||
### 使用 tox 运行测试
|
||||
|
||||
通过 {% data variables.product.prodname_actions %},您可以使用 tox 运行测试并将工作分散到多个作业。 您需要使用 `-e py` 选项调用 tox,以在 `PATH` 中选择 Python 版本,而不是指定特定版本。 更多信息请参阅 [tox](https://tox.readthedocs.io/en/latest/)。
|
||||
|
||||
{% raw %}
|
||||
|
||||
|
||||
```yaml{:copy}
|
||||
name: Python package
|
||||
|
||||
@@ -391,11 +316,11 @@ jobs:
|
||||
python: ["3.7", "3.8", "3.9"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: {% data reusables.actions.action-setup-python %}
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
python-version: {% raw %}${{ matrix.python }}{% endraw %}
|
||||
- name: Install tox and any other packages
|
||||
run: pip install tox
|
||||
- name: Run tox
|
||||
@@ -403,20 +328,12 @@ jobs:
|
||||
run: tox -e py
|
||||
```
|
||||
|
||||
|
||||
{% endraw %}
|
||||
|
||||
|
||||
|
||||
## 将工作流数据打包为构件
|
||||
|
||||
您可以在工作流程完成后上传构件以查看。 例如,您可能需要保存日志文件、核心转储、测试结果或屏幕截图。 更多信息请参阅“[使用构件持久化工作流程](/github/automating-your-workflow-with-github-actions/persisting-workflow-data-using-artifacts)”。
|
||||
|
||||
下面的示例演示如何使用 `upload-artifact` 操作来存档运行 `pytest` 的测试结果。 更多信息请参阅 [`upload-artifact` 操作](https://github.com/actions/upload-artifact)。
|
||||
|
||||
{% raw %}
|
||||
|
||||
|
||||
```yaml{:copy}
|
||||
name: Python package
|
||||
|
||||
@@ -431,40 +348,33 @@ jobs:
|
||||
python-version: ["3.6", "3.7", "3.8", "3.9"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Setup Python # Set Python version
|
||||
uses: actions/setup-python@v2
|
||||
uses: {% data reusables.actions.action-setup-python %}
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
python-version: {% raw %}${{ matrix.python-version }}{% endraw %}
|
||||
# Install pip and pytest
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pytest
|
||||
- name: Test with pytest
|
||||
run: pytest tests.py --doctest-modules --junitxml=junit/test-results-${{ matrix.python-version }}.xml
|
||||
run: pytest tests.py --doctest-modules {% raw %}--junitxml=junit/test-results-${{ matrix.python-version }}.xml{% endraw %}
|
||||
- name: Upload pytest test results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: pytest-results-${{ matrix.python-version }}
|
||||
path: junit/test-results-${{ matrix.python-version }}.xml
|
||||
name: {% raw %}pytest-results-${{ matrix.python-version }}{% endraw %}
|
||||
path: {% raw %}junit/test-results-${{ matrix.python-version }}.xml{% endraw %}
|
||||
# Use always() to always run this step to publish test results when there are test failures
|
||||
if: ${{ always() }}
|
||||
if: {% raw %}${{ always() }}{% endraw %}
|
||||
```
|
||||
|
||||
|
||||
{% endraw %}
|
||||
|
||||
|
||||
|
||||
## 发布到包注册表
|
||||
|
||||
您可以配置工作流程在 CI 测试通过后将 Python 包发布到包注册表。 此部分展示在您每次[发布版本](/github/administering-a-repository/managing-releases-in-a-repository)时如何使用 {% data variables.product.prodname_actions %} 将包上传到 PyPI。
|
||||
您可以配置工作流程在 CI 测试通过后将 Python 包发布到包注册表。 此部分展示在您每次[发布版本](/github/administering-a-repository/managing-releases-in-a-repository)时如何使用 {% data variables.product.prodname_actions %} 将包上传到 PyPI。
|
||||
|
||||
在本例中,您将需要创建两个 [PyPI API 令牌](https://pypi.org/help/#apitoken)。 您可以使用机密来存储发布软件包所需的访问令牌或凭据。 更多信息请参阅“[创建和使用加密密码](/github/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)”。
|
||||
|
||||
|
||||
|
||||
```yaml{:copy}
|
||||
{% data reusables.actions.actions-not-certified-by-github-comment %}
|
||||
|
||||
@@ -478,9 +388,9 @@ jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: {% data reusables.actions.action-setup-python %}
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install dependencies
|
||||
@@ -496,5 +406,4 @@ jobs:
|
||||
password: {% raw %}${{ secrets.PYPI_API_TOKEN }}{% endraw %}
|
||||
```
|
||||
|
||||
|
||||
有关入门工作流程的更多信息,请参阅 [`python-published`](https://github.com/actions/starter-workflows/blob/main/ci/python-publish.yml)。
|
||||
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
|
||||
with:
|
||||
@@ -71,17 +71,15 @@ jobs:
|
||||
|
||||
`setup-ruby` 操作采用 Ruby 版本作为输入,并在运行器上配置该版本。
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
|
||||
with:
|
||||
ruby-version: '3.1' # Not needed with a .ruby-version file
|
||||
- run: bundle install
|
||||
- run: bundle exec rake
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
或者,您也可以将 `.ruby-version` 文件检入仓库的根目录,而 `setup-ruby` 将使用该文件中定义的版本。
|
||||
|
||||
@@ -122,7 +120,7 @@ jobs:
|
||||
ruby-version: ['3.1', '3.0', '2.7']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: {% raw %}Set up Ruby ${{ matrix.ruby-version }}{% endraw %}
|
||||
uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
|
||||
with:
|
||||
@@ -137,16 +135,14 @@ jobs:
|
||||
|
||||
`setup-ruby` 操作将自动为您安装 Bundler。 版本由您的 `gemfile.lock` 文件决定。 如果您的锁定文件中没有版本,则会安装最新的兼容版本。
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
|
||||
with:
|
||||
ruby-version: '3.1'
|
||||
- run: bundle install
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### 缓存依赖项
|
||||
|
||||
@@ -169,39 +165,35 @@ steps:
|
||||
|
||||
为了加强缓存控制,如果您使用的是 {% data variables.product.prodname_dotcom %} 托管的运行器,可以直接使用 `actions/cache` 操作。 更多信息请参阅“<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">缓存依赖项以加快工作流程</a>”。
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/cache@v2
|
||||
- uses: {% data reusables.actions.action-cache %}
|
||||
with:
|
||||
path: vendor/bundle
|
||||
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
||||
key: {% raw %}${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}{% endraw %}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gems-
|
||||
{% raw %}${{ runner.os }}-gems-{% endraw %}
|
||||
- name: Bundle install
|
||||
run: |
|
||||
bundle config path vendor/bundle
|
||||
bundle install --jobs 4 --retry 3
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
如果您使用的是矩阵构建,您将会想要在缓存密钥中包含矩阵变量。 例如,如果您e 不同 ruby 版本 (`matrix.ruby-version`) 和不同系统 (`matrix.os`) 的矩阵策略,您的工作流程步骤可能看起来如下:
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/cache@v2
|
||||
- uses: {% data reusables.actions.action-cache %}
|
||||
with:
|
||||
path: vendor/bundle
|
||||
key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }}
|
||||
key: {% raw %}bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }}{% endraw %}
|
||||
restore-keys: |
|
||||
bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-
|
||||
{% raw %}bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-{% endraw %}
|
||||
- name: Bundle install
|
||||
run: |
|
||||
bundle config path vendor/bundle
|
||||
bundle install --jobs 4 --retry 3
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 测试代码的矩阵
|
||||
|
||||
@@ -228,7 +220,7 @@ jobs:
|
||||
ruby: [2.5, 2.6, 2.7, head, debug, jruby, jruby-head, truffleruby, truffleruby-head]
|
||||
continue-on-error: {% raw %}${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}{% endraw %}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
|
||||
with:
|
||||
ruby-version: {% raw %}${{ matrix.ruby }}{% endraw %}
|
||||
@@ -251,7 +243,7 @@ jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
|
||||
with:
|
||||
ruby-version: 2.6
|
||||
@@ -288,8 +280,8 @@ jobs:
|
||||
packages: write
|
||||
contents: read{% endif %}
|
||||
|
||||
steps:{% raw %}
|
||||
- uses: actions/checkout@v2
|
||||
steps:
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up Ruby 2.6
|
||||
uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
|
||||
with:
|
||||
@@ -297,7 +289,7 @@ jobs:
|
||||
- run: bundle install
|
||||
|
||||
- name: Publish to GPR
|
||||
run: |
|
||||
run: |{% raw %}
|
||||
mkdir -p $HOME/.gem
|
||||
touch $HOME/.gem/credentials
|
||||
chmod 0600 $HOME/.gem/credentials
|
||||
|
||||
@@ -37,7 +37,6 @@ shortTitle: 构建和测试 Swift
|
||||
|
||||
要快速开始,请将入门工作流程添加到仓库的 `.github/workflows` 目录中。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Swift
|
||||
|
||||
@@ -49,13 +48,12 @@ jobs:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Build
|
||||
run: swift build
|
||||
- name: Run tests
|
||||
run: swift test
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 指定 Swift 版本
|
||||
|
||||
@@ -88,7 +86,7 @@ jobs:
|
||||
- uses: fwal/setup-swift@2040b795e5c453c3a05fcb8316496afc8a74f192
|
||||
with:
|
||||
swift-version: {% raw %}${{ matrix.swift }}{% endraw %}
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Build
|
||||
run: swift build
|
||||
- name: Run tests
|
||||
@@ -114,10 +112,9 @@ steps:
|
||||
|
||||
您可以使用与本地相同的命令来使用 Swift 构建和测试代码。 此示例演示如何在作业中使用 `swift build` 和 `swift test`:
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: fwal/setup-swift@2040b795e5c453c3a05fcb8316496afc8a74f192
|
||||
with:
|
||||
swift-version: "5.3.3"
|
||||
@@ -126,4 +123,3 @@ steps:
|
||||
- name: Run tests
|
||||
run: swift test
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
@@ -45,7 +45,6 @@ shortTitle: 构建和测试 Xamarin 应用程序
|
||||
|
||||
下面的示例演示如何更改默认 Xamarin SDK 版本并构建 Xamarin.iOS 应用程序。
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: Build Xamarin.iOS app
|
||||
|
||||
@@ -57,7 +56,7 @@ jobs:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set default Xamarin SDK versions
|
||||
run: |
|
||||
$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --ios=14.10
|
||||
@@ -69,7 +68,7 @@ jobs:
|
||||
sudo xcode-select -s $XCODE_ROOT
|
||||
|
||||
- name: Setup .NET Core SDK 5.0.x
|
||||
uses: actions/setup-dotnet@v1
|
||||
uses: {% data reusables.actions.action-setup-dotnet %}
|
||||
with:
|
||||
dotnet-version: '5.0.x'
|
||||
|
||||
@@ -79,13 +78,11 @@ jobs:
|
||||
- name: Build
|
||||
run: msbuild <csproj_file_path> /p:Configuration=Debug /p:Platform=iPhoneSimulator /t:Rebuild
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 构建 Xamarin.Android 应用程序
|
||||
|
||||
下面的示例演示如何更改默认 Xamarin SDK 版本并构建 Xamarin.Android 应用程序。
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: Build Xamarin.Android app
|
||||
|
||||
@@ -97,13 +94,13 @@ jobs:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set default Xamarin SDK versions
|
||||
run: |
|
||||
$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.10 --android=10.2
|
||||
|
||||
- name: Setup .NET Core SDK 5.0.x
|
||||
uses: actions/setup-dotnet@v1
|
||||
uses: {% data reusables.actions.action-setup-dotnet %}
|
||||
with:
|
||||
dotnet-version: '5.0.x'
|
||||
|
||||
@@ -113,7 +110,6 @@ jobs:
|
||||
- name: Build
|
||||
run: msbuild <csproj_file_path> /t:PackageForAndroid /p:Configuration=Debug
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 指定 .NET 版本
|
||||
|
||||
|
||||
@@ -117,7 +117,6 @@ shortTitle: 组合操作
|
||||
|
||||
将工作流程代码复制到另一个仓库中的 `.github/workflows/main.yml` 文件,但用您创建的仓库和标记替换 `actions/hello-world-composite-action@v1`。 您还可以将 `who-to-greet` 输入替换为您的名称。
|
||||
|
||||
{% raw %}
|
||||
**.github/workflows/main.yml**
|
||||
```yaml
|
||||
on: [push]
|
||||
@@ -127,14 +126,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
name: A job to say hello
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- id: foo
|
||||
uses: actions/hello-world-composite-action@v1
|
||||
with:
|
||||
who-to-greet: 'Mona the Octocat'
|
||||
- run: echo random-number ${{ steps.foo.outputs.random-number }}
|
||||
- run: echo random-number {% raw %}${{ steps.foo.outputs.random-number }}{% endraw %}
|
||||
shell: bash
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
从您的仓库中,单击 **Actions(操作)**选项卡,然后选择最新的工作流程来运行。 输出应包括:"Hello Mona the Octocat"、"Goodbye" 脚本的结果以及随机数字。
|
||||
|
||||
@@ -212,7 +212,6 @@ jobs:
|
||||
|
||||
将以下示例工作流程代码复制到操作仓库中的 `.github/workflows/main.yml` 文件。 您还可以将 `who-to-greet` 输入替换为您的名称。 {% ifversion fpt or ghec %}此操作不能发布到 {% data variables.product.prodname_marketplace %},并且只能在此仓库中使用。{% endif %}
|
||||
|
||||
{% raw %}
|
||||
**.github/workflows/main.yml**
|
||||
```yaml{:copy}
|
||||
on: [push]
|
||||
@@ -225,7 +224,7 @@ jobs:
|
||||
# To use this repository's private action,
|
||||
# you must check out the repository
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Hello world action step
|
||||
uses: ./ # Uses an action in the root directory
|
||||
id: hello
|
||||
@@ -233,9 +232,8 @@ jobs:
|
||||
who-to-greet: 'Mona the Octocat'
|
||||
# Use the output from the `hello` step
|
||||
- name: Get the output time
|
||||
run: echo "The time was ${{ steps.hello.outputs.time }}"
|
||||
run: echo "The time was {% raw %}${{ steps.hello.outputs.time }}"{% endraw %}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
从您的仓库中,单击 **Actions(操作)**选项卡,然后选择最新的工作流程来运行。 在 **Jobs(作业)**下或可视化图形中,单击 **A job to say hello(打招呼的作业)**。 您应看到 "Hello Mona the Octocat" 或您用于 `who-to-greet` 输入的姓名和时间戳在日志中打印。
|
||||
|
||||
|
||||
@@ -238,7 +238,6 @@ jobs:
|
||||
|
||||
将工作流程代码复制到操作仓库中的 `.github/workflows/main.yml` 文件。 您还可以将 `who-to-greet` 输入替换为您的名称。
|
||||
|
||||
{% raw %}
|
||||
**.github/workflows/main.yml**
|
||||
```yaml{:copy}
|
||||
on: [push]
|
||||
@@ -251,7 +250,7 @@ jobs:
|
||||
# To use this repository's private action,
|
||||
# you must check out the repository
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Hello world action step
|
||||
uses: ./ # Uses an action in the root directory
|
||||
id: hello
|
||||
@@ -259,9 +258,8 @@ jobs:
|
||||
who-to-greet: 'Mona the Octocat'
|
||||
# Use the output from the `hello` step
|
||||
- name: Get the output time
|
||||
run: echo "The time was ${{ steps.hello.outputs.time }}"
|
||||
run: echo "The time was {% raw %}${{ steps.hello.outputs.time }}{% endraw %}"
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
从您的仓库中,单击 **Actions(操作)**选项卡,然后选择最新的工作流程来运行。 在 **Jobs(作业)**下或可视化图形中,单击 **A job to say hello(打招呼的作业)**。 您应看到 "Hello Mona the Octocat" 或您用于 `who-to-greet` 输入的姓名和时间戳在日志中打印。
|
||||
|
||||
|
||||
@@ -431,9 +431,9 @@ runs:
|
||||
# Reference a specific commit
|
||||
- uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675
|
||||
# Reference the major version of a release
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
# Reference a specific version
|
||||
- uses: actions/checkout@v2.2.0
|
||||
- uses: {% data reusables.actions.action-checkout %}.2.0
|
||||
# Reference a branch
|
||||
- uses: actions/checkout@main
|
||||
# References a subdirectory in a public GitHub repository at a specific branch, ref, or SHA
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
---
|
||||
title: Sharing actions and workflows with your enterprise
|
||||
intro: You can share an action or workflow with your enterprise without publishing the action or workflow publicly.
|
||||
title: 与企业共享操作和工作流程
|
||||
intro: 您可以与企业共享操作或工作流程,而无需公开发布操作或工作流程。
|
||||
versions:
|
||||
feature: internal-actions
|
||||
type: tutorial
|
||||
topics:
|
||||
- Actions
|
||||
- Action development
|
||||
shortTitle: Share with your enterprise
|
||||
shortTitle: 与企业共享
|
||||
---
|
||||
|
||||
## About {% data variables.product.prodname_actions %} access to internal repositories
|
||||
## 关于 {% data variables.product.prodname_actions %} 对内部存储库的访问
|
||||
|
||||
If your organization is owned by an enterprise account, you can share actions and workflows within your enterprise, without publishing the action or workflow publicly, by allowing {% data variables.product.prodname_actions %} workflows to access an internal repository that contains the action or workflow.
|
||||
如果您的组织由企业帐户拥有,则通过允许 {% data variables.product.prodname_actions %} 工作流程访问包含操作或工作流程的内部存储库,您可以在企业内共享操作和工作流程,而无需公开发布操作或工作流程。
|
||||
|
||||
Any actions or workflows stored in the internal repository can be used in workflows defined in other private and internal repositories owned by the same organization, or by any organization owned by the enterprise. Actions and workflows stored in internal repositories cannot be used in public repositories.
|
||||
存储在内部存储库中的任何操作或工作流程都可以在同一组织拥有的其他私有和内部存储库或者企业拥有的任何组织所定义的工作流程中使用。 存储在内部存储库中的操作和工作流程不能在公共存储库中使用。
|
||||
|
||||
{% warning %}
|
||||
|
||||
**Warning**: {% data reusables.actions.outside-collaborators-internal-actions %}
|
||||
**警告**:{% data reusables.actions.outside-collaborators-internal-actions %}
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
## Sharing actions and workflows with your enterprise
|
||||
## 与企业共享操作和工作流程
|
||||
|
||||
1. Store the action or workflow in an internal repository. 更多信息请参阅“[关于仓库](/repositories/creating-and-managing-repositories/about-repositories#about-internal-repositories)”。
|
||||
1. Configure the repository to allow access to workflows in other private and internal repositories. 更多信息请参阅“[管理仓库的 {% data variables.product.prodname_actions %} 设置](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#allowing-access-to-components-in-an-internal-repository)”。
|
||||
1. 将操作或工作流程存储在内部存储库中。 更多信息请参阅“[关于仓库](/repositories/creating-and-managing-repositories/about-repositories#about-internal-repositories)”。
|
||||
1. 配置存储库以允许访问其他私有和内部存储库中的工作流程。 更多信息请参阅“[管理仓库的 {% data variables.product.prodname_actions %} 设置](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#allowing-access-to-components-in-an-internal-repository)”。
|
||||
|
||||
## 延伸阅读
|
||||
|
||||
- “[关于企业帐户](/admin/overview/about-enterprise-accounts)”
|
||||
- "[Reusing workflows](/actions/using-workflows/reusing-workflows)"
|
||||
- "[重用工作流程](/actions/using-workflows/reusing-workflows)"
|
||||
|
||||
@@ -115,11 +115,11 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
environment: production
|
||||
|
||||
{% raw %}steps:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
- name: Configure AWS credentials
|
||||
{% raw %}- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@13d241b293754004c80624b5567555c4a39ffbe3
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
|
||||
@@ -100,7 +100,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
@@ -83,10 +83,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
- name: Set up Java version
|
||||
uses: actions/setup-java@v2.3.1
|
||||
uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: {% raw %}${{ env.JAVA_VERSION }}{% endraw %}
|
||||
cache: 'maven'
|
||||
@@ -95,7 +95,7 @@ jobs:
|
||||
run: mvn clean install
|
||||
|
||||
- name: Upload artifact for deployment job
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: java-app
|
||||
path: '{% raw %}${{ github.workspace }}{% endraw %}/target/*.jar'
|
||||
@@ -109,7 +109,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Download artifact from build job
|
||||
uses: actions/download-artifact@v3
|
||||
uses: {% data reusables.actions.action-download-artifact %}
|
||||
with:
|
||||
name: java-app
|
||||
|
||||
|
||||
@@ -83,15 +83,15 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
- name: Set up .NET Core
|
||||
uses: actions/setup-dotnet@v1
|
||||
uses: {% data reusables.actions.action-setup-dotnet %}
|
||||
with:
|
||||
dotnet-version: {% raw %}${{ env.DOTNET_VERSION }}{% endraw %}
|
||||
|
||||
- name: Set up dependency caching for faster builds
|
||||
uses: actions/cache@v2
|
||||
uses: {% data reusables.actions.action-cache %}
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: {% raw %}${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}{% endraw %}
|
||||
@@ -105,7 +105,7 @@ jobs:
|
||||
run: dotnet publish -c Release -o {% raw %}${{env.DOTNET_ROOT}}{% endraw %}/myapp
|
||||
|
||||
- name: Upload artifact for deployment job
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: .net-app
|
||||
path: {% raw %}${{env.DOTNET_ROOT}}{% endraw %}/myapp
|
||||
@@ -119,7 +119,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Download artifact from build job
|
||||
uses: actions/download-artifact@v3
|
||||
uses: {% data reusables.actions.action-download-artifact %}
|
||||
with:
|
||||
name: .net-app
|
||||
|
||||
|
||||
@@ -86,10 +86,10 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v2
|
||||
uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: {% raw %}${{ env.NODE_VERSION }}{% endraw %}
|
||||
cache: 'npm'
|
||||
@@ -100,7 +100,7 @@ jobs:
|
||||
npm run build --if-present
|
||||
npm run test --if-present
|
||||
- name: Upload artifact for deployment job
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: node-app
|
||||
path: .
|
||||
@@ -114,7 +114,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Download artifact from build job
|
||||
uses: actions/download-artifact@v3
|
||||
uses: {% data reusables.actions.action-download-artifact %}
|
||||
with:
|
||||
name: node-app
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
@@ -103,7 +103,7 @@ jobs:
|
||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Set up dependency caching for faster installs
|
||||
uses: actions/cache@v2
|
||||
uses: {% data reusables.actions.action-cache %}
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
with:
|
||||
path: {% raw %}${{ steps.composer-cache.outputs.dir }}{% endraw %}
|
||||
@@ -116,7 +116,7 @@ jobs:
|
||||
run: composer validate --no-check-publish && composer install --prefer-dist --no-progress
|
||||
|
||||
- name: Upload artifact for deployment job
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: php-app
|
||||
path: .
|
||||
@@ -130,7 +130,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Download artifact from build job
|
||||
uses: actions/download-artifact@v3
|
||||
uses: {% data reusables.actions.action-download-artifact %}
|
||||
with:
|
||||
name: php-app
|
||||
|
||||
|
||||
@@ -85,10 +85,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
- name: Set up Python version
|
||||
uses: actions/setup-python@v2.2.2
|
||||
uses: {% data reusables.actions.action-setup-python %}
|
||||
with:
|
||||
python-version: {% raw %}${{ env.PYTHON_VERSION }}{% endraw %}
|
||||
|
||||
@@ -98,7 +98,7 @@ jobs:
|
||||
source venv/bin/activate
|
||||
|
||||
- name: Set up dependency caching for faster installs
|
||||
uses: actions/cache@v2
|
||||
uses: {% data reusables.actions.action-cache %}
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: {% raw %}${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}{% endraw %}
|
||||
@@ -111,11 +111,11 @@ jobs:
|
||||
# Optional: Add a step to run tests here (PyTest, Django test suites, etc.)
|
||||
|
||||
- name: Upload artifact for deployment jobs
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: python-app
|
||||
path: |
|
||||
.
|
||||
.
|
||||
!venv/
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -126,7 +126,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Download artifact from build job
|
||||
uses: actions/download-artifact@v3
|
||||
uses: {% data reusables.actions.action-download-artifact %}
|
||||
with:
|
||||
name: python-app
|
||||
path: .
|
||||
|
||||
@@ -73,7 +73,7 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
- name: Azure Login
|
||||
uses: azure/login@89d153571fe9a34ed70fcf9f1d95ab8debea7a73
|
||||
|
||||
@@ -79,7 +79,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
name: Build and Deploy
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
with:
|
||||
submodules: true
|
||||
- name: Build And Deploy
|
||||
|
||||
@@ -159,7 +159,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
# Setup gcloud CLI
|
||||
- uses: google-github-actions/setup-gcloud@94337306dda8180d967a56932ceb4ddcf01edae7
|
||||
|
||||
@@ -74,7 +74,6 @@ shortTitle: 签名 Xcode 应用程序
|
||||
|
||||
此示例工作流程包括从 {% data variables.product.prodname_dotcom %} 密钥导入 Apple 证书和配置文件并将其安装在运行器上的步骤。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: App build
|
||||
on: push
|
||||
@@ -85,13 +84,13 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Install the Apple certificate and provisioning profile
|
||||
env:
|
||||
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
|
||||
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
|
||||
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
|
||||
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
|
||||
BUILD_CERTIFICATE_BASE64: {% raw %}${{ secrets.BUILD_CERTIFICATE_BASE64 }}{% endraw %}
|
||||
P12_PASSWORD: {% raw %}${{ secrets.P12_PASSWORD }}{% endraw %}
|
||||
BUILD_PROVISION_PROFILE_BASE64: {% raw %}${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}{% endraw %}
|
||||
KEYCHAIN_PASSWORD: {% raw %}${{ secrets.KEYCHAIN_PASSWORD }}{% endraw %}
|
||||
run: |
|
||||
# create variables
|
||||
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
|
||||
@@ -117,7 +116,6 @@ jobs:
|
||||
- name: Build app
|
||||
...
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 自托管运行器上的必要清理
|
||||
|
||||
|
||||
@@ -79,13 +79,13 @@ env:
|
||||
# permission can be added at job level or workflow level
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read # This is required for actions/checkout@v2
|
||||
contents: read # This is required for actions/checkout
|
||||
jobs:
|
||||
S3PackageUpload:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Git clone the repository
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
- name: configure aws credentials
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
with:
|
||||
|
||||
@@ -68,7 +68,7 @@ jobs:
|
||||
- name: Install OIDC Client from Core Package
|
||||
run: npm install @actions/core@1.6.0 @actions/http-client
|
||||
- name: Get Id Token
|
||||
uses: actions/github-script@v4
|
||||
uses: {% data reusables.actions.action-github-script %}
|
||||
id: idtoken
|
||||
with:
|
||||
script: |
|
||||
@@ -90,7 +90,7 @@ jobs:
|
||||
job:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v4
|
||||
- uses: {% data reusables.actions.action-github-script %}
|
||||
id: script
|
||||
timeout-minutes: 10
|
||||
with:
|
||||
|
||||
@@ -104,7 +104,6 @@ The following operating systems are supported for the self-hosted runner applica
|
||||
- Windows 8.1 64-bit
|
||||
- Windows 10 64-bit
|
||||
- Windows Server 2012 R2 64-bit
|
||||
- Windows Server 2016 64-bit
|
||||
- Windows Server 2019 64-bit
|
||||
|
||||
### macOS
|
||||
|
||||
@@ -257,7 +257,7 @@ jobs:
|
||||
normal_ci:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Run normal CI
|
||||
run: ./run-tests
|
||||
|
||||
@@ -265,7 +265,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
if: {% raw %}${{ github.event_name == 'pull_request' }}{% endraw %}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Run PR CI
|
||||
run: ./run-additional-pr-ci
|
||||
```
|
||||
@@ -367,7 +367,6 @@ jobs:
|
||||
|
||||
此示例工作流程配置 PostgreSQL 服务容器,并自动将服务容器中的端口 5432 映射到主机上随机选择的可用端口。 `job` 上下文用于访问在主机上分配的端口号。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: PostgreSQL Service Example
|
||||
on: push
|
||||
@@ -385,11 +384,10 @@ jobs:
|
||||
- 5432
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: pg_isready -h localhost -p ${{ job.services.postgres.ports[5432] }}
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- run: pg_isready -h localhost -p {% raw %}${{ job.services.postgres.ports[5432] }}{% endraw %}
|
||||
- run: ./run-tests
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## `steps` 上下文
|
||||
|
||||
@@ -428,7 +426,6 @@ jobs:
|
||||
|
||||
此示例工作流程在一个步骤中生成一个随机数作为输出,后面的步骤使用 `steps` 上下文来读取该输出的值。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Generate random failure
|
||||
on: push
|
||||
@@ -437,15 +434,14 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- id: checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Generate 0 or 1
|
||||
id: generate_number
|
||||
run: echo "::set-output name=random_number::$(($RANDOM % 2))"
|
||||
- name: Pass or fail
|
||||
run: |
|
||||
if [[ ${{ steps.generate_number.outputs.random_number }} == 0 ]]; then exit 0; else exit 1; fi
|
||||
if [[ {% raw %}${{ steps.generate_number.outputs.random_number }}{% endraw %} == 0 ]]; then exit 0; else exit 1; fi
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## `runner` 上下文
|
||||
|
||||
@@ -486,7 +482,6 @@ jobs:
|
||||
|
||||
此示例工作流程使用 `runner` 上下文来设置临时目录的路径以写入日志,如果工作流程失败,它将这些日志上传为构件。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Build
|
||||
on: push
|
||||
@@ -495,19 +490,18 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Build with logs
|
||||
run: |
|
||||
mkdir ${{ runner.temp }}/build_logs
|
||||
./build.sh --log-path ${{ runner.temp }}/build_logs
|
||||
mkdir {% raw %}${{ runner.temp }}{% endraw %}/build_logs
|
||||
./build.sh --log-path {% raw %}${{ runner.temp }}{% endraw %}/build_logs
|
||||
- name: Upload logs on fail
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
if: {% raw %}${{ failure() }}{% endraw %}
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: Build failure logs
|
||||
path: ${{ runner.temp }}/build_logs
|
||||
path: {% raw %}${{ runner.temp }}{% endraw %}/build_logs
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## `secrets` 上下文
|
||||
|
||||
@@ -568,7 +562,6 @@ jobs:
|
||||
|
||||
此示例工作流程使用 `strategy.job-index` 属性为生成矩阵中每个作业的日志文件设置唯一名称。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Test matrix
|
||||
on: push
|
||||
@@ -581,15 +574,14 @@ jobs:
|
||||
test-group: [1, 2]
|
||||
node: [14, 16]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: npm test > test-job-${{ strategy.job-index }}.txt
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- run: npm test > test-job-{% raw %}${{ strategy.job-index }}{% endraw %}.txt
|
||||
- name: Upload logs
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: Build log for job ${{ strategy.job-index }}
|
||||
path: test-job-${{ strategy.job-index }}.txt
|
||||
name: Build log for job {% raw %}${{ strategy.job-index }}{% endraw %}
|
||||
path: test-job-{% raw %}${{ strategy.job-index }}{% endraw %}.txt
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## `matrix` 上下文
|
||||
|
||||
@@ -617,29 +609,27 @@ jobs:
|
||||
|
||||
此示例工作流程创建一个包含 `os` 和 `node` 键的生成矩阵。 它使用 `matrix.os` 属性为每个作业设置运行器类型,并使用 `matrix.node` 属性为每个作业设置 Node.js 版本。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Test matrix
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
runs-on: {% raw %}${{ matrix.os }}{% endraw %}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
node: [14, 16]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
node-version: {% raw %}${{ matrix.node }}{% endraw %}
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Run tests
|
||||
run: npm test
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## `needs` 上下文
|
||||
|
||||
@@ -676,7 +666,6 @@ jobs:
|
||||
|
||||
此示例工作流程有三个作业:执行生成的 `build` 作业,执行生成;需要 `build` 作业的 `deploy` 作业,以及需要 `build` 和 `deploy` 作业并且仅工作流程中出现失败时运行的 `debug` 作业。 `deploy` 作业还使用 `needs` 上下文来访问 `build` 作业的输出。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Build and deploy
|
||||
on: push
|
||||
@@ -685,9 +674,9 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
build_id: ${{ steps.build_step.outputs.build_id }}
|
||||
build_id: {% raw %}${{ steps.build_step.outputs.build_id }}{% endraw %}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Build
|
||||
id: build_step
|
||||
run: |
|
||||
@@ -697,17 +686,16 @@ jobs:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: ./deploy --build ${{ needs.build.outputs.build_id }}
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- run: ./deploy --build {% raw %}${{ needs.build.outputs.build_id }}{% endraw %}
|
||||
debug:
|
||||
needs: [build, deploy]
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ failure() }}
|
||||
if: {% raw %}${{ failure() }}{% endraw %}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- run: ./debug
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-4757 %}
|
||||
## `inputs` 上下文
|
||||
|
||||
@@ -75,7 +75,7 @@ jobs:
|
||||
run: |
|
||||
expr 1 + 1 > output.log
|
||||
- name: Upload output file
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: output-log-file
|
||||
path: output.log
|
||||
@@ -88,7 +88,7 @@ jobs:
|
||||
example-job:
|
||||
steps:
|
||||
- name: Download a single artifact
|
||||
uses: actions/download-artifact@v3
|
||||
uses: {% data reusables.actions.action-download-artifact %}
|
||||
with:
|
||||
name: output-log-file
|
||||
```
|
||||
|
||||
@@ -96,7 +96,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# This step checks out a copy of your repository.
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
# This step references the directory that contains the action.
|
||||
- uses: ./.github/actions/hello-world-action
|
||||
```
|
||||
@@ -114,7 +114,7 @@ jobs:
|
||||
my_first_job:
|
||||
steps:
|
||||
- name: My first step
|
||||
uses: actions/setup-node@v1.1.0
|
||||
uses: {% data reusables.actions.action-setup-node %}
|
||||
```
|
||||
|
||||
### 引用 Docker Hub 上的容器
|
||||
|
||||
@@ -94,20 +94,21 @@ _操作_是 {% data variables.product.prodname_actions %} 平台的自定义应
|
||||
|
||||
1. 在您的仓库中,创建 `.github/workflows/` 目录来存储工作流程文件。
|
||||
1. 在 `.github/workflows/` 目录中,创建一个名为 `learn-github-actions.yml` 的新文件并添加以下代码。
|
||||
```yaml
|
||||
name: learn-github-actions
|
||||
on: [push]
|
||||
jobs:
|
||||
check-bats-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
- run: npm install -g bats
|
||||
- run: bats -v
|
||||
```
|
||||
|
||||
```yaml
|
||||
name: learn-github-actions
|
||||
on: [push]
|
||||
jobs:
|
||||
check-bats-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: '14'
|
||||
- run: npm install -g bats
|
||||
- run: bats -v
|
||||
```
|
||||
1. 提交这些更改并将其推送到您的 {% data variables.product.prodname_dotcom %} 仓库。
|
||||
|
||||
您的新 {% data variables.product.prodname_actions %} 工作流程文件现在安装在您的仓库中,每次有人推送更改到仓库时都会自动运行。 有关作业的执行历史记录的详细信息,请参阅“[查看工作流程的活动](/actions/learn-github-actions/introduction-to-github-actions#viewing-the-jobs-activity)”。
|
||||
@@ -187,7 +188,7 @@ _操作_是 {% data variables.product.prodname_actions %} 平台的自定义应
|
||||
<td>
|
||||
|
||||
```yaml
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
```
|
||||
</td>
|
||||
<td>
|
||||
@@ -198,13 +199,13 @@ _操作_是 {% data variables.product.prodname_actions %} 平台的自定义应
|
||||
<td>
|
||||
|
||||
```yaml
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: '14'
|
||||
```
|
||||
</td>
|
||||
<td>
|
||||
此步骤使用 <code>actions/setup-node@v2</code> 操作来安装指定版本的 Node.js(此示例使用 v14)。 这会将 <code>node</code> 和 <code>npm</code> 命令放在 <code>PATH</code>中。
|
||||
此步骤使用 <code>{% data reusables.actions.action-setup-node %}</code> 操作来安装指定版本的 Node.js(此示例使用 v14)。 这会将 <code>node</code> 和 <code>npm</code> 命令放在 <code>PATH</code>中。
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -42,7 +42,7 @@ topics:
|
||||
issues: write
|
||||
pull-requests: write{% endif %}
|
||||
steps:
|
||||
- uses: actions/stale@v3
|
||||
- uses: {% data reusables.actions.action-stale %}
|
||||
with:
|
||||
days-before-issue-stale: 30
|
||||
days-before-issue-close: 14
|
||||
|
||||
@@ -315,19 +315,19 @@ jobs:
|
||||
{% endraw %}
|
||||
</td>
|
||||
<td class="d-table-cell v-align-top">
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
run_python:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: {% data reusables.actions.action-setup-python %}
|
||||
with:
|
||||
python-version: '3.7'
|
||||
architecture: 'x64'
|
||||
- run: python script.py
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -105,16 +105,16 @@ GitHub Actions
|
||||
{% endraw %}
|
||||
</td>
|
||||
<td class="d-table-cell v-align-top">
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
uses: {% data reusables.actions.action-cache %}
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: v1-npm-deps-${{ hashFiles('**/package-lock.json') }}
|
||||
key: {% raw %}v1-npm-deps-${{ hashFiles('**/package-lock.json') }}{% endraw %}
|
||||
restore-keys: v1-npm-deps-
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -155,10 +155,10 @@ GitHub Actions
|
||||
{% endraw %}
|
||||
</td>
|
||||
<td class="d-table-cell v-align-top">
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
- name: Upload math result for job 1
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: homework
|
||||
path: math-homework.txt
|
||||
@@ -166,11 +166,11 @@ GitHub Actions
|
||||
...
|
||||
|
||||
- name: Download math result for job 1
|
||||
uses: actions/download-artifact@v3
|
||||
uses: {% data reusables.actions.action-download-artifact %}
|
||||
with:
|
||||
name: homework
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -250,7 +250,7 @@ workflows:
|
||||
{% endraw %}
|
||||
</td>
|
||||
<td class="d-table-cell v-align-top">
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
name: Containers
|
||||
|
||||
@@ -284,7 +284,7 @@ jobs:
|
||||
# See https://docs.github.com/actions/reference/virtual-environments-for-github-hosted-runners#docker-container-filesystem
|
||||
- name: Setup file system permissions
|
||||
run: sudo chmod -R 777 $GITHUB_WORKSPACE /github /__w/_temp
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Install dependencies
|
||||
run: bundle install --path vendor/bundle
|
||||
- name: Setup environment configuration
|
||||
@@ -294,7 +294,6 @@ jobs:
|
||||
- name: Run tests
|
||||
run: bundle exec rake
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -401,9 +400,9 @@ workflows:
|
||||
{% endraw %}
|
||||
</td>
|
||||
<td class="d-table-cell v-align-top">
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
{% endraw %}{% data reusables.actions.actions-not-certified-by-github-comment %}{% raw %}
|
||||
{% data reusables.actions.actions-not-certified-by-github-comment %}
|
||||
|
||||
name: Containers
|
||||
|
||||
@@ -436,16 +435,16 @@ jobs:
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Setup Ruby
|
||||
uses: eregon/use-ruby-action@477b21f02be01bcb8030d50f37cfec92bfa615b6
|
||||
with:
|
||||
ruby-version: ${{ matrix.ruby }}
|
||||
ruby-version: {% raw %}${{ matrix.ruby }}{% endraw %}
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
uses: {% data reusables.actions.action-cache %}
|
||||
with:
|
||||
path: vendor/bundle
|
||||
key: administrate-${{ matrix.image }}-${{ hashFiles('Gemfile.lock') }}
|
||||
key: administrate-{% raw %}${{ matrix.image }}-${{ hashFiles('Gemfile.lock') }}{% endraw %}
|
||||
- name: Install postgres headers
|
||||
run: |
|
||||
sudo apt-get update
|
||||
@@ -463,7 +462,6 @@ jobs:
|
||||
- name: Run appraisal
|
||||
run: bundle exec appraisal rake
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -65,15 +65,15 @@ job1:
|
||||
{% endraw %}
|
||||
</td>
|
||||
<td class="d-table-cell v-align-top">
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
job1:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- run: echo "Run your script here"
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -341,20 +341,20 @@ test_async:
|
||||
{% endraw %}
|
||||
</td>
|
||||
<td class="d-table-cell v-align-top">
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
test_async:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
uses: {% data reusables.actions.action-cache %}
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: v1-npm-deps-${{ hashFiles('**/package-lock.json') }}
|
||||
key: {% raw %}v1-npm-deps-${{ hashFiles('**/package-lock.json') }}{% endraw %}
|
||||
restore-keys: v1-npm-deps-
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -388,15 +388,15 @@ artifacts:
|
||||
{% endraw %}
|
||||
</td>
|
||||
<td class="d-table-cell v-align-top">
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
- name: Upload math result for job 1
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: homework
|
||||
path: math-homework.txt
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -448,7 +448,7 @@ container-job:
|
||||
{% endraw %}
|
||||
</td>
|
||||
<td class="d-table-cell v-align-top">
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
container-job:
|
||||
@@ -463,7 +463,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
# Performs a clean installation of all dependencies
|
||||
# in the `package.json` file
|
||||
@@ -481,7 +481,7 @@ jobs:
|
||||
# The default PostgreSQL port
|
||||
POSTGRES_PORT: 5432
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -264,28 +264,26 @@ pipeline {
|
||||
</td>
|
||||
<td>
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: demo-workflow
|
||||
on:
|
||||
push:
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
runs-on: {% raw %}${{ matrix.os }}{% endraw %}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: 12
|
||||
- run: npm install -g bats
|
||||
- run: bats tests
|
||||
working-directory: scripts/myapp
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -164,13 +164,13 @@ git:
|
||||
{% endraw %}
|
||||
</td>
|
||||
<td class="d-table-cell v-align-top">
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
with:
|
||||
submodules: false
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -283,19 +283,19 @@ script:
|
||||
{% endraw %}
|
||||
</td>
|
||||
<td class="d-table-cell v-align-top">
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
run_python:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: {% data reusables.actions.action-setup-python %}
|
||||
with:
|
||||
python-version: '3.7'
|
||||
architecture: 'x64'
|
||||
- run: python script.py
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -323,16 +323,16 @@ cache: npm
|
||||
{% endraw %}
|
||||
</td>
|
||||
<td class="d-table-cell v-align-top">
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
uses: {% data reusables.actions.action-cache %}
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: v1-npm-deps-${{ hashFiles('**/package-lock.json') }}
|
||||
key: {% raw %}v1-npm-deps-${{ hashFiles('**/package-lock.json') }}{% endraw %}
|
||||
restore-keys: v1-npm-deps-
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -402,7 +402,7 @@ script:
|
||||
{% endraw %}
|
||||
</td>
|
||||
<td>
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
name: Node.js CI
|
||||
on: [push]
|
||||
@@ -410,16 +410,16 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v2
|
||||
uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: '12.x'
|
||||
- run: npm install
|
||||
- run: npm run build
|
||||
- run: npm test
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -81,7 +81,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||
@@ -151,7 +151,7 @@ jobs:
|
||||
contents: read{% endif %}
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
- name: Log in to GitHub Docker Registry
|
||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||
@@ -197,7 +197,7 @@ jobs:
|
||||
contents: read{% endif %}
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||
|
||||
@@ -87,16 +87,16 @@ jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
|
||||
- name: Publish package
|
||||
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
|
||||
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
|
||||
with:
|
||||
arguments: publish
|
||||
env:
|
||||
@@ -159,15 +159,15 @@ jobs:
|
||||
contents: read
|
||||
packages: write {% endif %}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
|
||||
- name: Publish package
|
||||
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
|
||||
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
|
||||
with:
|
||||
arguments: publish
|
||||
env:
|
||||
@@ -237,16 +237,16 @@ jobs:
|
||||
contents: read
|
||||
packages: write {% endif %}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
|
||||
- name: Publish package
|
||||
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
|
||||
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
|
||||
with:
|
||||
arguments: publish
|
||||
env: {% raw %}
|
||||
|
||||
@@ -74,7 +74,6 @@ _pom.xml_ 文件还包含 Maven 将在其中部署包的分配管理仓库的配
|
||||
在部署步骤中,您需要将环境变量设置为向仓库验证的用户名,以及用密码或令牌配置为进行身份验证的密钥。 更多信息请参阅“[创建和使用加密密码](/github/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)”。
|
||||
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Publish package to the Maven Central Repository
|
||||
on:
|
||||
@@ -84,9 +83,9 @@ jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up Maven Central Repository
|
||||
uses: actions/setup-java@v2
|
||||
uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
@@ -96,10 +95,9 @@ jobs:
|
||||
- name: Publish package
|
||||
run: mvn --batch-mode deploy
|
||||
env:
|
||||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
|
||||
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
|
||||
MAVEN_USERNAME: {% raw %}${{ secrets.OSSRH_USERNAME }}{% endraw %}
|
||||
MAVEN_PASSWORD: {% raw %}${{ secrets.OSSRH_TOKEN }}{% endraw %}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
此工作流程执行以下步骤:
|
||||
|
||||
@@ -150,8 +148,8 @@ jobs:
|
||||
contents: read
|
||||
packages: write {% endif %}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
@@ -187,9 +185,9 @@ jobs:
|
||||
contents: read
|
||||
packages: write {% endif %}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up Java for publishing to Maven Central Repository
|
||||
uses: actions/setup-java@v2
|
||||
uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
@@ -198,18 +196,18 @@ jobs:
|
||||
server-password: MAVEN_PASSWORD
|
||||
- name: Publish to the Maven Central Repository
|
||||
run: mvn --batch-mode deploy
|
||||
env:{% raw %}
|
||||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
|
||||
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
|
||||
env:
|
||||
MAVEN_USERNAME: {% raw %}${{ secrets.OSSRH_USERNAME }}{% endraw %}
|
||||
MAVEN_PASSWORD: {% raw %}${{ secrets.OSSRH_TOKEN }}{% endraw %}
|
||||
- name: Set up Java for publishing to GitHub Packages
|
||||
uses: actions/setup-java@v2
|
||||
uses: {% data reusables.actions.action-setup-java %}
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
- name: Publish to GitHub Packages
|
||||
run: mvn --batch-mode deploy
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}{% endraw %}
|
||||
GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}
|
||||
```
|
||||
|
||||
此工作流程将调用 `setup-java` 操作两次。 每次运行 `setup-java` 操作时,都会覆盖 Maven _settings.xml_ 文件以发布包。 为向仓库验证,_settings.xml_ 文件引用分发管理仓库 `id` 以及用户名和密码。
|
||||
|
||||
@@ -61,7 +61,6 @@ shortTitle: Node.js 包
|
||||
|
||||
此示例将 `NPM_TOKEN` 密码存储在 `NODE_AUTH_TOKEN` 环境变量中。 当 `setup-node` 操作创建 *.npmrc* 文件时,会引用 `NODE_AUTH_TOKEN` 环境变量中的令牌。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Publish Package to npmjs
|
||||
on:
|
||||
@@ -71,18 +70,17 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
# Setup .npmrc file to publish to npm
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: '16.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- run: npm ci
|
||||
- run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
NODE_AUTH_TOKEN: {% raw %}${{ secrets.NPM_TOKEN }}{% endraw %}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
在上面的示例中,`setup-node` 操作在运行器上创建一个包含以下内容的 *.npmrc* 文件:
|
||||
|
||||
@@ -135,9 +133,9 @@ jobs:
|
||||
contents: read
|
||||
packages: write {% endif %}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
# Setup .npmrc file to publish to GitHub Packages
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: '16.x'
|
||||
registry-url: 'https://npm.pkg.github.com'
|
||||
@@ -161,7 +159,6 @@ always-auth=true
|
||||
|
||||
如果您使用 Yarn 包管理器,可以使用 Yarn 安装和发布包。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Publish Package to npmjs
|
||||
on:
|
||||
@@ -171,9 +168,9 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
# Setup .npmrc file to publish to npm
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: '16.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
@@ -182,6 +179,5 @@ jobs:
|
||||
- run: yarn
|
||||
- run: yarn publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
NODE_AUTH_TOKEN: {% raw %}${{ secrets.NPM_TOKEN }}{% endraw %}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
@@ -39,9 +39,9 @@ shortTitle: 快速入门
|
||||
steps:
|
||||
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
|
||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
|
||||
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
|
||||
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."{% endraw %}
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}{% raw %}
|
||||
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
|
||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||
- name: List files in the repository
|
||||
|
||||
@@ -327,29 +327,27 @@ steps:
|
||||
|
||||
1. 从工作流程使用 `step` 调用 shell 脚本并对密码解密。 要在工作流程运行的环境中创建仓库的副本,需要使用 [`actions/checkout`](https://github.com/actions/checkout) 操作。 使用与仓库根目录相关的 `run` 命令引用 shell 脚本。
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: Workflows with large secrets
|
||||
```yaml
|
||||
name: Workflows with large secrets
|
||||
|
||||
on: push
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
my-job:
|
||||
name: My Job
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Decrypt large secret
|
||||
run: ./.github/scripts/decrypt_secret.sh
|
||||
env:
|
||||
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
|
||||
# This command is just an example to show your secret being printed
|
||||
# Ensure you remove any print statements of your secrets. GitHub does
|
||||
# not hide secrets that use this workaround.
|
||||
- name: Test printing your secret (Remove this step in production)
|
||||
run: cat $HOME/secrets/my_secret.json
|
||||
```
|
||||
{% endraw %}
|
||||
jobs:
|
||||
my-job:
|
||||
name: My Job
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Decrypt large secret
|
||||
run: ./.github/scripts/decrypt_secret.sh
|
||||
env:
|
||||
LARGE_SECRET_PASSPHRASE: {% raw %}${{ secrets. LARGE_SECRET_PASSPHRASE }}{% endraw %}
|
||||
# This command is just an example to show your secret being printed
|
||||
# Ensure you remove any print statements of your secrets. GitHub does
|
||||
# not hide secrets that use this workaround.
|
||||
- name: Test printing your secret (Remove this step in production)
|
||||
run: cat $HOME/secrets/my_secret.json
|
||||
```
|
||||
|
||||
## 将 Base64 二进制 blob 存储为机密
|
||||
|
||||
@@ -385,7 +383,7 @@ steps:
|
||||
decode-secret:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Retrieve the secret and decode it to a file
|
||||
env:
|
||||
{% raw %}CERTIFICATE_BASE64: ${{ secrets.CERTIFICATE_BASE64 }}{% endraw %}
|
||||
@@ -395,4 +393,3 @@ steps:
|
||||
run: |
|
||||
openssl x509 -in cert.der -inform DER -text -noout
|
||||
```
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ topics:
|
||||
|
||||
{% data reusables.actions.copy-workflow-file %}
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: PostgreSQL service example
|
||||
on: push
|
||||
@@ -73,7 +72,7 @@ jobs:
|
||||
steps:
|
||||
# Downloads a copy of the code in your repository before running CI tests
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
# Performs a clean installation of all dependencies in the `package.json` file
|
||||
# For more information, see https://docs.npmjs.com/cli/ci.html
|
||||
@@ -91,7 +90,6 @@ jobs:
|
||||
# The default PostgreSQL port
|
||||
POSTGRES_PORT: 5432
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### 配置运行器作业
|
||||
|
||||
@@ -133,7 +131,7 @@ jobs:
|
||||
steps:
|
||||
# Downloads a copy of the code in your repository before running CI tests
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
# Performs a clean installation of all dependencies in the `package.json` file
|
||||
# For more information, see https://docs.npmjs.com/cli/ci.html
|
||||
@@ -163,7 +161,6 @@ PostgreSQL 文档中的服务的主机名是您在工作流程中配置的标签
|
||||
|
||||
{% data reusables.actions.copy-workflow-file %}
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: PostgreSQL Service Example
|
||||
on: push
|
||||
@@ -196,7 +193,7 @@ jobs:
|
||||
steps:
|
||||
# Downloads a copy of the code in your repository before running CI tests
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
# Performs a clean installation of all dependencies in the `package.json` file
|
||||
# For more information, see https://docs.npmjs.com/cli/ci.html
|
||||
@@ -215,7 +212,6 @@ jobs:
|
||||
# The default PostgreSQL port
|
||||
POSTGRES_PORT: 5432
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### 配置运行器作业
|
||||
|
||||
@@ -260,7 +256,7 @@ jobs:
|
||||
steps:
|
||||
# Downloads a copy of the code in your repository before running CI tests
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
# Performs a clean installation of all dependencies in the `package.json` file
|
||||
# For more information, see https://docs.npmjs.com/cli/ci.html
|
||||
|
||||
@@ -41,7 +41,6 @@ topics:
|
||||
|
||||
{% data reusables.actions.copy-workflow-file %}
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Redis container example
|
||||
on: push
|
||||
@@ -70,7 +69,7 @@ jobs:
|
||||
steps:
|
||||
# Downloads a copy of the code in your repository before running CI tests
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
# Performs a clean installation of all dependencies in the `package.json` file
|
||||
# For more information, see https://docs.npmjs.com/cli/ci.html
|
||||
@@ -88,7 +87,6 @@ jobs:
|
||||
# The default Redis port
|
||||
REDIS_PORT: 6379
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### 配置容器作业
|
||||
|
||||
@@ -127,7 +125,7 @@ jobs:
|
||||
steps:
|
||||
# Downloads a copy of the code in your repository before running CI tests
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
# Performs a clean installation of all dependencies in the `package.json` file
|
||||
# For more information, see https://docs.npmjs.com/cli/ci.html
|
||||
@@ -156,7 +154,6 @@ Redis 服务的主机名是您在工作流程中配置的标签,本例中为 `
|
||||
|
||||
{% data reusables.actions.copy-workflow-file %}
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Redis runner example
|
||||
on: push
|
||||
@@ -186,7 +183,7 @@ jobs:
|
||||
steps:
|
||||
# Downloads a copy of the code in your repository before running CI tests
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
# Performs a clean installation of all dependencies in the `package.json` file
|
||||
# For more information, see https://docs.npmjs.com/cli/ci.html
|
||||
@@ -205,7 +202,6 @@ jobs:
|
||||
# The default Redis port
|
||||
REDIS_PORT: 6379
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### 配置运行器作业
|
||||
|
||||
@@ -247,7 +243,7 @@ jobs:
|
||||
steps:
|
||||
# Downloads a copy of the code in your repository before running CI tests
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
# Performs a clean installation of all dependencies in the `package.json` file
|
||||
# For more information, see https://docs.npmjs.com/cli/ci.html
|
||||
|
||||
@@ -80,7 +80,6 @@ For the overall list of included tools for each runner operating system, see the
|
||||
* [Ubuntu 18.04 LTS](https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu1804-Readme.md)
|
||||
* [Windows Server 2022](https://github.com/actions/virtual-environments/blob/main/images/win/Windows2022-Readme.md)
|
||||
* [Windows Server 2019](https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md)
|
||||
* [Windows Server 2016](https://github.com/actions/virtual-environments/blob/main/images/win/Windows2016-Readme.md)
|
||||
* [macOS 11](https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11-Readme.md)
|
||||
* [macOS 10.15](https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md)
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ shortTitle: 自定义运行器
|
||||
|
||||
以下示例演示如何在作业中安装 `apt` 包。
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: Build on Ubuntu
|
||||
on: push
|
||||
@@ -32,13 +31,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Install jq tool
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install jq
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
{% note %}
|
||||
|
||||
@@ -50,7 +48,6 @@ jobs:
|
||||
|
||||
以下示例演示如何将 Brew 包和桶安装为作业的一部分。
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: Build on macOS
|
||||
on: push
|
||||
@@ -60,7 +57,7 @@ jobs:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Install GitHub CLI
|
||||
run: |
|
||||
brew update
|
||||
@@ -70,7 +67,6 @@ jobs:
|
||||
brew update
|
||||
brew install --cask microsoft-edge
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 在 Windows 运行器上安装软件
|
||||
|
||||
|
||||
@@ -74,7 +74,6 @@ jobs:
|
||||
|
||||
如果您希望工作流程跨操作系统、平台和语言的多个组合运行测试,可以使用构建矩阵。 构建矩阵是使用 `strategy` 关键字创建的,它接收构建选项作为数组。 例如,此构建矩阵将使用不同版本的 Node.js 多次运行作业:
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
jobs:
|
||||
build:
|
||||
@@ -83,11 +82,10 @@ jobs:
|
||||
matrix:
|
||||
node: [6, 8, 10]
|
||||
steps:
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
node-version: {% raw %}${{ matrix.node }}{% endraw %}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
更多信息请参阅“[对作业使用构建矩阵](/actions/using-jobs/using-a-build-matrix-for-your-jobs)”。
|
||||
|
||||
@@ -98,22 +96,20 @@ jobs:
|
||||
|
||||
此示例演示如何缓存 `~/.npm` 目录:
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
jobs:
|
||||
example-job:
|
||||
steps:
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
uses: {% data reusables.actions.action-cache %}
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
key: {% raw %}${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}{% endraw %}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
{% raw %}${{ runner.os }}-build-${{ env.cache-name }}-{% endraw %}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
更多信息请参阅“<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">缓存依赖项以加快工作流程</a>”。
|
||||
{% endif %}
|
||||
@@ -132,7 +128,7 @@ jobs:
|
||||
image: postgres
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Connect to PostgreSQL
|
||||
|
||||
@@ -92,9 +92,10 @@ If you are caching the package managers listed below, consider using the respect
|
||||
- `path`:**必要** 运行器上缓存或还原的文件路径。 The path can be an absolute path or relative to the workspace directory.
|
||||
- 路径可以是目录或单个文件,并且支持 glob 模式。
|
||||
- 使用 `cache` 操作的 `v2`,可以指定单个路径,也可以在单独的行上添加多个路径。 例如:
|
||||
|
||||
```
|
||||
- name: Cache Gradle packages
|
||||
uses: actions/cache@v2
|
||||
uses: {% data reusables.actions.action-cache %}
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
@@ -111,7 +112,6 @@ If you are caching the package managers listed below, consider using the respect
|
||||
|
||||
此示例在 `package-lock.json` 文件中的包更改时,或运行器的操作系统更改时,创建一个新的缓存。 缓存键使用上下文和表达式生成一个键值,其中包括运行器的操作系统和 `package-lock.json` 文件的 SHA-256 哈希。
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Caching with npm
|
||||
|
||||
@@ -122,20 +122,20 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
uses: {% data reusables.actions.action-cache %}
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
# npm cache files are stored in `~/.npm` on Linux/macOS
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
key: {% raw %}${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}{% endraw %}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
{% raw %}${{ runner.os }}-build-${{ env.cache-name }}-{% endraw %}
|
||||
{% raw %}${{ runner.os }}-build-{% endraw %}
|
||||
{% raw %}${{ runner.os }}-{% endraw %}
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
@@ -146,7 +146,6 @@ jobs:
|
||||
- name: Test
|
||||
run: npm test
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
当 `key` 匹配现有缓存时,被称为缓存命中,并且操作会将缓存的文件还原到 `path` 目录。
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ topics:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
- name: Run a one-line script
|
||||
run: echo Hello from Octo Organization
|
||||
|
||||
@@ -1079,6 +1079,12 @@ on:
|
||||
types: [on-demand-test]
|
||||
```
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** The `event_type` value is limited to 100 characters.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
通过 `client_payload` 参数发送的任何数据都将在工作流程中的 `github.event` 上下文中提供。 例如,如果在创建存储库调度事件时发送此请求正文:
|
||||
|
||||
```json
|
||||
@@ -1429,7 +1435,7 @@ jobs:
|
||||
run: |
|
||||
mkdir -p ./pr
|
||||
echo $PR_NUMBER > ./pr/pr_number
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: pr_number
|
||||
path: pr/
|
||||
@@ -1451,7 +1457,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Download artifact'
|
||||
uses: actions/github-script@v5
|
||||
uses: {% data reusables.actions.action-github-script %}
|
||||
with:
|
||||
script: |
|
||||
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
||||
@@ -1475,7 +1481,7 @@ jobs:
|
||||
run: unzip pr_number.zip
|
||||
|
||||
- name: 'Comment on PR'
|
||||
uses: actions/github-script@v5
|
||||
uses: {% data reusables.actions.action-github-script %}
|
||||
with:
|
||||
github-token: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}
|
||||
script: |
|
||||
|
||||
@@ -94,21 +94,21 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
- name: npm install, build, and test
|
||||
run: |
|
||||
npm install
|
||||
npm run build --if-present
|
||||
npm test
|
||||
- name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: dist-without-markdown
|
||||
path: |
|
||||
dist
|
||||
!dist/**/*.md
|
||||
- name: Archive code coverage results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: code-coverage-report
|
||||
path: output/test/code-coverage.html
|
||||
@@ -120,7 +120,7 @@ You can define a custom retention period for individual artifacts created by a w
|
||||
|
||||
```yaml{:copy}
|
||||
- name: 'Upload Artifact'
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: my-artifact
|
||||
path: my_file.txt
|
||||
@@ -149,7 +149,7 @@ Specify an artifact's name to download an individual artifact. If you uploaded a
|
||||
|
||||
```yaml
|
||||
- name: Download a single artifact
|
||||
uses: actions/download-artifact@v3
|
||||
uses: {% data reusables.actions.action-download-artifact %}
|
||||
with:
|
||||
name: my-artifact
|
||||
```
|
||||
@@ -158,7 +158,7 @@ You can also download all artifacts in a workflow run by not specifying a name.
|
||||
|
||||
```yaml
|
||||
- name: Download all workflow run artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
uses: {% data reusables.actions.action-download-artifact %}
|
||||
```
|
||||
|
||||
If you download all workflow run's artifacts, a directory for each artifact is created using its name.
|
||||
@@ -200,7 +200,7 @@ jobs:
|
||||
run: |
|
||||
expr 3 + 7 > math-homework.txt
|
||||
- name: Upload math result for job 1
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: homework
|
||||
path: math-homework.txt
|
||||
@@ -211,7 +211,7 @@ jobs:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Download math result for job 1
|
||||
uses: actions/download-artifact@v3
|
||||
uses: {% data reusables.actions.action-download-artifact %}
|
||||
with:
|
||||
name: homework
|
||||
- shell: bash
|
||||
@@ -219,7 +219,7 @@ jobs:
|
||||
value=`cat math-homework.txt`
|
||||
expr $value \* 9 > math-homework.txt
|
||||
- name: Upload math result for job 2
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
name: homework
|
||||
path: math-homework.txt
|
||||
@@ -230,7 +230,7 @@ jobs:
|
||||
runs-on: macOS-latest
|
||||
steps:
|
||||
- name: Download math result for job 2
|
||||
uses: actions/download-artifact@v3
|
||||
uses: {% data reusables.actions.action-download-artifact %}
|
||||
with:
|
||||
name: homework
|
||||
- name: Print the final result
|
||||
|
||||
@@ -391,9 +391,9 @@ steps:
|
||||
# Reference a specific commit
|
||||
- uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675
|
||||
# Reference the major version of a release
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
# Reference a specific version
|
||||
- uses: actions/checkout@v2.2.0
|
||||
- uses: {% data reusables.actions.action-checkout %}.2.0
|
||||
# Reference a branch
|
||||
- uses: actions/checkout@main
|
||||
```
|
||||
@@ -441,7 +441,7 @@ jobs:
|
||||
my_first_job:
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Use local my-action
|
||||
uses: ./.github/actions/my-action
|
||||
```
|
||||
@@ -495,22 +495,20 @@ jobs:
|
||||
|
||||
将示例中的 `PERSONAL_ACCESS_TOKEN` 替换为您的密钥名称。
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
jobs:
|
||||
my_first_job:
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
with:
|
||||
repository: octocat/my-private-repo
|
||||
ref: v1.0
|
||||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
||||
token: {% raw %}${{ secrets.PERSONAL_ACCESS_TOKEN }}{% endraw %}
|
||||
path: ./.github/actions/my-private-repo
|
||||
- name: Run my action
|
||||
uses: ./.github/actions/my-private-repo/my-action
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### `jobs.<job_id>.steps[*].run`
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ topics:
|
||||
|
||||
- {% data variables.product.prodname_code_scanning_capc %},请参阅“[为设备配置 {% data variables.product.prodname_code_scanning %}](/admin/advanced-security/configuring-code-scanning-for-your-appliance#prerequisites-for-code-scanning)”。
|
||||
- {% data variables.product.prodname_secret_scanning_caps %},请参阅“[为设备配置 {% data variables.product.prodname_secret_scanning %}](/admin/advanced-security/configuring-secret-scanning-for-your-appliance#prerequisites-for-secret-scanning)”。{% endif %}
|
||||
- {% data variables.product.prodname_dependabot %}, see "[Enabling {% data variables.product.prodname_dependabot %} for your enterprise](/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise)."
|
||||
- {% data variables.product.prodname_dependabot %},请参阅“[为企业启用 {% data variables.product.prodname_dependabot %}](/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise)”。
|
||||
|
||||
## 启用和禁用 {% data variables.product.prodname_GH_advanced_security %} 功能
|
||||
|
||||
@@ -82,7 +82,7 @@ topics:
|
||||
```shell
|
||||
ghe-config app.secret-scanning.enabled true
|
||||
```
|
||||
- To enable the dependency graph, enter the following {% ifversion ghes > 3.1 %}command{% else %}commands{% endif %}.
|
||||
- 要启用依赖关系图,请输入以下 {% ifversion ghes > 3.1 %}命令{% else %}命令{% endif %}。
|
||||
{% ifversion ghes > 3.1 %}```shell
|
||||
ghe-config app.dependency-graph.enabled true
|
||||
```
|
||||
@@ -101,7 +101,7 @@ topics:
|
||||
```shell
|
||||
ghe-config app.secret-scanning.enabled false
|
||||
```
|
||||
- To disable the dependency graph, enter the following {% ifversion ghes > 3.1 %}command{% else %}commands{% endif %}.
|
||||
- 要禁用依赖关系图,请输入以下 {% ifversion ghes > 3.1 %}命令{% else %}命令{% endif %}。
|
||||
{% ifversion ghes > 3.1 %}```shell
|
||||
ghe-config app.dependency-graph.enabled false
|
||||
```
|
||||
|
||||
@@ -16,7 +16,7 @@ topics:
|
||||
|
||||
{% data reusables.dependabot.about-the-dependency-graph %} For more information, see "[About the dependency graph](/github/visualizing-repository-data-with-graphs/about-the-dependency-graph)"
|
||||
|
||||
After you enable the dependency graph for your enterprise, you can enable {% data variables.product.prodname_dependabot %} to detect vulnerable dependencies in your repository{% ifversion ghes > 3.2 %} and automatically fix the vulnerabilities{% endif %}. For more information, see "[Enabling {% data variables.product.prodname_dependabot %} for your enterprise](/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise)."
|
||||
After you enable the dependency graph for your enterprise, you can enable {% data variables.product.prodname_dependabot %} to detect vulnerable dependencies in your repository{% ifversion ghes > 3.2 %} and automatically fix the vulnerabilities{% endif %}. 更多信息请参阅“[为企业启用 {% data variables.product.prodname_dependabot %}](/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise)”。
|
||||
|
||||
{% ifversion ghes > 3.1 %}
|
||||
您可以通过 {% data variables.enterprise.management_console %} 或管理 shell 启用依赖关系图。 We recommend using the {% data variables.enterprise.management_console %} unless {% data variables.product.product_location %} uses clustering.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: Managing supply chain security for your enterprise
|
||||
title: 管理企业的供应链安全
|
||||
shortTitle: 供应链安全
|
||||
intro: 'You can visualize, maintain, and secure the dependencies in your developers'' software supply chain.'
|
||||
intro: 您可以可视化、维护和保护开发人员软件供应链中的依赖项。
|
||||
versions:
|
||||
ghes: '*'
|
||||
ghae: issue-4864
|
||||
|
||||
@@ -17,7 +17,7 @@ If {% data variables.product.prodname_dependabot_alerts %} are enabled for your
|
||||
|
||||
You can manually sync vulnerability data from {% data variables.product.prodname_dotcom_the_website %} to update the list.
|
||||
|
||||
Before you can view vulnerability data, you must enable {% data variables.product.prodname_dependabot_alerts %}. For more information, see "[Enabling {% data variables.product.prodname_dependabot %} for your enterprise](/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise)."
|
||||
Before you can view vulnerability data, you must enable {% data variables.product.prodname_dependabot_alerts %}. 更多信息请参阅“[为企业启用 {% data variables.product.prodname_dependabot %}](/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise)”。
|
||||
|
||||
{% data reusables.enterprise_site_admin_settings.access-settings %}
|
||||
2. 在左侧边栏中,单击 **Vulnerabilities**。 
|
||||
|
||||
@@ -10,7 +10,7 @@ topics:
|
||||
- GitHub Connect
|
||||
---
|
||||
|
||||
## 关于 {% data variables.product.prodname_github_connect %}
|
||||
## About {% data variables.product.prodname_github_connect %}
|
||||
|
||||
{% data variables.product.prodname_github_connect %} enhances {% data variables.product.product_name %} by allowing {% data variables.product.product_location %} to benefit from the power of {% data variables.product.prodname_dotcom_the_website %} in limited ways. After you enable {% data variables.product.prodname_github_connect %}, you can enable additional features and workflows that rely on {% data variables.product.prodname_dotcom_the_website %}, such as {% ifversion ghes or ghae-issue-4864 %}{% data variables.product.prodname_dependabot_alerts %} for security vulnerabilities that are tracked in the {% data variables.product.prodname_advisory_database %}{% else %}allowing users to use community-powered actions from {% data variables.product.prodname_dotcom_the_website %} in their workflow files{% endif %}.
|
||||
|
||||
@@ -26,21 +26,21 @@ After enabling {% data variables.product.prodname_github_connect %}, you will be
|
||||
|
||||
After you configure the connection between {% data variables.product.product_location %} and {% data variables.product.prodname_ghe_cloud %}, you can enable individual features of {% data variables.product.prodname_github_connect %} for your enterprise.
|
||||
|
||||
| 功能 | 描述 | 更多信息 |
|
||||
| ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |{% ifversion ghes %}
|
||||
| Automatic user license sync | Manage license usage across your {% data variables.product.prodname_enterprise %} deployments by automatically syncing user licenses from {% data variables.product.product_location %} to {% data variables.product.prodname_ghe_cloud %}. | "[Enabling automatic user license sync for your enterprise](/admin/configuration/configuring-github-connect/enabling-automatic-user-license-sync-for-your-enterprise)"{% endif %}{% ifversion ghes or ghae-issue-4864 %}
|
||||
| {% data variables.product.prodname_dependabot %} | Allow users to find and fix vulnerabilities in code dependencies. | "[Enabling {% data variables.product.prodname_dependabot %} for your enterprise](/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise)"{% endif %}
|
||||
| {% data variables.product.prodname_dotcom_the_website %} actions | Allow users to use actions from {% data variables.product.prodname_dotcom_the_website %} in workflow files. | "[Enabling automatic access to {% data variables.product.prodname_dotcom_the_website %} actions using {% data variables.product.prodname_github_connect %}](/admin/github-actions/managing-access-to-actions-from-githubcom/enabling-automatic-access-to-githubcom-actions-using-github-connect)" |
|
||||
| Unified search | Allow users to include repositories on {% data variables.product.prodname_dotcom_the_website %} in their search results when searching from {% data variables.product.product_location %}. | "[Enabling {% data variables.product.prodname_unified_search %} for your enterprise](/admin/configuration/configuring-github-connect/enabling-unified-search-for-your-enterprise)" |
|
||||
| Unified contributions | Allow users to include anonymized contribution counts for their work on {% data variables.product.product_location %} in their contribution graphs on {% data variables.product.prodname_dotcom_the_website %}. | "[Enabling {% data variables.product.prodname_unified_contributions %} for your enterprise](/admin/configuration/configuring-github-connect/enabling-unified-contributions-for-your-enterprise)" |
|
||||
Feature | Description | More information |
|
||||
------- | ----------- | ---------------- |{% ifversion ghes %}
|
||||
Automatic user license sync | Manage license usage across your {% data variables.product.prodname_enterprise %} deployments by automatically syncing user licenses from {% data variables.product.product_location %} to {% data variables.product.prodname_ghe_cloud %}. | "[Enabling automatic user license sync for your enterprise](/admin/configuration/configuring-github-connect/enabling-automatic-user-license-sync-for-your-enterprise)"{% endif %}{% ifversion ghes or ghae-issue-4864 %}
|
||||
{% data variables.product.prodname_dependabot %} | Allow users to find and fix vulnerabilities in code dependencies. | "[Enabling {% data variables.product.prodname_dependabot %} for your enterprise](/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise)"{% endif %}
|
||||
{% data variables.product.prodname_dotcom_the_website %} actions | Allow users to use actions from {% data variables.product.prodname_dotcom_the_website %} in workflow files. | "[Enabling automatic access to {% data variables.product.prodname_dotcom_the_website %} actions using {% data variables.product.prodname_github_connect %}](/admin/github-actions/managing-access-to-actions-from-githubcom/enabling-automatic-access-to-githubcom-actions-using-github-connect)"
|
||||
Unified search | Allow users to include repositories on {% data variables.product.prodname_dotcom_the_website %} in their search results when searching from {% data variables.product.product_location %}. | "[Enabling {% data variables.product.prodname_unified_search %} for your enterprise](/admin/configuration/configuring-github-connect/enabling-unified-search-for-your-enterprise)"
|
||||
Unified contributions | Allow users to include anonymized contribution counts for their work on {% data variables.product.product_location %} in their contribution graphs on {% data variables.product.prodname_dotcom_the_website %}. | "[Enabling {% data variables.product.prodname_unified_contributions %} for your enterprise](/admin/configuration/configuring-github-connect/enabling-unified-contributions-for-your-enterprise)"
|
||||
|
||||
## Data transmission for {% data variables.product.prodname_github_connect %}
|
||||
## Data transmission for {% data variables.product.prodname_github_connect %}
|
||||
|
||||
When you enable {% data variables.product.prodname_github_connect %} or specific {% data variables.product.prodname_github_connect %} features, a record on {% data variables.product.prodname_ghe_cloud %} stores the following information about the connection.
|
||||
{% ifversion ghes %}
|
||||
- {% data variables.product.prodname_ghe_server %} 许可的公钥部分
|
||||
- {% data variables.product.prodname_ghe_server %} 许可的哈希
|
||||
- {% data variables.product.prodname_ghe_server %} 许可上的客户名称
|
||||
- The public key portion of your {% data variables.product.prodname_ghe_server %} license
|
||||
- A hash of your {% data variables.product.prodname_ghe_server %} license
|
||||
- The customer name on your {% data variables.product.prodname_ghe_server %} license
|
||||
- The version of {% data variables.product.product_location_enterprise %}{% endif %}
|
||||
- The hostname of {% data variables.product.product_location %}
|
||||
- The organization or enterprise account on {% data variables.product.prodname_ghe_cloud %} that's connected to {% data variables.product.product_location %}
|
||||
@@ -61,15 +61,15 @@ When you enable {% data variables.product.prodname_github_connect %} or specific
|
||||
|
||||
Additional data is transmitted if you enable individual features of {% data variables.product.prodname_github_connect %}.
|
||||
|
||||
| 功能 | Data | Which way does the data flow? | Where is the data used? |
|
||||
| ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |{% ifversion ghes %}
|
||||
| Automatic user license sync | Each {% data variables.product.product_name %} user's user ID and email addresses | From {% data variables.product.product_name %} to {% data variables.product.prodname_ghe_cloud %} | {% data variables.product.prodname_ghe_cloud %} |{% endif %}{% ifversion ghes or ghae-issue-4864 %}
|
||||
| {% data variables.product.prodname_dependabot_alerts %} | Vulnerability alerts | From {% data variables.product.prodname_dotcom_the_website %} to {% data variables.product.product_name %} | {% data variables.product.product_name %} |{% endif %}{% if dependabot-updates-github-connect %}
|
||||
| {% data variables.product.prodname_dependabot_updates %} | Dependencies and the metadata for each dependency's repository<br><br>If a dependency is stored in a private repository on {% data variables.product.prodname_dotcom_the_website %}, data will only be transmitted if {% data variables.product.prodname_dependabot %} is configured and authorized to access that repository. | From {% data variables.product.prodname_dotcom_the_website %} to {% data variables.product.product_name %} | {% data variables.product.product_name %} {% endif %}
|
||||
| {% data variables.product.prodname_dotcom_the_website %} actions | Name of action, action (YAML file from {% data variables.product.prodname_marketplace %}) | From {% data variables.product.prodname_dotcom_the_website %} to {% data variables.product.product_name %}<br><br>From {% data variables.product.product_name %} to {% data variables.product.prodname_dotcom_the_website %} | {% data variables.product.product_name %}
|
||||
| Unified search | Search terms, search results | From {% data variables.product.prodname_dotcom_the_website %} to {% data variables.product.product_name %}<br><br>From {% data variables.product.product_name %} to {% data variables.product.prodname_dotcom_the_website %} | {% data variables.product.product_name %}
|
||||
| Unified contributions | Contribution counts | From {% data variables.product.product_name %} to {% data variables.product.prodname_dotcom_the_website %} | {% data variables.product.prodname_dotcom_the_website %}
|
||||
Feature | Data | Which way does the data flow? | Where is the data used? |
|
||||
------- | ---- | --------- | ------ |{% ifversion ghes %}
|
||||
Automatic user license sync | Each {% data variables.product.product_name %} user's user ID and email addresses | From {% data variables.product.product_name %} to {% data variables.product.prodname_ghe_cloud %} | {% data variables.product.prodname_ghe_cloud %} |{% endif %}{% ifversion ghes or ghae-issue-4864 %}
|
||||
{% data variables.product.prodname_dependabot_alerts %} | Vulnerability alerts | From {% data variables.product.prodname_dotcom_the_website %} to {% data variables.product.product_name %} | {% data variables.product.product_name %} |{% endif %}{% if dependabot-updates-github-connect %}
|
||||
{% data variables.product.prodname_dependabot_updates %} | Dependencies and the metadata for each dependency's repository<br><br>If a dependency is stored in a private repository on {% data variables.product.prodname_dotcom_the_website %}, data will only be transmitted if {% data variables.product.prodname_dependabot %} is configured and authorized to access that repository. | From {% data variables.product.prodname_dotcom_the_website %} to {% data variables.product.product_name %} | {% data variables.product.product_name %} {% endif %}
|
||||
{% data variables.product.prodname_dotcom_the_website %} actions | Name of action, action (YAML file from {% data variables.product.prodname_marketplace %}) | From {% data variables.product.prodname_dotcom_the_website %} to {% data variables.product.product_name %}<br><br>From {% data variables.product.product_name %} to {% data variables.product.prodname_dotcom_the_website %} | {% data variables.product.product_name %}
|
||||
Unified search | Search terms, search results | From {% data variables.product.prodname_dotcom_the_website %} to {% data variables.product.product_name %}<br><br>From {% data variables.product.product_name %} to {% data variables.product.prodname_dotcom_the_website %} | {% data variables.product.product_name %} |
|
||||
Unified contributions | Contribution counts | From {% data variables.product.product_name %} to {% data variables.product.prodname_dotcom_the_website %} | {% data variables.product.prodname_dotcom_the_website %} |
|
||||
|
||||
## 延伸阅读
|
||||
## Further reading
|
||||
|
||||
- GraphQL API 文档中的“[企业帐户](/graphql/guides/managing-enterprise-accounts)”
|
||||
- "[Enterprise accounts](/graphql/guides/managing-enterprise-accounts)" in the GraphQL API documentation
|
||||
|
||||
@@ -17,8 +17,7 @@ topics:
|
||||
- Licensing
|
||||
shortTitle: Automatic user license sync
|
||||
---
|
||||
|
||||
## 关于许可同步
|
||||
## About license synchronization
|
||||
|
||||
{% data reusables.enterprise-licensing.about-license-sync %} For more information, see "[About {% data variables.product.prodname_github_connect %}](/admin/configuration/configuring-github-connect/about-github-connect#data-transmission-for-github-connect)."
|
||||
|
||||
@@ -28,14 +27,15 @@ If you use multiple {% data variables.product.prodname_ghe_server %} instances,
|
||||
|
||||
{% data reusables.enterprise-licensing.view-consumed-licenses %}
|
||||
|
||||
您还可以手动将 {% data variables.product.prodname_ghe_server %} 用户许可信息上传到 {% data variables.product.prodname_ghe_cloud %}。 For more information, see "[Syncing license usage between {% data variables.product.prodname_ghe_server %} and {% data variables.product.prodname_ghe_cloud %}](/billing/managing-your-license-for-github-enterprise/syncing-license-usage-between-github-enterprise-server-and-github-enterprise-cloud)."
|
||||
You can also manually upload {% data variables.product.prodname_ghe_server %} user license information to {% data variables.product.prodname_ghe_cloud %}. For more information, see "[Syncing license usage between {% data variables.product.prodname_ghe_server %} and {% data variables.product.prodname_ghe_cloud %}](/billing/managing-your-license-for-github-enterprise/syncing-license-usage-between-github-enterprise-server-and-github-enterprise-cloud)."
|
||||
|
||||
{% data reusables.enterprise-licensing.verified-domains-license-sync %}
|
||||
|
||||
## 启用许可同步
|
||||
## Enabling license synchronization
|
||||
|
||||
Before enabling license synchronization on {% data variables.product.product_location %}, you must enable {% data variables.product.prodname_github_connect %}. For more information, see "[Managing {% data variables.product.prodname_github_connect %}](/admin/configuration/configuring-github-connect/managing-github-connect)."
|
||||
|
||||
{% data reusables.enterprise-accounts.access-enterprise %}
|
||||
{% data reusables.enterprise-accounts.github-connect-tab %}
|
||||
1. 在“Server can sync user license count and usage”下,使用下拉菜单,然后选择 **Enabled**。 
|
||||
1. Under "Server can sync user license count and usage", use the drop-down menu and select **Enabled**.
|
||||

|
||||
|
||||
@@ -28,7 +28,7 @@ topics:
|
||||
|
||||
{% data variables.product.prodname_dependabot %} helps users of {% data variables.product.product_location %} find and fix vulnerabilities in their dependencies.{% ifversion ghes > 3.2 %} You can enable {% data variables.product.prodname_dependabot_alerts %} to notify users about vulnerable dependencies and {% data variables.product.prodname_dependabot_updates %} to fix the vulnerabilities and keep dependencies updated to the latest version.
|
||||
|
||||
### 关于 {% data variables.product.prodname_dependabot_alerts %}
|
||||
### About {% data variables.product.prodname_dependabot_alerts %}
|
||||
{% endif %}
|
||||
|
||||
{% data reusables.dependabot.dependabot-alerts-beta %}
|
||||
@@ -37,28 +37,28 @@ With {% data variables.product.prodname_dependabot_alerts %}, {% data variables.
|
||||
|
||||
{% data reusables.repositories.tracks-vulnerabilities %}
|
||||
|
||||
After you enable {% data variables.product.prodname_dependabot_alerts %} for your enterprise, vulnerability data is synced from the {% data variables.product.prodname_advisory_database %} to your instance once every hour. Only {% data variables.product.company_short %}-reviewed advisories are synchronized. {% data reusables.security-advisory.link-browsing-advisory-db %}
|
||||
After you enable {% data variables.product.prodname_dependabot_alerts %} for your enterprise, vulnerability data is synced from the {% data variables.product.prodname_advisory_database %} to your instance once every hour. Only {% data variables.product.company_short %}-reviewed advisories are synchronized. {% data reusables.security-advisory.link-browsing-advisory-db %}
|
||||
|
||||
您还可以随时选择手动同步漏洞数据。 For more information, see "[Viewing the vulnerability data for your enterprise](/admin/code-security/managing-supply-chain-security-for-your-enterprise/viewing-the-vulnerability-data-for-your-enterprise)."
|
||||
You can also choose to manually sync vulnerability data at any time. For more information, see "[Viewing the vulnerability data for your enterprise](/admin/code-security/managing-supply-chain-security-for-your-enterprise/viewing-the-vulnerability-data-for-your-enterprise)."
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** When you enable enable {% data variables.product.prodname_dependabot_alerts %}, no code or information about code from {% data variables.product.product_location %} is uploaded to {% data variables.product.prodname_dotcom_the_website %}.
|
||||
**Note:** When you enable enable {% data variables.product.prodname_dependabot_alerts %}, no code or information about code from {% data variables.product.product_location %} is uploaded to {% data variables.product.prodname_dotcom_the_website %}.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
When {% data variables.product.product_location %} receives information about a vulnerability, it identifies repositories in {% data variables.product.product_location %} that use the affected version of the dependency and generates {% data variables.product.prodname_dependabot_alerts %}. You can choose whether or not to notify users automatically about new {% data variables.product.prodname_dependabot_alerts %}.
|
||||
When {% data variables.product.product_location %} receives information about a vulnerability, it identifies repositories in {% data variables.product.product_location %} that use the affected version of the dependency and generates {% data variables.product.prodname_dependabot_alerts %}. You can choose whether or not to notify users automatically about new {% data variables.product.prodname_dependabot_alerts %}.
|
||||
|
||||
For repositories with {% data variables.product.prodname_dependabot_alerts %} enabled, scanning is triggered on any push to the default branch that contains a manifest file or lock file. Additionally, when a new vulnerability record is added to {% data variables.product.product_location %}, {% data variables.product.product_name %} scans all existing repositories on {% data variables.product.product_location %} and generates alerts for any repository that is vulnerable. 更多信息请参阅“[关于 {% data variables.product.prodname_dependabot_alerts %}](/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies)”。
|
||||
For repositories with {% data variables.product.prodname_dependabot_alerts %} enabled, scanning is triggered on any push to the default branch that contains a manifest file or lock file. Additionally, when a new vulnerability record is added to {% data variables.product.product_location %}, {% data variables.product.product_name %} scans all existing repositories on {% data variables.product.product_location %} and generates alerts for any repository that is vulnerable. For more information, see "[About {% data variables.product.prodname_dependabot_alerts %}](/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies)."
|
||||
|
||||
{% ifversion ghes > 3.2 %}
|
||||
### 关于 {% data variables.product.prodname_dependabot_updates %}
|
||||
### About {% data variables.product.prodname_dependabot_updates %}
|
||||
|
||||
{% data reusables.dependabot.beta-security-and-version-updates %}
|
||||
|
||||
After you enable {% data variables.product.prodname_dependabot_alerts %}, you can choose to enable {% data variables.product.prodname_dependabot_updates %}. When {% data variables.product.prodname_dependabot_updates %} are enabled for {% data variables.product.product_location %}, users can configure repositories so that their dependencies are updated and kept secure automatically.
|
||||
After you enable {% data variables.product.prodname_dependabot_alerts %}, you can choose to enable {% data variables.product.prodname_dependabot_updates %}. When {% data variables.product.prodname_dependabot_updates %} are enabled for {% data variables.product.product_location %}, users can configure repositories so that their dependencies are updated and kept secure automatically.
|
||||
|
||||
{% note %}
|
||||
{% note %}
|
||||
|
||||
**Note:** {% data variables.product.prodname_dependabot_updates %} on {% data variables.product.product_name %} requires {% data variables.product.prodname_actions %} with self-hosted runners.
|
||||
|
||||
@@ -66,15 +66,15 @@ After you enable {% data variables.product.prodname_dependabot_alerts %}, you ca
|
||||
|
||||
With {% data variables.product.prodname_dependabot_updates %}, {% data variables.product.company_short %} automatically creates pull requests to update dependencies in two ways.
|
||||
|
||||
- **{% data variables.product.prodname_dependabot_version_updates %}**: Users add a {% data variables.product.prodname_dependabot %} configuration file to the repository to enable {% data variables.product.prodname_dependabot %} to create pull requests when a new version of a tracked dependency is released. 更多信息请参阅“[关于 {% data variables.product.prodname_dependabot_version_updates %}](/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates)“。
|
||||
- **{% data variables.product.prodname_dependabot_version_updates %}**: Users add a {% data variables.product.prodname_dependabot %} configuration file to the repository to enable {% data variables.product.prodname_dependabot %} to create pull requests when a new version of a tracked dependency is released. For more information, see "[About {% data variables.product.prodname_dependabot_version_updates %}](/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates)."
|
||||
- **{% data variables.product.prodname_dependabot_security_updates %}**: Users toggle a repository setting to enable {% data variables.product.prodname_dependabot %} to create pull requests when {% data variables.product.prodname_dotcom %} detects a vulnerability in one of the dependencies of the dependency graph for the repository. For more information, see "[About {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-alerts-for-vulnerable-dependencies)" and "[About {% data variables.product.prodname_dependabot_security_updates %}](/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-dependabot-security-updates)."
|
||||
{% endif %}
|
||||
|
||||
## 启用 {% data variables.product.prodname_dependabot_alerts %}
|
||||
## Enabling {% data variables.product.prodname_dependabot_alerts %}
|
||||
|
||||
Before you can enable {% data variables.product.prodname_dependabot_alerts %}:
|
||||
- You must enable {% data variables.product.prodname_github_connect %}. For more information, see "[Managing {% data variables.product.prodname_github_connect %}](/admin/configuration/configuring-github-connect/managing-github-connect)."{% ifversion ghes %}
|
||||
- 您必须启用依赖关系图。 For more information, see "[Enabling the dependency graph for your enterprise](/admin/code-security/managing-supply-chain-security-for-your-enterprise/enabling-the-dependency-graph-for-your-enterprise)."{% endif %}
|
||||
- You must enable the dependency graph. For more information, see "[Enabling the dependency graph for your enterprise](/admin/code-security/managing-supply-chain-security-for-your-enterprise/enabling-the-dependency-graph-for-your-enterprise)."{% endif %}
|
||||
|
||||
{% data reusables.enterprise-accounts.access-enterprise %}
|
||||
{% data reusables.enterprise-accounts.github-connect-tab %}
|
||||
@@ -84,21 +84,22 @@ Before you can enable {% data variables.product.prodname_dependabot_alerts %}:
|
||||

|
||||
|
||||
{%- else %}
|
||||
1. Under "Repositories can be scanned for vulnerabilities", select the drop-down menu and click **Enabled without notifications**. Optionally, to enable alerts with notifications, click **Enabled with notifications**. 
|
||||
1. Under "Repositories can be scanned for vulnerabilities", select the drop-down menu and click **Enabled without notifications**. Optionally, to enable alerts with notifications, click **Enabled with notifications**.
|
||||

|
||||
{%- endif %}
|
||||
{% tip %}
|
||||
|
||||
**Tip**: We recommend configuring {% data variables.product.prodname_dependabot_alerts %} without notifications for the first few days to avoid an overload of emails. 几天后,您可以开启通知,像往常一样接收 {% data variables.product.prodname_dependabot_alerts %}。
|
||||
**Tip**: We recommend configuring {% data variables.product.prodname_dependabot_alerts %} without notifications for the first few days to avoid an overload of emails. After a few days, you can enable notifications to receive {% data variables.product.prodname_dependabot_alerts %} as usual.
|
||||
|
||||
{% endtip %}
|
||||
|
||||
{% if dependabot-updates-github-connect %}
|
||||
## 启用 {% data variables.product.prodname_dependabot_updates %}
|
||||
## Enabling {% data variables.product.prodname_dependabot_updates %}
|
||||
|
||||
After you enable {% data variables.product.prodname_dependabot_alerts %} for your enterprise, you can enable {% data variables.product.prodname_dependabot_updates %}.
|
||||
|
||||
{% ifversion ghes %}
|
||||
Before you enable {% data variables.product.prodname_dependabot_updates %}, you must configure {% data variables.product.product_location %} to use {% data variables.product.prodname_actions %} with self-hosted runners. 更多信息请参阅“[开始使用 GitHub Enterprise Server 的 {% data variables.product.prodname_actions %}](/admin/github-actions/enabling-github-actions-for-github-enterprise-server/getting-started-with-github-actions-for-github-enterprise-server)”。
|
||||
Before you enable {% data variables.product.prodname_dependabot_updates %}, you must configure {% data variables.product.product_location %} to use {% data variables.product.prodname_actions %} with self-hosted runners. For more information, see "[Getting started with {% data variables.product.prodname_actions %} for GitHub Enterprise Server](/admin/github-actions/enabling-github-actions-for-github-enterprise-server/getting-started-with-github-actions-for-github-enterprise-server)."
|
||||
|
||||
{% data variables.product.prodname_dependabot_updates %} are not supported on {% data variables.product.product_name %} if your enterprise uses clustering.
|
||||
{% endif %}
|
||||
@@ -112,7 +113,7 @@ Before you enable {% data variables.product.prodname_dependabot_updates %}, you
|
||||

|
||||
|
||||
{% data reusables.enterprise_management_console.save-settings %}
|
||||
1. 单击 **Visit your instance(访问您的实例)**。
|
||||
1. Click **Visit your instance**.
|
||||
1. Configure self-hosted runners to create the pull requests that will update dependencies. For more information, see "[Managing self-hosted runners for {% data variables.product.prodname_dependabot_updates %} on your enterprise](/admin/github-actions/enabling-github-actions-for-github-enterprise-server/managing-self-hosted-runners-for-dependabot-updates)."
|
||||
{% data reusables.enterprise-accounts.access-enterprise %}
|
||||
{% data reusables.enterprise-accounts.github-connect-tab %}
|
||||
|
||||
@@ -27,13 +27,13 @@ topics:
|
||||
|
||||
As an enterprise owner, you can allow end users to send anonymized contribution counts for their work from {% data variables.product.product_location %} to their {% data variables.product.prodname_dotcom_the_website %} contribution graph.
|
||||
|
||||
After you enable {% data variables.product.prodname_unified_contributions %}, before individual users can send contribution counts from {% data variables.product.product_location %} to {% data variables.product.prodname_dotcom_the_website %}, each user must also connect their personal account on {% data variables.product.product_name %} with a personal account on {% data variables.product.prodname_dotcom_the_website %}. 更多信息请参阅“[将企业贡献发送到 {% data variables.product.prodname_dotcom_the_website %} 个人资料](/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/sending-enterprise-contributions-to-your-githubcom-profile)”。
|
||||
After you enable {% data variables.product.prodname_unified_contributions %}, before individual users can send contribution counts from {% data variables.product.product_location %} to {% data variables.product.prodname_dotcom_the_website %}, each user must also connect their personal account on {% data variables.product.product_name %} with a personal account on {% data variables.product.prodname_dotcom_the_website %}. For more information, see "[Sending enterprise contributions to your {% data variables.product.prodname_dotcom_the_website %} profile](/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/sending-enterprise-contributions-to-your-githubcom-profile)."
|
||||
|
||||
{% data reusables.github-connect.sync-frequency %}
|
||||
|
||||
If the enterprise owner disables the functionality or individual users opt out of the connection, the contribution counts from {% data variables.product.product_name %} will be deleted on {% data variables.product.prodname_dotcom_the_website %}. If the user reconnects their profiles after disabling them, the contribution counts for the past 90 days are restored.
|
||||
|
||||
{% data variables.product.product_name %} **仅**为已连接的用户发送贡献计数和来源 ({% data variables.product.product_name %})。 它不会发送有关贡献或做出该贡献的方式的任何信息。
|
||||
{% data variables.product.product_name %} **only** sends the contribution count and source ({% data variables.product.product_name %}) for connected users. It does not send any information about the contribution or how it was made.
|
||||
|
||||
## Enabling unified contributions
|
||||
|
||||
@@ -44,10 +44,11 @@ Before enabling {% data variables.product.prodname_unified_contributions %} on {
|
||||
{% data reusables.enterprise_site_admin_settings.access-settings %}
|
||||
{% data reusables.enterprise_site_admin_settings.business %}
|
||||
{% data reusables.enterprise-accounts.github-connect-tab %}{% else %}
|
||||
1. 登录到 {% data variables.product.product_location %} 和 {% data variables.product.prodname_dotcom_the_website %}。
|
||||
1. Sign in to {% data variables.product.product_location %} and {% data variables.product.prodname_dotcom_the_website %}.
|
||||
{% data reusables.enterprise-accounts.access-enterprise %}{% data reusables.enterprise-accounts.github-connect-tab %}{% endif %}
|
||||
1. 在“Users can share contribution counts to {% data variables.product.prodname_dotcom_the_website %}”下,单击 **Request access**。 {% ifversion ghes %}
|
||||
2. [登录](https://enterprise.github.com/login) {% data variables.product.prodname_ghe_server %} 站点以接收其他说明。
|
||||
1. Under "Users can share contribution counts to {% data variables.product.prodname_dotcom_the_website %}", click **Request access**.
|
||||
{% ifversion ghes %}
|
||||
2. [Sign in](https://enterprise.github.com/login) to the {% data variables.product.prodname_ghe_server %} site to receive further instructions.
|
||||
|
||||
When you request access, we may redirect you to the {% data variables.product.prodname_ghe_server %} site to check your current terms of service.
|
||||
{% endif %}
|
||||
|
||||
@@ -22,21 +22,21 @@ topics:
|
||||
- GitHub search
|
||||
---
|
||||
|
||||
## 关于 {% data variables.product.prodname_unified_search %}
|
||||
## About {% data variables.product.prodname_unified_search %}
|
||||
|
||||
{% data reusables.github-connect.beta %}
|
||||
|
||||
When you enable unified search, users can view search results from content on {% data variables.product.prodname_dotcom_the_website %} when searching from {% data variables.product.product_location %}{% ifversion ghae %} on {% data variables.product.prodname_ghe_managed %}{% endif %}.
|
||||
When you enable unified search, users can view search results from content on {% data variables.product.prodname_dotcom_the_website %} when searching from {% data variables.product.product_location %}{% ifversion ghae %} on {% data variables.product.prodname_ghe_managed %}{% endif %}.
|
||||
|
||||
You can choose to allow search results for public repositories on {% data variables.product.prodname_dotcom_the_website %}, and you can separately choose to allow search results for private repositories on {% data variables.product.prodname_ghe_cloud %}. If you enable unified search for private repositories, users can only search private repositories that they have access to and that are owned by the connected organization or enterprise account. 更多信息请参阅“[关于在 {% data variables.product.prodname_dotcom %} 上搜索](/search-github/getting-started-with-searching-on-github/about-searching-on-github/#searching-across-github-enterprise-and-githubcom-simultaneously)”。
|
||||
You can choose to allow search results for public repositories on {% data variables.product.prodname_dotcom_the_website %}, and you can separately choose to allow search results for private repositories on {% data variables.product.prodname_ghe_cloud %}. If you enable unified search for private repositories, users can only search private repositories that they have access to and that are owned by the connected organization or enterprise account. For more information, see "[About searching on {% data variables.product.prodname_dotcom %}](/search-github/getting-started-with-searching-on-github/about-searching-on-github/#searching-across-github-enterprise-and-githubcom-simultaneously)."
|
||||
|
||||
Users will never be able to search {% data variables.product.product_location %} from {% data variables.product.prodname_dotcom_the_website %}, even if they have access to both environments.
|
||||
|
||||
After you enable unified search for {% data variables.product.product_location %}, before individual users can see search results from {% data variables.product.prodname_dotcom_the_website %} on {% data variables.product.product_location %}, each user must also connect their personal account on {% data variables.product.product_name %} with a personal account on {% data variables.product.prodname_dotcom_the_website %}. For more information, see "[Enabling {% data variables.product.prodname_dotcom_the_website %} repository search in your private enterprise account](/search-github/getting-started-with-searching-on-github/enabling-githubcom-repository-search-from-your-private-enterprise-environment)."
|
||||
|
||||
通过 REST 和 GraphQL API 进行搜索不包含 {% data variables.product.prodname_dotcom_the_website %} 搜索结果。 不支持在 {% data variables.product.prodname_dotcom_the_website %} 中进行高级搜索和搜索 Wiki。
|
||||
Searching via the REST and GraphQL APIs does not include {% data variables.product.prodname_dotcom_the_website %} search results. Advanced search and searching for wikis in {% data variables.product.prodname_dotcom_the_website %} are not supported.
|
||||
|
||||
## 启用 {% data variables.product.prodname_unified_search %}
|
||||
## Enabling {% data variables.product.prodname_unified_search %}
|
||||
|
||||
Before you can enable {% data variables.product.prodname_unified_search %}, you must enable {% data variables.product.prodname_github_connect %}. For more information, see "[Managing {% data variables.product.prodname_github_connect %}](/admin/configuration/configuring-github-connect/managing-github-connect)."
|
||||
|
||||
@@ -47,5 +47,7 @@ Before you can enable {% data variables.product.prodname_unified_search %}, you
|
||||
{% data reusables.enterprise-accounts.github-connect-tab %}{% else %}
|
||||
1. Sign into {% data variables.product.product_location %} and {% data variables.product.prodname_dotcom_the_website %}.
|
||||
{% data reusables.enterprise-accounts.access-enterprise %}{% data reusables.enterprise-accounts.github-connect-tab %}{% endif %}
|
||||
1. 在“Users can search {% data variables.product.prodname_dotcom_the_website %}”下,使用下拉菜单,然后单击 **Enabled**。 
|
||||
1. (可选)在“用户可以在 {% data variables.product.prodname_dotcom_the_website %} 上搜索私有仓库”下,使用下拉菜单并单击 **Enabled(启用)**。 
|
||||
1. Under "Users can search {% data variables.product.prodname_dotcom_the_website %}", use the drop-down menu and click **Enabled**.
|
||||

|
||||
1. Optionally, under "Users can search private repositories on {% data variables.product.prodname_dotcom_the_website %}", use the drop-down menu and click **Enabled**.
|
||||

|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Configuring GitHub Connect
|
||||
intro: 'With {% data variables.product.prodname_github_connect %}, you can access additional features and workflows by connecting {% data variables.product.product_location %} to {% data variables.product.prodname_ghe_cloud %}.'
|
||||
title: 配置 GitHub Connect
|
||||
intro: '使用 {% data variables.product.prodname_github_connect %},您可以通过将 {% data variables.product.product_location %} 连接到 {% data variables.product.prodname_ghe_cloud %} 来访问其他功能和工作流程。'
|
||||
redirect_from:
|
||||
- /enterprise/admin/developer-workflow/connecting-github-enterprise-to-github-com
|
||||
- /enterprise/admin/guides/developer-workflow/connecting-github-enterprise-and-github-com
|
||||
|
||||
@@ -24,19 +24,19 @@ topics:
|
||||
|
||||
{% data reusables.github-connect.beta %}
|
||||
|
||||
## 关于 {% data variables.product.prodname_github_connect %}
|
||||
## About {% data variables.product.prodname_github_connect %}
|
||||
|
||||
You can access additional features and workflows on {% data variables.product.product_location %} by enabling {% data variables.product.prodname_github_connect %}. 更多信息请参阅“[关于 {% data variables.product.prodname_github_connect %}](/admin/configuration/configuring-github-connect/about-github-connect)”。
|
||||
You can access additional features and workflows on {% data variables.product.product_location %} by enabling {% data variables.product.prodname_github_connect %}. For more information, see "[About {% data variables.product.prodname_github_connect %}](/admin/configuration/configuring-github-connect/about-github-connect)."
|
||||
|
||||
When you enable {% data variables.product.prodname_github_connect %}, you configure a connection between {% data variables.product.product_location %} and an organization or enterprise account on {% data variables.product.prodname_ghe_cloud %}. Enabling {% data variables.product.prodname_github_connect %} creates a {% data variables.product.prodname_github_app %} owned by the organization or enterprise account on {% data variables.product.prodname_ghe_cloud %}. {% data variables.product.product_name %} 使用 {% data variables.product.prodname_github_app %} 的凭据向 {% data variables.product.prodname_ghe_cloud %} 发送请求。
|
||||
When you enable {% data variables.product.prodname_github_connect %}, you configure a connection between {% data variables.product.product_location %} and an organization or enterprise account on {% data variables.product.prodname_ghe_cloud %}. Enabling {% data variables.product.prodname_github_connect %} creates a {% data variables.product.prodname_github_app %} owned by the organization or enterprise account on {% data variables.product.prodname_ghe_cloud %}. {% data variables.product.product_name %} uses the {% data variables.product.prodname_github_app %}'s credentials to make requests to {% data variables.product.prodname_ghe_cloud %}.
|
||||
|
||||
{% ifversion ghes %}
|
||||
{% data variables.product.prodname_ghe_server %} 会存储来自 {% data variables.product.prodname_github_app %} 的凭据。 The following credentials will be replicated to all nodes in a high availability or cluster environment, and stored in any backups, including snapshots created by {% data variables.product.prodname_enterprise_backup_utilities %}.
|
||||
- 有效期为一小时的身份验证令牌
|
||||
- 用于生成新的身份验证令牌的私钥
|
||||
{% data variables.product.prodname_ghe_server %} stores credentials from the {% data variables.product.prodname_github_app %}. The following credentials will be replicated to all nodes in a high availability or cluster environment, and stored in any backups, including snapshots created by {% data variables.product.prodname_enterprise_backup_utilities %}.
|
||||
- An authentication token, which is valid for one hour
|
||||
- A private key, which is used to generate a new authentication token
|
||||
{% endif %}
|
||||
|
||||
## 基本要求
|
||||
## Prerequisites
|
||||
|
||||
To use {% data variables.product.prodname_github_connect %}, you must have an organization or enterprise account on {% data variables.product.prodname_dotcom_the_website %} that uses {% data variables.product.prodname_ghe_cloud %}. You may already have {% data variables.product.prodname_ghe_cloud %} included in your plan. {% data reusables.enterprise.link-to-ghec-trial %}
|
||||
|
||||
@@ -46,7 +46,7 @@ If your organization or enterprise account on {% data variables.product.prodname
|
||||
To configure a connection, your proxy configuration must allow connectivity to `github.com`, `api.github.com`, and `uploads.github.com`. For more information, see "[Configuring an outbound web proxy server](/enterprise/{{ currentVersion }}/admin/guides/installation/configuring-an-outbound-web-proxy-server)."
|
||||
{% endif %}
|
||||
|
||||
## 启用 {% data variables.product.prodname_github_connect %}
|
||||
## Enabling {% data variables.product.prodname_github_connect %}
|
||||
|
||||
Enterprise owners who are also owners of an organization or enterprise account that uses {% data variables.product.prodname_ghe_cloud %} can enable {% data variables.product.prodname_github_connect %}.
|
||||
|
||||
@@ -55,19 +55,20 @@ If you're connecting {% data variables.product.product_location %} to an organiz
|
||||
If you're connecting {% data variables.product.product_location %} to an organization on {% data variables.product.prodname_ghe_cloud %} that is owned by an enterprise account or to an enterprise account itself, you must sign into {% data variables.product.prodname_dotcom_the_website %} as an enterprise owner.
|
||||
|
||||
{% ifversion ghes %}
|
||||
1. 登录到 {% data variables.product.product_location %} 和 {% data variables.product.prodname_dotcom_the_website %}。
|
||||
1. Sign in to {% data variables.product.product_location %} and {% data variables.product.prodname_dotcom_the_website %}.
|
||||
{% data reusables.enterprise-accounts.access-enterprise %}
|
||||
{% data reusables.enterprise-accounts.github-connect-tab %}{% else %}
|
||||
1. 登录到 {% data variables.product.product_location %} 和 {% data variables.product.prodname_dotcom_the_website %}。
|
||||
1. Sign in to {% data variables.product.product_location %} and {% data variables.product.prodname_dotcom_the_website %}.
|
||||
{% data reusables.enterprise-accounts.access-enterprise %}{% data reusables.enterprise-accounts.github-connect-tab %}{% endif %}
|
||||
1. 在“{% data variables.product.prodname_github_connect %} is not enabled yet”下,单击 **Enable {% data variables.product.prodname_github_connect %}**。 By clicking **Enable {% data variables.product.prodname_github_connect %}**, you agree to the "<a href="/github/site-policy/github-terms-for-additional-products-and-features#connect" class="dotcom-only">{% data variables.product.prodname_dotcom %} Terms for Additional Products and Features</a>."
|
||||
1. Under "{% data variables.product.prodname_github_connect %} is not enabled yet", click **Enable {% data variables.product.prodname_github_connect %}**. By clicking **Enable {% data variables.product.prodname_github_connect %}**, you agree to the "<a href="/github/site-policy/github-terms-for-additional-products-and-features#connect" class="dotcom-only">{% data variables.product.prodname_dotcom %} Terms for Additional Products and Features</a>."
|
||||
{% ifversion ghes %}
|
||||
{% else %}
|
||||

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

|
||||
{% endif %}
|
||||
1. 在要连接的企业帐户或组织旁,单击 **Connect**。 
|
||||
1. Next to the enterprise account or organization you'd like to connect, click **Connect**.
|
||||

|
||||
|
||||
## 禁用 {% data variables.product.prodname_github_connect %}
|
||||
## Disabling {% data variables.product.prodname_github_connect %}
|
||||
|
||||
Enterprise owners can disable {% data variables.product.prodname_github_connect %}.
|
||||
|
||||
@@ -75,11 +76,13 @@ When you disconnect from {% data variables.product.prodname_ghe_cloud %}, the {%
|
||||
|
||||
{% data reusables.enterprise-accounts.access-enterprise %}
|
||||
{% data reusables.enterprise-accounts.github-connect-tab %}
|
||||
1. 在要断开连接的企业帐户或组织旁,单击 **Disable {% data variables.product.prodname_github_connect %}**。
|
||||
1. Next to the enterprise account or organization you'd like to disconnect, click **Disable {% data variables.product.prodname_github_connect %}**.
|
||||
{% ifversion ghes %}
|
||||

|
||||
1. 阅读有关断开连接的信息,并单击 **Disable {% data variables.product.prodname_github_connect %}**。 
|
||||

|
||||
1. Read the information about disconnecting and click **Disable {% data variables.product.prodname_github_connect %}**.
|
||||

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

|
||||
1. 阅读有关断开连接的信息,并单击 **Disable {% data variables.product.prodname_github_connect %}**。 
|
||||

|
||||
1. Read the information about disconnecting and click **Disable {% data variables.product.prodname_github_connect %}**.
|
||||

|
||||
{% endif %}
|
||||
|
||||
@@ -23,14 +23,14 @@ You can help users of {% data variables.product.product_location %} to create an
|
||||
|
||||
To use {% data variables.product.prodname_dependabot_updates %} on {% data variables.product.product_location %}, you must configure self-hosted runners to create the pull requests that will update dependencies.
|
||||
|
||||
## 基本要求
|
||||
## Prerequisites
|
||||
|
||||
{% if dependabot-updates-github-connect %}
|
||||
Configuring self-hosted runners is only one step in the middle of the process for enabling {% data variables.product.prodname_dependabot_updates %}. There are several steps you must follow before these steps, including configuring {% data variables.product.product_location %} to use {% data variables.product.prodname_actions %} with self-hosted runners. For more information, see "[Enabling {% data variables.product.prodname_dependabot %} for your enterprise](/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise)."
|
||||
{% else %}
|
||||
Before you configure self-hosted runners for {% data variables.product.prodname_dependabot_updates %}, you must:
|
||||
|
||||
- Configure {% data variables.product.product_location %} to use {% data variables.product.prodname_actions %} with self-hosted runners. 更多信息请参阅“[开始使用 GitHub Enterprise Server 的 {% data variables.product.prodname_actions %}](/admin/github-actions/enabling-github-actions-for-github-enterprise-server/getting-started-with-github-actions-for-github-enterprise-server)”。
|
||||
- Configure {% data variables.product.product_location %} to use {% data variables.product.prodname_actions %} with self-hosted runners. For more information, see "[Getting started with {% data variables.product.prodname_actions %} for GitHub Enterprise Server](/admin/github-actions/enabling-github-actions-for-github-enterprise-server/getting-started-with-github-actions-for-github-enterprise-server)."
|
||||
- Enable {% data variables.product.prodname_dependabot_alerts %} for your enterprise. For more information, see "[Enabling {% data variables.product.prodname_dependabot %} for your enterprise](/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise)."
|
||||
{% endif %}
|
||||
|
||||
@@ -66,7 +66,7 @@ If you specify more than 14 concurrent runners on a VM, you must also update the
|
||||
|
||||
### Adding self-hosted runners for {% data variables.product.prodname_dependabot %} updates
|
||||
|
||||
1. Provision self-hosted runners, at the repository, organization, or enterprise account level. 更多信息请参阅“[关于自托管的运行器](/actions/hosting-your-own-runners/about-self-hosted-runners)”和“[添加自托管的运行器](/actions/hosting-your-own-runners/adding-self-hosted-runners)”。
|
||||
1. Provision self-hosted runners, at the repository, organization, or enterprise account level. For more information, see "[About self-hosted runners](/actions/hosting-your-own-runners/about-self-hosted-runners)" and "[Adding self-hosted runners](/actions/hosting-your-own-runners/adding-self-hosted-runners)."
|
||||
|
||||
2. Set up the self-hosted runners with the requirements described above. For example, on a VM running Ubuntu 20.04 you would:
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
---
|
||||
title: Getting started with self-hosted runners for your enterprise
|
||||
shortTitle: 自托管运行器
|
||||
intro: 'You can configure a runner machine for your enterprise so your developers can start automating workflows with {% data variables.product.prodname_actions %}.'
|
||||
shortTitle: Self-hosted runners
|
||||
intro: You can configure a runner machine for your enterprise so your developers can start automating workflows with {% data variables.product.prodname_actions %}.
|
||||
versions:
|
||||
ghec: '*'
|
||||
ghes: '*'
|
||||
ghae: '*'
|
||||
permissions: 'Enterprise owners can configure policies for {% data variables.product.prodname_actions %} and add self-hosted runners to the enterprise.'
|
||||
permissions: Enterprise owners can configure policies for {% data variables.product.prodname_actions %} and add self-hosted runners to the enterprise.
|
||||
type: quick_start
|
||||
topics:
|
||||
- Actions
|
||||
@@ -18,11 +18,11 @@ topics:
|
||||
|
||||
{% data reusables.actions.about-actions-for-enterprises %} 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)."
|
||||
|
||||
With {% data variables.product.prodname_actions %}, developers can write and combine individual tasks called actions to create custom workflows. {% ifversion ghes or ghae %}To enable {% data variables.product.prodname_actions %} for {% ifversion ghae %}your enterprise{% elsif ghes %} {% data variables.product.product_location %}{% endif %}, you must host at least one machine to execute jobs.{% endif %} {% ifversion ghec %}You can host your own runner machine to execute jobs, and this{% elsif ghes or ghae %}This{% endif %} machine is called a self-hosted runner. {% data reusables.actions.self-hosted-runner-locations %} {% data reusables.actions.self-hosted-runner-architecture %} {% ifversion ghec %}All{% elsif ghes or ghae %}Self-hosted{% endif %} runners can run Linux, Windows, or macOS. 更多信息请参阅“[关于自托管运行器](/actions/hosting-your-own-runners/about-self-hosted-runners)”。
|
||||
With {% data variables.product.prodname_actions %}, developers can write and combine individual tasks called actions to create custom workflows. {% ifversion ghes or ghae %}To enable {% data variables.product.prodname_actions %} for {% ifversion ghae %}your enterprise{% elsif ghes %} {% data variables.product.product_location %}{% endif %}, you must host at least one machine to execute jobs.{% endif %} {% ifversion ghec %}You can host your own runner machine to execute jobs, and this{% elsif ghes or ghae %}This{% endif %} machine is called a self-hosted runner. {% data reusables.actions.self-hosted-runner-locations %} {% data reusables.actions.self-hosted-runner-architecture %} {% ifversion ghec %}All{% elsif ghes or ghae %}Self-hosted{% endif %} runners can run Linux, Windows, or macOS. For more information, see "[About self-hosted runners](/actions/hosting-your-own-runners/about-self-hosted-runners)."
|
||||
|
||||
{% ifversion ghec %}
|
||||
|
||||
Alternatively, you can use runner machines that {% data variables.product.company_short %} hosts. {% data variables.product.company_short %}-hosted runners are outside the scope of this guide. 更多信息请参阅“[关于 {% data variables.product.company_short %} 托管的运行器](/actions/using-github-hosted-runners/about-github-hosted-runners)”。
|
||||
Alternatively, you can use runner machines that {% data variables.product.company_short %} hosts. {% data variables.product.company_short %}-hosted runners are outside the scope of this guide. For more information, see "[About {% data variables.product.company_short %}-hosted runners](/actions/using-github-hosted-runners/about-github-hosted-runners)."
|
||||
|
||||
{% endif %}
|
||||
|
||||
@@ -40,7 +40,7 @@ You'll also find additional information about how to monitor and secure your sel
|
||||
|
||||
After you finish the guide, {% ifversion ghec or ghae %}members of your enterprise{% elsif ghes %}users of {% data variables.product.product_location %}{% endif %} will be able to run workflow jobs from {% data variables.product.prodname_actions %} on a self-hosted runner machine.
|
||||
|
||||
## 基本要求
|
||||
## Prerequisites
|
||||
|
||||
{% data reusables.actions.self-hosted-runners-prerequisites %}
|
||||
|
||||
@@ -54,7 +54,7 @@ First, enable {% data variables.product.prodname_actions %} for all organization
|
||||
{% data reusables.enterprise-accounts.policies-tab %}
|
||||
{% data reusables.enterprise-accounts.actions-tab %}
|
||||
1. Under "Policies", select **Enable for all organizations**.
|
||||
|
||||
|
||||

|
||||
1. Select {% data reusables.actions.policy-label-for-select-actions-workflows %} and **Allow actions created by GitHub** to allow local actions{% if actions-workflow-policy %} and reusable workflows{% endif %}, and actions created by {% data variables.product.company_short %}.
|
||||
|
||||
@@ -63,9 +63,9 @@ First, enable {% data variables.product.prodname_actions %} for all organization
|
||||
{%- else %}
|
||||

|
||||
{%- endif %}
|
||||
1. 单击 **Save(保存)**。
|
||||
1. Click **Save**.
|
||||
|
||||
You can configure additional policies to restrict the actions available to {% ifversion ghec or ghae %}enterprise members{% elsif ghes %}users of {% data variables.product.product_location %}{% endif %}. 更多信息请参阅“[在企业中执行 {% data variables.product.prodname_actions %} 的策略](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#allowing-select-actions-to-run)”。
|
||||
You can configure additional policies to restrict the actions available to {% ifversion ghec or ghae %}enterprise members{% elsif ghes %}users of {% data variables.product.product_location %}{% endif %}. 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#allowing-select-actions-to-run)."
|
||||
|
||||
## 2. Deploy the self-hosted runner for your enterprise
|
||||
|
||||
@@ -92,11 +92,11 @@ You can create a runner group to manage access to the runner that you added to y
|
||||
|
||||
{% warning %}
|
||||
|
||||
**警告**:
|
||||
**Warning**:
|
||||
|
||||
{% indented_data_reference reusables.actions.self-hosted-runner-security spaces=3 %}
|
||||
|
||||
更多信息请参阅“[关于自托管运行器](/actions/hosting-your-own-runners/about-self-hosted-runners#self-hosted-runner-security-with-public-repositories)”。
|
||||
For more information, see "[About self-hosted runners](/actions/hosting-your-own-runners/about-self-hosted-runners#self-hosted-runner-security-with-public-repositories)."
|
||||
|
||||
{% endwarning %}
|
||||
{%- endif %}
|
||||
@@ -104,7 +104,7 @@ You can create a runner group to manage access to the runner that you added to y
|
||||
{%- ifversion ghec or ghes > 3.3 or ghae-issue-5091 %}
|
||||
1. Click the "Runners" tab.
|
||||
1. In the list of runners, click the runner that you deployed in the previous section.
|
||||
1. 单击 **Edit(编辑)**。
|
||||
1. Click **Edit**.
|
||||
1. Click **Runner groups {% octicon "gear" aria-label="The Gear icon" %}**.
|
||||
1. In the list of runner groups, click the name of the group that you previously created.
|
||||
1. Click **Save** to move the runner to the group.
|
||||
@@ -120,23 +120,23 @@ You've now deployed a self-hosted runner that can run jobs from {% data variable
|
||||
|
||||
Optionally, organization owners can further restrict the access policy of the runner group that you created. For example, an organization owner could allow only certain repositories in the organization to use the runner group.
|
||||
|
||||
更多信息请参阅“[使用组管理对自托管运行器的访问](/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups#changing-the-access-policy-of-a-self-hosted-runner-group)”。
|
||||
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#changing-the-access-policy-of-a-self-hosted-runner-group)."
|
||||
|
||||
{% ifversion ghec or ghae-issue-4462 or ghes > 3.2 %}
|
||||
|
||||
## 5. Automatically scale your self-hosted runners
|
||||
|
||||
Optionally, you can build custom tooling to automatically scale the self-hosted runners for {% ifversion ghec or ghae %}your enterprise{% elsif ghes %}{% data variables.product.product_location %}{% endif %}. For example, your tooling can respond to webhook events from {% data variables.product.product_location %} to automatically scale a cluster of runner machines. 更多信息请参阅“[使用自托管运行器自动缩放](/actions/hosting-your-own-runners/autoscaling-with-self-hosted-runners)”。
|
||||
Optionally, you can build custom tooling to automatically scale the self-hosted runners for {% ifversion ghec or ghae %}your enterprise{% elsif ghes %}{% data variables.product.product_location %}{% endif %}. For example, your tooling can respond to webhook events from {% data variables.product.product_location %} to automatically scale a cluster of runner machines. For more information, see "[Autoscaling with self-hosted runners](/actions/hosting-your-own-runners/autoscaling-with-self-hosted-runners)."
|
||||
|
||||
{% endif %}
|
||||
|
||||
## 后续步骤
|
||||
## Next steps
|
||||
|
||||
- You can monitor self-hosted runners and troubleshoot common issues. 更多信息请参阅“[自托管运行器监控和故障排除](/actions/hosting-your-own-runners/monitoring-and-troubleshooting-self-hosted-runners)”。
|
||||
- You can monitor self-hosted runners and troubleshoot common issues. For more information, see "[Monitoring and troubleshooting self-hosted runners](/actions/hosting-your-own-runners/monitoring-and-troubleshooting-self-hosted-runners)."
|
||||
|
||||
- {% data variables.product.company_short %} recommends that you review security considerations for self-hosted runner machines. 更多信息请参阅“[{% data variables.product.prodname_actions %} 的安全强化](/actions/security-guides/security-hardening-for-github-actions#hardening-for-self-hosted-runners)”。
|
||||
- {% data variables.product.company_short %} recommends that you review security considerations for self-hosted runner machines. 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)."
|
||||
|
||||
- {% ifversion ghec %}If you use {% data variables.product.prodname_ghe_server %} or {% data variables.product.prodname_ghe_managed %}, you{% elsif ghes or ghae %}You{% endif %} can manually sync repositories on {% data variables.product.prodname_dotcom_the_website %} containing actions to your enterprise on {% ifversion ghes or ghae %}{% data variables.product.product_name %}{% elsif ghec %}{% data variables.product.prodname_ghe_server %} or {% data variables.product.prodname_ghe_managed %}{% endif %}. Alternatively, you can allow members of your enterprise to automatically access actions from {% data variables.product.prodname_dotcom_the_website %} by using {% data variables.product.prodname_github_connect %}. 更多信息请参阅以下文章。
|
||||
- {% ifversion ghec %}If you use {% data variables.product.prodname_ghe_server %} or {% data variables.product.prodname_ghe_managed %}, you{% elsif ghes or ghae %}You{% endif %} can manually sync repositories on {% data variables.product.prodname_dotcom_the_website %} containing actions to your enterprise on {% ifversion ghes or ghae %}{% data variables.product.product_name %}{% elsif ghec %}{% data variables.product.prodname_ghe_server %} or {% data variables.product.prodname_ghe_managed %}{% endif %}. Alternatively, you can allow members of your enterprise to automatically access actions from {% data variables.product.prodname_dotcom_the_website %} by using {% data variables.product.prodname_github_connect %}. For more information, see the following.
|
||||
|
||||
{%- ifversion ghes or ghae %}
|
||||
- "[Manually syncing actions from {% data variables.product.prodname_dotcom_the_website %}](/admin/github-actions/managing-access-to-actions-from-githubcom/manually-syncing-actions-from-githubcom)"
|
||||
@@ -148,7 +148,7 @@ Optionally, you can build custom tooling to automatically scale the self-hosted
|
||||
|
||||
- You can customize the software available on your self-hosted runner machines, or configure your runners to run software similar to {% data variables.product.company_short %}-hosted runners{% ifversion ghes or ghae %} available for customers using {% data variables.product.prodname_dotcom_the_website %}{% endif %}. The software that powers runner machines for {% data variables.product.prodname_actions %} is open source. For more information, see the [`actions/runner`](https://github.com/actions/runner) and [`actions/virtual-environments`](https://github.com/actions/virtual-environments) repositories.
|
||||
|
||||
## 延伸阅读
|
||||
## Further reading
|
||||
|
||||
- "[Configuring the self-hosted runner application as a service](/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service)"
|
||||
- "[Using self-hosted runners in a workflow](/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow)"
|
||||
|
||||
@@ -47,7 +47,6 @@ You can populate the runner tool cache by running a {% data variables.product.pr
|
||||
|
||||
The following example demonstrates a workflow that uploads the tool cache for an Ubuntu 18.04 environment, using the `setup-node` action with Node.js versions 10 and 12.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: Upload Node.js 10 and 12 tool cache
|
||||
on: push
|
||||
@@ -57,26 +56,25 @@ You can populate the runner tool cache by running a {% data variables.product.pr
|
||||
steps:
|
||||
- name: Clear any existing tool cache
|
||||
run: |
|
||||
mv "${{ runner.tool_cache }}" "${{ runner.tool_cache }}.old"
|
||||
mkdir -p "${{ runner.tool_cache }}"
|
||||
mv "{% raw %}${{ runner.tool_cache }}" "${{ runner.tool_cache }}.old"{% endraw %}
|
||||
mkdir -p "{% raw %}${{ runner.tool_cache }}{% endraw %}"
|
||||
- name: Setup Node 10
|
||||
uses: actions/setup-node@v2
|
||||
uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: 10.x
|
||||
- name: Setup Node 12
|
||||
uses: actions/setup-node@v2
|
||||
uses: {% data reusables.actions.action-setup-node %}
|
||||
with:
|
||||
node-version: 12.x
|
||||
- name: Archive tool cache
|
||||
run: |
|
||||
cd "${{ runner.tool_cache }}"
|
||||
cd "{% raw %}${{ runner.tool_cache }}{% endraw %}"
|
||||
tar -czf tool_cache.tar.gz *
|
||||
- name: Upload tool cache artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: {% data reusables.actions.action-upload-artifact %}
|
||||
with:
|
||||
path: ${{runner.tool_cache}}/tool_cache.tar.gz
|
||||
path: {% raw %}${{runner.tool_cache}}/tool_cache.tar.gz{% endraw %}
|
||||
```
|
||||
{% endraw %}
|
||||
1. Download the tool cache artifact from the workflow run. For instructions on downloading artifacts, see "[Downloading workflow artifacts](/actions/managing-workflow-runs/downloading-workflow-artifacts)."
|
||||
1. Transfer the tool cache artifact to your self hosted runner and extract it to the local tool cache directory. The default tool cache directory is `RUNNER_DIR/_work/_tool`. If the runner hasn't processed any jobs yet, you might need to create the `_work/_tool` directories.
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ To update the bundled actions, you can use the `actions-sync` tool to update the
|
||||
|
||||
You can use {% data variables.product.prodname_github_connect %} to allow {% data variables.product.product_name %} to use actions from {% data variables.product.prodname_dotcom_the_website %}. For more information, see "[Enabling automatic access to {% data variables.product.prodname_dotcom_the_website %} actions using {% data variables.product.prodname_github_connect %}](/admin/github-actions/enabling-automatic-access-to-githubcom-actions-using-github-connect)."
|
||||
|
||||
Once {% data variables.product.prodname_github_connect %} is configured, you can use the latest version of an action by deleting its local repository in the `actions` organization on your instance. For example, if your enterprise instance is using the `actions/checkout@v1` action, and you need to use `actions/checkout@v2` which isn't available on your enterprise instance, perform the following steps to be able to use the latest `checkout` action from {% data variables.product.prodname_dotcom_the_website %}:
|
||||
Once {% data variables.product.prodname_github_connect %} is configured, you can use the latest version of an action by deleting its local repository in the `actions` organization on your instance. For example, if your enterprise instance is using `v1` of the `actions/checkout` action, and you need to use `{% data reusables.actions.action-checkout %}` which isn't available on your enterprise instance, perform the following steps to be able to use the latest `checkout` action from {% data variables.product.prodname_dotcom_the_website %}:
|
||||
|
||||
1. From an enterprise owner account on {% data variables.product.product_name %}, navigate to the repository you want to delete from the *actions* organization (in this example `checkout`).
|
||||
1. By default, site administrators are not owners of the bundled *actions* organization. To get the access required to delete the `checkout` repository, you must use the site admin tools. Click {% octicon "rocket" aria-label="The rocket ship" %} in the upper-right corner of any page in that repository.
|
||||
@@ -44,8 +44,8 @@ Once {% data variables.product.prodname_github_connect %} is configured, you can
|
||||
1. Under "Repository info", click **View code** to leave the site admin pages and display the `checkout` repository.
|
||||
1. Delete the `checkout` repository within the `actions` organization. For information on how to delete a repository, see "[Deleting a repository](/github/administering-a-repository/deleting-a-repository)."
|
||||

|
||||
1. Configure your workflow's YAML to use `actions/checkout@v2`.
|
||||
1. Each time your workflow runs, the runner will use the `v2` version of `actions/checkout` from {% data variables.product.prodname_dotcom_the_website %}.
|
||||
1. Configure your workflow's YAML to use `{% data reusables.actions.action-checkout %}`.
|
||||
1. Each time your workflow runs, the runner will use the specified version of `actions/checkout` from {% data variables.product.prodname_dotcom_the_website %}.
|
||||
|
||||
{% ifversion ghes > 3.2 or ghae-issue-4815 %}
|
||||
{% note %}
|
||||
|
||||
@@ -54,6 +54,6 @@ shortTitle: IdP 以外的身份验证
|
||||
|
||||
## 延伸阅读
|
||||
|
||||
- "[Using LDAP](/enterprise/admin/authentication/using-ldap)"
|
||||
- "[使用 LDAP](/enterprise/admin/authentication/using-ldap)"
|
||||
- "[使用 SAML](/enterprise/{{ currentVersion }}/admin/guides/user-management/using-saml)"
|
||||
- "[使用 CAS](/enterprise/{{ currentVersion }}/admin/guides/user-management/using-cas)"
|
||||
|
||||
@@ -107,7 +107,7 @@ topics:
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** Teams using LDAP Sync are limited to a maximum 1499 members.
|
||||
**注意**:使用 LDAP 同步的团队限制为最多 1499 名成员。
|
||||
|
||||
{% endnote %}
|
||||
|
||||
@@ -124,8 +124,8 @@ topics:
|
||||
- 如果存在 LDAP 映射但目录中相应的 LDAP 条目缺失,请挂起该用户并前进到下一个用户。
|
||||
- 如果相应的 LDAP 条目已被标记为禁用并且该用户尚未被挂起,请挂起该用户并前进到下一个用户。
|
||||
- 如果相应的 LDAP 条目未被标记为禁用,用户已被挂起,并且已在 Admin Center 中启用 _Reactivate suspended users_,请取消挂起该用户。
|
||||
- If one or more restricted user groups are configured on the instance and the corresponding LDAP entry is not in one of these groups, suspend the user.
|
||||
- If one or more restricted user groups are configured on the instance, the corresponding LDAP entry is in one of these groups, and _Reactivate suspended users_ is enabled in the Admin Center, unsuspend the user.
|
||||
- 如果在实例上配置了一个或多个受限制的用户组,并且相应的 LDAP 条目不在其中一个组中,请暂停该用户。
|
||||
- 如果在实例上配置了一个或多个受限用户组,则相应的 LDAP 条目位于其中一个组中,并且在管理中心中启用了 _Reactivate suspended users(重新激活挂起的用户)_ ,请取消暂停该用户。
|
||||
- 如果相应的 LDAP 条目包括 `name` 属性,请更新用户的个人资料姓名。
|
||||
- 如果相应的 LDAP 条目位于管理员组中,请将该用户升级为站点管理员。
|
||||
- 如果相应的 LDAP 条目不位于管理员组中,请将该用户降级为普通帐户。
|
||||
@@ -135,14 +135,14 @@ topics:
|
||||
|
||||
{% note %}
|
||||
|
||||
**注**:只有您使用 Active Directory,`userAccountControl` 属性显示并使用 `ACCOUNTDISABLE` 标记时,才可以将 LDAP 条目标记为禁用。 Some variations of Active Directory, such as AD LDS and ADAM, don't support the `userAccountControl` attribute.
|
||||
**注**:只有您使用 Active Directory,`userAccountControl` 属性显示并使用 `ACCOUNTDISABLE` 标记时,才可以将 LDAP 条目标记为禁用。 Active Directory 的某些变体(如 AD LDS 和 ADAM)不支持 `userAccountControl` 属性。
|
||||
|
||||
{% endnote %}
|
||||
|
||||
某个同步作业也将以指定的时间间隔运行,在已经映射到 LDAP 组的每个团队上执行以下操作:
|
||||
|
||||
- 如果已移除团队的相应 LDAP 组,请移除团队中的所有成员。
|
||||
- 如果已从 LDAP 组中移除 LDAP 成员条目,请从团队中移除相应的用户。 If the user is no longer a member of any team in the organization, remove the user from the organization. 如果用户因此失去了任何仓库的访问权限,请删除用户在这些仓库中的任何私有分叉。
|
||||
- 如果已从 LDAP 组中移除 LDAP 成员条目,请从团队中移除相应的用户。 如果用户不再是组织中任何团队的成员,请从组织中删除该用户。 如果用户因此失去了任何仓库的访问权限,请删除用户在这些仓库中的任何私有分叉。
|
||||
- 如果已向 LDAP 组中添加 LDAP 成员条目,请将相应的用户添加到团队中。 如果用户因此重新获得了任何仓库的访问权限,请恢复过去 90 天内因为用户失去访问权限而被删除的仓库中的任何私有分叉。
|
||||
|
||||
{% data reusables.enterprise_user_management.ldap-sync-nested-teams %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: 使用 SAML
|
||||
title: Using SAML
|
||||
redirect_from:
|
||||
- /enterprise/admin/articles/configuring-saml-authentication
|
||||
- /enterprise/admin/articles/about-saml-authentication
|
||||
@@ -23,11 +23,11 @@ topics:
|
||||
|
||||
SAML SSO allows people to authenticate and access {% data variables.product.product_location %} through an external system for identity management.
|
||||
|
||||
SAML 是一种基于 XML 的身份验证和授权标准。 When you configure SAML for {% data variables.product.product_location %}, the external system for authentication is called an identity provider (IdP). Your instance acts as a SAML service provider (SP). For more information, see [Security Assertion Markup Language](https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language) on Wikipedia.
|
||||
SAML is an XML-based standard for authentication and authorization. When you configure SAML for {% data variables.product.product_location %}, the external system for authentication is called an identity provider (IdP). Your instance acts as a SAML service provider (SP). For more information, see [Security Assertion Markup Language](https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language) on Wikipedia.
|
||||
|
||||
{% data reusables.enterprise_user_management.built-in-authentication %}
|
||||
|
||||
## 支持的 SAML 服务
|
||||
## Supported SAML services
|
||||
|
||||
{% data reusables.saml.saml-supported-idps %}
|
||||
|
||||
@@ -39,18 +39,18 @@ If your IdP supports encrypted assertions, you can configure encrypted assertion
|
||||
|
||||
{% data reusables.saml.saml-single-logout-not-supported %}
|
||||
|
||||
## 使用 SAML 时的用户名考量因素
|
||||
## Username considerations with SAML
|
||||
|
||||
每个 {% data variables.product.prodname_ghe_server %} 用户名都由 SAML 响应中的以下断言之一决定,这些断言按优先级从高到低排列的顺序为:
|
||||
Each {% data variables.product.prodname_ghe_server %} username is determined by one of the following assertions in the SAML response, ordered by priority:
|
||||
|
||||
- 自定义用户名属性(如果定义且存在)
|
||||
- `http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name` 断言(如果存在)
|
||||
- `http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress` 断言(如果存在)
|
||||
- `NameID` 元素
|
||||
- The custom username attribute, if defined and present
|
||||
- An `http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name` assertion, if present
|
||||
- An `http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress` assertion, if present
|
||||
- The `NameID` element
|
||||
|
||||
即使其他属性存在,也需要 `NameID` 元素。
|
||||
The `NameID` element is required even if other attributes are present.
|
||||
|
||||
将在 `NameID` 与 {% data variables.product.prodname_ghe_server %} 用户名之间创建映射,`NameID` 应持久、唯一,并且在用户生命周期内不会发生变化。
|
||||
A mapping is created between the `NameID` and the {% data variables.product.prodname_ghe_server %} username, so the `NameID` should be persistent, unique, and not subject to change for the lifecycle of the user.
|
||||
|
||||
{% note %}
|
||||
|
||||
@@ -65,25 +65,25 @@ If your IdP supports encrypted assertions, you can configure encrypted assertion
|
||||
{% data reusables.enterprise_user_management.two_factor_auth_header %}
|
||||
{% data reusables.enterprise_user_management.external_auth_disables_2fa %}
|
||||
|
||||
## SAML 元数据
|
||||
## SAML metadata
|
||||
|
||||
The service provider metadata for {% data variables.product.product_location %} is available at `http(s)://[hostname]/saml/metadata`.
|
||||
|
||||
要手动配置您的身份提供程序,断言使用者服务 (ACS) URL 为 `http(s)://[hostname]/saml/consume`。 它使用 `urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST` 绑定。
|
||||
To configure your identity provider manually, the Assertion Consumer Service (ACS) URL is `http(s)://[hostname]/saml/consume`. It uses the `urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST` binding.
|
||||
|
||||
## SAML 属性
|
||||
## SAML attributes
|
||||
|
||||
以下属性可用。 You can change the attribute names in the [management console](/enterprise/{{ currentVersion }}/admin/guides/installation/accessing-the-management-console/), with the exception of the `administrator` attribute.
|
||||
These attributes are available. You can change the attribute names in the [management console](/enterprise/{{ currentVersion }}/admin/guides/installation/accessing-the-management-console/), with the exception of the `administrator` attribute.
|
||||
|
||||
| 默认属性名称 | 类型 | 描述 |
|
||||
| ------------- | -- | --------------------------------------------------------------------------------------------------------------- |
|
||||
| `NameID` | 必选 | 持久用户标识符。 可以使用任意持久名称标识符格式。 除非提供备用断言之一,否则将为 {% data variables.product.prodname_ghe_server %} 用户名使用 `NameID` 元素。 |
|
||||
| `管理员` | 可选 | 如果值为“true”,用户将被自动升级为管理员。 任何其他值或不存在的值会将用户降级为普通用户帐户。 |
|
||||
| `用户名` | 可选 | {% data variables.product.prodname_ghe_server %} 用户名。 |
|
||||
| `full_name` | 可选 | 用户的个人资料页面上显示的姓名。 用户可以在配置后更改他们的姓名。 |
|
||||
| `emails` | 可选 | 用户的电子邮件地址。 可以指定多个。 |
|
||||
| `public_keys` | 可选 | 用户的 SSH 公钥。 可以指定多个。 |
|
||||
| `gpg_keys` | 可选 | 用户的 GPG 密钥。 可以指定多个。 |
|
||||
| Default attribute name | Type | Description |
|
||||
|-----------------|----------|-------------|
|
||||
| `NameID` | Required | A persistent user identifier. Any persistent name identifier format may be used. The `NameID` element will be used for a {% data variables.product.prodname_ghe_server %} username unless one of the alternative assertions is provided. |
|
||||
| `administrator` | Optional | When the value is 'true', the user will automatically be promoted as an administrator. Any other value or a non-existent value will demote the user to a normal user account. |
|
||||
| `username` | Optional | The {% data variables.product.prodname_ghe_server %} username. |
|
||||
| `full_name` | Optional | The name of the user displayed on their profile page. Users may change their names after provisioning. |
|
||||
| `emails` | Optional | The email addresses for the user. More than one can be specified. |
|
||||
| `public_keys` | Optional | The public SSH keys for the user. More than one can be specified. |
|
||||
| `gpg_keys` | Optional | The GPG keys for the user. More than one can be specified. |
|
||||
|
||||
To specify more than one value for an attribute, use multiple `<saml2:AttributeValue>` elements.
|
||||
|
||||
@@ -94,9 +94,9 @@ To specify more than one value for an attribute, use multiple `<saml2:AttributeV
|
||||
</saml2:Attribute>
|
||||
```
|
||||
|
||||
## 配置 SAML 设置
|
||||
## Configuring SAML settings
|
||||
|
||||
You can enable or disable SAML authentication for {% data variables.product.product_location %}, or you can edit an existing configuration. You can view and edit authentication settings for {% data variables.product.product_name %} in the {% data variables.enterprise.management_console %}. 更多信息请参阅“[访问管理控制台](/admin/configuration/configuring-your-enterprise/accessing-the-management-console)”。
|
||||
You can enable or disable SAML authentication for {% data variables.product.product_location %}, or you can edit an existing configuration. You can view and edit authentication settings for {% data variables.product.product_name %} in the {% data variables.enterprise.management_console %}. For more information, see "[Accessing the management console](/admin/configuration/configuring-your-enterprise/accessing-the-management-console)."
|
||||
|
||||
{% note %}
|
||||
|
||||
@@ -107,13 +107,13 @@ You can enable or disable SAML authentication for {% data variables.product.prod
|
||||
{% data reusables.enterprise_site_admin_settings.access-settings %}
|
||||
{% data reusables.enterprise_site_admin_settings.management-console %}
|
||||
{% data reusables.enterprise_management_console.authentication %}
|
||||
1. 选择 **SAML**。
|
||||
|
||||
1. Select **SAML**.
|
||||
|
||||

|
||||
1. {% data reusables.enterprise_user_management.built-in-authentication-option %}
|
||||
|
||||

|
||||
1. 或者,要启用非请求响应 SSO,请选择 **IdP initiated SSO**。 默认情况下,{% data variables.product.prodname_ghe_server %} 将向 IdP 发回 `AuthnRequest`,回复非请求身份提供程序 (IdP) 发起的请求。
|
||||
1. Optionally, to enable unsolicited response SSO, select **IdP initiated SSO**. By default, {% data variables.product.prodname_ghe_server %} will reply to an unsolicited Identity Provider (IdP) initiated request with an `AuthnRequest` back to the IdP.
|
||||
|
||||

|
||||
|
||||
@@ -123,7 +123,7 @@ You can enable or disable SAML authentication for {% data variables.product.prod
|
||||
|
||||
{% endtip %}
|
||||
|
||||
1. 如果您**不**希望 SAML 提供程序为 {% data variables.product.product_location %} 上的用户确定管理员权限,请选择 **Disable administrator demotion/promotion(禁用管理员降级/升级)**。
|
||||
1. Select **Disable administrator demotion/promotion** if you **do not** want your SAML provider to determine administrator rights for users on {% data variables.product.product_location %}.
|
||||
|
||||

|
||||
{%- ifversion ghes > 3.3 %}
|
||||
@@ -131,7 +131,7 @@ You can enable or disable SAML authentication for {% data variables.product.prod
|
||||
|
||||

|
||||
{%- endif %}
|
||||
1. In the **Single sign-on URL** field, type the HTTP or HTTPS endpoint on your IdP for single sign-on requests. 此值由您的 IdP 配置提供。 If the host is only available from your internal network, you may need to [configure {% data variables.product.product_location %} to use internal nameservers](/enterprise/{{ currentVersion }}/admin/guides/installation/configuring-dns-nameservers/).
|
||||
1. In the **Single sign-on URL** field, type the HTTP or HTTPS endpoint on your IdP for single sign-on requests. This value is provided by your IdP configuration. If the host is only available from your internal network, you may need to [configure {% data variables.product.product_location %} to use internal nameservers](/enterprise/{{ currentVersion }}/admin/guides/installation/configuring-dns-nameservers/).
|
||||
|
||||

|
||||
1. Optionally, in the **Issuer** field, type your SAML issuer's name. This verifies the authenticity of messages sent to {% data variables.product.product_location %}.
|
||||
@@ -140,7 +140,7 @@ You can enable or disable SAML authentication for {% data variables.product.prod
|
||||
1. In the **Signature Method** and **Digest Method** drop-down menus, choose the hashing algorithm used by your SAML issuer to verify the integrity of the requests from {% data variables.product.product_location %}. Specify the format with the **Name Identifier Format** drop-down menu.
|
||||
|
||||

|
||||
1. 在 **Verification certificate(验证证书)**下,单击 **Choose File(选择文件)**并选择用于验证 IdP 的 SAML 响应的证书。
|
||||
1. Under **Verification certificate**, click **Choose File** and choose a certificate to validate SAML responses from the IdP.
|
||||
|
||||

|
||||
1. Modify the SAML attribute names to match your IdP if needed, or accept the default names.
|
||||
@@ -180,7 +180,7 @@ To enable encrypted assertions, your SAML IdP must also support encrypted assert
|
||||
1. To the right of "Key Transport Method", select the key transport method for your IdP from step 9.
|
||||
|
||||

|
||||
1. 单击 **Save settings(保存设置)**。
|
||||
1. Click **Save settings**.
|
||||
{% data reusables.enterprise_site_admin_settings.wait-for-configuration-run %}
|
||||
|
||||
If you enabled SAML debugging to test authentication with encrypted assertions, disable SAML debugging when you're done testing. For more information, see "[Configuring SAML debugging](#configuring-saml-debugging)."
|
||||
@@ -190,26 +190,31 @@ If you enabled SAML debugging to test authentication with encrypted assertions,
|
||||
## Updating a user's SAML `NameID`
|
||||
|
||||
{% data reusables.enterprise_site_admin_settings.access-settings %}
|
||||
2. 选择 **SAML**。 
|
||||
3. 在用户列表中,点击您想要更新其 `NameID` 映射的用户名。 
|
||||
2. In the left sidebar, click **All users**.
|
||||

|
||||
3. In the list of users, click the username you'd like to update the `NameID` mapping for.
|
||||

|
||||
{% data reusables.enterprise_site_admin_settings.security-tab %}
|
||||
5. 在“Update SAML NameID(更新 SAML 名称 ID)”右侧,单击 **Edit(编辑)**。 
|
||||
6. 在“NameID(名称 ID)”字段中,为用户键入新的 `NameID`。 
|
||||
7. 单击 **Update NameID(更新名称 ID)**。 
|
||||
5. To the right of "Update SAML NameID", click **Edit** .
|
||||

|
||||
6. In the "NameID" field, type the new `NameID` for the user.
|
||||

|
||||
7. Click **Update NameID**.
|
||||

|
||||
|
||||
## 撤销 {% data variables.product.product_location %} 的权限
|
||||
## Revoking access to {% data variables.product.product_location %}
|
||||
|
||||
如果您将某个用户从您的身份提供程序中移除,还必须手动挂起他们。 否则,他们仍可以继续使用访问令牌或 SSH 密钥进行身份验证。 更多信息请参阅“[挂起和取消挂起用户](/enterprise/admin/guides/user-management/suspending-and-unsuspending-users)”。
|
||||
If you remove a user from your identity provider, you must also manually suspend them. Otherwise, they'll continue to be able to authenticate using access tokens or SSH keys. For more information, see "[Suspending and unsuspending users](/enterprise/admin/guides/user-management/suspending-and-unsuspending-users)".
|
||||
|
||||
## 响应消息的要求
|
||||
## Response message requirements
|
||||
|
||||
响应消息必须满足以下要求:
|
||||
The response message must fulfill the following requirements:
|
||||
|
||||
- `<Destination>` 元素必须在根响应文档上提供,而且只有在根响应文档签署后才匹配 ACS URL。 如果断言已签名,它将被忽略。
|
||||
- `<Audience>` 元素必须始终作为 `<AudienceRestriction>` 元素的一部分提供。 It must match the `EntityId` for {% data variables.product.prodname_ghe_server %}. 这是 {% data variables.product.prodname_ghe_server %} 实例的 URL,如 `https://ghe.corp.example.com`。
|
||||
- Each assertion in the response **must** be protected by a digital signature. 签署各个 `<Assertion>` 元素或签署 `<Response>` 元素可以实现此操作。
|
||||
- `<NameID>` 元素必须作为 `<Subject>` 元素的一部分提供。 可以使用任意持久名称标识符格式。
|
||||
- `Recipient` 属性必须存在并设为 ACS URL。 例如:
|
||||
- The `<Destination>` element must be provided on the root response document and match the ACS URL only when the root response document is signed. If the assertion is signed, it will be ignored.
|
||||
- The `<Audience>` element must always be provided as part of the `<AudienceRestriction>` element. It must match the `EntityId` for {% data variables.product.prodname_ghe_server %}. This is the URL to the {% data variables.product.prodname_ghe_server %} instance, such as `https://ghe.corp.example.com`.
|
||||
- Each assertion in the response **must** be protected by a digital signature. This can be accomplished by signing each individual `<Assertion>` element or by signing the `<Response>` element.
|
||||
- A `<NameID>` element must be provided as part of the `<Subject>` element. Any persistent name identifier format may be used.
|
||||
- The `Recipient` attribute must be present and set to the ACS URL. For example:
|
||||
|
||||
```xml
|
||||
<samlp:Response ...>
|
||||
@@ -229,21 +234,21 @@ If you enabled SAML debugging to test authentication with encrypted assertions,
|
||||
</samlp:Response>
|
||||
```
|
||||
|
||||
## SAML 身份验证
|
||||
## Troubleshooting SAML authentication
|
||||
|
||||
{% data variables.product.prodname_ghe_server %} 在 _/var/log/github/auth.log_ 的身份验证日志中为失败的 SAML 身份验证记录错误消息。 关于 SAML 响应要求的更多信息,请参阅“[响应消息要求](#response-message-requirements)”。
|
||||
{% data variables.product.prodname_ghe_server %} logs error messages for failed SAML authentication in the authentication log at _/var/log/github/auth.log_. For more information about SAML response requirements, see "[Response message requirements](#response-message-requirements)."
|
||||
|
||||
### Error: "Another user already owns the account"(错误:“其他用户已拥有该帐户”)
|
||||
### Error: "Another user already owns the account"
|
||||
|
||||
When a user signs in to {% data variables.product.prodname_ghe_server %} for the first time with SAML authentication, {% data variables.product.prodname_ghe_server %} creates a user account on the instance and maps the SAML `NameID` to the account.
|
||||
|
||||
当用户再次登录时,{% data variables.product.prodname_ghe_server %} 会比较帐户的 `NameID` 映射与 IdP 的响应。 如果 IdP 响应中的 `NameID` 不再与 {% data variables.product.prodname_ghe_server %} 对用户预期的 `NameID` 匹配, 登录将失败。 用户将看到以下消息。
|
||||
When the user signs in again, {% data variables.product.prodname_ghe_server %} compares the account's `NameID` mapping to the IdP's response. If the `NameID` in the IdP's response no longer matches the `NameID` that {% data variables.product.prodname_ghe_server %} expects for the user, the sign-in will fail. The user will see the following message.
|
||||
|
||||
> 另一个用户已经拥有该帐户。 请让您的管理员检查身份验证日志。
|
||||
> Another user already owns the account. Please have your administrator check the authentication log.
|
||||
|
||||
该消息通常表示此人的用户名或电子邮件地址已在 IdP 上更改。 Ensure that the `NameID` mapping for the user account on {% data variables.product.prodname_ghe_server %} matches the user's `NameID` on your IdP. For more information, see "[Updating a user's SAML `NameID`](#updating-a-users-saml-nameid)."
|
||||
The message typically indicates that the person's username or email address has changed on the IdP. Ensure that the `NameID` mapping for the user account on {% data variables.product.prodname_ghe_server %} matches the user's `NameID` on your IdP. For more information, see "[Updating a user's SAML `NameID`](#updating-a-users-saml-nameid)."
|
||||
|
||||
### Error: Recipient in SAML response was blank or not valid(错误:SAML 响应中的收件人为空或无效)
|
||||
### Error: Recipient in SAML response was blank or not valid
|
||||
|
||||
If the `Recipient` does not match the ACS URL for {% data variables.product.product_location %}, one of the following two error messages will appear in the authentication log when a user attempts to authenticate.
|
||||
|
||||
@@ -255,24 +260,24 @@ Recipient in the SAML response must not be blank.
|
||||
Recipient in the SAML response was not valid.
|
||||
```
|
||||
|
||||
Ensure that you set the value for `Recipient` on your IdP to the full ACS URL for {% data variables.product.product_location %}. 例如,`https://ghe.corp.example.com/saml/consume`。
|
||||
Ensure that you set the value for `Recipient` on your IdP to the full ACS URL for {% data variables.product.product_location %}. For example, `https://ghe.corp.example.com/saml/consume`.
|
||||
|
||||
### Error: "SAML Response is not signed or has been modified"(错误:“SAML 响应未签名或已修改”)
|
||||
### Error: "SAML Response is not signed or has been modified"
|
||||
|
||||
如果您的 IdP 未对 SAML 响应进行签名,或者签名与内容不匹配,则身份验证日志中将显示以下错误消息。
|
||||
If your IdP does not sign the SAML response, or the signature does not match the contents, the following error message will appear in the authentication log.
|
||||
|
||||
```
|
||||
SAML Response is not signed or has been modified.
|
||||
```
|
||||
|
||||
确保为 IdP 上的 {% data variables.product.prodname_ghe_server %} 应用程序配置签名的断言。
|
||||
Ensure that you configure signed assertions for the {% data variables.product.prodname_ghe_server %} application on your IdP.
|
||||
|
||||
### Error: "Audience is invalid" or "No assertion found"(错误:“受众无效”或“未找到断言”)
|
||||
### Error: "Audience is invalid" or "No assertion found"
|
||||
|
||||
如果 IdP 的响应缺少 `Audience` 的值或者该值不正确,则身份验证日志中将显示以下错误消息。
|
||||
If the IdP's response has a missing or incorrect value for `Audience`, the following error message will appear in the authentication log.
|
||||
|
||||
```shell
|
||||
Audience is invalid. Audience is invalid. Audience attribute does not match your_instance_url
|
||||
Audience is invalid. Audience attribute does not match https://<em>YOUR-INSTANCE-URL</em>
|
||||
```
|
||||
|
||||
Ensure that you set the value for `Audience` on your IdP to the `EntityId` for {% data variables.product.product_location %}, which is the full URL to {% data variables.product.product_location %}. For example, `https://ghe.corp.example.com`.
|
||||
@@ -283,10 +288,10 @@ You can configure {% data variables.product.product_name %} to write verbose deb
|
||||
|
||||
{% warning %}
|
||||
|
||||
**警告**:
|
||||
**Warnings**:
|
||||
|
||||
- Only enable SAML debugging temporarily, and disable debugging immediately after you finish troubleshooting. If you leave debugging enabled, the size of your log may increase much faster than usual, which can negatively impact the performance of {% data variables.product.product_name %}.
|
||||
- Test new authentication settings for {% data variables.product.product_location %} in a staging environment before you apply the settings in your production environment. 更多信息请参阅“[设置暂存实例](/admin/installation/setting-up-a-github-enterprise-server-instance/setting-up-a-staging-instance)”。
|
||||
- Test new authentication settings for {% data variables.product.product_location %} in a staging environment before you apply the settings in your production environment. For more information, see "[Setting up a staging instance](/admin/installation/setting-up-a-github-enterprise-server-instance/setting-up-a-staging-instance)."
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 使用身份提供程序配置身份验证和预配
|
||||
intro: You can configure user authentication and provisioning by integrating with an identity provider (IdP) that supports SAML single sign-on (SSO) and SCIM.
|
||||
intro: 您可以通过与支持 SAML 单点登录 (SSO) 和 SCIM 的身份提供程序 (IdP) 集成来配置用户身份验证和预配。
|
||||
versions:
|
||||
ghae: '*'
|
||||
redirect_from:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Mapping Okta groups to teams
|
||||
intro: 'You can map your Okta groups to teams on {% data variables.product.prodname_ghe_managed %} to automatically add and remove team members.'
|
||||
title: 将 Okta 组映射到团队
|
||||
intro: '您可以将 Okta 组映射到 {% data variables.product.prodname_ghe_managed %} 上的团队,以自动添加和删除团队成员。'
|
||||
permissions: 'Enterprise owners can configure authentication and provisioning for {% data variables.product.prodname_ghe_managed %}.'
|
||||
versions:
|
||||
ghae: '*'
|
||||
@@ -17,80 +17,80 @@ topics:
|
||||
|
||||
{% data reusables.saml.okta-ae-sso-beta %}
|
||||
|
||||
## About team mapping
|
||||
## 关于团队映射
|
||||
|
||||
If you use Okta as your IdP, you can map your Okta group to a team in {% data variables.product.prodname_ghe_managed %}. Members of the Okta group will automatically become members of the mapped {% data variables.product.prodname_ghe_managed %} team. To configure this mapping, you can configure the Okta "GitHub AE" app to push the group and its members to {% data variables.product.prodname_ghe_managed %}. You can then choose which team in {% data variables.product.prodname_ghe_managed %} will be mapped to the Okta group.
|
||||
如果您使用 Okta 作为您的 IdP,则可以将 Okta 组映射到 {% data variables.product.prodname_ghe_managed %} 中的团队。 Okta 组的成员将自动成为映射的 {% data variables.product.prodname_ghe_managed %} 组的成员。 要配置此映射,您可以配置 Okta "GitHub AE" 应用,以将组及其成员推送到 {% data variables.product.prodname_ghe_managed %}。 然后,您可以选择 {% data variables.product.prodname_ghe_managed %} 中的哪个团队将映射到 Okta 组。
|
||||
|
||||
## 基本要求
|
||||
|
||||
You or your Okta administrator must be a Global administrator or a Privileged Role administrator in Okta.
|
||||
您或您的 Okta 管理员必须是 Okta 中的全局管理员或特权角色管理员。
|
||||
|
||||
You must enable SAML single sign-on with Okta. 更多信息请参阅“[配置企业的 SAML 单点登录](/admin/authentication/managing-identity-and-access-for-your-enterprise/configuring-saml-single-sign-on-for-your-enterprise)”。
|
||||
您必须使用 Okta 启用 SAML 单点登录。 更多信息请参阅“[配置企业的 SAML 单点登录](/admin/authentication/managing-identity-and-access-for-your-enterprise/configuring-saml-single-sign-on-for-your-enterprise)”。
|
||||
|
||||
You must authenticate to your enterprise account using SAML SSO and Okta. 更多信息请参阅“[使用 SAML 单点登录进行身份验证](/github/authenticating-to-github/authenticating-with-saml-single-sign-on)”。
|
||||
您必须使用 SAML SSO 和 Okta 对企业帐户进行身份验证。 更多信息请参阅“[使用 SAML 单点登录进行身份验证](/github/authenticating-to-github/authenticating-with-saml-single-sign-on)”。
|
||||
|
||||
## Assigning your Okta group to the "GitHub AE" app
|
||||
## 将 Okta 组分配给 "GitHub AE" 应用
|
||||
|
||||
1. In the Okta Dashboard, open your group's settings.
|
||||
1. Click **Manage Apps**. 
|
||||
1. 在 Okta 仪表板中,打开组的设置。
|
||||
1. 单击 **Manage Apps(管理应用)**。 
|
||||
|
||||
1. To the right of "GitHub AE", click **Assign**.
|
||||
1. 在 "GitHub AE" 的右侧,单击 **Assign(分配)**。
|
||||
|
||||

|
||||

|
||||
|
||||
1. 单击 **Done(完成)**。
|
||||
|
||||
## Pushing the Okta group to {% data variables.product.prodname_ghe_managed %}
|
||||
## 将 Octa 组推送到 {% data variables.product.prodname_ghe_managed %}
|
||||
|
||||
When you push an Okta group and map the group to a team, all of the group's members will be able to sign in to {% data variables.product.prodname_ghe_managed %}.
|
||||
当您推送 Okta 组并将该组映射到团队时,该组的所有成员都能够登录到 {% data variables.product.prodname_ghe_managed %}。
|
||||
|
||||
{% data reusables.saml.okta-ae-applications-menu %}
|
||||
{% data reusables.saml.okta-ae-configure-app %}
|
||||
|
||||
1. Click **Push Groups**.
|
||||
1. 单击 **Push Groups(推送组)**。
|
||||
|
||||

|
||||
|
||||
1. Select the Push Groups drop-down menu and click **Find groups by name**.
|
||||
1. 选择 Push Groups(推送组)下拉菜单,然后单击 **Find groups by name(按名称查找组)**。
|
||||
|
||||

|
||||

|
||||
|
||||
1. Type the name of the group to push to {% data variables.product.prodname_ghe_managed %}, then click **Save**.
|
||||
1. 键入要推送到 {% data variables.product.prodname_ghe_managed %} 的组的名称,然后单击 **Save(保存)**。
|
||||
|
||||

|
||||

|
||||
|
||||
## Mapping a team to the Okta group
|
||||
## 将团队映射到 Okta 组
|
||||
|
||||
You can map a team in your enterprise to an Okta group you previously pushed to {% data variables.product.prodname_ghe_managed %}. Members of the Okta group will then automatically becomes members of the {% data variables.product.prodname_ghe_managed %} team. Any subsequent changes to the Okta group's membership are automatically synchronized with the {% data variables.product.prodname_ghe_managed %} team.
|
||||
您可以将企业中的团队映射到之前推送到 {% data variables.product.prodname_ghe_managed %} 的 Okta 组。 然后,Okta 组的成员将自动成为 {% data variables.product.prodname_ghe_managed %} 组的成员。 对 Okta 组成员身份的任何后续更改都将自动与 {% data variables.product.prodname_ghe_managed %} 团队同步。
|
||||
|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.user-settings.access_org %}
|
||||
{% data reusables.organizations.specific_team %}
|
||||
{% data reusables.organizations.team_settings %}
|
||||
6. Under "Identity Provider Group", select the drop-down menu and click an identity provider group. 
|
||||
6. 在“Identity Provider Group(身份提供程序组)”下,选择下拉菜单,然后单击身份提供程序组。 
|
||||
7. 单击 **Save changes(保存更改)**。
|
||||
|
||||
## Checking the status of your mapped teams
|
||||
## 检查映射团队的状态
|
||||
|
||||
Enterprise owners can use the site admin dashboard to check how Okta groups are mapped to teams on {% data variables.product.prodname_ghe_managed %}.
|
||||
企业所有者可以使用站点管理仪表板来检查 Okta 组如何映射到 {% data variables.product.prodname_ghe_managed %} 上的团队。
|
||||
|
||||
1. 要访问仪表板,请在任意页面的右上角中单击 {% octicon "rocket" aria-label="The rocket ship" %}。 
|
||||
|
||||
1. In the left pane, click **External groups**.
|
||||
1. 在左窗格中,单击 **External groups(外部组)**。
|
||||
|
||||

|
||||

|
||||
|
||||
1. To view more details about a group, in the list of external groups, click on a group.
|
||||
1. 要查看有关组的更多详细信息,请在外部组列表中,单击某个组。
|
||||
|
||||

|
||||

|
||||
|
||||
1. The group's details includes the name of the Okta group, a list of the Okta users that are members of the group, and the corresponding mapped team on {% data variables.product.prodname_ghe_managed %}.
|
||||
1. 组的详细信息包括 Okta 组的名称、作为该组成员的 Okta 用户的列表以及 {% data variables.product.prodname_ghe_managed %} 上相应的映射团队。
|
||||
|
||||

|
||||

|
||||
|
||||
## Viewing audit log events for mapped groups
|
||||
## 查看已映射组的审核日志事件
|
||||
|
||||
To monitor SSO activity for mapped groups, you can review the following events in the {% data variables.product.prodname_ghe_managed %} audit log.
|
||||
要监控映射组的 SSO 活动,可以在 {% data variables.product.prodname_ghe_managed %} 审核日志中查看以下事件。
|
||||
|
||||
{% data reusables.saml.external-group-audit-events %}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Identity and access management
|
||||
title: 身份和访问管理
|
||||
intro: 您可以配置用户如何访问您的企业。
|
||||
redirect_from:
|
||||
- /enterprise/admin/authentication
|
||||
|
||||
@@ -27,13 +27,13 @@ redirect_from:
|
||||
|
||||
{% data reusables.saml.dotcom-saml-explanation %} {% data reusables.saml.about-saml-enterprise-accounts %} 更多信息请参阅“[为企业配置 SAML 单点登录](/admin/authentication/managing-identity-and-access-for-your-enterprise/configuring-saml-single-sign-on-for-your-enterprise)”。
|
||||
|
||||
{% data reusables.enterprise-accounts.about-recovery-codes %} For more information, see "[Managing recovery codes for your enterprise](/admin/identity-and-access-management/managing-recovery-codes-for-your-enterprise)."
|
||||
{% data reusables.enterprise-accounts.about-recovery-codes %} 更多信息请参阅“[管理企业的恢复代码](/admin/identity-and-access-management/managing-recovery-codes-for-your-enterprise)”。
|
||||
|
||||
启用 SAML SSO 后,根据使用的 IDP,您可能能够启用额外的身份和访问管理功能。 {% data reusables.scim.enterprise-account-scim %}
|
||||
|
||||
如果使用 Azure AD 作为 IDP,您可以使用团队同步来管理每个组织中的团队成员身份。 {% data reusables.identity-and-permissions.about-team-sync %} 更多信息请参阅“[管理企业帐户中组织的团队同步](/admin/authentication/managing-identity-and-access-for-your-enterprise/managing-team-synchronization-for-organizations-in-your-enterprise)”。
|
||||
|
||||
{% data reusables.saml.switching-from-org-to-enterprise %} For more information, see "[Switching your SAML configuration from an organization to an enterprise account](/github/setting-up-and-managing-your-enterprise/configuring-identity-and-access-management-for-your-enterprise-account/switching-your-saml-configuration-from-an-organization-to-an-enterprise-account)."
|
||||
{% data reusables.saml.switching-from-org-to-enterprise %} 更多信息请参阅“[将 SAML 配置从组织切换到企业帐户](/github/setting-up-and-managing-your-enterprise/configuring-identity-and-access-management-for-your-enterprise-account/switching-your-saml-configuration-from-an-organization-to-an-enterprise-account)”。
|
||||
|
||||
## 关于 {% data variables.product.prodname_emus %}
|
||||
|
||||
@@ -58,7 +58,7 @@ redirect_from:
|
||||
|
||||
{% data reusables.saml.ae-uses-saml-sso %} {% data reusables.saml.ae-enable-saml-sso-during-bootstrapping %}
|
||||
|
||||
After you configure the application for {% data variables.product.product_name %} on your identity provider (IdP), you can provision access to {% data variables.product.product_location %} by assigning the application to users and groups on your IdP. 有关用于 {% data variables.product.product_name %} 的 SAML SSO 的详细信息,请参阅“[为企业配置 SAML 单点登录](/admin/authentication/configuring-saml-single-sign-on-for-your-enterprise)”。
|
||||
在身份提供程序 (IdP) 上为 {% data variables.product.product_name %} 配置应用程序后,可以通过将应用程序分配到 IdP 上的用户和组来预配其访问 {% data variables.product.product_location %} 的权限。 有关用于 {% data variables.product.product_name %} 的 SAML SSO 的详细信息,请参阅“[为企业配置 SAML 单点登录](/admin/authentication/configuring-saml-single-sign-on-for-your-enterprise)”。
|
||||
|
||||
{% data reusables.scim.after-you-configure-saml %} 更多信息请参阅“[配置企业的用户预配](/admin/authentication/configuring-user-provisioning-for-your-enterprise)”。
|
||||
|
||||
@@ -66,15 +66,15 @@ After you configure the application for {% data variables.product.product_name %
|
||||
|
||||
## 支持的 IdP
|
||||
|
||||
The following IdPs are officially supported for integration with {% data variables.product.prodname_ghe_managed %}.
|
||||
正式支持以下 IdP 与 {% data variables.product.prodname_ghe_managed %} 集成。
|
||||
|
||||
{% data reusables.saml.okta-ae-sso-beta %}
|
||||
|
||||
{% data reusables.github-ae.saml-idp-table %}
|
||||
|
||||
## Mapping {% data variables.product.prodname_ghe_managed %} teams to Okta groups
|
||||
## 将 {% data variables.product.prodname_ghe_managed %} 团队映射到 Okta 组
|
||||
|
||||
If you use Okta as your IdP, you can map your Okta groups to teams on {% data variables.product.prodname_ghe_managed %}. 更多信息请参阅“[将 Okta 组映射到团队](/admin/authentication/configuring-authentication-and-provisioning-with-your-identity-provider/mapping-okta-groups-to-teams)”。
|
||||
如果您使用 Okta 作为您的 IdP,则可以将 Okta 组映射到 {% data variables.product.prodname_ghe_managed %} 上的团队。 更多信息请参阅“[将 Okta 组映射到团队](/admin/authentication/configuring-authentication-and-provisioning-with-your-identity-provider/mapping-okta-groups-to-teams)”。
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -24,14 +24,14 @@ shortTitle: 使用 Okta 配置 SAML
|
||||
|
||||
SAML SSO 控制并保护对企业帐户资源(如组织、仓库、议题和拉取请求)的访问。 更多信息请参阅“[配置企业的 SAML 单点登录](/admin/authentication/managing-identity-and-access-for-your-enterprise/configuring-saml-single-sign-on-for-your-enterprise)”。
|
||||
|
||||
{% data reusables.saml.switching-from-org-to-enterprise %} For more information, see "[Switching your SAML configuration from an organization to an enterprise account](/github/setting-up-and-managing-your-enterprise/configuring-identity-and-access-management-for-your-enterprise-account/switching-your-saml-configuration-from-an-organization-to-an-enterprise-account)."
|
||||
{% data reusables.saml.switching-from-org-to-enterprise %} 更多信息请参阅“[将 SAML 配置从组织切换到企业帐户](/github/setting-up-and-managing-your-enterprise/configuring-identity-and-access-management-for-your-enterprise-account/switching-your-saml-configuration-from-an-organization-to-an-enterprise-account)”。
|
||||
|
||||
或者,您也可以使用 Okta 配置为使用 {% data variables.product.prodname_ghe_cloud %} 的组织 SAML SSO。 更多信息请参阅“[使用 Okta 配置 SAML 单点登录和 SCIM](/organizations/managing-saml-single-sign-on-for-your-organization/configuring-saml-single-sign-on-and-scim-using-okta)”。
|
||||
|
||||
## 在 Okta 中添加 {% data variables.product.prodname_ghe_cloud %} 应用程序
|
||||
|
||||
{% data reusables.saml.okta-sign-into-your-account %}
|
||||
1. 导航到 Okta 集成网络中的 [GitHub Enterprise Cloud - 企业帐户](https://www.okta.com/integrations/github-enterprise-cloud-enterprise-accounts)应用程序,然后单击 **Add Integration(添加集成)**。
|
||||
1. 导航到 Okta 集成网络中的 [{% data variables.product.prodname_ghe_cloud %} - 企业帐户](https://www.okta.com/integrations/github-enterprise-cloud-enterprise-accounts) 应用程序,然后单击 **Add Integration(添加集成)**。
|
||||
{% data reusables.saml.okta-dashboard-click-applications %}
|
||||
1. (可选)在“Application label(应用程序标签)”右边输入应用程序的描述性名称。
|
||||
1. 在“{% data variables.product.prodname_dotcom %} Enterprises”右侧,键入企业帐户的名称。 例如,如果企业帐户的 URL 是`https://github.com/enterprises/octo-corp`,请键入 `octo-corp`。
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Managing team synchronization for organizations in your enterprise
|
||||
title: 管理企业中组织的团队同步
|
||||
intro: '您可以启用身份提供程序 (IdP) 与 {% data variables.product.product_name %} 之间的团队同步,以允许企业帐户拥有的组织通过 IdP 组管理团队成员身份。'
|
||||
permissions: Enterprise owners can manage team synchronization for an enterprise account.
|
||||
versions:
|
||||
@@ -37,7 +37,7 @@ shortTitle: 管理团队同步
|
||||
|
||||
您或您的 Azure AD 管理员必须是 Azure AD 中的全局管理员或特权角色管理员。
|
||||
|
||||
You must enforce SAML single sign-on for organizations in your enterprise account with your supported IdP. 更多信息请参阅“[配置企业的 SAML 单点登录](/admin/authentication/managing-identity-and-access-for-your-enterprise/configuring-saml-single-sign-on-for-your-enterprise)”。
|
||||
您必须使用受支持的 IdP 对企业帐户中的组织强制实施 SAML 单点登录。 更多信息请参阅“[配置企业的 SAML 单点登录](/admin/authentication/managing-identity-and-access-for-your-enterprise/configuring-saml-single-sign-on-for-your-enterprise)”。
|
||||
|
||||
您必须使用 SAML SSO 和支持的 IdP 向企业帐户进行身份验证。 更多信息请参阅“[使用 SAML 单点登录进行身份验证](/articles/authenticating-with-saml-single-sign-on)”。
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Switching your SAML configuration from an organization to an enterprise account
|
||||
intro: Learn special considerations and best practices for replacing an organization-level SAML configuration with an enterprise-level SAML configuration.
|
||||
title: 将 SAML 配置从组织切换到企业帐户
|
||||
intro: 了解将组织级 SAML 配置替换为企业级 SAML 配置的特殊注意事项和最佳实践。
|
||||
permissions: Enterprise owners can configure SAML single sign-on for an enterprise account.
|
||||
versions:
|
||||
ghec: '*'
|
||||
@@ -9,7 +9,7 @@ topics:
|
||||
- Enterprise
|
||||
- Organizations
|
||||
type: how_to
|
||||
shortTitle: Switching from organization
|
||||
shortTitle: 从组织切换
|
||||
redirect_from:
|
||||
- /github/setting-up-and-managing-your-enterprise/configuring-identity-and-access-management-for-your-enterprise-account/switching-your-saml-configuration-from-an-organization-to-an-enterprise-account
|
||||
- /admin/authentication/managing-identity-and-access-for-your-enterprise/switching-your-saml-configuration-from-an-organization-to-an-enterprise-account
|
||||
@@ -21,24 +21,24 @@ redirect_from:
|
||||
|
||||
{% data reusables.saml.switching-from-org-to-enterprise %}
|
||||
|
||||
When you configure SAML SSO at the organization level, each organization must be configured with a unique SSO tenant in your IdP, which means that your members will be associated with a unique SAML identity record for each organization they have successfully authenticated with. If you configure SAML SSO for your enterprise account instead, each enterprise member will have one SAML identity that is used for all organizations owned by the enterprise account.
|
||||
在组织级别配置 SAML SSO 时,必须在 IdP 中为每个组织配置唯一的 SSO 租户,这意味着您的成员将与已成功进行身份验证的每个组织的唯一 SAML 身份记录相关联。 如果您为企业帐户配置 SAML SSO,则每个企业成员将具有一个 SAML 身份,该身份用于企业帐户拥有的所有组织。
|
||||
|
||||
After you configure SAML SSO for your enterprise account, the new configuration will override any existing SAML SSO configurations for organizations owned by the enterprise account.
|
||||
为企业帐户配置 SAML SSO 后,新配置将覆盖企业帐户拥有的组织的任何现有 SAML SSO 配置。
|
||||
|
||||
Enterprise members will not be notified when an enterprise owner enables SAML for the enterprise account. If SAML SSO was previously enforced at the organization level, members should not see a major difference when navigating directly to organization resources. The members will continue to be prompted to authenticate via SAML. If members navigate to organization resources via their IdP dashboard, they will need to click the new tile for the enterprise-level app, instead of the old tile for the organization-level app. The members will then be able to choose the organization to navigate to.
|
||||
当企业所有者为企业帐户启用 SAML 时,不会通知企业成员。 如果以前在组织级别强制实施了 SAML SSO,则在直接导航到组织资源时,成员应该不会看到重大差异。 系统将继续提示成员通过 SAML 进行身份验证。 如果成员通过其 IdP 仪表板导航到组织资源,则需要单击企业级应用程序的新磁贴,而不是组织级应用程序的旧磁贴。 然后,成员将能够选择要导航到的组织。
|
||||
|
||||
Any personal access tokens (PATs), SSH keys, {% data variables.product.prodname_oauth_apps %}, and {% data variables.product.prodname_github_apps %} that were previously authorized for the organization will continue to be authorized for the organization. However, members will need to authorize any PATs, SSH keys, {% data variables.product.prodname_oauth_apps %}, and {% data variables.product.prodname_github_apps %} that were never authorized for use with SAML SSO for the organization.
|
||||
以前为组织授权的任何个人访问令牌 (PAT)、SSH 密钥、{% data variables.product.prodname_oauth_apps %} 和 {% data variables.product.prodname_github_apps %} 将继续为组织授权。 但是,成员需要授权任何从未授权与组织的 SAML SSO 一起使用的 PAT、SSH 密钥、{% data variables.product.prodname_oauth_apps %}和 {% data variables.product.prodname_github_apps %} 。
|
||||
|
||||
SCIM provisioning is not currently supported when SAML SSO is configured for an enterprise account. If you are currently using SCIM for an organization owned by your enterprise account, you will lose this functionality when switching to an enterprise-level configuration.
|
||||
为企业帐户配置 SAML SSO 时,当前不支持 SCIM 预配。 如果您当前正在为企业帐户拥有的组织使用 SCIM,则在切换到企业级配置时将失去此功能。
|
||||
|
||||
You are not required to remove any organization-level SAML configurations before configuring SAML SSO for your enterprise account, but you may want to consider doing so. If SAML is ever disabled for the enterprise account in the future, any remaining organization-level SAML configurations will take effect. Removing the organization-level configurations can prevent unexpected issues in the future.
|
||||
在为企业帐户配置 SAML SSO 之前,不需要删除任何组织级 SAML 配置,但您可能需要考虑这样做。 如果将来为企业帐户禁用 SAML,则任何剩余的组织级 SAML 配置都将生效。 删除组织级配置可以防止将来出现意外问题。
|
||||
|
||||
## Switching your SAML configuration from an organization to an enterprise account
|
||||
## 将 SAML 配置从组织切换到企业帐户
|
||||
|
||||
1. Enforce SAML SSO for your enterprise account, making sure all organization members are assigned or given access to the IdP app being used for the enterprise account. 更多信息请参阅“[配置企业的 SAML 单点登录](/admin/authentication/managing-identity-and-access-for-your-enterprise/configuring-saml-single-sign-on-for-your-enterprise)”。
|
||||
1. Optionally, remove any existing SAML configuration for organizations owned by the enterprise account. To help you decide whether to remove the configurations, see "[About SAML single sign-on for enterprise accounts](#about-saml-single-sign-on-for-enterprise-accounts)."
|
||||
1. If you kept any organization-level SAML configurations in place, to prevent confusion, consider hiding the tile for the organization-level apps in your IdP.
|
||||
1. Advise your enterprise members about the change.
|
||||
- Members will no longer be able to access their organizations by clicking the SAML app for the organization in the IdP dashboard. They will need to use the new app configured for the enterprise account.
|
||||
- Members will need to authorize any PATs or SSH keys that were not previously authorized for use with SAML SSO for their organization. 更多信息请参阅“[授权个人访问令牌用于 SAML 单点登录](/github/authenticating-to-github/authenticating-with-saml-single-sign-on/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on)”和“[授权 SSH 密钥用于 SAML 单点登录](/github/authenticating-to-github/authenticating-with-saml-single-sign-on/authorizing-an-ssh-key-for-use-with-saml-single-sign-on)”。
|
||||
- Members may need to reauthorize {% data variables.product.prodname_oauth_apps %} that were previously authorized for the organization. 更多信息请参阅“[关于使用 SAML 单点登录进行身份验证](/github/authenticating-to-github/authenticating-with-saml-single-sign-on/about-authentication-with-saml-single-sign-on#about-oauth-apps-and-saml-sso)”。
|
||||
1. 为您的企业帐户强制实施 SAML SSO,确保为所有组织成员分配或授予对用于企业帐户的 IdP 应用程序的访问权限。 更多信息请参阅“[配置企业的 SAML 单点登录](/admin/authentication/managing-identity-and-access-for-your-enterprise/configuring-saml-single-sign-on-for-your-enterprise)”。
|
||||
1. (可选)删除企业帐户拥有的组织的任何现有 SAML 配置。 为了帮助您决定是否删除配置,请参阅“[关于企业帐户的 SAML 单点登录](#about-saml-single-sign-on-for-enterprise-accounts)”。
|
||||
1. 如果您保留了任何组织级 SAML 配置,为防止混淆,请考虑在 IdP 中隐藏组织级应用程序的磁贴。
|
||||
1. 向您的企业成员提供有关更改的建议。
|
||||
- 成员将无法再通过单击 IdP 控制面板中组织的 SAML 应用程序来访问其组织。 他们将需要使用为企业帐户配置的新应用。
|
||||
- 成员需要授权以前未授权其组织与 SAML SSO 一起使用的任何 PAT 或 SSH 密钥。 更多信息请参阅“[授权个人访问令牌用于 SAML 单点登录](/github/authenticating-to-github/authenticating-with-saml-single-sign-on/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on)”和“[授权 SSH 密钥用于 SAML 单点登录](/github/authenticating-to-github/authenticating-with-saml-single-sign-on/authorizing-an-ssh-key-for-use-with-saml-single-sign-on)”。
|
||||
- 成员可能需要重新授权以前为组织授权的 {% data variables.product.prodname_oauth_apps %} 。 更多信息请参阅“[关于使用 SAML 单点登录进行身份验证](/github/authenticating-to-github/authenticating-with-saml-single-sign-on/about-authentication-with-saml-single-sign-on#about-oauth-apps-and-saml-sso)”。
|
||||
|
||||
@@ -17,7 +17,7 @@ topics:
|
||||
- SSO
|
||||
---
|
||||
|
||||
## 关于 {% data variables.product.prodname_emus %}
|
||||
## About {% data variables.product.prodname_emus %}
|
||||
|
||||
With {% data variables.product.prodname_emus %}, you can control the user accounts of your enterprise members through your identity provider (IdP). You can simplify authentication with SAML single sign-on (SSO) and provision, update, and deprovision user accounts for your enterprise members. Users assigned to the {% data variables.product.prodname_emu_idp_application %} application in your IdP are provisioned as new user accounts on {% data variables.product.prodname_dotcom %} and added to your enterprise. You control usernames, profile data, team membership, and repository access from your IdP.
|
||||
|
||||
@@ -38,7 +38,7 @@ To use {% data variables.product.prodname_emus %}, you need a separate type of e
|
||||
|
||||
## Identity provider support
|
||||
|
||||
{% data variables.product.prodname_emus %} 支持以下 IdP:
|
||||
{% data variables.product.prodname_emus %} supports the following IdPs:
|
||||
|
||||
{% data reusables.enterprise-accounts.emu-supported-idps %}
|
||||
|
||||
@@ -48,13 +48,13 @@ To use {% data variables.product.prodname_emus %}, you need a separate type of e
|
||||
|
||||
* {% data variables.product.prodname_managed_users_caps %} cannot create issues or pull requests in, comment or add reactions to, nor star, watch, or fork repositories outside of the enterprise.
|
||||
* {% data variables.product.prodname_managed_users_caps %} can view all public repositories on {% data variables.product.prodname_dotcom_the_website %}, but cannot push code to repositories outside of the enterprise.
|
||||
* {% data variables.product.prodname_managed_users_caps %} and the content they create is only visible to other members of the enterprise.
|
||||
* {% data variables.product.prodname_managed_users_caps %} and the content they create is only visible to other members of the enterprise.
|
||||
* {% data variables.product.prodname_managed_users_caps %} cannot follow users outside of the enterprise.
|
||||
* {% data variables.product.prodname_managed_users_caps %} cannot create gists or comment on gists.
|
||||
* {% data variables.product.prodname_managed_users_caps %} cannot install {% data variables.product.prodname_github_apps %} on their user accounts.
|
||||
* Other {% data variables.product.prodname_dotcom %} users cannot see, mention, or invite a {% data variables.product.prodname_managed_user %} to collaborate.
|
||||
* {% data variables.product.prodname_managed_users_caps %} can only own private repositories and {% data variables.product.prodname_managed_users %} can only invite other enterprise members to collaborate on their owned repositories.
|
||||
* Only private and internal repositories can be created in organizations owned by an {% data variables.product.prodname_emu_enterprise %}, depending on organization and enterprise repository visibility settings.
|
||||
* Only private and internal repositories can be created in organizations owned by an {% data variables.product.prodname_emu_enterprise %}, depending on organization and enterprise repository visibility settings.
|
||||
|
||||
## About enterprises with managed users
|
||||
|
||||
@@ -64,7 +64,7 @@ Your contact on the GitHub Sales team will work with you to create your new {% d
|
||||
|
||||
After we create your enterprise, you will receive an email from {% data variables.product.prodname_dotcom %} inviting you to choose a password for your enterprise's setup user, which will be the first owner in the enterprise. Use an incognito or private browsing window when setting the password. The setup user is only used to configure SAML single sign-on and SCIM provisioning integration for the enterprise. It will no longer have access to administer the enterprise account once SAML is successfully enabled.
|
||||
|
||||
The setup user's username is your enterprise's shortcode suffixed with `_admin`. After you log in to your setup user, you can get started by configuring SAML SSO for your enterprise. 更多信息请参阅“[为企业托管用户配置 SAML 单点登录](/github/setting-up-and-managing-your-enterprise/managing-your-enterprise-users-with-your-identity-provider/configuring-saml-single-sign-on-for-enterprise-managed-users)”。
|
||||
The setup user's username is your enterprise's shortcode suffixed with `_admin`. After you log in to your setup user, you can get started by configuring SAML SSO for your enterprise. For more information, see "[Configuring SAML single sign-on for Enterprise Managed Users](/github/setting-up-and-managing-your-enterprise/managing-your-enterprise-users-with-your-identity-provider/configuring-saml-single-sign-on-for-enterprise-managed-users)."
|
||||
|
||||
{% note %}
|
||||
|
||||
@@ -72,7 +72,7 @@ The setup user's username is your enterprise's shortcode suffixed with `_admin`.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
## 验证为 {% data variables.product.prodname_managed_user %}
|
||||
## Authenticating as a {% data variables.product.prodname_managed_user %}
|
||||
|
||||
{% data variables.product.prodname_managed_users_caps %} must authenticate through their identity provider. To authenticate, a {% data variables.product.prodname_managed_user %} can visit their IdP application portal or use the login page on {% data variables.product.prodname_dotcom_the_website %}.
|
||||
|
||||
@@ -81,8 +81,11 @@ The setup user's username is your enterprise's shortcode suffixed with `_admin`.
|
||||
### Authenticating as a {% data variables.product.prodname_managed_user %} via {% data variables.product.prodname_dotcom_the_website %}
|
||||
|
||||
1. Navigate to [https://github.com/login](https://github.com/login).
|
||||
1. In the "Username or email address" text box, enter your username including the underscore and short code.  When the form recognizes your username, the form will update. You do not need to enter your password on this form.
|
||||
1. To continue to your identity provider, click **Sign in with your identity provider**. 
|
||||
1. In the "Username or email address" text box, enter your username including the underscore and short code.
|
||||

|
||||
When the form recognizes your username, the form will update. You do not need to enter your password on this form.
|
||||
1. To continue to your identity provider, click **Sign in with your identity provider**.
|
||||

|
||||
|
||||
## Usernames and profile information
|
||||
|
||||
@@ -90,10 +93,10 @@ When your {% data variables.product.prodname_emu_enterprise %} is created, you w
|
||||
|
||||
When you provision a new user from your identity provider, the new {% data variables.product.prodname_managed_user %} will have a {% data variables.product.prodname_dotcom %} username in the format of **@<em>IDP-USERNAME</em>_<em>SHORT-CODE</em>**.
|
||||
|
||||
| Identity provider | {% data variables.product.prodname_dotcom %} username |
|
||||
| --------------------------------- | ----------------------------------------------------- |
|
||||
| Azure Active Directory (Azure AD) | <ul><li>_IDP-USERNAME_ is formed by normalizing the characters preceding the `@` character in the UPN (User Principal Name).</li><li>Guest accounts will have `#EXT` removed from the UPN.</li></ul> |
|
||||
| Okta | <ul><li>_IDP-USERNAME_ is the normalized username attribute provided by the IdP.</li></ul> |
|
||||
| Identity provider | {% data variables.product.prodname_dotcom %} username |
|
||||
|-----------------------------------|----------------------|
|
||||
| Azure Active Directory (Azure AD) | <ul><li>_IDP-USERNAME_ is formed by normalizing the characters preceding the `@` character in the UPN (User Principal Name).</li><li>Guest accounts will have `#EXT` removed from the UPN.</li></ul> |
|
||||
| Okta | <ul><li>_IDP-USERNAME_ is the normalized username attribute provided by the IdP.</li></ul> |
|
||||
|
||||
It's possible for a conflict to occur when provisioning users if the unique parts of the username provided by your IdP are removed when it is normalized. If you are unable to provision a user due to a username conflict, you should modify the username provided by your IdP.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: Auditing activity in your enterprise
|
||||
shortTitle: Auditing activity
|
||||
intro: 'You can audit the activity of the {% data variables.product.prodname_managed_users %} in your enterprise, viewing information about what actions were performed, by which user, and when they took place.'
|
||||
title: 审核企业中的活动
|
||||
shortTitle: 审核活动
|
||||
intro: '您可以审核企业中 {% data variables.product.prodname_managed_users %} 的活动,查看执行的操作、执行的用户以及执行时间等相关信息。'
|
||||
permissions: Enterprise owners can access the audit log.
|
||||
product: '{% data reusables.gated-features.emus %}'
|
||||
redirect_from:
|
||||
@@ -14,9 +14,9 @@ topics:
|
||||
- Enterprise
|
||||
---
|
||||
|
||||
## About the audit log
|
||||
## 关于审核日志
|
||||
|
||||
The audit log allows enterprise owners to quickly review or export the actions performed by both owners and members of your enterprise. Each audit log entry shows information about the event.
|
||||
审核日志允许企业所有者快速查看或导出企业所有者和成员执行的操作。 每个审核日志条目都显示有关事件的信息。
|
||||
|
||||
- 可在其中执行操作的组织
|
||||
- 执行操作的用户
|
||||
@@ -27,9 +27,9 @@ The audit log allows enterprise owners to quickly review or export the actions p
|
||||
|
||||
## 访问审核日志
|
||||
|
||||
You can also access the audit log for your enterprise from the REST API. For more information, see "[GitHub Enterprise administration](/rest/reference/enterprise-admin#get-the-audit-log-for-an-enterprise)" in the API documentation.
|
||||
您还可以从 REST API 访问企业的审核日志。 更多信息请参阅 API 文档中的“[GitHub Enterprise 管理](/rest/reference/enterprise-admin#get-the-audit-log-for-an-enterprise)”。
|
||||
|
||||
{% data reusables.enterprise-accounts.access-enterprise %}
|
||||
{% data reusables.enterprise-accounts.settings-tab %}
|
||||
{% data reusables.enterprise-accounts.audit-log-tab %}
|
||||
1. Optionally, above the list of events, select the **Export Git Events** or **Export** drop-down menu and choose options for exporting events from the audit log. 
|
||||
1. (可选)在事件列表上方,选择 **Export Git Events(导出 Git 事件)**或 **Export(导出)**下拉菜单,然后选择用于从审核日志中导出事件的选项。 
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: Managing IAM with Enterprise Managed Users
|
||||
title: 使用企业托管用户管理 IAM
|
||||
shortTitle: Enterprise Managed Users
|
||||
product: '{% data reusables.gated-features.emus %}'
|
||||
intro: You can manage identity and access with your identity provider and provision accounts that can only contribute to your enterprise.
|
||||
intro: 您可以使用身份提供程序管理身份和访问权限,并预配只能参与您的企业的帐户。
|
||||
redirect_from:
|
||||
- /github/setting-up-and-managing-your-enterprise/managing-your-enterprise-users-with-your-identity-provider
|
||||
- /admin/authentication/managing-your-enterprise-users-with-your-identity-provider
|
||||
|
||||
@@ -18,7 +18,7 @@ topics:
|
||||
|
||||
## About team management with {% data variables.product.prodname_emus %}
|
||||
|
||||
With {% data variables.product.prodname_emus %}, you can manage team membership within your enterprise through your IdP. When you connect a team in one of your enterprise's organizations to an IdP group, changes to membership from the IdP group are reflected in your enterprise automatically, reducing the need for manual updates and custom scripts.
|
||||
With {% data variables.product.prodname_emus %}, you can manage team membership within your enterprise through your IdP. When you connect a team in one of your enterprise's organizations to an IdP group, changes to membership from the IdP group are reflected in your enterprise automatically, reducing the need for manual updates and custom scripts.
|
||||
|
||||
When a change to an IdP group or a new team connection results in a {% data variables.product.prodname_managed_user %} joining a team in an organization they were not already a member of, the {% data variables.product.prodname_managed_user %} will automatically be added to the organization. Organization owners can also manage organization membership manually. When you disconnect a group from a team, users who became members of the organization via team membership are removed from the organization if they are not assigned membership in the organization by any other means.
|
||||
|
||||
@@ -34,14 +34,15 @@ To manage repository access for any team in your enterprise, including teams con
|
||||
|
||||
## Creating a new team connected to an IdP group
|
||||
|
||||
Any member of an organization can create a new team and connect the team to an IdP group.
|
||||
Any member of an organization can create a new team and connect the team to an IdP group.
|
||||
|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.user-settings.access_org %}
|
||||
{% data reusables.organizations.new_team %}
|
||||
{% data reusables.organizations.team_name %}
|
||||
{% data reusables.organizations.team_description %}
|
||||
1. To connect a team, select the "Identity Provider Groups" drop-down menu and click the team you want to connect. 
|
||||
1. To connect a team, select the "Identity Provider Groups" drop-down menu and click the team you want to connect.
|
||||

|
||||
{% data reusables.organizations.team_visibility %}
|
||||
{% data reusables.organizations.create_team %}
|
||||
|
||||
@@ -60,15 +61,20 @@ Organization owners and team maintainers can manage the existing connection betw
|
||||
{% data reusables.profile.access_org %}
|
||||
{% data reusables.organizations.specific_team %}
|
||||
{% data reusables.organizations.team_settings %}
|
||||
1. Optionally, under "Identity Provider Group", to the right of the IdP group you want to disconnect, click {% octicon "x" aria-label="X symbol" %}. 
|
||||
1. To connect an IdP group, under "Identity Provider Group", select the drop-down menu, and click an identity provider group from the list. 
|
||||
1. 单击 **Save changes(保存更改)**。
|
||||
1. Optionally, under "Identity Provider Group", to the right of the IdP group you want to disconnect, click {% octicon "x" aria-label="X symbol" %}.
|
||||

|
||||
1. To connect an IdP group, under "Identity Provider Group", select the drop-down menu, and click an identity provider group from the list.
|
||||

|
||||
1. Click **Save changes**.
|
||||
|
||||
## Viewing IdP groups, group membership, and connected teams
|
||||
|
||||
You can review a list of IdP groups, see any teams connected to an IdP group, and see the membership of each IdP group on {% data variables.product.product_name %}. You must edit the membership for a group on your IdP.
|
||||
|
||||
{% data reusables.enterprise-accounts.access-enterprise %}
|
||||
1. To review a list of IdP groups, in the left sidebar, click {% octicon "key" aria-label="The key icon" %} **Identity provider**. 
|
||||
2. To see the members and teams connected to an IdP group, click the group's name. 
|
||||
4. To view the teams connected to the IdP group, click **Teams**. 
|
||||
1. To review a list of IdP groups, in the left sidebar, click {% octicon "key" aria-label="The key icon" %} **Identity provider**.
|
||||

|
||||
2. To see the members and teams connected to an IdP group, click the group's name.
|
||||

|
||||
4. To view the teams connected to the IdP group, click **Teams**.
|
||||

|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: Accessing your enterprise account if your identity provider is unavailable
|
||||
shortTitle: Access your enterprise account
|
||||
intro: 'You can sign into {% data variables.product.product_name %} even if your identity provider is unavailable by bypassing SAML single sign-on (SSO) with a recovery code.'
|
||||
title: 身份提供程序不可用时访问企业帐户
|
||||
shortTitle: 访问您的企业帐户
|
||||
intro: '即使身份提供程序不可用,您也可以使用恢复代码绕过 SAML 单点登录 (SSO) 登录到 {% data variables.product.product_name %}。'
|
||||
versions:
|
||||
ghec: '*'
|
||||
type: how_to
|
||||
@@ -13,15 +13,15 @@ topics:
|
||||
permissions: Enterprise owners can use a recovery code to access an enterprise account.
|
||||
---
|
||||
|
||||
You can use a recovery code to access your enterprise account when a SAML configuration error or an issue with your identity provider (IdP) prevents you from using SAML SSO.
|
||||
当 SAML 配置错误或身份提供程序 (IdP) 问题阻止您使用 SAML SSO 时,您可以使用恢复代码访问您的企业帐户。
|
||||
|
||||
In order to access your enterprise account this way, you must have previously downloaded and stored the recovery codes for your enterprise. For more information, see "[Downloading your enterprise account's SAML single sign-on recovery codes](/admin/identity-and-access-management/managing-recovery-codes-for-your-enterprise/downloading-your-enterprise-accounts-saml-single-sign-on-recovery-codes)."
|
||||
要以这种方式访问您的企业帐户,您必须以前下载并存储了企业的恢复代码。 更多信息请参阅“[下载企业帐户的单点登录恢复代码](/admin/identity-and-access-management/managing-recovery-codes-for-your-enterprise/downloading-your-enterprise-accounts-saml-single-sign-on-recovery-codes)”。
|
||||
|
||||
{% data reusables.saml.recovery-code-caveats %}
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** If your enterprises uses {% data variables.product.prodname_emus %}, you must sign in as the setup user to use a recovery code.
|
||||
**注意:** 如果您的企业使用 {% data variables.product.prodname_emus %},则必须以安装用户身份登录才能使用恢复代码。
|
||||
|
||||
{% endnote %}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Accessing compliance reports for your enterprise
|
||||
intro: 'You can access {% data variables.product.company_short %}''s compliance reports, such as our SOC reports and Cloud Security Alliance CAIQ self-assessment (CSA CAIQ), for your enterprise.'
|
||||
title: 访问企业的合规性报告
|
||||
intro: '您可以访问企业的 {% data variables.product.company_short %}合规性报告,例如我们的 SOC 报告和 Cloud Security Alliance CAIQ 自我评估 (CSA CAIQ)。'
|
||||
versions:
|
||||
ghec: '*'
|
||||
type: how_to
|
||||
@@ -9,23 +9,23 @@ topics:
|
||||
- Enterprise
|
||||
- Fundamentals
|
||||
permissions: Enterprise owners can access compliance reports for the enterprise.
|
||||
shortTitle: Access compliance reports
|
||||
shortTitle: 访问合规性报告
|
||||
---
|
||||
|
||||
## About {% data variables.product.company_short %}'s compliance reports
|
||||
## 关于 {% data variables.product.company_short %} 合规报告
|
||||
|
||||
You can access {% data variables.product.company_short %}'s compliance reports in your enterprise settings.
|
||||
您可以在企业设置中访问 {% data variables.product.company_short %} 合规性报告。
|
||||
|
||||
{% data reusables.security.compliance-report-list %}
|
||||
|
||||
## Accessing compliance reports for your enterprise
|
||||
## 访问企业的合规性报告
|
||||
|
||||
{% data reusables.enterprise-accounts.access-enterprise %}
|
||||
{% data reusables.enterprise-accounts.enterprise-accounts-compliance-tab %}
|
||||
1. Under "Resources", to the right of the report you want to access, click {% octicon "download" aria-label="The Download icon" %} **Download** or {% octicon "link-external" aria-label="The external link icon" %} **View**.
|
||||
1. 在“Resources(资源)”下要访问的报告右侧,单击 {% octicon "download" aria-label="The Download icon" %} **Download(下载)**或 {% octicon "link-external" aria-label="The external link icon" %} **View(查看)**。
|
||||
|
||||
{% data reusables.security.compliance-report-screenshot %}
|
||||
|
||||
## 延伸阅读
|
||||
|
||||
- "[Accessing compliance reports for your organization](/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/accessing-compliance-reports-for-your-organization)"
|
||||
- "[访问组织的合规性报告](/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/accessing-compliance-reports-for-your-organization)"
|
||||
|
||||
@@ -131,6 +131,16 @@ topics:
|
||||
| `repo.config.lock_anonymous_git_access` | 已锁定仓库的匿名 Git 读取权限设置,阻止仓库管理员更改(启用或禁用)此设置。 更多信息请参阅“[阻止用户更改匿名 Git 读取权限](/enterprise/{{ currentVersion }}/admin/guides/user-management/preventing-users-from-changing-anonymous-git-read-access)”。 |
|
||||
| `repo.config.unlock_anonymous_git_access` | 已解锁仓库的匿名 Git 读取权限设置,允许仓库管理员更改(启用或禁用)此设置。 更多信息请参阅“[阻止用户更改匿名 Git 读取权限](/enterprise/{{ currentVersion }}/admin/guides/user-management/preventing-users-from-changing-anonymous-git-read-access)”。{% endif %}
|
||||
|
||||
{% if secret-scanning-audit-log-custom-patterns %}
|
||||
## 秘密扫描
|
||||
|
||||
| 操作 | 描述 |
|
||||
| -- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| | `business_secret_scanning_custom_pattern.create` | Triggered when an enterprise-level custom pattern is published for secret scanning. For more information, see "[Defining custom patterns for secret scanning](/code-security/secret-scanning/defining-custom-patterns-for-secret-scanning#defining-a-custom-pattern-for-an-enterprise-account)." |
|
||||
| | `business_secret_scanning_custom_pattern.update` | Triggered when changes to an enterprise-level custom pattern are saved for secret scanning. |
|
||||
| | `business_secret_scanning_custom_pattern.delete` | Triggered when an enterprise-level custom pattern is removed from secret scanning. |
|
||||
{% endif %}
|
||||
|
||||
## 站点管理员工具
|
||||
|
||||
| 操作 | 描述 |
|
||||
|
||||
@@ -97,16 +97,10 @@ shortTitle: 将您的签名密钥告诉 Git
|
||||
{% data reusables.gpg.list-keys-with-note %}
|
||||
{% data reusables.gpg.copy-gpg-key-id %}
|
||||
{% data reusables.gpg.paste-gpg-key-id %}
|
||||
1. 要将 GPG 密钥添加到您的 bash 配置文件中,请运行以下命令:
|
||||
```shell
|
||||
$ if [ -r ~/.bash_profile ]; then echo 'export GPG_TTY=$(tty)' >> ~/.bash_profile; \
|
||||
else echo 'export GPG_TTY=$(tty)' >> ~/.profile; fi
|
||||
1. To add your GPG key to your `.bashrc` startup file, run the following command:
|
||||
```bash
|
||||
$ [ -f ~/.bashrc ] && echo 'export GPG_TTY=$(tty)' >> ~/.bashrc
|
||||
```
|
||||
{% note %}
|
||||
|
||||
**注:**如果您没有 `.bash_profile`,此命令会将 GPG 密钥添加到 `.profile`。
|
||||
|
||||
{% endnote %}
|
||||
|
||||
{% endlinux %}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: One-time payments for customers in India
|
||||
intro: Customers in India who have been impacted by the Reserve Bank of India's recurring payment regulation can now make one-time payments for their GitHub subscriptions and services.
|
||||
title: 印度客户的一次性付款
|
||||
intro: 受印度储备银行经常性支付法规影响的印度客户现在可以为其 GitHub 订阅和服务进行一次性付款。
|
||||
redirect_from:
|
||||
- /early-access/billing/india-rbi-regulation
|
||||
versions:
|
||||
@@ -10,15 +10,15 @@ topics:
|
||||
- Billing
|
||||
- Sponsors
|
||||
- Policy
|
||||
shortTitle: India one-time payments
|
||||
shortTitle: 印度一次性付款
|
||||
---
|
||||
|
||||
|
||||
## About the Reserve Bank of India's recurring payments regulation
|
||||
## 关于印度储备银行的经常性支付法规
|
||||
|
||||
A new payments regulation from the Reserve Bank of India (RBI) recently came into effect. This regulation places additional requirements on recurring online transactions and has prevented some {% data variables.product.company_short %} customers in India from making recurring payments. Customers using payment methods issued in India for any recurring transactions on {% data variables.product.product_name %} may find that their payments are declined by their banks or card issuers. For more information, see [the RBI's press release](https://www.rbi.org.in/Scripts/BS_PressReleaseDisplay.aspx?prid=51353).
|
||||
印度储备银行 (RBI) 的一项新支付法规最近生效。 该法规对经常性在线交易提出了额外的要求,并阻止印度一些 {% data variables.product.company_short %} 客户进行定期付款。 对 {% data variables.product.product_name %} 上的任何定期交易使用印度颁布的付款方式的客户,可能会发现他们的付款被银行或发卡机构拒绝。 更多信息请参阅 [RBI 的新闻稿](https://www.rbi.org.in/Scripts/BS_PressReleaseDisplay.aspx?prid=51353)。
|
||||
|
||||
The regulation applies to all recurring transactions, including:
|
||||
该法规适用于所有经常性交易,包括:
|
||||
- {% data variables.product.prodname_dotcom %} plan subscriptions (Pro, Team, Enterprise)
|
||||
- {% data variables.product.prodname_marketplace %} purchases
|
||||
- {% data variables.product.prodname_sponsors %} transactions
|
||||
@@ -63,3 +63,4 @@ Existing sponsorships will remain in place during this period and maintainers wi
|
||||
4. Review your billing and payment information. If you need to make an edit, click **Edit** next to the relevant section. Otherwise, click **Submit payment**. 
|
||||
5. Optionally, if you clicked **Edit**, make any necessary changes, and then click **Submit payment**. 
|
||||
6. Once payment for the current billing cycle has been successfully made, the **Pay now** button on your "Billing & plans" page will be disabled until your next payment is due. 
|
||||
|
||||
|
||||
@@ -17,29 +17,29 @@ topics:
|
||||
{% data reusables.code-scanning.beta %}
|
||||
{% data reusables.code-scanning.enterprise-enable-code-scanning %}
|
||||
|
||||
## 关于 {% data variables.product.prodname_code_scanning %} 中的警报
|
||||
## About alerts from {% data variables.product.prodname_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)”。
|
||||
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)."
|
||||
|
||||
默认情况下, {% data variables.product.prodname_code_scanning %} 定期在默认分支和拉取请求中分析您的代码。 有关管理拉取请求中的警报的更多信息,请参阅“[对拉取请求中的 {% data variables.product.prodname_code_scanning %} 警报分类](/code-security/secure-coding/triaging-code-scanning-alerts-in-pull-requests)”。
|
||||
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)."
|
||||
|
||||
## About alert details
|
||||
|
||||
每个警报都会高亮显示代码的问题以及识别该问题的工具名称。 You can see the line of code that triggered the alert, as well as properties of the alert, such as the alert severity{% ifversion fpt or ghes > 3.1 or ghae or ghec %}, security severity,{% endif %} and the nature of the problem. 警报还会告知该问题第一次被引入的时间。 对于由 {% data variables.product.prodname_codeql %} 分析确定的警报,您还会看到如何解决问题的信息。
|
||||
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{% ifversion fpt or ghes > 3.1 or ghae or ghec %}, security severity,{% endif %} 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 %}
|
||||
{% data reusables.code-scanning.alert-default-branch %}
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6249 %}
|
||||

|
||||

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

|
||||

|
||||
{% endif %}
|
||||
|
||||
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. 数据流分析将查找代码中的潜在安全问题,例如:不安全地使用数据、将危险参数传递给函数以及泄漏敏感信息。
|
||||
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.
|
||||
|
||||
当 {% data variables.product.prodname_code_scanning %} 报告数据流警报时,{% data variables.product.prodname_dotcom %} 将显示数据在代码中如何移动。 {% data variables.product.prodname_code_scanning_capc %} 可用于识别泄露敏感信息的代码区域,以及可能成为恶意用户攻击切入点的代码区域。
|
||||
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.
|
||||
|
||||
### About severity levels
|
||||
|
||||
@@ -56,6 +56,22 @@ To calculate the security severity of an alert, we use Common Vulnerability Scor
|
||||
|
||||
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)."{% endif %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.4 or ghae-issue-6251 or ghec %}
|
||||
### About analysis origins
|
||||
|
||||
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 %} assigns a category label to alerts that are not found in application code. The label relates to the location of the alert.
|
||||
@@ -108,13 +124,13 @@ The default {% data variables.product.prodname_codeql %} query suites do not inc
|
||||
When you update your workflow to run an additional query suite this will increase the analysis time.
|
||||
|
||||
``` yaml
|
||||
- uses: github/codeql-action/init@v1
|
||||
- uses: {% data reusables.actions.action-codeql-action-init %}
|
||||
with:
|
||||
# Run extended queries including queries using machine learning
|
||||
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
|
||||
|
||||
|
||||
@@ -193,13 +193,11 @@ For recommended specifications (RAM, CPU cores, and disk) for running {% data va
|
||||
|
||||
In general, you do not need to worry about where the {% data variables.product.prodname_codeql_workflow %} places {% data variables.product.prodname_codeql %} databases since later steps will automatically find databases created by previous steps. However, if you are writing a custom workflow step that requires the {% data variables.product.prodname_codeql %} database to be in a specific disk location, for example to upload the database as a workflow artifact, you can specify that location using the `db-location` parameter under the `init` action.
|
||||
|
||||
{% raw %}
|
||||
``` yaml
|
||||
- uses: github/codeql-action/init@v1
|
||||
- uses: {% data reusables.actions.action-codeql-action-init %}
|
||||
with:
|
||||
db-location: '${{ github.workspace }}/codeql_dbs'
|
||||
db-location: {% raw %}'${{ github.workspace }}/codeql_dbs'{% endraw %}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
The {% data variables.product.prodname_codeql_workflow %} will expect the path provided in `db-location` to be writable, and either not exist, or be an empty directory. When using this parameter in a job running on a self-hosted runner or using a Docker container, it's the responsibility of the user to ensure that the chosen directory is cleared between runs, or that the databases are removed once they are no longer needed. {% ifversion fpt or ghec or ghes %} This is not necessary for jobs running on {% data variables.product.prodname_dotcom %}-hosted runners, which obtain a fresh instance and a clean filesystem each time they run. For more information, see "[About {% data variables.product.prodname_dotcom %}-hosted runners](/actions/using-github-hosted-runners/about-github-hosted-runners)."{% endif %}
|
||||
|
||||
@@ -232,7 +230,7 @@ jobs:
|
||||
If your workflow does not contain a matrix called `language`, then {% data variables.product.prodname_codeql %} is configured to run analysis sequentially. If you don't specify languages in the workflow, {% data variables.product.prodname_codeql %} automatically detects, and attempts to analyze, any supported languages in the repository. If you want to choose which languages to analyze, without using a matrix, you can use the `languages` parameter under the `init` action.
|
||||
|
||||
```yaml
|
||||
- uses: github/codeql-action/init@v1
|
||||
- uses: {% data reusables.actions.action-codeql-action-init %}
|
||||
with:
|
||||
languages: cpp, csharp, python
|
||||
```
|
||||
@@ -257,9 +255,9 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: {% data reusables.actions.action-setup-python %}
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install dependencies
|
||||
@@ -272,7 +270,7 @@ jobs:
|
||||
# that includes the dependencies
|
||||
echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
uses: {% data reusables.actions.action-codeql-action-init %}
|
||||
with:
|
||||
languages: python
|
||||
# Override the default behavior so that the action doesn't attempt
|
||||
@@ -288,17 +286,15 @@ Use `category` to distinguish between multiple analyses for the same tool and co
|
||||
|
||||
This parameter is particularly useful if you work with monorepos and have multiple SARIF files for different components of the monorepo.
|
||||
|
||||
{% raw %}
|
||||
``` yaml
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze
|
||||
uses: {% data reusables.actions.action-codeql-action-analyze %}
|
||||
with:
|
||||
# Optional. Specify a category to distinguish between multiple analyses
|
||||
# for the same tool and ref. If you don't use `category` in your workflow,
|
||||
# GitHub will generate a default category name for you
|
||||
category: "my_category"
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
If you don't specify a `category` parameter in your workflow, {% data variables.product.product_name %} will generate a category name for you, based on the name of the workflow file triggering the action, the action name, and any matrix variables. For example:
|
||||
- The `.github/workflows/codeql-analysis.yml` workflow and the `analyze` action will produce the category `.github/workflows/codeql.yml:analyze`.
|
||||
@@ -319,7 +315,7 @@ Your specified category will not overwrite the details of the `runAutomationDeta
|
||||
|
||||
{% data reusables.code-scanning.beta-codeql-packs-cli %}
|
||||
|
||||
To add one or more {% data variables.product.prodname_codeql %} query packs (beta), add a `with: packs:` entry within the `uses: github/codeql-action/init@v1` section of the workflow. Within `packs` you specify one or more packages to use and, optionally, which version to download. Where you don't specify a version, the latest version is downloaded. If you want to use packages that are not publicly available, you need to set the `GITHUB_TOKEN` environment variable to a secret that has access to the packages. For more information, see "[Authentication in a workflow](/actions/reference/authentication-in-a-workflow)" and "[Encrypted secrets](/actions/reference/encrypted-secrets)."
|
||||
To add one or more {% data variables.product.prodname_codeql %} query packs (beta), add a `with: packs:` entry within the `uses: {% data reusables.actions.action-codeql-action-init %}` section of the workflow. Within `packs` you specify one or more packages to use and, optionally, which version to download. Where you don't specify a version, the latest version is downloaded. If you want to use packages that are not publicly available, you need to set the `GITHUB_TOKEN` environment variable to a secret that has access to the packages. For more information, see "[Authentication in a workflow](/actions/reference/authentication-in-a-workflow)" and "[Encrypted secrets](/actions/reference/encrypted-secrets)."
|
||||
|
||||
{% note %}
|
||||
|
||||
@@ -329,28 +325,24 @@ To add one or more {% data variables.product.prodname_codeql %} query packs (bet
|
||||
|
||||
In the example below, `scope` is the organization or personal account that published the package. When the workflow runs, the three {% data variables.product.prodname_codeql %} query packs are downloaded from {% data variables.product.product_name %} and the default queries or query suite for each pack run. The latest version of `pack1` is downloaded as no version is specified. Version 1.2.3 of `pack2` is downloaded, as well as the latest version of `pack3` that is compatible with version 1.2.3.
|
||||
|
||||
{% raw %}
|
||||
``` yaml
|
||||
- uses: github/codeql-action/init@v1
|
||||
- uses: {% data reusables.actions.action-codeql-action-init %}
|
||||
with:
|
||||
# Comma-separated list of packs to download
|
||||
packs: scope/pack1,scope/pack2@1.2.3,scope/pack3@~1.2.3
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### Using queries in QL packs
|
||||
{% endif %}
|
||||
To add one or more queries, add a `with: queries:` entry within the `uses: github/codeql-action/init@v1` section of the workflow. If the queries are in a private repository, use the `external-repository-token` parameter to specify a token that has access to checkout the private repository.
|
||||
To add one or more queries, add a `with: queries:` entry within the `uses: {% data reusables.actions.action-codeql-action-init %}` section of the workflow. If the queries are in a private repository, use the `external-repository-token` parameter to specify a token that has access to checkout the private repository.
|
||||
|
||||
{% raw %}
|
||||
``` yaml
|
||||
- uses: github/codeql-action/init@v1
|
||||
- uses: {% data reusables.actions.action-codeql-action-init %}
|
||||
with:
|
||||
queries: COMMA-SEPARATED LIST OF PATHS
|
||||
# Optional. Provide a token to access queries stored in private repositories.
|
||||
external-repository-token: ${{ secrets.ACCESS_TOKEN }}
|
||||
external-repository-token: {% raw %}${{ secrets.ACCESS_TOKEN }}{% endraw %}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
You can also specify query suites in the value of `queries`. Query suites are collections of queries, usually grouped by purpose or language.
|
||||
|
||||
@@ -365,13 +357,13 @@ If you also use a configuration file for custom settings, any additional {% if c
|
||||
In the following example, the `+` symbol ensures that the specified additional {% if codeql-packs %}packs and {% endif %}queries are used together with any specified in the referenced configuration file.
|
||||
|
||||
``` yaml
|
||||
- uses: github/codeql-action/init@v1
|
||||
- uses: {% data reusables.actions.action-codeql-action-init %}
|
||||
with:
|
||||
config-file: ./.github/codeql/codeql-config.yml
|
||||
queries: +security-and-quality,octo-org/python-qlpack/show_ifs.ql@main
|
||||
{%- if codeql-packs %}
|
||||
packs: +scope/pack1,scope/pack2@v1.2.3
|
||||
{% endif %}
|
||||
{%- endif %}
|
||||
```
|
||||
|
||||
## Using a custom configuration file
|
||||
@@ -381,7 +373,7 @@ A custom configuration file is an alternative way to specify additional {% if co
|
||||
In the workflow file, use the `config-file` parameter of the `init` action to specify the path to the configuration file you want to use. This example loads the configuration file _./.github/codeql/codeql-config.yml_.
|
||||
|
||||
``` yaml
|
||||
- uses: github/codeql-action/init@v1
|
||||
- uses: {% data reusables.actions.action-codeql-action-init %}
|
||||
with:
|
||||
config-file: ./.github/codeql/codeql-config.yml
|
||||
```
|
||||
@@ -390,13 +382,11 @@ In the workflow file, use the `config-file` parameter of the `init` action to sp
|
||||
|
||||
If the configuration file is located in an external private repository, use the `external-repository-token` parameter of the `init` action to specify a token that has access to the private repository.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
- uses: github/codeql-action/init@v1
|
||||
- uses: {% data reusables.actions.action-codeql-action-init %}
|
||||
with:
|
||||
external-repository-token: ${{ secrets.ACCESS_TOKEN }}
|
||||
external-repository-token: {% raw %}${{ secrets.ACCESS_TOKEN }}{% endraw %}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
The settings in the configuration file are written in YAML format.
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ If your repository contains multiple compiled languages, you can specify languag
|
||||
```yaml
|
||||
- if: matrix.language == 'cpp' || matrix.language == 'csharp'
|
||||
name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
uses: {% data reusables.actions.action-codeql-action-autobuild %}
|
||||
|
||||
- if: matrix.language == 'java'
|
||||
name: Build Java
|
||||
|
||||
@@ -167,6 +167,14 @@ Alerts may be fixed in one branch but not in another. You can use the "Branch" f
|
||||
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6249 %}
|
||||
{% data reusables.code-scanning.filter-non-default-branches %}
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.4 or ghae-issue-6251 or ghec %}
|
||||
{% note %}
|
||||
|
||||
**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 %}
|
||||
## Dismissing or deleting alerts
|
||||
|
||||
There are two ways of closing an alert. You can fix the problem in the code, or you can dismiss the alert. 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.
|
||||
|
||||
@@ -82,9 +82,9 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Initialize {% data variables.product.prodname_codeql %}
|
||||
uses: github/codeql-action/init@v1
|
||||
uses: {% data reusables.actions.action-codeql-action-init %}
|
||||
with:
|
||||
languages: {% raw %}${{ matrix.language }}{% endraw %}
|
||||
- name: Build
|
||||
@@ -92,5 +92,5 @@ jobs:
|
||||
./configure
|
||||
make
|
||||
- name: Perform {% data variables.product.prodname_codeql %} Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
uses: {% data reusables.actions.action-codeql-action-analyze %}
|
||||
```
|
||||
|
||||
@@ -33,6 +33,10 @@ 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 %}
|
||||
{% data reusables.code-scanning.about-analysis-origins-link %}
|
||||
{% endif %}
|
||||
|
||||
{% ifversion ghes or ghae %}
|
||||
{% note %}
|
||||
|
||||
|
||||
@@ -51,10 +51,11 @@ You can obtain artifacts to help you debug {% data variables.product.prodname_co
|
||||
|
||||
```yaml
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
uses: {% data reusables.actions.action-codeql-action-init %}
|
||||
with:
|
||||
debug: true
|
||||
```
|
||||
|
||||
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 %} code scanning. If you contact GitHub support, they might ask for this data.
|
||||
@@ -86,7 +87,7 @@ If an automatic build of code for a compiled language within your project fails,
|
||||
steps:
|
||||
...
|
||||
- name: Initialize {% data variables.product.prodname_codeql %}
|
||||
uses: github/codeql-action/init@v1
|
||||
uses: {% data reusables.actions.action-codeql-action-init %}
|
||||
with:
|
||||
languages: {% raw %}${{ matrix.language }}{% endraw %}
|
||||
```
|
||||
@@ -151,7 +152,7 @@ You may be able to understand why some source files haven't been analyzed by ins
|
||||
|
||||
```yaml
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
uses: {% data reusables.actions.action-codeql-action-init %}
|
||||
with:
|
||||
debug: true
|
||||
```
|
||||
@@ -294,11 +295,11 @@ The revised `steps` section of the workflow will look like this:
|
||||
```yaml
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
|
||||
# Initializes the {% data variables.product.prodname_codeql %} tools for scanning.
|
||||
- name: Initialize {% data variables.product.prodname_codeql %}
|
||||
uses: github/codeql-action/init@v1
|
||||
uses: {% data reusables.actions.action-codeql-action-init %}
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
@@ -28,6 +28,10 @@ As an alternative to running {% data variables.product.prodname_code_scanning %}
|
||||
|
||||
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)."
|
||||
|
||||
{% ifversion fpt or ghes > 3.4 or ghae-issue-6251 or ghec %}
|
||||
{% data reusables.code-scanning.about-analysis-origins-link %}
|
||||
{% endif %}
|
||||
|
||||
## Integrations with webhooks
|
||||
|
||||
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)."
|
||||
|
||||
@@ -94,9 +94,9 @@ jobs:
|
||||
steps:
|
||||
# This step checks out a copy of your repository.
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Upload SARIF file
|
||||
uses: github/codeql-action/upload-sarif@v1
|
||||
uses: {% data reusables.actions.action-codeql-action-upload-sarif %}
|
||||
with:
|
||||
# Path to SARIF file relative to the root of the repository
|
||||
sarif_file: results.sarif
|
||||
@@ -133,7 +133,7 @@ jobs:
|
||||
actions: read
|
||||
contents: read{% endif %}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: {% data reusables.actions.action-checkout %}
|
||||
- name: Run npm install
|
||||
run: npm install
|
||||
# Runs the ESlint code analysis
|
||||
@@ -141,7 +141,7 @@ jobs:
|
||||
# eslint exits 1 if it finds anything to report
|
||||
run: node_modules/.bin/eslint build docs lib script spec-main -f node_modules/@microsoft/eslint-formatter-sarif/sarif.js -o results.sarif || true
|
||||
# Uploads results.sarif to GitHub repository using the upload-sarif action
|
||||
- uses: github/codeql-action/upload-sarif@v1
|
||||
- uses: {% data reusables.actions.action-codeql-action-upload-sarif %}
|
||||
with:
|
||||
# Path to SARIF file relative to the root of the repository
|
||||
sarif_file: results.sarif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user