1
0
mirror of synced 2025-12-30 03:01:36 -05:00

New translation batch for cn (#33553)

This commit is contained in:
docubot
2022-12-14 12:03:48 -05:00
committed by GitHub
parent 87cdab9de2
commit ebe9ad53d5
1137 changed files with 43613 additions and 19864 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
---
title: Managing your subscriptions
intro: 'To help you manage your notifications efficiently, there are several ways to unsubscribe.'
title: 管理订阅
intro: 为帮助您有效地管理通知,提供了多种取消订阅的方法。
versions:
fpt: '*'
ghes: '*'
@@ -12,73 +12,79 @@ redirect_from:
- /github/managing-subscriptions-and-notifications-on-github/managing-your-subscriptions
- /github/managing-subscriptions-and-notifications-on-github/managing-subscriptions-for-activity-on-github/managing-your-subscriptions
shortTitle: Manage your subscriptions
ms.openlocfilehash: 750a3a9ad87ff9aa709b84a98f548d85d53072ee
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/10/2022
ms.locfileid: '145087363'
---
To help you understand your subscriptions and decide whether to unsubscribe, see "[Viewing your subscriptions](/github/managing-subscriptions-and-notifications-on-github/viewing-your-subscriptions)."
为了帮助了解订阅并决定是否取消订阅,请参阅“[查看订阅](/github/managing-subscriptions-and-notifications-on-github/viewing-your-subscriptions)”。
{% note %}
**Note:** Instead of unsubscribing, you have the option to ignore a repository. If you ignore a repository, you won't receive any notifications. We don't recommend ignoring repositories as you won't be notified if you're @mentioned. {% ifversion fpt or ghec %}If you're experiencing abuse and want to ignore a repository, please contact {% data variables.contact.contact_support %} so we can help. {% data reusables.policies.abuse %}{% endif %}
注意:可以选择忽略存储库,而不是取消订阅。 如果忽略仓库,将不会收到任何通知。 不建议忽略存储库,因为如果你被 @mentioned,你将不会收到通知。 {% ifversion fpt or ghec %} 如果遇到滥用行为并想要忽略存储库,请联系 {% data variables.contact.contact_support %} 以获取帮助。 {% data reusables.policies.abuse %}{% endif %}
{% endnote %}
## Choosing how to unsubscribe
## 选择如何取消订阅
To unwatch (or unsubscribe from) repositories quickly, navigate to [github.com/watching](https://github.com/watching) to see all the repositories you're following. For more information, see "[Unwatching repositories](#unwatching-repositories)."
若要快速取消关注(或取消订阅)存储库,请导航至 [github.com/watching](https://github.com/watching)查看你所关注的所有存储库。 有关详细信息,请参阅“[取消关注存储库](#unwatching-repositories)”。
To unsubscribe from multiple notifications at the same time, you can unsubscribe using your inbox or on the subscriptions page. Both of these options offer more context about your subscriptions than the "Watched repositories" page.
要同时取消订阅多个通知,您可以使用收件箱或订阅页面上取消订阅。 相比“Watched repositories已关注仓库”页面这两个选项可提供有关您的订阅的更多上下文。
### Benefits of unsubscribing from your inbox
### 从收件箱中取消订阅的优点
When you unsubscribe from notifications in your inbox, you have several other triaging options and can filter your notifications by custom filters and discussion types. For more information, see "[Managing notifications from your inbox](/github/managing-subscriptions-and-notifications-on-github/managing-notifications-from-your-inbox)."
在收件箱中取消订阅通知时,您还有其他一些分类选项,并且可以按自定义过滤器和讨论类型来过滤通知。 有关详细信息,请参阅“[管理收件箱中的通知](/github/managing-subscriptions-and-notifications-on-github/managing-notifications-from-your-inbox)”。
### Benefits of unsubscribing from the subscriptions page
### 从订阅页面取消订阅的优点
When you unsubscribe from notifications on the subscriptions page, you can see more of the notifications you're subscribed to and sort them by "Most recently subscribed" or "Least recently subscribed".
在订阅页面上取消订阅通知时,您可以查看更多已订阅的通知,并且可以按“最多最近订阅”或“最少最近订阅”对它们进行排序。
The subscriptions page shows you all of the notifications that you're currently subscribed to, including notifications that you have marked as **Done** in your inbox.
订阅页将显示当前订阅的所有通知,包括在收件箱中标记为“完成”的通知。
You can only filter your subscriptions by repository and the reason you're receiving the notification.
您只能按仓库和接收通知的原因过滤订阅。
## Unsubscribing from notifications in your inbox
## 在收件箱中取消订阅通知
When you unsubscribe from notifications in your inbox, they will automatically disappear from your inbox.
当您取消订阅收件箱中的通知时,它们将自动从您的收件箱中消失。
{% data reusables.notifications.access_notifications %}
1. From the notifications inbox, select the notifications you want to unsubscribe to.
2. Click **Unsubscribe.**
![Unsubscribe option from main inbox](/assets/images/help/notifications-v2/unsubscribe-from-main-inbox.png)
1. 从通知收件箱中选择您想要取消订阅的通知。
2. 单击“取消订阅”。
![主收件箱中的“取消订阅”选项](/assets/images/help/notifications-v2/unsubscribe-from-main-inbox.png)
## Unsubscribing from notifications on the subscriptions page
## 从订阅页面取消订阅通知
{% data reusables.notifications.access_notifications %}
1. In the left sidebar, under the list of repositories, use the "Manage notifications" drop-down to click **Subscriptions**.
![Manage notifications drop down menu options](/assets/images/help/notifications-v2/manage-notifications-options.png)
1. 在左侧边栏存储库列表下的“管理通知”下拉菜单中单击“订阅”。
![管理通知下拉菜单选项](/assets/images/help/notifications-v2/manage-notifications-options.png)
2. Select the notifications you want to unsubscribe to. In the top right, click **Unsubscribe.**
![Subscriptions page](/assets/images/help/notifications-v2/unsubscribe-from-subscriptions-page.png)
2. 选择要取消订阅的通知。 单击右上角的“取消订阅”。
![订阅页面](/assets/images/help/notifications-v2/unsubscribe-from-subscriptions-page.png)
## Unwatching repositories
## 取消关注仓库
When you unwatch a repository, you unsubscribe from future updates from that repository unless you participate in a conversation or are @mentioned.
如果取消关注存储库,将取消订阅该存储库的未来更新,除非参与对话或被 @mentioned
{% data reusables.notifications.access_notifications %}
1. In the left sidebar, under the list of repositories, use the "Manage notifications" drop-down to click **Watched repositories**.
1. 在左侧边栏存储库列表下的“管理通知”下拉菜单中单击“已关注的存储库”。
![Manage notifications drop down menu options](/assets/images/help/notifications-v2/manage-notifications-options.png)
![管理通知下拉菜单选项](/assets/images/help/notifications-v2/manage-notifications-options.png)
2. On the watched repositories page, after you've evaluated the repositories you're watching, choose whether to:
2. 在关注的仓库页面上,评估您关注的仓库后,选择是否:
- Unwatch a repository
- Ignore all notifications for a repository
- If enabled, customize the types of event you receive notifications for ({% data reusables.notifications-v2.custom-notification-types %})
- 取消关注仓库
- 忽略某仓库的所有通知
- 如有启用,请自定义接收通知的事件类型({% data reusables.notifications-v2.custom-notification-types %}
{%- ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
1. Optionally, to unsubscribe from all repositories owned by a given user or organization, select the **Unwatch all** dropdown and click the organization whose repositories you'd like to unsubscribe from. The button to unwatch all repositories is only available if you are watching all activity or custom notifications on over 10 repositories.
{%- ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5819 %}
1. (可选)要取消订阅指定用户或组织拥有的所有存储库,请选择“全部取消关注”下拉列表,然后单击要取消订阅其存储库的组织 ****。 取消关注所有存储库的按钮仅在您正在关注超过 10 个存储库上的所有活动或自定义通知时才可用。
![Screenshot of the Unwatch All button.](/assets/images/help/notifications-v2/unsubscribe-from-all-repos.png)
![“全部取消关注”按钮的屏幕截图](/assets/images/help/notifications-v2/unsubscribe-from-all-repos.png)
- Click **Unwatch** to confirm that you want to unwatch the repositories owned by the selected user or organization, or click **Cancel** to cancel.
- 单击“取消关注”以确认要取消关注所选用户或组织拥有的存储库,或单击“取消”以取消关注 。
![Screenshot of the unwatch all confirmation dialogue.](/assets/images/help/notifications-v2/unwatch-repo-dialog.png)
![全部取消关注确认对话框的屏幕截图。](/assets/images/help/notifications-v2/unwatch-repo-dialog.png)
{% endif %}

View File

@@ -1,6 +1,6 @@
---
title: Viewing your subscriptions
intro: 'To understand where your notifications are coming from and your notifications volume, we recommend reviewing your subscriptions and watched repositories regularly.'
title: 查看订阅
intro: 为了解通知来自何处以及通知量,建议定期查看订阅和关注的仓库。
redirect_from:
- /articles/subscribing-to-conversations
- /articles/unsubscribing-from-conversations
@@ -24,61 +24,63 @@ versions:
topics:
- Notifications
shortTitle: View subscriptions
ms.openlocfilehash: 34faad79004d34f5beb14e8992b9aff4e6a3ab39
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/10/2022
ms.locfileid: '145099202'
---
You receive notifications for your subscriptions of ongoing activity on {% data variables.product.product_name %}. There are many reasons you can be subscribed to a conversation. For more information, see "[About notifications](/github/managing-subscriptions-and-notifications-on-github/about-notifications#notifications-and-subscriptions)."
接收 {% data variables.product.product_name %} 上长期活动的订阅通知。 有很多原因可能导致您订阅对话。 有关详细信息,请参阅“[关于通知](/github/managing-subscriptions-and-notifications-on-github/about-notifications#notifications-and-subscriptions)”。
We recommend auditing and unsubscribing from your subscriptions as a part of a healthy notifications workflow. For more information about your options for unsubscribing, see "[Managing subscriptions](/github/managing-subscriptions-and-notifications-on-github/managing-your-subscriptions)."
我们建议将审核订阅和取消订阅作为健康通知工作流程的一部分。 有关取消订阅的选项的详细信息,请参阅“[管理订阅](/github/managing-subscriptions-and-notifications-on-github/managing-your-subscriptions)”。
## Diagnosing why you receive too many notifications
## 诊断收到太多通知的原因
When your inbox has too many notifications to manage, consider whether you have oversubscribed or how you can change your notification settings to reduce the subscriptions you have and the types of notifications you're receiving. For example, you may consider disabling the settings to automatically watch all repositories and all team discussions whenever you've joined a team or repository.
当收件箱中要管理的通知过多时,请考虑您是否订阅过多,或者如何更改通知设置以减少订阅数量和接收的通知类型。 例如,您可以考虑禁用在加入团队或仓库时自动关注所有仓库和所有团队讨论的设置。
{% ifversion update-notification-settings-22 %}
![Screenshot of automatic watching options for teams and repositories](/assets/images/automatically-watch-repos-and-teams.png)
{% else %}
![Screenshot of automatic watching options for teams and repositories](/assets/images/help/notifications-v2/automatic-watching-example.png){% endif %}
![自动关注](/assets/images/help/notifications-v2/automatic-watching-example.png)
For more information, see "[Configuring notifications](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#automatic-watching)."
有关详细信息,请参阅“[配置通知](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#automatic-watching)”。
To see an overview of your repository subscriptions, see "[Reviewing repositories that you're watching](#reviewing-repositories-that-youre-watching)."
{% tip %}
若要查看存储库订阅概述,请参阅“[查看正在关注的存储库](#reviewing-repositories-that-youre-watching)”。 {% tip %}
**Tip:** You can select the types of event to be notified of by using the **Custom** option of the **Watch/Unwatch** dropdown list in your [watching page](https://github.com/watching) or on any repository page on {% data variables.product.product_name %}. For more information, see "[Configuring notifications](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#configuring-your-watch-settings-for-an-individual-repository)."
**提示:** 你可以在 [关注页面](https://github.com/watching) {% data variables.product.product_name %} 上的任何存储库页面,使用“关注/取消关注”下拉列表中的“自定义”选项选择要通知的事件类型 。 有关详细信息,请参阅“[配置通知](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#configuring-your-watch-settings-for-an-individual-repository)”。
{% endtip %}
Many people forget about repositories that they've chosen to watch in the past. From the "Watched repositories" page you can quickly unwatch repositories. For more information on ways to unsubscribe, see "[Unwatch recommendations](https://github.blog/changelog/2020-11-10-unwatch-recommendations/)" on {% data variables.product.prodname_blog %} and "[Managing your subscriptions](/github/managing-subscriptions-and-notifications-on-github/managing-your-subscriptions)." You can also create a triage workflow to help with the notifications you receive. For guidance on triage workflows, see "[Customizing a workflow for triaging your notifications](/github/managing-subscriptions-and-notifications-on-github/customizing-a-workflow-for-triaging-your-notifications)."
许多人忘记了他们过去选择关注的仓库。 从“Watched repositories已关注仓库”页面您可以快速取消关注仓库。 有关取消订阅的方式的详细信息,请参阅 {% data variables.product.prodname_blog %} 上的“[取消关注建议](https://github.blog/changelog/2020-11-10-unwatch-recommendations/)”和“[管理订阅](/github/managing-subscriptions-and-notifications-on-github/managing-your-subscriptions)”。 您也可以创建分类工作流程来帮助整理收到的通知。 有关分类工作流的指导,请参阅“[自定义对通知进行分类的工作流](/github/managing-subscriptions-and-notifications-on-github/customizing-a-workflow-for-triaging-your-notifications)”。
## Reviewing all of your subscriptions
## 查看所有订阅
{% data reusables.notifications.access_notifications %}
1. In the left sidebar, under the list of repositories that you have notifications from, use the "Manage notifications" drop-down to click **Subscriptions**.
![Manage notifications drop down menu options](/assets/images/help/notifications-v2/manage-notifications-options.png)
1. 在左侧边栏中你接收其通知的存储库列表下,在“管理通知”下拉菜单中单击“订阅”。
![“管理通知”下拉菜单选项](/assets/images/help/notifications-v2/manage-notifications-options.png)
2. Use the filters and sort to narrow the list of subscriptions and begin unsubscribing to conversations you no longer want to receive notifications for.
2. 使用过滤器和排序来缩小订阅列表,并开始取消订阅您不想再接收其通知的对话。
![Subscriptions page](/assets/images/help/notifications-v2/all-subscriptions.png)
![订阅页面](/assets/images/help/notifications-v2/all-subscriptions.png)
{% tip %}
**Tips:**
- To review subscriptions you may have forgotten about, sort by "least recently subscribed."
**提示:**
- 要查看您可能忘记了的订阅,请按“least recently subscribed(最近最少订阅)”进行排序。
- To review a list of repositories that you can still receive notifications for, see the repository list in the "filter by repository" drop-down menu.
- 要查看您仍然可以接收其通知的仓库列表,请查看“filter by repository(按仓库过滤)”下拉菜单中的仓库列表。
{% endtip %}
## Reviewing repositories that you're watching
## 查看您目前关注的仓库
1. In the left sidebar, under the list of repositories, use the "Manage notifications" drop-down menu and click **Watched repositories**.
![Manage notifications drop down menu options](/assets/images/help/notifications-v2/manage-notifications-options.png)
2. Evaluate the repositories that you are watching and decide if their updates are still relevant and helpful. When you watch a repository, you will be notified of all conversations for that repository.
![Watched notifications page](/assets/images/help/notifications-v2/watched-notifications-custom.png)
1. 在左侧边栏的存储库列表下,在“管理通知”下拉菜单中单击“已关注的存储库”。
![“管理通知”下拉菜单选项](/assets/images/help/notifications-v2/manage-notifications-options.png)
2. 评估您正在关注的仓库,确定它们更新是否仍然相关和有用。 关注某仓库后,您将收到该仓库所有对话的通知。
![已关注的通知页面](/assets/images/help/notifications-v2/watched-notifications-custom.png)
{% tip %}
**Tip:** Instead of watching a repository, consider only receiving notifications when there are updates to {% data reusables.notifications-v2.custom-notification-types %} (if enabled for the repository), or any combination of these options, or completely unwatching a repository.
**提示:** 不要关注存储库,而是考虑仅当 {% data reusables.notifications-v2.custom-notification-types %}(如已为存储库启用)或这些选项的任意组合有更新时接收通知,或者完全取消关注存储库。
When you unwatch a repository, you can still be notified when you're @mentioned or participating in a thread. When you configure to receive notifications for certain event types, you're only notified when there are updates to these event types in the repository, you're participating in a thread, or you or a team you're on is @mentioned.
取消关注存储库后,当你被 @mentioned 或参与帖子时仍然会收到通知。 当配置为接收某些事件类型的通知时,仅当存储库中有这些事件类型的更新、你参与了线程或者你或你所在团队被 @mentioned 时才会收到通知。
{% endtip %}

View File

@@ -1,6 +1,6 @@
---
title: About notifications
intro: 'Notifications provide updates about the activity on {% data variables.location.product_location %} that you''ve subscribed to. You can use the notifications inbox to customize, triage, and manage your updates.'
title: 关于通知
intro: '通知提供有关你在 {% data variables.product.product_location %} 上已订阅活动的更新。 可以使用通知收件箱来自定义、分类和管理更新。'
redirect_from:
- /articles/notifications
- /articles/about-notifications
@@ -14,86 +14,90 @@ versions:
ghec: '*'
topics:
- Notifications
ms.openlocfilehash: 87034df88eb94c1d880806f01cb8748ed555a284
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147432022'
---
## 通知和订阅
## Notifications and subscriptions
可选择通过订阅接收有关 {% data variables.product.product_location %} 上的特定活动的持续更新。 通知是您收到的已订阅特定活动的更新。
You can choose to receive ongoing updates about specific activity on {% data variables.location.product_location %} through a subscription. Notifications are updates that you receive for specific activity that you are subscribed to.
### 订阅选项
### Subscription options
您可以选择订阅关于以下内容的通知:
- 关于特定议题、拉取请求或 Gist 的对话。
- 仓库或团队讨论中的所有活动。
- CI 活动,例如仓库中使用 {% data variables.product.prodname_actions %} 设置的工作流程的状态。
- 仓库 {% data reusables.notifications-v2.custom-notification-types %} (如果启用)。
You can choose to subscribe to notifications for:
- A conversation in a specific issue, pull request, or gist.
- All activity in a repository or team discussion.
- CI activity, such as the status of workflows in repositories set up with {% data variables.product.prodname_actions %}.
- Repository {% data reusables.notifications-v2.custom-notification-types %} (if enabled).
您也可以选择自动关注所有您有推送访问权限的仓库,但复刻除外。 可单击“关注”来手动关注你有权访问的任何其他存储库。
You can also choose to automatically watch all repositories that you have push access to, except forks. You can watch any other repository you have access to manually by clicking **Watch**.
如果您的某项对话不再感兴趣,您可以取消订阅、取消关注或自定义以后接收的通知类型。 例如,如果不想再接收特定存储库的通知,可单击“取消订阅”。 有关详细信息,请参阅“[管理订阅](/github/managing-subscriptions-and-notifications-on-github/managing-your-subscriptions)”。
If you're no longer interested in a conversation, you can unsubscribe, unwatch, or customize the types of notifications you'll receive in the future. For example, if you no longer want to receive notifications from a particular repository, you can click **Unsubscribe**. For more information, see "[Managing your subscriptions](/github/managing-subscriptions-and-notifications-on-github/managing-your-subscriptions)."
### 默认订阅
### Default subscriptions
一般来说,默认在以下情况下自动订阅对话:
- 在通知设置中未禁用自动关注您加入的仓库或团队。 默认情况下,此设置处于启用状态。
- 被分配了议题或拉取请求。
- 打开了拉取请求、议题或创建了团队讨论帖子。
- 在帖子中发表了评论。
- 通过单击“关注”或“订阅”手动订阅了帖子 。
- 向你的用户名执行了 @mentioned
- 更改了帖子的状态,例如通过关闭议题或合并拉取请求。
- 向你所属的团队执行了 @mentioned
In general, you are automatically subscribed to conversations by default when you have:
- Not disabled automatic watching for repositories or teams you've joined in your notification settings. This setting is enabled by default.
- Been assigned to an issue or pull request.
- Opened a pull request, issue, or created a team discussion post.
- Commented on a thread.
- Subscribed to a thread manually by clicking **Watch** or **Subscribe**.
- Had your username @mentioned.
- Changed the state of a thread, such as by closing an issue or merging a pull request.
- Had a team you're a member of @mentioned.
默认情况下,还会自动关注你创建的以及你的个人帐户所拥有的所有存储库。
By default, you also automatically watch all repositories that you create and are owned by your personal account.
要取消订阅自动订阅的对话,可更改通知设置,或者直接取消订阅或取消关注 {% data variables.product.product_location %} 上的活动。 有关详细信息,请参阅“[管理订阅](/github/managing-subscriptions-and-notifications-on-github/managing-your-subscriptions)”。
To unsubscribe from conversations you're automatically subscribed to, you can change your notification settings or directly unsubscribe or unwatch activity on {% data variables.location.product_location %}. For more information, see "[Managing your subscriptions](/github/managing-subscriptions-and-notifications-on-github/managing-your-subscriptions)."
## 自定义通知和订阅
## Customizing notifications and subscriptions
可选择通过 [https://github.com/notifications](https://github.com/notifications){% ifversion fpt or ghes or ghec %} 上和 {% data variables.product.prodname_mobile %} 应用中的通知收件箱查看通知{% endif %},或者通过电子邮件或这些选项的某种组合进行查看。
You can choose to view your notifications through the notifications inbox at [https://github.com/notifications](https://github.com/notifications){% ifversion fpt or ghes or ghec %} and in the {% data variables.product.prodname_mobile %} app{% endif %}, through your email, or some combination of these options.
要自定义您希望接收的更新类型以及将这些更新发送至何处,请配置通知设置。 有关详细信息,请参阅“[配置通知](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications)”。
To customize the types of updates you'd like to receive and where to send those updates, configure your notification settings. For more information, see "[Configuring notifications](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications)."
要保持订阅的可管理性,请审查您的订阅和关注的仓库,并根据需要取消订阅。 有关详细信息,请参阅“[在 GitHub 上管理活动的订阅](/github/managing-subscriptions-and-notifications-on-github/managing-subscriptions-for-activity-on-github)”。
To keep your subscriptions manageable, review your subscriptions and watched repositories and unsubscribe as needed. For more information, see "[Managing subscriptions for activity on GitHub](/github/managing-subscriptions-and-notifications-on-github/managing-subscriptions-for-activity-on-github)."
要自定义如何接收特定拉取请求或议题的更新,可以在议题或拉取请求中配置首选项。 有关详细信息,请参阅“[对单个通知进行分类](/github/managing-subscriptions-and-notifications-on-github/triaging-a-single-notification#customizing-when-to-receive-future-updates-for-an-issue-or-pull-request)”。
To customize how you'd like to receive updates for specific pull requests or issues, you can configure your preferences within the issue or pull request. For more information, see "[Triaging a single notification](/github/managing-subscriptions-and-notifications-on-github/triaging-a-single-notification#customizing-when-to-receive-future-updates-for-an-issue-or-pull-request)."
{% ifversion fpt or ghes or ghec %}
You can customize and schedule push notifications in the {% data variables.product.prodname_mobile %} app. For more information, see "[Configuring notifications](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#managing-your-notification-settings-with-github-mobile)."
{% ifversion fpt or ghes or ghec %} 可在 {% data variables.product.prodname_mobile %} 应用中自定义和安排推送通知。 有关详细信息,请参阅“[配置通知](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#managing-your-notification-settings-with-github-mobile)”。
{% endif %}
## Reasons for receiving notifications
## 接收通知的原因
Your inbox is configured with default filters, which represent the most common reasons that people need to follow-up on their notifications. For more information about inbox filters, see "[Managing notifications from your inbox](/github/managing-subscriptions-and-notifications-on-github/managing-notifications-from-your-inbox#default-notification-filters)."
您的收件箱配置了默认过滤器,它们代表人们需要跟进通知的最常见原因。 有关收件箱筛选器的详细信息,请参阅“[管理收件箱中的通知](/github/managing-subscriptions-and-notifications-on-github/managing-notifications-from-your-inbox#default-notification-filters)”。
Your inbox shows the `reasons` you're receiving notifications as a label.
收件箱以标签形式显示你接收通知的 `reasons`
![Reasons labels in inbox](/assets/images/help/notifications-v2/reasons-as-labels-in-inbox.png)
![收件箱中的原因标签](/assets/images/help/notifications-v2/reasons-as-labels-in-inbox.png)
You can filter your inbox by the reason you're subscribed to notifications. For example, to only see pull requests where someone requested your review, you can use the `review-requested` query filter.
您可以按订阅通知的原因过滤收件箱。 例如,要仅查看有人请求你审查的拉取请求,可使用 `review-requested` 查询筛选器。
![Filter notifications by review requested reason](/assets/images/help/notifications-v2/review-requested-reason.png)
![通过查看请求的原因过滤通知](/assets/images/help/notifications-v2/review-requested-reason.png)
If you've configured notifications to be sent by email and believe you're receiving notifications that don't belong to you, consider troubleshooting with email headers, which show the intended recipient. For more information, see "[Configuring notifications](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#filtering-email-notifications)."
如果您已将通知配置为通过电子邮件发送,但认为您收到了不属于自己的通知,请考虑使用显示预期收件人的电子邮件标头排除故障。 有关详细信息,请参阅“[配置通知](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#filtering-email-notifications)”。
## Triaging notifications from your inbox
## 从收件箱分类通知
To effectively manage your notifications, you can triage your inbox with options to:
- Remove a notification from the inbox with **Done**. You can review **Done** notifications all in one place by clicking **Done** in the sidebar or by using the query `is:done`.
- Mark a notification as read or unread.
- **Save** a notification for later review. **Saved** notifications are flagged in your inbox. You can review **Saved** notifications all in one place in the sidebar by clicking **Saved** or by using the query `is:saved`.
- Automatically unsubscribe from this notification and future updates from this conversation. Unsubscribing also removes the notification from your inbox. If you unsubscribe from a conversation and someone mentions your username or a team you're on that you're receiving updates for, then you will start to receive notifications from this conversation again.
为了有效地管理通知,您可以使用以下选项对收件箱进行分类:
- 从收件箱中删除带有“完成”标记的通知。 可单击边栏中的“完成”或使用 `is:done` 查询集中查看所有“已完成”的通知 。
- 将通知标记为已读或未读。
- 保存通知供以后查看。 已保存的通知会在收件箱中标记。 可在边栏中单击“已保存”或使用 `is:saved` 查询集中查看所有“已保存”的通知 。
- 自动取消订阅此通知和此对话的未来更新。 取消订阅还会从收件箱中删除通知。 如果您取消订阅了对话,但有人在此对话中提及您的用户名或您所在的团队(您正在为其接收更新),则您将再次开始接收此对话的通知。
From your inbox you can also triage multiple notifications at once. For more information, see "[Managing notifications from your inbox](/github/managing-subscriptions-and-notifications-on-github/managing-notifications-from-your-inbox#triaging-multiple-notifications-at-the-same-time)."
您还可以从收件箱中一次分类多个通知。 有关详细信息,请参阅“[管理收件箱中的通知](/github/managing-subscriptions-and-notifications-on-github/managing-notifications-from-your-inbox#triaging-multiple-notifications-at-the-same-time)”。
## Customizing your notifications inbox
## 自定义通知收件箱
To focus on a group of notifications in your inbox on {% data variables.location.product_location %}{% ifversion fpt or ghes or ghec %} or {% data variables.product.prodname_mobile %}{% endif %}, you can create custom filters. For example, you can create a custom filter for an open source project you contribute to and only see notifications for that repository in which you are mentioned. For more information, see "[Managing notifications from your inbox](/github/managing-subscriptions-and-notifications-on-github/managing-notifications-from-your-inbox)." For more examples of how to customize your triaging workflow, see "[Customizing a workflow for triaging your notifications](/github/managing-subscriptions-and-notifications-on-github/customizing-a-workflow-for-triaging-your-notifications)."
要在 {% data variables.product.product_location %}{% ifversion fpt or ghes or ghec %} {% data variables.product.prodname_mobile %}{% endif %} 上的收件箱中关注一组通知,可创建自定义筛选器。 例如,您可以为您参与的开源项目创建自定义过滤器,只查看您被提及的仓库的通知。 有关详细信息,请参阅“[管理收件箱中的通知](/github/managing-subscriptions-and-notifications-on-github/managing-notifications-from-your-inbox)”。 有关如何自定义分类工作流的更多示例,请参阅“[自定义对通知进行分类的工作流](/github/managing-subscriptions-and-notifications-on-github/customizing-a-workflow-for-triaging-your-notifications)”。
## Notification retention policy
## 通知保留策略
Notifications that are not marked as **Saved** are kept for 5 months. Notifications marked as **Saved** are kept indefinitely. If your saved notification is older than 5 months and you unsave it, the notification will disappear from your inbox within a day.
未标记为“已保存”的通知将保留 5 个月。 标记为“已保存”的通知将无限期保留。 如果已保存通知超过 5 个月后,您取消保存它,则该通知将在一天之内从收件箱中消失。
## Feedback and support
## 反馈和支持
If you have feedback or feature requests for notifications, use a [{% data variables.product.prodname_github_community %} discussion](https://github.com/orgs/community/discussions/categories/general).
如果你有针对通知的反馈或功能请求,请使用 [{% data variables.product.prodname_github_community %} 讨论](https://github.com/orgs/community/discussions/categories/general)

View File

@@ -1,6 +1,6 @@
---
title: Configuring notifications
intro: 'Choose the type of activity on {% data variables.product.prodname_dotcom %} that you want to receive notifications for and how you want these updates delivered.'
title: 配置通知
intro: '选择 {% data variables.product.prodname_dotcom %} 上您想要接收其通知的活动类型以及您希望如何发送这些更新。'
redirect_from:
- /articles/about-web-notifications
- /format-of-notification-emails
@@ -22,88 +22,78 @@ versions:
ghec: '*'
topics:
- Notifications
ms.openlocfilehash: b7822a7db40455476c5fc5ac6f779e45d7f558a9
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147060760'
---
## 通知递送选项
## Notification delivery options
可以在以下位置的 {% data variables.product.product_location %} 上接收活动的通知。
You can receive notifications for activity on {% data variables.location.product_location %} in the following locations.
- {% data variables.product.product_location %} Web 界面{% ifversion fpt or ghes or ghec %}中的通知收件箱
- {% data variables.product.prodname_mobile %} 上的通知收件箱,它与 {% data variables.product.product_location %} 上的收件箱同步{% endif %}
- 使用经验证电子邮件地址的电子邮件客户端,也可以与 {% data variables.product.product_location %}{% ifversion fpt or ghes or ghec %} 及 {% data variables.product.prodname_mobile %} 上的通知收件箱同步{% endif %}
- The notifications inbox in the {% data variables.location.product_location %} web interface{% ifversion fpt or ghes or ghec %}
- The notifications inbox on {% data variables.product.prodname_mobile %}, which syncs with the inbox on {% data variables.location.product_location %}{% endif %}
- An email client that uses a verified email address, which can also sync with the notifications inbox on {% data variables.location.product_location %}{% ifversion fpt or ghes or ghec %} and {% data variables.product.prodname_mobile %}{% endif %}
{% ifversion fpt or ghes or ghec %}
{% data reusables.notifications-v2.notifications-inbox-required-setting %} For more information, see "[Choosing your notification settings](#choosing-your-notification-settings)."
{% ifversion fpt or ghes or ghec %} {% data reusables.notifications-v2.notifications-inbox-required-setting %} 有关详细信息,请参阅“[选择通知设置](#choosing-your-notification-settings)”。
{% endif %}
{% data reusables.notifications.shared_state %}
### Benefits of the notifications inbox
### 通知收件箱的优点
The notifications inbox on {% data variables.location.product_location %}{% ifversion fpt or ghes or ghec %} and {% data variables.product.prodname_mobile %}{% endif %} includes triaging options designed specifically for your {% data variables.product.prodname_dotcom %} notifications flow, including options to:
- Triage multiple notifications at once.
- Mark completed notifications as **Done** and remove them from your inbox. To view all of your notifications marked as **Done**, use the `is:done` query.
- Save a notification to review later. Saved notifications are flagged in your inbox and kept indefinitely. To view all of your saved notifications, use the `is:saved` query.
- Unsubscribe and remove a notification from your inbox.
- Preview the issue, pull request, or team discussion where the notification originates on {% data variables.location.product_location %} from within the notifications inbox.
- See one of the latest reasons you're receiving a notification from your inbox with a `reasons` label.
- Create custom filters to focus on different notifications when you want.
- Group notifications in your inbox by repository or date to get a quick overview with less context switching
{% data variables.product.product_location %}{% ifversion fpt or ghes or ghec %} {% data variables.product.prodname_mobile %}{% endif %} 上的通知收件箱包含专为你的 {% data variables.product.prodname_dotcom %} 通知流程设计的分类选项,包括:
- 一次分类多个通知。
- 将已完成的通知标记为“完成”并将其从收件箱中删除。 要查看标记为“完成”的所有通知,请使用 `is:done` 查询。
- 保存通知以供以后查看。 已保存的通知会在收件箱中标记并无限期保留。 要查看保存的所有通知,请使用 `is:saved` 查询。
- 取消订阅并从收件箱中删除通知。
- 从通知收件箱预览 {% data variables.product.product_location %} 上产生通知的议题、拉取请求或团队讨论。
- 查看你从收件箱收到带有 `reasons` 标签的通知的最新原因之一。
- 创建自定义筛选器,以便在需要时关注不同的通知。
- 按仓库或日期对收件箱中的通知进行分组,以快速概览通知,减少上下文切换
{% ifversion fpt or ghes or ghec %}
In addition, you can receive and triage notifications on your mobile device with {% data variables.product.prodname_mobile %}. For more information, see "[Managing your notification settings with GitHub Mobile](#managing-your-notification-settings-with-github-mobile)" or "[GitHub Mobile](/get-started/using-github/github-mobile)."
{% ifversion fpt or ghes or ghec %} 此外,可以通过 {% data variables.product.prodname_mobile %} 在移动设备上接收和分类通知。 有关详细信息,请参阅“[使用 GitHub Mobile 管理通知设置](#managing-your-notification-settings-with-github-mobile)”或“[GitHub Mobile](/get-started/using-github/github-mobile)”。
{% endif %}
### Benefits of using an email client for notifications
### 对通知使用电子邮件客户端的优点
One benefit of using an email client is that all of your notifications can be kept indefinitely depending on your email client's storage capacity. Your inbox notifications are only kept for 5 months on {% data variables.product.prodname_dotcom %} unless you've marked them as **Saved**. **Saved** notifications are kept indefinitely. For more information about your inbox's retention policy, see "[About notifications](/github/managing-subscriptions-and-notifications-on-github/about-notifications#notification-retention-policy)."
使用电子邮件客户端的一个好处是,可以无限期地保留所有通知,具体取决于电子邮件客户端的存储容量。 收件箱通知在 {% data variables.product.prodname_dotcom %} 上仅保留 5 个月,除非将它们标记为“已保存”。 “已保存”通知将无限期保留。 有关收件箱保留策略的详细信息,请参阅“[关于通知](/github/managing-subscriptions-and-notifications-on-github/about-notifications#notification-retention-policy)”。
Sending notifications to your email client also allows you to customize your inbox according to your email client's settings, which can include custom or color-coded labels.
向电子邮件客户端发送通知还允许您根据电子邮件客户端的设置(可以包括自定义或颜色编码的标签)自定义收件箱。
Email notifications also allow flexibility with the types of notifications you receive and allow you to choose different email addresses for updates. For example, you can send certain notifications for a repository to a verified personal email address. For more information, about your email customization options, see "[Customizing your email notifications](#customizing-your-email-notifications)."
电子邮件通知还允许您灵活地设置收到的通知类型,并允许您选择不同的电子邮件地址进行更新。 例如,您可以向经验证的个人电子邮件地址发送仓库的某些通知。 有关电子邮件自定义选项的详细信息,请参阅“[自定义电子邮件通知](#customizing-your-email-notifications)”。
## About participating and watching notifications
## 关于参与和查看通知
When you watch a repository, you're subscribing to updates for activity in that repository. Similarly, when you watch a specific team's discussions, you're subscribing to all conversation updates on that team's page. For more information, see "[About team discussions](/organizations/collaborating-with-your-team/about-team-discussions)."
关注仓库,意味着订阅该仓库中的活动更新。 同样,关注特定团队的讨论,意味着订阅该团队页面上的所有对话更新。 有关详细信息,请参阅“[关于团队讨论](/organizations/collaborating-with-your-team/about-team-discussions)”。
To see repositories that you're watching, go to your [watching page](https://github.com/watching). For more information, see "[Managing subscriptions and notifications on GitHub](/github/managing-subscriptions-and-notifications-on-github/managing-subscriptions-for-activity-on-github)."
若要查看正在监视的存储库,请参阅[监视页面](https://github.com/watching)。 有关详细信息,请参阅“[在 GitHub 上管理订阅和通知](/github/managing-subscriptions-and-notifications-on-github/managing-subscriptions-for-activity-on-github)”。
{% ifversion ghae %}
### Configuring notifications
{% endif %}
You can configure notifications for a repository on the repository page, or on your watching page.
### 配置通知
{% endif %} 可以在存储库页面上或在监视页面上为存储库配置通知。
### About custom notifications
You can customize notifications for a repository. For example, you can choose to only be notified when updates to one or more types of events ({% data reusables.notifications-v2.custom-notification-types %}) happen within a repository, or ignore all notifications for a repository. For more information, see "[Configuring your watch settings for an individual repository](#configuring-your-watch-settings-for-an-individual-repository)" below.
### 关于自定义通知
您可以自定义仓库的通知。 例如,您可以选择仅在仓库中发生一类或多类事件 ({% data reusables.notifications-v2.custom-notification-types %}) 的更新时收到通知,或者忽略仓库的所有通知。 有关详细信息,请参阅下方的“[为单个存储库配置监视设置](#configuring-your-watch-settings-for-an-individual-repository)”。
### Participating in conversations
Anytime you comment in a conversation or when someone @mentions your username, you are _participating_ in a conversation. By default, you are automatically subscribed to a conversation when you participate in it. You can unsubscribe from a conversation you've participated in manually by clicking **Unsubscribe** on the issue or pull request or through the **Unsubscribe** option in the notifications inbox.
### 参与对话
每当你在对话中发表评论或有人 @mentions你的用户名时,你都在参与对话。 默认情况下,当您参与对话时,会自动订阅该对话。 你可以通过单击议题或拉取请求上的“取消订阅”或通过通知收件箱中的“取消订阅”选项,手动取消订阅已参与的对话 。
{% ifversion update-notification-settings-22 %}For conversations you're watching or participating in, you can choose whether you want to receive notifications on {% data variables.product.company_short %} or by email in your notification settings. For more information, see "[Choosing your notification settings](/account-and-profile/managing-subscriptions-and-notifications-on-github/setting-up-notifications/configuring-notifications#choosing-your-notification-settings)."
对于你监视或参与的对话,你可以选择是通过电子邮件还是 {% data variables.product.product_location %}{% ifversion fpt or ghes or ghec %} 和 {% data variables.product.prodname_mobile %}{% endif %} 上的收件箱接收通知。
![Animated GIF of participating and watching subscriptions options](/assets/images/help/notifications/selecting-participating-notifications.gif)
![参与和关注通知选项](/assets/images/help/notifications-v2/participating-and-watching-options.png)
{% else %}
例如:
- 如果不希望将通知发送到你的电子邮件地址,请取消选中“电子邮件”以便参与和监视通知。
- 如果希望在参与对话时通过电子邮件接收通知,则可以选中“参与”下的“电子邮件”。
For conversations you're watching or participating in, you can choose whether you want to receive notifications by email or through the notifications inbox on {% data variables.location.product_location %}{% ifversion ghes %} and {% data variables.product.prodname_mobile %}{% endif %}. For more information, see "[Choosing your notification settings](/account-and-profile/managing-subscriptions-and-notifications-on-github/setting-up-notifications/configuring-notifications#choosing-your-notification-settings)."
如果未对 Web{% ifversion fpt or ghes or ghec %} 和移动{% endif %}启用监视或参与通知,则你的通知收件箱不会收到任何更新。
![Screenshot of participating and watching notifications options](/assets/images/help/notifications-v2/participating-and-watching-options.png){% endif %}
## 自定义电子邮件通知
For example:
- If you don't want notifications to be sent to your email, unselect **email** for participating and watching notifications.
- If you want to receive notifications by email when you've participated in a conversation, then you can select **email** under "Participating".
{% ifversion update-notification-settings-22 %}If you do not enable "Notify me: On GitHub" for watching or participating notifications, then your notifications inbox will not have any updates.
{% else %}
If you do not enable watching or participating notifications for web{% ifversion ghes %} and mobile{% endif %}, then your notifications inbox will not have any updates.{% endif %}
## Customizing your email notifications
After enabling email notifications, {% data variables.location.product_location %} will send notifications to you as multipart emails that contain both HTML and plain text copies of the content. Email notification content includes any Markdown, @mentions, emojis, hash-links, and more, that appear in the original content on {% data variables.location.product_location %}. If you only want to see the text in the email, you can configure your email client to display the plain text copy only.
在启用电子邮件通知后,{% data variables.product.product_location %} 将以多部分电子邮件向你发送通知,其中包含内容的 HTML 和纯文本副本。 电子邮件通知内容包含出现在 {% data variables.product.product_location %} 上的原始内容中的任何 Markdown、@mentions、表情符号、哈希链接等。 如果您只想查看电子邮件中的文本,可以配置电子邮件客户端只显示明文副本。
{% data reusables.notifications.outbound_email_tip %}
@@ -111,194 +101,150 @@ After enabling email notifications, {% data variables.location.product_location
{% ifversion fpt or ghec %}
If you're using Gmail, you can click a button beside the notification email to visit the original issue or pull request that generated the notification.
如果您使用 Gmail可以单击通知电子邮件旁边的按钮访问生成该通知的原始议题或拉取请求。
![Buttons in Gmail](/assets/images/help/notifications/gmail-buttons.png)
![Gmail 中的按钮](/assets/images/help/notifications/gmail-buttons.png)
{% endif %}
Choose a default email address where you want to send updates for conversations you're participating in or watching. You can also specify which activity on {% data variables.location.product_location %} you want to receive updates for using your default email address. For example, choose whether you want updates to your default email from:
- Comments on issues and pull requests.
- Pull request reviews.
- Pull request pushes.
- Your own updates, such as when you open, comment on, or close an issue or pull request.
选择一个默认电子邮件地址,用于发送您参与或关注的对话的更新。 还可以指定希望使用默认电子邮件地址接收 {% data variables.product.product_location %} 上哪些活动的更新。 例如,选择您的默认电子邮件地址是否要接收以下更新:
- 对问题和拉取请求的评论。
- 拉取请求评审。
- 拉取请求推送。
- 您自己的更新,例如当您打开、评论或关闭议题或拉取请求时。
Depending on the organization that owns the repository, you can also send notifications to different email addresses. Your organization may require the email address to be verified for a specific domain. For more information, see "[Choosing where your organizations email notifications are sent](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#choosing-where-your-organizations-email-notifications-are-sent)."
您还可以向不同电子邮件地址发送通知,具体取决于拥有仓库的组织。 您的组织可能要求验证特定域的电子邮件地址。 有关详细信息,请参阅“[选择接收组织的电子邮件通知的位置](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#choosing-where-your-organizations-email-notifications-are-sent)”。
You can also send notifications for a specific repository to an email address. For more information, see "[About email notifications for pushes to your repository](/github/administering-a-repository/about-email-notifications-for-pushes-to-your-repository)."
您也可以将特定仓库的通知发送到电子邮件地址。 有关详细信息,请参阅“[关于推送到存储库的电子邮件通知](/github/administering-a-repository/about-email-notifications-for-pushes-to-your-repository)”。
{% data reusables.notifications-v2.email-notification-caveats %}
## Filtering email notifications
## 过滤电子邮件通知
Each email notification that {% data variables.location.product_location %} sends contains header information. The header information in every email is consistent, so you can use it in your email client to filter or forward all {% data variables.product.prodname_dotcom %} notifications, or certain types of {% data variables.product.prodname_dotcom %} notifications.
{% data variables.product.product_location %} 发送的每封电子邮件通知都包含标头信息。 每封电子邮件的标头信息都是一致的,因此可用于在电子邮件客户端中筛选或转发所有 {% data variables.product.prodname_dotcom %} 通知,或特定类型的 {% data variables.product.prodname_dotcom %} 通知。
If you believe you're receiving notifications that don't belong to you, examine the `X-GitHub-Recipient` and `X-GitHub-Recipient-Address` headers. These headers show who the intended recipient is. Depending on your email setup, you may receive notifications intended for another user.
如果你认为你收到不属于你的通知,请检查 `X-GitHub-Recipient` `X-GitHub-Recipient-Address` 标题。 这些标头显示预期的收件人。 根据您的电子邮件设置,您可能会收到预期发给其他用户的通知。
Email notifications from {% data variables.location.product_location %} contain the following header information:
来自 {% data variables.product.product_location %} 的电子邮件通知包含以下标头信息:
| Header | Information |
| 标头 | 信息 |
| --- | --- |
| `From` address | This address will always be {% ifversion fpt or ghec %}'`notifications@github.com`'{% else %}'the no-reply email address configured by your site administrator'{% endif %}. |
| `To` field | This field connects directly to the thread.{% ifversion not ghae %} If you reply to the email, you'll add a new comment to the conversation.{% endif %} |
| `Cc` address | {% data variables.product.product_name %} will `Cc` you if you're subscribed to a conversation. The second `Cc` email address matches the notification reason. The suffix for these notification reasons is {% data variables.notifications.cc_address %}. The possible notification reasons are: <ul><li>`assign`: You were assigned to an issue or pull request.</li><li>`author`: You created an issue or pull request.</li><li>`ci_activity`: A {% data variables.product.prodname_actions %} workflow run that you triggered was completed.</li><li>`comment`: You commented on an issue or pull request.</li><li>`manual`: There was an update to an issue or pull request you manually subscribed to.</li><li>`mention`: You were mentioned on an issue or pull request.</li><li>`push`: Someone committed to a pull request you're subscribed to.</li><li>`review_requested`: You or a team you're a member of was requested to review a pull request.</li><li>`security_alert`: {% data variables.product.prodname_dotcom %} detected a vulnerability in a repository you receive alerts for.</li><li>`state_change`: An issue or pull request you're subscribed to was either closed or opened.</li><li>`subscribed`: There was an update in a repository you're watching.</li><li>`team_mention`: A team you belong to was mentioned on an issue or pull request.</li><li>`your_activity`: You opened, commented on, or closed an issue or pull request.</li></ul> |
| `mailing list` field | This field identifies the name of the repository and its owner. The format of this address is always `<repository name>.<repository owner>.{% data variables.command_line.backticks %}`. |
| `X-GitHub-Severity` field | {% data reusables.repositories.security-alerts-x-github-severity %} The possible severity levels are:<ul><li>`low`</li><li>`moderate`</li><li>`high`</li><li>`critical`</li></ul>For more information, see "[About {% data variables.product.prodname_dependabot_alerts %}](/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies)." |
| `From` 地址 | 此地址始终是{% ifversion fpt or ghec %}'`notifications@github.com`'{% else %}“站点管理员配置的无需回复电子邮件地址”{% endif %} |
| `To` 字段 | 此字段直接连接到线程。{% ifversion not ghae %} 如果你回复电子邮件,将在对话中添加一个新的评论。{% endif %} |
| `Cc` 地址 | 如果你订阅了对话,{% data variables.product.product_name %} 将会 `Cc` 给你。 第二个 `Cc` 电子邮件地址与通知原因匹配。 这些通知原因的后缀是 {% data variables.notifications.cc_address %}。 可能的通知原因包括: <ul><li>`assign`:为你分配了一个议题或拉取请求。</li><li>`author`:你创建了议题或拉取请求。</li><li>`ci_activity`:你触发的 {% data variables.product.prodname_actions %} 工作流程运行已完成。</li><li>`comment`:你对议题或拉取请求发表了评论。</li><li>`manual`:你手动订阅的议题或拉取请求有更新。</li><li>`mention`:有人在议题或拉取请求中提及了你。</li><li>`push`:有人提交了你订阅的拉取请求。</li><li>`review_requested`:有人申请你或你所在的团队评审拉取请求。</li><li>`security_alert`{% data variables.product.prodname_dotcom %} 检测到你要接收其漏洞警报的存储库中存在漏洞。</li><li>`state_change`:你订阅的议题或拉取请求已关闭或打开。</li><li>`subscribed`:你监视的存储库有更新。</li><li>`team_mention`:你所属的团队在议题或拉取请求中被提及。</li><li>`your_activity`:你打开、评论或关闭了议题或拉取请求。</li></ul> |
| `mailing list` 字段 | 此字段识别仓库名称及其所有者。 此地址的格式始终为 `<repository name>.<repository owner>.{% data variables.command_line.backticks %}` |
| `X-GitHub-Severity` 字段 | {% data reusables.repositories.security-alerts-x-github-severity %} 可能的严重程度等级包括:<ul><li>`low`</li><li>`moderate`</li><li>`high`</li><li>`critical`</li></ul>有关详细信息,请参阅“[关于 {% data variables.product.prodname_dependabot_alerts %}](/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies)”。 |
## Choosing your notification settings
## 选择通知设置
{% data reusables.notifications.access_notifications %}
{% data reusables.notifications-v2.manage-notifications %}
3. On the notifications settings page, choose how you receive notifications when:
- There are updates in repositories or team discussions you're watching or in a conversation you're participating in. For more information, see "[About participating and watching notifications](#about-participating-and-watching-notifications)."
- You gain access to a new repository or you've joined a new team. For more information, see "[Automatic watching](#automatic-watching)."
- There are new {% data variables.product.prodname_dependabot_alerts %} in your repository. For more information, see "[{% data variables.product.prodname_dependabot_alerts %} notification options](#dependabot-alerts-notification-options)." {% ifversion fpt or ghec %}
- There are workflow runs updates on repositories set up with {% data variables.product.prodname_actions %}. For more information, see "[{% data variables.product.prodname_actions %} notification options](#github-actions-notification-options)."{% endif %}{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
- There are new deploy keys added to repositories that belong to organizations that you're an owner of. For more information, see "[Organization alerts notification options](#organization-alerts-notification-options)."{% endif %}
{% data reusables.notifications.access_notifications %} {% data reusables.notifications-v2.manage-notifications %}
3. 在通知设置页面上,选择在以下情况下如何接收通知:
- 在您关注的仓库或团队讨论或参与的对话中发生了更新。 有关详细信息,请参阅“[关于参与和监视通知](#about-participating-and-watching-notifications)”。
- 您获得了新仓库的访问权限或加入了新团队。 有关详细信息,请参阅“[自动监视](#automatic-watching)”。
- 存储库中有新的 {% data variables.product.prodname_dependabot_alerts %}。 有关详细信息,请参阅“[{% data variables.product.prodname_dependabot_alerts %} 通知选项](#dependabot-alerts-notification-options)”。 {% ifversion fpt or ghec %}
- 在使用 {% data variables.product.prodname_actions %} 设置的仓库上有工作流程运行更新。 有关详细信息,请参阅“[{% data variables.product.prodname_actions %} notification options](#github-actions-notification-options)”。{% endif %}{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5668 %}
- 新部署密钥已添加到属于您作为其所有者的组织的仓库。 有关详细信息,请参阅“[组织警报通知选项](#organization-alerts-notification-options)”。{% endif %}
## Automatic watching
## 自动关注
By default, anytime you gain access to a new repository, you will automatically begin watching that repository. Anytime you join a new team, you will automatically be subscribed to updates and receive notifications when that team is @mentioned. If you don't want to automatically be subscribed, you can unselect the automatic watching options in your notification settings.
默认情况下,每当您获得新仓库的访问权限时,您将会自动开始关注该仓库。 每当你加入新团队时,你都会自动订阅更新,并在该团队被 @mentioned时收到通知。 如果不想自动订阅,您可以取消选择自动关注选项。
{% ifversion update-notification-settings-22 %}
![Automatic watching options for teams and repositories](/assets/images/automatically-watch-repos-and-teams.png)
{% else %}
![Automatic watching options](/assets/images/help/notifications-v2/automatic-watching-options.png){% endif %}
![自动关注选项](/assets/images/help/notifications-v2/automatic-watching-options.png)
If "Automatically watch repositories" is disabled, then you will not automatically watch your own repositories. You must navigate to your repository page and choose the watch option.
如果禁用了“Automatically watch repositories(自动关注仓库)”,您将不会自动关注自己拥有的仓库。 您必须导航到仓库页面,然后选择关注选项。
For more information, see "[Choosing your notification settings](/account-and-profile/managing-subscriptions-and-notifications-on-github/setting-up-notifications/configuring-notifications#choosing-your-notification-settings)."
## 配置单个仓库的关注设置
## Configuring your watch settings for an individual repository
You can choose whether to watch or unwatch an individual repository. You can also choose to only be notified of certain event types such as {% data reusables.notifications-v2.custom-notification-types %} (if enabled for the repository) , or completely ignore an individual repository.
您可以选择关注还是取消关注单个仓库。 您还可以选择仅接收某些事件类型的通知,例如 {% data reusables.notifications-v2.custom-notification-types %} (如果为存储库启用),或者完全忽略单个存储库。
{% data reusables.repositories.navigate-to-repo %}
2. In the upper-right corner, select the "Watch" drop-down menu to click a watch option.
![Watch options in a drop-down menu for a repository](/assets/images/help/notifications-v2/watch-repository-options-custom.png)
2. 在右上角选择“Watch关注”下拉菜单以单击关注选项。
{% ifversion fpt or ghes or ghae-issue-4910 or ghec %} ![存储库下拉菜单中的“监视”选项](/assets/images/help/notifications-v2/watch-repository-options-custom.png)
The **Custom** option allows you to further customize notifications so that you're only notified when specific events happen in the repository, in addition to participating and @mentions.
![Custom watch options in a drop-down menu for a repository](/assets/images/help/notifications-v2/watch-repository-options-custom2-dotcom.png)
If you select "Issues", you will be notified about, and subscribed to, updates on every issue (including those that existed prior to you selecting this option) in the repository. If you're @mentioned in a pull request in this repository, you'll receive notifications for that too, and you'll be subscribed to updates on that specific pull request, in addition to being notified about issues.
“自定义”选项可用于进一步自定义通知,以便除了参与和 @mentions之外,你仅在存储库中发生特定事件时才收到通知。
{% else %} ![存储库下拉菜单中的“监视”选项](/assets/images/help/notifications-v2/watch-repository-options.png){% endif %} {% ifversion fpt or ghes or ghae-issue-4910 or ghec %} ![存储库下拉菜单中的“自定义监视”选项](/assets/images/help/notifications-v2/watch-repository-options-custom2-dotcom.png) 如果选择“议题”,你将收到存储库中每个议题(包括在你选择此选项之前存在的议题)的更新通知并订阅这些更新。 如果你在此存储库中的拉取请求中被 @mentioned,则除了收到有关议题的通知外,你还将收到有关该特定拉取请求的通知并订阅其更新。
{% endif %}
## Choosing where your organizations email notifications are sent
## 选择接收组织的电子邮件通知的位置
If you belong to an organization, you can choose the email account you want notifications for organization activity sent to. For example, if you belong to an organization for work, you may want your notifications sent to your work email address, rather than your personal address.
如果您属于某个组织,您可以选择要接收组织活动通知的电子邮件帐户。 例如,如果您属于某个工作组织,您可能希望通知发送到您的工作电子邮件地址,而不是您的个人地址。
{% data reusables.notifications-v2.email-notification-caveats %}
{% data reusables.notifications.access_notifications %}
{% data reusables.notifications-v2.manage-notifications %}
{% data reusables.notifications.access_notifications %} {% data reusables.notifications-v2.manage-notifications %}
3. 在“Default notification email默认通知电子邮件”下选择要接收通知的电子邮件地址。
![默认通知电子邮件地址下拉菜单](/assets/images/help/notifications/notifications_primary_email_for_orgs.png)
4. 单击“ **保存**”。
3. Under "Default notification email", select the email address you'd like notifications sent to.
{% ifversion update-notification-settings-22 %}
### 自定义每个组织的电子邮件路由
![Screenshot of the default notification email address setting](/assets/images/help/notifications/default-email-address-emphasized.png)
如果您是多个组织的成员,您可以配置每个组织发送通知到任何{% ifversion fpt or ghec %} 您已验证的电子邮件地址{% else %} 帐户的电子邮件地址{% endif %}。 {% ifversion fpt or ghec %} 有关详细信息,请参阅“[验证电子邮件地址](/articles/verifying-your-email-address)”。{% endif %}
{% else %}
{% data reusables.notifications.access_notifications %} {% data reusables.notifications-v2.manage-notifications %}
3. 在“Custom routing自定义路由”下在列表中找到您组织的名称。
![组织和电子邮件地址列表](/assets/images/help/notifications/notifications_org_emails.png)
4. 单击要更改的电子邮件地址旁边的“编辑”。
![编辑组织的电子邮件地址](/assets/images/help/notifications/notifications_edit_org_emails.png)
5. 选择一个经验证的电子邮件地址,然后单击“保存”。
![切换组织对应的电子邮件地址](/assets/images/help/notifications/notifications_switching_org_email.gif)
![Screenshot of the default notification email address dropdown](/assets/images/help/notifications/notifications_primary_email_for_orgs.png){% endif %}
{% ifversion ghes or ghae %}
4. Click **Save**.{% endif %}
## {% data variables.product.prodname_dependabot_alerts %} 通知选项
### Customizing email routes per organization
{% data reusables.notifications.vulnerable-dependency-notification-enable %} {% data reusables.notifications.vulnerable-dependency-notification-delivery-method-customization2 %} {% data reusables.notifications.vulnerable-dependency-notification-options %}
If you are a member of more than one organization, you can configure each one to send notifications to any of{% ifversion fpt or ghec %} your verified email addresses{% else %} the email addresses for your account{% endif %}. {% ifversion fpt or ghec %} For more information, see "[Verifying your email address](/articles/verifying-your-email-address)."{% endif %}
若要详细了解可用的通知传递方法,并查看关于优化 {% data variables.product.prodname_dependabot_alerts %} 通知的建议,请参阅“[为 {% data variables.product.prodname_dependabot_alerts %} 配置通知](/code-security/dependabot/dependabot-alerts/configuring-notifications-for-dependabot-alerts)”。
{% data reusables.notifications.access_notifications %}
{% data reusables.notifications-v2.manage-notifications %}
{% ifversion update-notification-settings-22 %}
3. Under "Default notifications email", click **Custom routing**.
{% ifversion fpt or ghes or ghec %}
## {% data variables.product.prodname_actions %} 通知选项
![Screenshot of default notifications email settings with custom routing button emphasised](/assets/images/help/notifications/custom-router-emphasized.png)
选择您希望如何接收所关注仓库的工作流程运行更新,通过 {% data variables.product.prodname_actions %} 设置。 您也可以选择仅接收关于失败的工作流程运行的通知。
4. Click **Add new route**.
![{% data variables.product.prodname_actions %} 的警报选项](/assets/images/help/notifications-v2/github-actions-notification-options.png)
![Screenshot of custom routing settings with add new route button emphasised](/assets/images/help/notifications/add-new-route-emphasized.png)
{% endif %}
5. Click **Pick organization**, then select the organization you want to customize from the dropdown.
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5668 %}
## 组织警报通知选项
![Screenshot of dropdown to pick organization](/assets/images/help/notifications/organization-dropdown-custom-routing-emphasis.png)
6. Select one of your verified email addresses, then click **Save**.
![Screenshot of custom routing page with save button](/assets/images/help/notifications/select-email-address-custom-routing-and-save.png)
{% else %}
3. Under "Custom routing," find your organization's name in the list.
![List of organizations and email addresses](/assets/images/help/notifications/notifications_org_emails.png)
4. Click **Edit** next to the email address you want to change.
![Editing an organization's email addresses](/assets/images/help/notifications/notifications_edit_org_emails.png)
5. Select one of your verified email addresses, then click **Save**.
![Switching your per-org email address](/assets/images/help/notifications/notifications_switching_org_email.gif){% endif %}
## {% data variables.product.prodname_dependabot_alerts %} notification options
{% data reusables.notifications.vulnerable-dependency-notification-enable %}
{% data reusables.notifications.vulnerable-dependency-notification-delivery-method-customization2 %}
{% data reusables.notifications.vulnerable-dependency-notification-options %}
For more information about the notification delivery methods available to you, and advice on optimizing your notifications for {% data variables.product.prodname_dependabot_alerts %}, see "[Configuring notifications for {% data variables.product.prodname_dependabot_alerts %}](/code-security/dependabot/dependabot-alerts/configuring-notifications-for-dependabot-alerts)."
{% ifversion update-notification-settings-22 or ghes %}
## {% data variables.product.prodname_actions %} notification options
Choose how you want to receive workflow run updates for repositories that you are watching that are set up with {% data variables.product.prodname_actions %}. You can also choose to only receive notifications for failed workflow runs.{% endif %}
{% ifversion update-notification-settings-22 %}
![Animated GIF of notification options for {% data variables.product.prodname_actions %}](/assets/images/help/notifications/github-actions-customize-notifications.gif){% endif %}
{% ifversion ghes %}
![Screenshot of the notification options for {% data variables.product.prodname_actions %}](/assets/images/help/notifications-v2/github-actions-notification-options.png){% endif %}
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
## Organization alerts notification options
If you're an organization owner, you'll receive email notifications by default when organization members add new deploy keys to repositories within the organization. You can unsubscribe from these notifications. On the notification settings page, under "Organization alerts", unselect **Email**.
如果您是组织所有者,则当组织成员向组织内的存储库添加新的部署密钥时,默认情况下,您将收到电子邮件通知。 您可以取消订阅这些通知。 在通知设置页面上的“组织警报”下,取消选择“电子邮件”。
{% endif %}
{% ifversion fpt or ghes or ghec %}
## Managing your notification settings with {% data variables.product.prodname_mobile %}
## 使用 {% data variables.product.prodname_mobile %} 管理通知设置
When you install {% data variables.product.prodname_mobile %}, you will automatically be opted into web notifications. Within the app, you can enable push notifications for the following events.
- Direct mentions
- Assignments to issues or pull requests
- Requests to review a pull request
- Requests to approve a deployment
安装 {% data variables.product.prodname_mobile %} 时,您将自动选择 web 通知。 在应用程序中,您可以为以下事件启用推送通知。
- 直接提及
- 分配到议题或拉取请求
- 请求审核拉取请求
- 请求批准部署
You can also schedule when {% data variables.product.prodname_mobile %} will send push notifications to your mobile device.
您还可以安排 {% data variables.product.prodname_mobile %} 何时向移动设备发送推送通知。
{% data reusables.mobile.push-notifications-on-ghes %}
### Managing your notification settings with {% data variables.product.prodname_ios %}
### 使用 {% data variables.product.prodname_ios %} 管理通知设置
1. In the bottom menu, tap **Profile**.
2. To view your settings, tap {% octicon "gear" aria-label="The Gear icon" %}.
3. To update your notification settings, tap **Notifications** and then use the toggles to enable or disable your preferred types of push notifications.
4. Optionally, to schedule when {% data variables.product.prodname_mobile %} will send push notifications to your mobile device, tap **Working Hours**, use the **Custom working hours** toggle, and then choose when you would like to receive push notifications.
1. 在底部菜单中,点击“配置文件”。
2. 要查看设置,请点击 {% octicon "gear" aria-label="The Gear icon" %}
3. 要更新通知设置,请点击“通知”,然后使用切换开关来启用或禁用首选类型的推送通知。
4. (可选)要安排 {% data variables.product.prodname_mobile %} 何时向移动设备发送推送通知,请点击“工作时间”,使用“自定义工作时间”切换开关,然后选择何时接收推送通知 。
### Managing your notification settings with {% data variables.product.prodname_android %}
### 使用 {% data variables.product.prodname_android %} 管理通知设置
1. In the bottom menu, tap **Profile**.
2. To view your settings, tap {% octicon "gear" aria-label="The Gear icon" %}.
3. To update your notification settings, tap **Configure Notifications** and then use the toggles to enable or disable your preferred types of push notifications.
4. Optionally, to schedule when {% data variables.product.prodname_mobile %} will send push notifications to your mobile device, tap **Working Hours**, use the **Custom working hours** toggle, and then choose when you would like to receive push notifications.
1. 在底部菜单中,点击“配置文件”。
2. 要查看设置,请点击 {% octicon "gear" aria-label="The Gear icon" %}
3. 要更新通知设置,请点击“配置通知”,然后使用切换开关来启用或禁用首选类型的推送通知。
4. (可选)要安排 {% data variables.product.prodname_mobile %} 何时向移动设备发送推送通知,请点击“工作时间”,使用“自定义工作时间”切换开关,然后选择何时接收推送通知 。
## Configuring your watch settings for an individual repository with {% data variables.product.prodname_mobile %}
## 使用 {% data variables.product.prodname_mobile %} 配置个别仓库的关注设置
You can choose whether to watch or unwatch an individual repository. You can also choose to only be notified of {% ifversion fpt or ghec %}certain event types such as issues, pull requests, discussions (if enabled for the repository) and {% endif %}new releases, or completely ignore an individual repository.
您可以选择关注还是取消关注单个仓库。 你也可以选择接收{% ifversion fpt or ghec %}特定事件类型,如议题、拉取请求、讨论(如已对存储库启用)以及{% endif %}新版本的通知,或者完全忽略单个存储库。
1. On {% data variables.product.prodname_mobile %}, navigate to the main page of the repository.
2. Tap **Watch**.
![The watch button on {% data variables.product.prodname_mobile %}](/assets/images/help/notifications-v2/mobile-watch-button.png)
3. To choose what activities you receive notifications for, tap your preferred watch settings.
![Watch settings dropdown menu in {% data variables.product.prodname_mobile %}](/assets/images/help/notifications-v2/mobile-watch-settings.png)
1. {% data variables.product.prodname_mobile %} 上,导航到存储库的主页面。
2. 点击“监视”。
![{% data variables.product.prodname_mobile %} 上的监视按钮](/assets/images/help/notifications-v2/mobile-watch-button.png)
3. 要选择接收通知的活动,请点击首选的关注设置。
![{% data variables.product.prodname_mobile %} 中的监视设置下拉菜单](/assets/images/help/notifications-v2/mobile-watch-settings.png)
{% endif %}

View File

@@ -1,6 +1,6 @@
---
title: Managing your profile README
intro: 'You can add a README to your {% data variables.product.prodname_dotcom %} profile to tell other people about yourself.'
title: 管理个人资料自述文件
intro: '可以向您的 {% data variables.product.prodname_dotcom %} 个人资料添加自述文件以向其他人介绍自己。'
versions:
fpt: '*'
ghes: '*'
@@ -11,67 +11,71 @@ redirect_from:
- /github/setting-up-and-managing-your-github-profile/managing-your-profile-readme
- /github/setting-up-and-managing-your-github-profile/customizing-your-profile/managing-your-profile-readme
shortTitle: Your profile README
ms.openlocfilehash: 587bcea1e1a0f96aad8882b41196afcc6e433363
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147578898'
---
## About your profile README
## 关于您的个人资料自述文件
You can share information about yourself with the community on {% data variables.location.product_location %} by creating a profile README. {% data variables.product.prodname_dotcom %} shows your profile README at the top of your profile page.
你可以通过创建个人资料自述文件,在 {% data variables.product.product_location %} 上与社区分享有关你自己的信息。 {% data variables.product.prodname_dotcom %} 在个人资料页面的顶部显示您的个人资料自述文件。
You decide what information to include in your profile README, so you have full control over how you present yourself on {% data variables.product.prodname_dotcom %}. Here are some examples of information that visitors may find interesting, fun, or useful in your profile README.
您决定在个人资料自述文件中包含哪些信息,因此您可以完全控制如何在 {% data variables.product.prodname_dotcom %} 上展示自己。 以下是访客可能在您的个人资料自述文件中找到感兴趣、有趣或有用信息的一些示例。
- An "About me" section that describes your work and interests
- Contributions you're proud of, and context about those contributions
- Guidance for getting help in communities where you're involved
- About me(关于我)”部分介绍您的工作和兴趣。
- 您引以为豪的贡献以及这些贡献的背景信息
- 在您参与的社区获得帮助的指南
![Profile README file displayed on profile](/assets/images/help/repository/profile-with-readme.png)
![个人资料上显示的个人资料自述文件](/assets/images/help/repository/profile-with-readme.png)
You can format text and include emoji, images, and GIFs in your profile README by using {% data variables.product.company_short %} Flavored Markdown. For more information, see "[Getting started with writing and formatting on {% data variables.product.prodname_dotcom %}](/github/writing-on-github/getting-started-with-writing-and-formatting-on-github)." For a hands-on guide to customizing your profile README, see "[Quickstart for writing on {% data variables.product.prodname_dotcom %}](/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/quickstart-for-writing-on-github)."
您可以使用 {% data variables.product.company_short %} Flavored Markdown 在个人资料自述文件中设置文本格式和包含表情符号、图像及 GIF。 有关详细信息,请参阅“[ {% data variables.product.prodname_dotcom %} 上编写和设置格式入门](/github/writing-on-github/getting-started-with-writing-and-formatting-on-github)”。
## Prerequisites
## 先决条件
GitHub will display your profile README on your profile page if all of the following are true.
如果满足以下所有条件GitHub 将在您的个人资料页面显示您的个人资料自述文件。
- You've created a repository with a name that matches your {% data variables.product.prodname_dotcom %} username.
- The repository is public.
- The repository contains a file named README.md in its root.
- The README.md file contains any content.
- 您使用与您的 {% data variables.product.prodname_dotcom %} 用户名匹配的名称创建了仓库。
- 该仓库为公共仓库。
- 仓库的根目录中包含名为 README.md 的文件。
- README.md 文件包含任何内容。
{% note %}
**Note**: If you created a public repository with the same name as your username before July 2020, {% data variables.product.prodname_dotcom %} won't automatically show the repository's README on your profile. You can manually share the repository's README to your profile by going to the repository on {% data variables.product.prodname_dotcom_the_website %} and clicking **Share to profile**.
注意:如果你在 2020 年 7 月之前创建了一个与你的用户名同名的公共存储库,{% data variables.product.prodname_dotcom %} 将不会自动在你的个人资料中显示该存储库的自述文件。 可以通过转到 {% data variables.product.prodname_dotcom_the_website %} 上的存储库并单击“共享到配置文件”,手动将存储库的自述文件共享到配置文件。
![Button to share README to profile](/assets/images/help/repository/share-to-profile.png)
![将自述文件分享到个人资料的按钮](/assets/images/help/repository/share-to-profile.png)
{% endnote %}
## Adding a profile README
## 添加个人资料自述文件
{% data reusables.repositories.create_new %}
2. Under "Repository name", type a repository name that matches your {% data variables.product.prodname_dotcom %} username. For example, if your username is "octocat", the repository name must be "octocat".
![Repository name field which matches username](/assets/images/help/repository/repo-username-match.png)
3. Optionally, add a description of your repository. For example, "My personal repository."
![Field for entering a repository description](/assets/images/help/repository/create-personal-repository-desc.png)
4. Select **Public**.
![Radio button to select visibility with public selected](/assets/images/help/repository/create-personal-repository-visibility.png)
{% data reusables.repositories.initialize-with-readme %}
{% data reusables.repositories.create-repo %}
7. Above the right sidebar, click **Edit README**.
![Button to edit README file](/assets/images/help/repository/personal-repository-edit-readme.png)
2. 在“Repository name(仓库名称)”下,输入与您的 {% data variables.product.prodname_dotcom %} 用户名匹配的仓库名称。 例如,如果您的用户名是 "octocat",则仓库名称必须为 "octocat"
![与用户名匹配的存储库名称字段](/assets/images/help/repository/repo-username-match.png)
3. 可以选择性地添加存储库的说明。 例如,“My personal repository(我的个人仓库)”。
![用于输入存储库说明的字段](/assets/images/help/repository/create-personal-repository-desc.png)
4. 选择“公共”。
![用于选择可见性的单选按钮,已选择“公共”](/assets/images/help/repository/create-personal-repository-visibility.png) {% data reusables.repositories.initialize-with-readme %} {% data reusables.repositories.create-repo %}
7. 在右边栏上方,单击“编辑自述文件”。
![“编辑自述文件”按钮](/assets/images/help/repository/personal-repository-edit-readme.png)
The generated README file is pre-populated with a template to give you some inspiration for your profile README.
![README file with pre-populated template](/assets/images/help/repository/personal-repository-readme-template.png)
生成的自述文件用模板预先填充,为您创建个人资料自述文件提供一些启发。
![带有预填充模板的自述文件](/assets/images/help/repository/personal-repository-readme-template.png)
For a summary of all the available emojis and their codes, see "[Emoji cheat sheet](https://www.webfx.com/tools/emoji-cheat-sheet/)."
有关所有可用表情符号及其代码的摘要,请参阅“[表情符号备忘单](https://www.webfx.com/tools/emoji-cheat-sheet/)”。
## Removing a profile README
## 删除个人资料自述文件
The profile README is removed from your {% data variables.product.prodname_dotcom %} profile if any of the following apply:
如果以下任何一项适用,个人资料自述文件将从您的 {% data variables.product.prodname_dotcom %} 个人资料中被删除:
- The README file is empty or doesn't exist.
- The repository is private.
- The repository name no longer matches your username.
- 自述文件为空或不存在。
- 该仓库为私有仓库。
- 仓库名称不再与您的用户名匹配。
The method you choose depends upon your needs, but if you're unsure, we recommend making your repository private. For steps on how to make your repository private, see "[Changing a repository's visibility](/github/administering-a-repository/setting-repository-visibility#changing-a-repositorys-visibility)."
您选择的方法取决于您的需求,但如果您不确定,我们建议您将仓库设为私有。 有关如何将存储库设为专用的步骤,请参阅“[更改存储库的可见性](/github/administering-a-repository/setting-repository-visibility#changing-a-repositorys-visibility)”。
## Further reading
## 延伸阅读
- [About READMEs](/github/creating-cloning-and-archiving-repositories/about-readmes)
- [关于自述文件](/github/creating-cloning-and-archiving-repositories/about-readmes)

View File

@@ -1,6 +1,6 @@
---
title: Personalizing your profile
intro: 'You can share information about yourself with other {% data variables.product.product_name %} users by setting a profile picture and adding a bio to your profile.'
title: 个性化您的个人资料
intro: '你可以在个人资料中设置头像和添加个人简历,与其他 {% data variables.product.product_name %} 用户共享你自己的信息。'
redirect_from:
- /articles/adding-a-bio-to-your-profile
- /articles/setting-your-profile-picture
@@ -18,186 +18,156 @@ versions:
topics:
- Profiles
shortTitle: Personalize
ms.openlocfilehash: c12fccd91144428fe9aad2f01d2c0b0941fdd4d4
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '146681051'
---
## Changing your profile picture
## 更改头像
Your profile picture helps identify you across {% data variables.product.product_name %} in pull requests, comments, contributions pages, and graphs.
您的头像可帮助在 {% data variables.product.product_name %} 的拉取请求、评论、参与页面及图形中识别您。
When you sign up for an account, {% data variables.product.product_name %} provides you with a randomly generated "identicon". [Your identicon](https://github.com/blog/1586-identicons) generates from a hash of your user ID, so there's no way to control its color or pattern. You can replace your identicon with an image that represents you.
在注册帐户时,{% data variables.product.product_name %} 会提供一个随机生成的“默认肖像”。 [哈希头像](https://github.com/blog/1586-identicons)根据用户 ID 的哈希生成,因此无法控制其颜色或模式。 您可以将默认肖像替换为能代表您的图片。
{% note %}
**Note{% ifversion ghec %}s{% endif %}**: {% ifversion ghec %}
注意{% ifversion ghec %}s{% endif %}{% ifversion ghec %}
* {% endif %}Your profile picture should be a PNG, JPG, or GIF file, and it must be less than 1 MB in size and smaller than 3000 by 3000 pixels. For the best quality rendering, we recommend keeping the image at about 500 by 500 pixels.
{% ifversion ghec %}* Gravatar profile pictures are not supported with {% data variables.product.prodname_emus %}.{% endif %}
* {% endif %}个人资料图片应为 PNGJPG GIF 文件,其大小必须小于 1 MB且小于 3000 x 3000 像素。 为获取质量最佳的渲染,建议图像的像素保持在大约 500 x 500 像素。
{% ifversion ghec %}* {% data variables.product.prodname_emus %} 不支持 Gravatar 头像。{% endif %}
{% endnote %}
### Setting a profile picture
### 设置头像
{% data reusables.user-settings.access_settings %}
2. Under **Profile Picture**, click {% octicon "pencil" aria-label="The edit icon" %} **Edit**.
![Edit profile picture](/assets/images/help/profile/edit-profile-photo.png)
3. Click **Upload a photo...**.{% ifversion not ghae %}
![Update profile picture](/assets/images/help/profile/edit-profile-picture-options.png){% endif %}
3. Crop your picture. When you're done, click **Set new profile picture**.
![Crop uploaded photo](/assets/images/help/profile/avatar_crop_and_save.png)
2. 在“个人资料图片”下,单击 {% octicon "pencil" aria-label="The edit icon" %}“编辑” 。
![编辑个人资料图片](/assets/images/help/profile/edit-profile-photo.png)
3. 单击“上传照片...”。{% ifversion not ghae %}![更新个人资料图片](/assets/images/help/profile/edit-profile-picture-options.png){% endif %}
3. 裁剪图片。 完成后,单击“设置新的个人资料图片”。
![裁剪上传的照片](/assets/images/help/profile/avatar_crop_and_save.png)
### Resetting your profile picture to the identicon
### 将头像重置为默认肖像
{% data reusables.user-settings.access_settings %}
2. Under **Profile Picture**, click {% octicon "pencil" aria-label="The edit icon" %} **Edit**.
![Edit profile picture](/assets/images/help/profile/edit-profile-photo.png)
3. To revert to your identicon, click **Remove photo**. {% ifversion not ghae %}If your email address is associated with a [Gravatar](https://en.gravatar.com/), you cannot revert to your identicon. Click **Revert to Gravatar** instead.
![Update profile picture](/assets/images/help/profile/edit-profile-picture-options.png){% endif %}
2. 在“个人资料图片”下,单击 {% octicon "pencil" aria-label="The edit icon" %}“编辑” 。
![编辑个人资料图片](/assets/images/help/profile/edit-profile-photo.png)
3. 要还原为哈希头像,请单击“删除照片”。 {% ifversion not ghae %}如果电子邮件地址与 [Gravatar](https://en.gravatar.com/) 相关联,则无法还原为默认肖像。 此时请单击“还原为 Gravatar”。
![更新个人资料图片](/assets/images/help/profile/edit-profile-picture-options.png){% endif %}
## Changing your profile name
## 更改个人资料名称
You can change the name that is displayed on your profile. This name may also be displayed next to comments you make on private repositories owned by an organization. For more information, see "[Managing the display of member names in your organization](/articles/managing-the-display-of-member-names-in-your-organization)."
您可以更改显示在个人资料中的名称。 此名称也可能显示在您对于组织拥有的私有仓库所做的注释旁边。 有关详细信息,请参阅“[管理组织中成员名称的显示](/articles/managing-the-display-of-member-names-in-your-organization)”。
{% ifversion fpt or ghec %}
{% note %}
{% ifversion fpt or ghec %} {% note %}
**Note:** If you're a member of an {% data variables.enterprise.prodname_emu_enterprise %}, any changes to your profile name must be made through your identity provider instead of {% data variables.product.prodname_dotcom_the_website %}. {% data reusables.enterprise-accounts.emu-more-info-account %}
注意:如果你是 {% data variables.product.prodname_emu_enterprise %} 的成员,则必须通过你的标识提供者而不是 {% data variables.product.prodname_dotcom_the_website %} 对个人资料名称进行任何更改。 {% data reusables.enterprise-accounts.emu-more-info-account %}
{% endnote %}
{% endif %}
{% endnote %} {% endif %}
{% data reusables.user-settings.access_settings %}
2. Under "Name", type the name you want to be displayed on your profile.
![Name field in profile settings](/assets/images/help/profile/name-field.png)
2. 在“Name名称”下键入要显示在个人资料中的名称。
![个人资料设置中的名称字段](/assets/images/help/profile/name-field.png)
## Adding a bio to your profile
## 在个人资料中添加个人简历
Add a bio to your profile to share information about yourself with other {% data variables.product.product_name %} users. With the help of [@mentions](/articles/basic-writing-and-formatting-syntax) and emoji, you can include information about where you currently or have previously worked, what type of work you do, or even what kind of coffee you drink.
在个人资料中添加个人简历,与其他 {% data variables.product.product_name %} 用户共享您自己的信息。 借助 [@mentions](/articles/basic-writing-and-formatting-syntax) 和表情符号,你可以在简历中包括以下信息:目前或以前工作的工作地点、从事的工作类型,甚至是喜欢的咖啡种类。
{% ifversion fpt or ghes or ghec %}
For a longer-form and more prominent way of displaying customized information about yourself, you can also use a profile README. For more information, see "[Managing your profile README](/github/setting-up-and-managing-your-github-profile/managing-your-profile-readme)."
要以更长和更突出的方式显示有关自己的自定义信息,您还可以使用个人资料自述文件。 有关详细信息,请参阅“[管理个人资料 README](/github/setting-up-and-managing-your-github-profile/managing-your-profile-readme)”。
{% endif %}
{% note %}
**Note:**
If you have the activity overview section enabled for your profile and you @mention an organization you're a member of in your profile bio, then that organization will be featured first in your activity overview. For more information, see "[Showing an overview of your activity on your profile](/articles/showing-an-overview-of-your-activity-on-your-profile)."
注意:如果你为个人资料启用了活动概述部分,并且在个人资料的个人简历中 @mention 你所属的组织,那么该组织将首先出现在你的活动概述中。 有关详细信息,请参阅“[在个人资料中显示活动概述](/articles/showing-an-overview-of-your-activity-on-your-profile)”。
{% endnote %}
{% data reusables.user-settings.access_settings %}
2. Under **Bio**, add the content that you want displayed on your profile. The bio field is limited to 160 characters.
![Update bio on profile](/assets/images/help/profile/bio-field.png)
2. 在“个人简历”下,添加要在个人资料中显示的内容。 个人资料字段限于 160 个字符。
![更新个人资料中的个人简历](/assets/images/help/profile/bio-field.png)
{% tip %}
**Tip:** When you @mention an organization, only those that you're a member of will autocomplete. You can still @mention organizations that you're not a member of, like a previous employer, but the organization name won't autocomplete for you.
提示:当你 @mention 组织时,只有你所属的组织才会自动填写。 你也可 @mention 不是其成员的组织(例如前雇主),但该组织名称不会自动填写。
{% endtip %}
{% data reusables.profile.update-profile %}
3. 单击“更新个人资料”。
![“更新个人资料”按钮](/assets/images/help/profile/update-profile-button.png)
{% ifversion profile-time-zone %}
## 设置状态
## Setting your location and time zone
您可以设置状态以显示您当前在 {% data variables.product.product_name %} 上的可用性。 您的状态将会显示:
- 在您的 {% data variables.product.product_name %} 个人资料页面上。
- 当有人在 {% data variables.product.product_name %} 上将鼠标放在您的用户名或头像上时。
- 在您属于其成员的团队页面上时。 有关详细信息,请参阅“[关于团队](/articles/about-teams/#team-pages)”。
- 在您属于其成员的组织的组织仪表板上。 有关详细信息,请参阅“[关于组织仪表板](/articles/about-your-organization-dashboard/)”。
You can set a location and time zone on your profile to show other people your local time. Your location and time zone will be visible:
- on your {% data variables.product.product_name %} profile page.
- when people hover over your username or avatar on {% data variables.product.product_name %}.
在设置状态时,您也可以让人们知道您在 {% data variables.product.product_name %} 上的可用性有限。
When you view your profile, you will see your location, local time, and your time zone in relation to Universal Time Coordinated.
![提及的用户名在用户名旁边显示“忙碌”注释](/assets/images/help/profile/username-with-limited-availability-text.png)
![Screenshot of the Octocat profile page emphasizing the location, local time, and time zone fields.](/assets/images/help/profile/profile-location-and-time.png)
![请求的审阅者在用户名旁边显示“忙碌”注释](/assets/images/help/profile/request-a-review-limited-availability-status.png)
When others view your profile, they will see your location, local time, and the time difference in hours from their own local time.
如果选择“忙碌”选项,当人们 @mention 你的用户名、分配给你问题或拉取请求或者请求你对拉取请求进行评审时,你的用户名旁边将会出现一条表示你在忙碌的注释。 您还将被排除在分配给您所属的任何团队的拉取请求的自动审核任务之外。 有关详细信息,请参阅“[管理团队的代码评审设置](/organizations/organizing-members-into-teams/managing-code-review-settings-for-your-team)”。
![Screenshot of the Octocat profile page emphasizing the location, local time, and relative time fields.](/assets/images/help/profile/profile-relative-time.png)
{% data reusables.user-settings.access_settings %}
1. Under **Location**, type the location you want to be displayed on your profile.
![Screenshot of the location and local time settings emphasizing the location field.](/assets/images/help/profile/location-field.png)
1. Optionally, to display the current local time on your profile, select **Display current local time**.
![Screenshot of the location and local time settings emphasizing the display current local time checkbox.](/assets/images/help/profile/display-local-time-checkbox.png)
- Select the **Time zone** dropdown menu, then click your local time zone.
![Screenshot of the location and local time settings emphasizing the time zone dropdown menu.](/assets/images/help/profile/time-zone-dropdown.png)
{% data reusables.profile.update-profile %}
{% endif %}
## Setting a status
You can set a status to display information about your current availability on {% data variables.product.product_name %}. Your status will show:
- on your {% data variables.product.product_name %} profile page.
- when people hover over your username or avatar on {% data variables.product.product_name %}.
- on a team page for a team where you're a team member. For more information, see "[About teams](/articles/about-teams/#team-pages)."
- on the organization dashboard in an organization where you're a member. For more information, see "[About your organization dashboard](/articles/about-your-organization-dashboard/)."
When you set your status, you can also let people know that you have limited availability on {% data variables.product.product_name %}.
![At-mentioned username shows "busy" note next to username](/assets/images/help/profile/username-with-limited-availability-text.png)
![Requested reviewer shows "busy" note next to username](/assets/images/help/profile/request-a-review-limited-availability-status.png)
If you select the "Busy" option, when people @mention your username, assign you an issue or pull request, or request a pull request review from you, a note next to your username will show that you're busy. You will also be excluded from automatic review assignment for pull requests assigned to any teams you belong to. For more information, see "[Managing code review settings for your team](/organizations/organizing-members-into-teams/managing-code-review-settings-for-your-team)."
1. In the top right corner of {% ifversion fpt or ghec %}{% data variables.product.prodname_dotcom_the_website %}{% else %}{% data variables.product.product_name %}{% endif %}, click your profile photo, then click **Set status** or, if you already have a status set, click your current status.
![Button on profile to set your status](/assets/images/help/profile/set-status-on-profile.png)
2. To add custom text to your status, click in the text field and type a status message.
![Field to type a status message](/assets/images/help/profile/type-a-status-message.png)
3. Optionally, to set an emoji status, click the smiley icon and select an emoji from the list.
![Button to select an emoji status](/assets/images/help/profile/select-emoji-status.png)
4. Optionally, if you'd like to share that you have limited availability, select "Busy."
![Busy option selected in Edit status options](/assets/images/help/profile/limited-availability-status.png)
5. Use the **Clear status** drop-down menu, and select when you want your status to expire. If you don't select a status expiration, you will keep your status until you clear or edit your status.
![Drop down menu to choose when your status expires](/assets/images/help/profile/status-expiration.png)
6. Use the drop-down menu and click the organization you want your status visible to. If you don't select an organization, your status will be public.
![Drop down menu to choose who your status is visible to](/assets/images/help/profile/status-visibility.png)
7. Click **Set status**.
![Button to set status](/assets/images/help/profile/set-status-button.png)
1. 在 {% ifversion fpt or ghec %}{% data variables.product.prodname_dotcom_the_website %}{% else %}{% data variables.product.product_name %}{% endif %} 的右上角,单击你的个人资料照片,然后单击“设置状态”,或者,如果已设置状态,则单击当前状态。
![个人资料中用于设置状态的按钮](/assets/images/help/profile/set-status-on-profile.png)
2. 要添加自定义文本到状态,请单击文本字段,然后输入状态消息。
![用于键入状态消息的字段](/assets/images/help/profile/type-a-status-message.png)
3. (可选)要设置表情符号状态,请单击笑脸图标并从列表中选择表情符号。
![选择表情符号状态的按钮](/assets/images/help/profile/select-emoji-status.png)
4. 可选如果想表示您的可用性受限请选择“Busy忙碌”。
![在“编辑状态”选项中选择的“忙碌”选项](/assets/images/help/profile/limited-availability-status.png)
5. 使用“清除状态”下拉菜单,选择状态的到期时间。 如果不选择状态到期时间,您的状态将保持到您清除或编辑状态为止。
![用于选择状态到期时间的下拉菜单](/assets/images/help/profile/status-expiration.png)
6. 使用下拉菜单,单击您要向其显示状态的组织。 如果不选择组织,您的状态将是公共的。
![用于选择状态可见者的下拉菜单](/assets/images/help/profile/status-visibility.png)
7. 单击“设置状态”。
![设置状态的按钮](/assets/images/help/profile/set-status-button.png)
{% ifversion fpt or ghec %}
## Displaying badges on your profile
## 在个人资料中显示徽章
When you participate in certain programs, {% data variables.product.prodname_dotcom %} automatically displays a badge on your profile.
当您参与某些计划时, {% data variables.product.prodname_dotcom %} 会自动在您的个人资料中显示徽章。
| Badge | Program | Description |
| 徽章 | 节目 | 说明 |
| --- | --- | --- |
| {% octicon "cpu" aria-label="The Developer Program icon" %} | **Developer Program Member** | If you're a registered member of the {% data variables.product.prodname_dotcom %} Developer Program, building an app with the {% ifversion fpt or ghec %}{% data variables.product.prodname_dotcom %}{% else %}{% data variables.product.product_name %}{% endif %} API, you'll get a Developer Program Member badge on your profile. For more information on the {% data variables.product.prodname_dotcom %} Developer Program, see [GitHub Developer](/program/). |
| {% octicon "star-fill" aria-label="The star icon" %} | **Pro** | If you use {% data variables.product.prodname_pro %} you'll get a PRO badge on your profile. For more information about {% data variables.product.prodname_pro %}, see "[{% data variables.product.prodname_dotcom %}'s products](/github/getting-started-with-github/githubs-products#github-pro)." |
| {% octicon "lock" aria-label="The lock icon" %} | **Security Bug Bounty Hunter** | If you helped out hunting down security vulnerabilities, you'll get a Security Bug Bounty Hunter badge on your profile. For more information about the {% data variables.product.prodname_dotcom %} Security program, see [{% data variables.product.prodname_dotcom %} Security](https://bounty.github.com/). |
| {% octicon "mortar-board" aria-label="The mortar-board icon" %} | **{% data variables.product.prodname_dotcom %} Campus Expert** | If you participate in the {% data variables.product.prodname_campus_program %}, you will get a {% data variables.product.prodname_dotcom %} Campus Expert badge on your profile. For more information about the Campus Experts program, see [Campus Experts](https://education.github.com/experts). |
| {% octicon "shield" aria-label="The shield icon" %} | **Security advisory credit** | If a security advisory you submit to the [{% data variables.product.prodname_dotcom %} Advisory Database](https://github.com/advisories) is accepted, you'll get a Security advisory credit badge on your profile. For more information about {% data variables.product.prodname_dotcom %} Security Advisories, see [{% data variables.product.prodname_dotcom %} Security Advisories](/code-security/repository-security-advisories/about-github-security-advisories-for-repositories). |
| {% octicon "check" aria-label="The check icon" %} | **Discussion answered** | If your reply to a discussion is marked as the answer, you'll get a Discussion answered badge on your profile. For more information about {% data variables.product.prodname_dotcom %} Discussions, see [About discussions](/discussions/collaborating-with-your-community-using-discussions/about-discussions). |
| {% octicon "cpu" aria-label="The Developer Program icon" %} | **开发人员计划成员** | 如果您是 {% data variables.product.prodname_dotcom %} 开发者计划的注册成员,使用 {% ifversion fpt or ghec %}{% data variables.product.prodname_dotcom %}{% else %}{% data variables.product.product_name %}{% endif %} API 构建应用程序,您的个人资料上将获得开发者计划成员徽章。 有关 {% data variables.product.prodname_dotcom %} 开发人员计划的更多信息,请参阅 [GitHub 开发人员](/program/) |
| {% octicon "star-fill" aria-label="The star icon" %} | **Pro** | 如果您使用 {% data variables.product.prodname_pro %},您的个人资料中将获得一个 PRO 徽章。 有关 {% data variables.product.prodname_pro %} 的详细信息,请参阅“[{% data variables.product.prodname_dotcom %} 的产品](/github/getting-started-with-github/githubs-products#github-pro)”。 |
| {% octicon "lock" aria-label="The lock icon" %} | **Security Bug Bounty Hunter** | 如果你帮助寻找安全漏洞,您的个人资料上将获得 Security Bug Bounty Hunter 徽章。 有关 {% data variables.product.prodname_dotcom %} 安全计划的详细信息,请参阅 [{% data variables.product.prodname_dotcom %} 安全性](https://bounty.github.com/) |
| {% octicon "mortar-board" aria-label="The mortar-board icon" %} | **{% data variables.product.prodname_dotcom %} 校园专家** | 如果您参加 {% data variables.product.prodname_campus_program %},您的个人资料上将获得 {% data variables.product.prodname_dotcom %} 校园专家徽章。 有关校园专家计划的详细信息,请参阅[校园专家](https://education.github.com/experts) |
| {% octicon "shield" aria-label="The shield icon" %} | 安全公告信用 | 如果你提交到 [{% data variables.product.prodname_dotcom %} 公告数据库](https://github.com/advisories)的安全公告被接受,你的个人资料上将获得一个安全公告信用徽章。 有关 {% data variables.product.prodname_dotcom %} 安全公告的详细信息,请参阅“[{% data variables.product.prodname_dotcom %} 安全公告](/code-security/repository-security-advisories/about-github-security-advisories-for-repositories)”。 |
| {% octicon "check" aria-label="The check icon" %} | 已回答的讨论 | 如果对讨论的答复标记为答案,你将在个人资料上获得“已回答的讨论”徽章。 有关 {% data variables.product.prodname_dotcom %} 的详细信息,请参阅[关于讨论](/discussions/collaborating-with-your-community-using-discussions/about-discussions) |
{% endif %}
{% ifversion fpt or ghec %}
## Earning Achievements
## 获得成就
Achievements celebrate specific events and actions that happen on {% data variables.product.prodname_dotcom %}. They will appear as small badges listed in the sidebar of your profile. Clicking or hovering on an achievement will show a detailed view that hints at how the achievement was earned, with a short description and links to the contributing events. The event links will only be visible to users that have access to the repository or organization that the event took place in. Event links will appear inaccessible to all users without access.
成就庆祝 {% data variables.product.prodname_dotcom %} 上发生的特定事件和操作。 它们将显示为你的个人资料边栏中列出的小徽章。 单击或悬停在成就上将显示一个详细视图,该视图提示如何获得成就,并提供简短说明和参与事件的链接。 事件链接将仅对有权访问发生事件的存储库或组织的用户可见。 对于没有访问权限的所有用户,事件链接将不可访问。
To stop private contributions from counting toward your Achievements, or to turn off Achievements entirely, see "[Showing your private contributions and Achievements on your profile](/articles/publicizing-or-hiding-your-private-contributions-on-your-profile)."
若要阻止私人贡献计入成就,或完全关闭成就,请参阅“[在个人资料上显示你的私人贡献和成就](/articles/publicizing-or-hiding-your-private-contributions-on-your-profile)”。
{% note %}
**Note:** This feature is currently in beta and subject to change.
注意:此功能目前为 beta 版本,可能会有变动。
{% endnote %}
{% endif %}
## List of qualifying repositories for Mars 2020 Helicopter Contributor achievement
## Mars 2020 Helicopter 贡献者成就的合格仓库列表
If you authored any commit(s) present in the commit history for the listed tag of one or more of the repositories below, you'll receive the Mars 2020 Helicopter Contributor achievement on your profile. The authored commit must be with a verified email address, associated with your account at the time {% data variables.product.prodname_dotcom %} determined the eligible contributions, in order to be attributed to you. You can be the original author or [one of the co-authors](/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors) of the commit. Future changes to verified emails will not have an effect on the badge. We built the list based on information received from NASA's Jet Propulsion Laboratory.
如果你为下面一个或多个仓库列出的标记撰写了提交历史记录中的任何提交,你的个人资料中将获得 Mars 2020 Helicopter 贡献者成就。 撰写的提交必须有验证过的电子邮件地址,该电子邮件地址在 {% data variables.product.prodname_dotcom %} 确定符合条件的贡献时与您帐户关联,表示该贡献归属于您。 你可以是提交的原始作者或[共同作者之一](/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors)。 将来对经过验证的电子邮件的更改不会对徽章产生影响。 我们根据从美国航天局喷气推进实验室获得的资料编制了清单。
| {% data variables.product.prodname_dotcom %} Repository | Version | Tag |
| {% data variables.product.prodname_dotcom %} 仓库 | 版本 | 标记 |
|---|---|---|
| [torvalds/linux](https://github.com/torvalds/linux) | 3.4 | [v3.4](https://github.com/torvalds/linux/releases/tag/v3.4) |
| [python/cpython](https://github.com/python/cpython) | 3.9.2 | [v3.9.2](https://github.com/python/cpython/releases/tag/v3.9.2) |
@@ -268,6 +238,6 @@ If you authored any commit(s) present in the commit history for the listed tag o
| [locationtech/jts](https://github.com/locationtech/jts) | 1.15.0 | [jts-1.15.0](https://github.com/locationtech/jts/releases/tag/jts-1.15.0) |
| [apache/logging-log4j2](https://github.com/apache/logging-log4j2) | 2.11 | [log4j-2.11.0](https://github.com/apache/logging-log4j2/releases/tag/log4j-2.11.0) |
## Further reading
## 延伸阅读
- "[About your profile](/articles/about-your-profile)"
- [关于个人资料](/articles/about-your-profile)

View File

@@ -0,0 +1,28 @@
---
title: 管理个人资料中的贡献图
intro: Your contributions, including commits, proposed pull requests, and opened issues, are displayed on your profile so people can easily see the work you've done.
redirect_from:
- /articles/managing-contribution-graphs-on-your-profile
- /github/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Profiles
children:
- /viewing-contributions-on-your-profile
- /showing-an-overview-of-your-activity-on-your-profile
- /publicizing-or-hiding-your-private-contributions-on-your-profile
- /sending-enterprise-contributions-to-your-githubcom-profile
- /why-are-my-contributions-not-showing-up-on-my-profile
- /troubleshooting-commits-on-your-timeline
shortTitle: Manage contribution graph
ms.openlocfilehash: 87780d97656aa27b4d60fb06a5550f042a0f8f96
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145066986"
---

View File

@@ -0,0 +1,43 @@
---
title: 在个人资料中公开或隐藏您的私人贡献
intro: Your {% data variables.product.product_name %} profile shows a graph of your repository contributions over the past year. You can choose to show anonymized activity from {% ifversion fpt or ghes or ghec %}private and internal{% else %}private{% endif %} repositories{% ifversion fpt or ghes or ghec %} in addition to the activity from public repositories{% endif %}.
redirect_from:
- /articles/publicizing-or-hiding-your-private-contributions-on-your-profile
- /github/setting-up-and-managing-your-github-profile/publicizing-or-hiding-your-private-contributions-on-your-profile
- /github/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/publicizing-or-hiding-your-private-contributions-on-your-profile
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Profiles
shortTitle: Private contributions
ms.openlocfilehash: d3ca9c3bef9324baa73b96eb6dc26bdd75960b37
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145066983"
---
如果公开您的私有贡献,对您处理的私有仓库没有访问权限的人员将无法查看您的私有贡献详情, 而只能看到您在指定日期的贡献数。 您的公共贡献会包含详细信息。 有关详细信息,请参阅“[查看个人资料页面上的贡献](/articles/viewing-contributions-on-your-profile-page)”。
{% note %}
**注意:** {% ifversion fpt or ghes or ghec %}在 {% ifversion fpt or ghec %}{% data variables.product.prodname_dotcom_the_website %}{% elsif ghes %}{% data variables.product.product_name %}{% endif %} 上,你的个人资料上的公共贡献{% ifversion fpt or ghec %}对世界上能访问 {% data variables.product.prodname_dotcom_the_website %} 的任何人{% elsif ghes %}仅对其他 {% data variables.product.product_location%} 用户{% endif %}可见。{% elsif ghae %}在 {% data variables.product.prodname_ghe_managed %} 上,只有你企业的其他成员才可看到你的个人资料上的贡献。{% endif %}
{% endnote %}
## <a name="changing-the-visibility-of-your-private-contributions"></a>更改私有贡献的可见性
{% data reusables.profile.access_profile %}
1. 在个人资料中公开或隐藏您的私有贡献:
- 要公开你的私有贡献,在贡献图上方,使用“贡献设置”下拉菜单,然后选择“私有贡献” 。 访问者将会看到您的私有贡献数,但没有更多详细信息。
![从“贡献设置”下拉菜单允许访问者查看私有贡献](/assets/images/help/profile/private-contributions-on.png)
- 要隐藏你的私有贡献,在贡献图上方,使用“贡献设置”下拉菜单,然后取消选择“私有贡献” 。 访问者将只看到你的公共贡献。
![从“贡献设置”下拉菜单允许访问者查看私有贡献](/assets/images/help/profile/private-contributions-off.png)
## <a name="further-reading"></a>延伸阅读
- “[在个人资料页中查看贡献](/articles/viewing-contributions-on-your-profile-page)”
- “[为什么我的贡献未显示在我的个人资料上?](/articles/why-are-my-contributions-not-showing-up-on-my-profile)”

View File

@@ -0,0 +1,63 @@
---
title: 将企业贡献发送到您的 GitHub.com 个人资料
intro: You can highlight your work on {% data variables.product.prodname_enterprise %} by sending the contribution counts to your {% data variables.product.prodname_dotcom_the_website %} profile.
redirect_from:
- /articles/sending-your-github-enterprise-contributions-to-your-github-com-profile
- /articles/sending-your-github-enterprise-server-contributions-to-your-github-com-profile
- /articles/sending-your-github-enterprise-server-contributions-to-your-githubcom-profile
- /github/setting-up-and-managing-your-github-profile/sending-your-github-enterprise-server-contributions-to-your-githubcom-profile
- /github/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/sending-your-github-enterprise-server-contributions-to-your-githubcom-profile
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Profiles
shortTitle: Send enterprise contributions
ms.openlocfilehash: 19b26c9e274b66df16434727e42c5c291bacfea7
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145085058"
---
## <a name="about-enterprise-contributions-on-your--data-variablesproductprodname_dotcom_the_website--profile"></a>关于 {% data variables.product.prodname_dotcom_the_website %} 个人资料上的企业贡献
您的 {% data variables.product.prodname_dotcom_the_website %} 个人资料显示过去 90 天内 {% ifversion fpt or ghec %}{% data variables.product.prodname_enterprise %}{% else %}{% data variables.product.product_name %}{% endif %} 贡献计数。 {% data reusables.github-connect.sync-frequency %} {% ifversion fpt or ghec %}{% data variables.product.prodname_enterprise %}{% else %}{% data variables.product.product_name %}{% endif %} 的贡献计数被视为私人贡献。 提交详细信息将仅显示贡献计数,这些贡献是在 {% data variables.product.prodname_dotcom_the_website %} 以外的 {% data variables.product.prodname_enterprise %} 环境中进行的。
您可以决定是否在个人资料中显示私人贡献的计数。 有关详细信息,请参阅“[在个人资料中公开或隐藏你的私人贡献](/articles/publicizing-or-hiding-your-private-contributions-on-your-profile/)”。
有关如何计算贡献的详细信息,请参阅“[管理个人资料中的贡献图](/articles/managing-contribution-graphs-on-your-profile/)”。
{% note %}
**注意:**
- 帐户之间的连接受 [GitHub 的隐私声明](/free-pro-team@latest/github/site-policy/github-privacy-statement/)约束,启用连接即表示用户同意 [GitHub 的服务条款](/free-pro-team@latest/github/site-policy/github-terms-of-service)。
- 在将 {% ifversion fpt or ghec %}{% data variables.product.prodname_enterprise %}{% else %}{% data variables.product.product_name %}{% endif %} 配置文件连接到 {% data variables.product.prodname_dotcom_the_website %} 配置文件之前,企业所有者必须启用 {% data variables.product.prodname_github_connect %} 并启用环境之间的贡献共享。 有关详细信息,请与企业所有者联系。
{% endnote %}
## <a name="sending-your-enterprise-contributions-to-your--data-variablesproductprodname_dotcom_the_website--profile"></a>将您的企业贡献发送到您的 {% data variables.product.prodname_dotcom_the_website %} 个人资料
{% ifversion fpt or ghec %}
- 若要将来自 {% data variables.product.prodname_ghe_server %} 的企业贡献发送到你的 {% data variables.product.prodname_dotcom_the_website %} 个人资料,请参阅 {% data variables.product.prodname_ghe_server %} 文档中的“[将企业贡献发送到你的 {% data variables.product.prodname_dotcom_the_website %} 个人资料](/enterprise-server/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/sending-enterprise-contributions-to-your-githubcom-profile)”。
- 若要将来自 {% data variables.product.prodname_ghe_managed %} 的企业贡献发送到你的 {% data variables.product.prodname_dotcom_the_website %} 个人资料,请参阅 {% data variables.product.prodname_ghe_managed %} 文档中的“[将企业贡献发送到你的 {% data variables.product.prodname_dotcom_the_website %} 个人资料](/github-ae@latest/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/sending-enterprise-contributions-to-your-githubcom-profile)”。
{% elsif ghes %}
1. 登录到 {% data variables.product.prodname_ghe_server %} 和 {% data variables.product.prodname_dotcom_the_website %}。
1. 在 {% data variables.product.prodname_ghe_server %} 任意页的右上角,单击个人资料照片,然后单击“设置”。
![用户栏中的“设置”图标](/assets/images/help/settings/userbar-account-settings.png) {% data reusables.github-connect.github-connect-tab-user-settings %} {% data reusables.github-connect.connect-dotcom-and-enterprise %}
1. 查看 {% data variables.product.prodname_ghe_server %} 将从你的 {% data variables.product.prodname_dotcom_the_website %} 帐户访问的资源,然后单击“授权”。
![授权 GitHub Enterprise Server 与 GitHub.com 之间的连接](/assets/images/help/settings/authorize-ghe-to-connect-to-dotcom.png) {% data reusables.github-connect.send-contribution-counts-to-githubcom %}
{% elsif ghae %}
1. 登录到 {% data variables.product.prodname_ghe_managed %} 和 {% data variables.product.prodname_dotcom_the_website %}。
1. 在 {% data variables.product.prodname_ghe_managed %} 任意页的右上角,单击个人资料照片,然后单击“设置”。
![用户栏中的“设置”图标](/assets/images/help/settings/userbar-account-settings.png) {% data reusables.github-connect.github-connect-tab-user-settings %} {% data reusables.github-connect.connect-dotcom-and-enterprise %} {% data reusables.github-connect.authorize-connection %} {% data reusables.github-connect.send-contribution-counts-to-githubcom %}
{% endif %}

View File

@@ -0,0 +1,29 @@
---
title: 在个人资料中显示活动概览
intro: You can enable the activity overview section on your profile to give viewers more context about the types of contributions you make.
redirect_from:
- /articles/showing-an-overview-of-your-activity-on-your-profile
- /github/setting-up-and-managing-your-github-profile/showing-an-overview-of-your-activity-on-your-profile
- /github/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/showing-an-overview-of-your-activity-on-your-profile
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Profiles
shortTitle: Show an overview
ms.openlocfilehash: a87650ceff7e49269f117a1dd9d8ab3c7b53dcce
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145085057"
---
{% data reusables.profile.activity-overview-summary %} 有关更多信息,请参阅“[在个人资料中查看贡献](/articles/viewing-contributions-on-your-profile)”。
![个人资料中的活动概览部分](/assets/images/help/profile/activity-overview-section.png)
{% data reusables.profile.access_profile %}
2. 在贡献图上方,使用“贡献设置”下拉菜单,然后选择或取消选择“活动概述” 。
![从贡献设置下拉菜单启用活动概览](/assets/images/help/profile/activity-overview.png)

View File

@@ -0,0 +1,74 @@
---
title: 对时间表上的提交进行故障排除
intro: You can view details for commits from your profile's timeline. If you don't see commits you expect on your profile or can't find commit details from your profile page, the commit date and the commit author date may be different.
redirect_from:
- /articles/troubleshooting-commits-on-your-timeline
- /github/setting-up-and-managing-your-github-profile/troubleshooting-commits-on-your-timeline
- /github/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/troubleshooting-commits-on-your-timeline
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Profiles
shortTitle: Troubleshoot commits
ms.openlocfilehash: 78adf6a92412c89180adeb49f7a5f446f7ce7f17
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145085055"
---
## <a name="expected-behavior-to-view-commit-details"></a>查看提交详细信息的预期行为
在个人资料页面的时间表中,您可以单击特定仓库旁边的提交数量,以查看关于该时间段内提交的更多详细信息,包括仓库中进行的特定更改的差异。
![个人资料时间表中的提交链接](/assets/images/help/profile/commit-link-on-profile-timeline.png)
![提交详细信息](/assets/images/help/commits/commit-details.png)
## <a name="missing-commit-details-from-commits-in-your-timeline"></a>时间表中的提交缺少提交详细信息
如果单击个人资料页面中的提交链接而没有在仓库的提交页面上看到所有预期的提交,则可能会重写 Git 中的提交历史记录,并且提交创作日期和提交日期会不同。
![含有表明“未找到 octocat 的任何提交”消息的存储库页面](/assets/images/help/repository/no-commits-found.png)
## <a name="how-github-uses-the-git-author-date-and-commit-date"></a>GitHub 如何使用 Git 创作日期和提交日期
在 Git 中,创作日期是有人首次使用 `git commit` 创建提交的时间。 除非有人使用 `git commit --amend`、强制推送、变基或其他 Git 命令更改提交日期,否则提交日期与创作日期相同。
在个人资料页面上,创作日期用于计算进行提交的时间。 而在仓库中,提交日期用于计算在仓库中进行提交的时间。
通常,创作日期和提交日期是相同的,但如果提交历史记录发生变化,您可能会注意到提交顺序将被打乱。 有关详细信息,请参阅“[为什么我的贡献没有在我的个人资料中显示?](/articles/why-are-my-contributions-not-showing-up-on-my-profile)”
## <a name="viewing-missing-commit-details-from-commits-in-your-timeline"></a>查看时间表中提交缺少的提交详细信息
可以将 `git show` 命令与 `--pretty=fuller` 标志一起使用,以检查提交创作日期和提交日期是否不同。
```shell
$ git show <em>Your commit SHA number</em> --pretty=fuller
commit <em>Your commit SHA number</em>
Author: octocat <em>user email</em>
AuthorDate: Tue Apr 03 02:02:30 2018 +0900
Commit: Sally Johnson <em>user email</em>
CommitDate: Tue Apr 10 06:25:08 2018 +0900
```
如果创作和提交日期不同,您可以在 URL 中手动更改提交日期以查看提交详细信息。
例如:
- 以下 URL 使用的创作日期为 `2018-04-03`
`https://github.com/your-organization-or-personal-account/your-repository/commits?author=octocat&since=2018-04-03T00:00:00Z&until=2018-04-03T23:59:59Z`
- 以下 URL 使用的提交日期为 `2018-04-10`
`https://github.com/your-organization-or-personal-account/your-repository/commits?author=octocat&since=2018-04-10T00:00:00Z&until=2018-04-10T23:59:59Z`
使用修改后的提交日期打开 URL 时,您可以看到提交详细信息。
![提交详细信息](/assets/images/help/commits/commit-details.png)
## <a name="expected-commits-missing-in-your-timeline"></a>时间表中缺少预期的提交
如果没有在时间表中看到预期的提交,则可能 Git 中的提交历史记录已重写,并且提交创作日期与提交日期不同。 有关其他可能性,请参阅“[为什么我的贡献没有在我的个人资料中显示?](/articles/why-are-my-contributions-not-showing-up-on-my-profile)”

View File

@@ -0,0 +1,103 @@
---
title: 在个人资料中查看贡献
intro: Your {% data variables.product.product_name %} profile shows off {% ifversion fpt or ghes or ghec %}your pinned repositories as well as{% endif %} a graph of your repository contributions over the past year.
redirect_from:
- /articles/viewing-contributions
- /articles/viewing-contributions-on-your-profile-page
- /articles/viewing-contributions-on-your-profile
- /github/setting-up-and-managing-your-github-profile/viewing-contributions-on-your-profile
- /github/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/viewing-contributions-on-your-profile
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Profiles
shortTitle: View contributions
ms.openlocfilehash: fccf691bc2fa865dd6ebcdebd112cbe6da02e0b5
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145098711"
---
{% ifversion fpt or ghes or ghec %} 贡献图显示公共存储库的活动。 {% endif %}可以选择显示 {% ifversion fpt or ghes or ghec %} 公共和 {% endif %} 私有存储库的活动,并将私有存储库中活动的具体详细信息匿名化。 有关详细信息,请参阅“[在配置文件中公开或隐藏私人贡献](/articles/publicizing-or-hiding-your-private-contributions-on-your-profile)”。
{% note %}
注意:仅当用于创作提交的电子邮件地址与在 {% data variables.product.product_name %} 上的帐户相连时,提交才会显示在你的贡献图中。 有关详细信息,请参阅“[为什么我的贡献没有在我的配置文件中显示?](/articles/why-are-my-contributions-not-showing-up-on-my-profile#your-local-git-commit-email-isnt-connected-to-your-account)”
{% endnote %}
## <a name="what-counts-as-a-contribution"></a>计为贡献的内容
在您的个人资料页面上,某些操作计为贡献:
- 提交到存储库的默认分支或 `gh-pages` 分支
- 创建问题
- 打开讨论
- 回答讨论
- 提议拉取请求
- 提交拉取请求审查 {% ifversion ghes or ghae %}
- 合作创作存储库默认分支或 `gh-pages` 分支中的提交{% endif %}
{% data reusables.pull_requests.pull_request_merges_and_contributions %}
## <a name="popular-repositories"></a>受欢迎的仓库
此部分显示具有最多查看者的仓库。 {% ifversion fpt or ghes or ghec %}[将存储库固定到配置文件](/articles/pinning-repositories-to-your-profile)后,此部分将更改为“固定的存储库”。{% endif %}
![受欢迎的仓库](/assets/images/help/profile/profile_popular_repositories.png)
{% ifversion fpt or ghes or ghec %}
## <a name="pinned-repositories"></a>固定的仓库
此部分显示最多六个公共仓库,并可包括您的仓库以及您对其做出贡献的仓库。 为便于查看关于你选择提供的存储库的重要详细信息,此部分中的每个存储库均包括所做工作的摘要、存储库已收到的[星号](/articles/saving-repositories-with-stars/)数量以及存储库中使用的主要编程语言。 有关详细信息,请参阅“[将存储库固定到配置文件](/articles/pinning-repositories-to-your-profile)”。
![固定的仓库](/assets/images/help/profile/profile_pinned_repositories.png)
{% endif %}
## <a name="contributions-calendar"></a>贡献日历
您的贡献日历会显示贡献活动。
### <a name="viewing-contributions-from-specific-times"></a>查看特定时间的贡献
- 单击某个日期的方块可显示该 24 小时期间内所做的贡献。
- 按“Shift”并单击任意日期的方块可显示该时间范围内所做的贡献。
{% note %}
注意:可以在贡献日历中选择最多一个月的范围。 如果您选择更大的时间范围,我们将仅显示一个月的贡献。
{% endnote %}
![您的贡献图](/assets/images/help/profile/contributions_graph.png)
### <a name="how-contribution-event-times-are-calculated"></a>如何计算贡献事件时间
对于提交和拉取请求,时间戳的计算方式不同:
- “提交”使用提交时间戳中的时区信息。 有关详细信息,请参阅“[排查日程表上的提交问题](/articles/troubleshooting-commits-on-your-timeline)”。
- {% data variables.product.product_name %} 上打开的“拉取请求”和“议题”使用浏览器的时区 。 通过 API 打开的内容使用 [API 调用中指定的](https://developer.github.com/changes/2014-03-04-timezone-handling-changes)时间戳或时区。
## <a name="activity-overview"></a>活动概述
{% data reusables.profile.activity-overview-summary %} 有关详细信息,请参阅“[在配置文件中显示活动概览](/articles/showing-an-overview-of-your-activity-on-your-profile)”。
![个人资料中的活动概览部分](/assets/images/help/profile/activity-overview-section.png)
活动概览中提供的组织根据您在组织中的活跃程度确定优先级。 如果在配置文件简历中 @mention 某个组织,并且你是组织成员,则该组织首先在活动概览中确定优先级。 有关详细信息,请参阅“[提及人员和团队](/articles/basic-writing-and-formatting-syntax/#mentioning-people-and-teams)”或“[将个人简介添加到配置文件](/articles/adding-a-bio-to-your-profile/)”。
## <a name="contribution-activity"></a>贡献活动
贡献活动部分包括工作的详细时间表,包括您进行或合作的提交、您提议的拉取请求以及您打开的议题。 可通过单击贡献活动底部的“Show more activity显示更多活动”或通过在查看页面右侧时单击你感兴趣的年份来查看一段时间内你的贡献。 重要时刻(如您加入组织、提议第一个拉取请求或打开一个备受瞩目议题的日期)将在贡献活动中突出显示。 如果您在时间表中无法看到某些事件,请检查以确保您仍具有事件发生位置组织或仓库的访问权限。
![贡献活动时间过滤器](/assets/images/help/profile/contributions_activity_time_filter.png)
## <a name="viewing-contributions-from--data-variablesproductprodname_enterprise--on--data-variablesproductprodname_dotcom_the_website-"></a>在 {% data variables.product.prodname_dotcom_the_website %} 上查看 {% data variables.product.prodname_enterprise %} 中的贡献
如果使用 {% ifversion fpt or ghec %}{% data variables.product.prodname_ghe_server %}{% ifversion ghae %} 或 {% data variables.product.prodname_ghe_managed %}{% endif %}{% else %}{% data variables.product.product_name %}{% endif %} 并且你的企业所有者启用 {% data variables.product.prodname_unified_contributions %},可以向 {% 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)”。

View File

@@ -0,0 +1,105 @@
---
title: 为什么我的贡献没有在我的个人资料中显示?
intro: Learn common reasons that contributions may be missing from your contributions graph.
redirect_from:
- /articles/why-are-my-contributions-not-showing-up-on-my-profile
- /github/setting-up-and-managing-your-github-profile/why-are-my-contributions-not-showing-up-on-my-profile
- /github/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/why-are-my-contributions-not-showing-up-on-my-profile
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Profiles
shortTitle: Missing contributions
ms.openlocfilehash: c3921897284e16c979542c5f7629690ded2b841e
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145099743"
---
## <a name="about-your-contribution-graph"></a>关于您的贡献图
您的个人资料贡献图是您参与{% data variables.product.product_location %}{% ifversion ghae %}拥有{% else %}上{% endif %} 的存储库的记录。 贡献按照协调世界时 (UTC) 而不是您当地的时区加时间戳。 只有在满足特定标准时才会计算贡献。 在某些情况下,我们可能需要重建您的图表才能显示贡献。
如果您是使用 SAML 单点登录 (SSO) 的组织的成员,则在没有活动的 SSO 会话时,您将无法在配置文件上看到来自该组织的贡献活动。 从组织外部查看您个人资料的用户将看到您组织的贡献活动的匿名贡献活动。
## <a name="contributions-that-are-counted"></a>计算的贡献
### <a name="issues-pull-requests-and-discussions"></a>议题、拉取请求和讨论
如果议题、拉取请求和讨论在独立的仓库而不是复刻中打开,它们将在您的贡献图中显示。
### <a name="commits"></a>提交
如果提交符合以下所有条件,则会在贡献图中显示:
- 用于提交的电子邮件地址与您在 {% data variables.product.product_location %} 上的帐户关联。
- 提交在独立的仓库而不是复刻中进行。
- 提交在以下位置进行:
- 在仓库的默认分支中
- 在 `gh-pages` 分支(对于具有项目网站的存储库)中
有关项目网站的详细信息,请参阅“[关于 {% data variables.product.prodname_pages %}](/pages/getting-started-with-github-pages/about-github-pages#types-of-github-pages-sites)”。
此外,以下至少一项必须为 true
- 您是仓库中的协作者,或者是拥有该仓库的组织的成员。
- 您已复刻该仓库。
- 您已打开仓库中的拉取请求或议题。
- 您已为仓库加星标。
## <a name="common-reasons-that-contributions-are-not-counted"></a>贡献未计算的常见原因
{% data reusables.pull_requests.pull_request_merges_and_contributions %}
### <a name="commit-was-made-less-than-24-hours-ago"></a>24 小时内进行的提交
进行满足计为贡献要求的提交后,您可能需要等待最长 24 小时才能看到在贡献图中显示的贡献。
### <a name="your-local-git-commit-email-isnt-connected-to-your-account"></a>您的本地 Git 提交电子邮件地址未连接到您的帐户
提交必须使用与你在 {% data variables.product.product_location %}{% ifversion fpt or ghec %} 上的帐户连接的电子邮件地址进行,或者使用在电子邮件设置中提供给你的 {% data variables.product.prodname_dotcom %} 提供的 `noreply` 电子邮件地址进行,{% endif %}才能显示在你的贡献图上。{% ifversion fpt or ghec %} 有关 `noreply` 电子邮件地址的详细信息,请参阅“[设置提交电子邮件地址](/github/setting-up-and-managing-your-github-user-account/setting-your-commit-email-address#about-commit-email-addresses)”。{% endif %}
可以通过将 `.patch` 添加到提交 URL 的末尾(例如 <a href="https://github.com/octocat/octocat.github.io/commit/67c0afc1da354d8571f51b6f0af8f2794117fd10.patch" data-proofer-ignore>https://github.com/octocat/octocat.github.io/commit/67c0afc1da354d8571f51b6f0af8f2794117fd10.patch</a>)来检查用于提交的电子邮件地址:
```
From 67c0afc1da354d8571f51b6f0af8f2794117fd10 Mon Sep 17 00:00:00 2001
From: The Octocat <octocat@nowhere.com>
Date: Sun, 27 Apr 2014 15:36:39 +0530
Subject: [PATCH] updated index for better welcome message
```
`From:` 字段中的电子邮件地址是在[本地 git 配置设置](/articles/set-up-git)中设置的地址。 在此示例中,用于提交的电子邮件地址为 `octocat@nowhere.com`
如果用于提交的电子邮件地址未连接到您的 {% data variables.product.product_location %} 帐户,{% ifversion ghae %}请更改用于在 Git 中创作提交的电子邮件地址。 有关详细信息,请参阅“[设置提交电子邮件地址](/github/setting-up-and-managing-your-github-user-account/setting-your-commit-email-address#setting-your-commit-email-address-in-git)”。{% else %}必须[将电子邮件地址添加](/articles/adding-an-email-address-to-your-github-account)到 {% data variables.product.product_location %} 上的帐户。 您的贡献图将在添加新地址后自动重建。{% endif %}
{% warning %}
警告:通用电子邮件地址(如 `jane@computer.local`)无法添加到 {% data variables.product.prodname_dotcom %} 帐户。 如果为您的提交使用这类电子邮件,则提交不会链接到您的 {% data variables.product.prodname_dotcom %} 个人资料,并且不会在您的贡献图中显示。
{% endwarning %}
### <a name="commit-was-not-made-in-the-default-or-gh-pages-branch"></a>未在默认分支或 `gh-pages` 分支中执行提交
仅发生在默认分支或 `gh-pages` 分支(对于包含项目网站的存储库)中的提交才会计入。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_pages %}](/pages/getting-started-with-github-pages/about-github-pages#types-of-github-pages-sites)”。
如果提交位于非默认或非 `gh-pages` 分支中,并且你希望将其计入你的贡献,则需要执行以下操作之一:
- [打开拉取请求](/articles/creating-a-pull-request),将更改合并到默认分支或 `gh-pages` 分支中。
- [更改存储库的默认分支](/github/administering-a-repository/changing-the-default-branch)。
{% warning %}
警告:更改存储库的默认分支将会更改所有存储库协作者的默认分支。 仅当您希望新分支成为进行所有未来拉取请求和提交的基础时才执行此操作。
{% endwarning %}
### <a name="commit-was-made-in-a-fork"></a>提交在复刻中进行
在复刻中进行的提交不会计入您的贡献。 要将其计入,您必须执行以下操作之一:
- [打开拉取请求](/articles/creating-a-pull-request),将更改合并到父存储库中。
- 要分离复刻并将其变为 {% data variables.product.product_location %} 上独立的仓库,请联系 {% data variables.contact.contact_support %}。 如果该复刻有自己的复刻,让 {% data variables.contact.contact_support %} 了解这些复刻是随您的仓库移入新网络还是留在当前网络中。 有关详细信息,请参阅“[关于分支](/articles/about-forks/)”。
## <a name="further-reading"></a>延伸阅读
- [在个人资料中公开或隐藏你的私人贡献](/articles/publicizing-or-hiding-your-private-contributions-on-your-profile)
- [在个人资料页中查看贡献](/articles/viewing-contributions-on-your-profile-page)

View File

@@ -1,6 +1,6 @@
---
title: Showing your private contributions and achievements on your profile
intro: 'Your {% data variables.product.product_name %} profile shows a graph of your repository contributions over the past year. You can choose to show anonymized activity from {% ifversion fpt or ghes or ghec %}private and internal{% else %}private{% endif %} repositories{% ifversion fpt or ghes or ghec %} in addition to the activity from public repositories{% endif %}.'
title: 在个人资料上显示你的私有贡献和成就
intro: '您的 {% data variables.product.product_name %} 个人资料显示过去一年中您的仓库贡献图。 除公共存储库{% endif %}中的活动外,还可选择显示{% ifversion fpt or ghes or ghec %}专用和内部{% else %}专用{% endif %}存储库{% ifversion fpt or ghes or ghec %}中的匿名活动。'
redirect_from:
- /articles/publicizing-or-hiding-your-private-contributions-on-your-profile
- /github/setting-up-and-managing-your-github-profile/publicizing-or-hiding-your-private-contributions-on-your-profile
@@ -14,42 +14,40 @@ versions:
topics:
- Profiles
shortTitle: Private contributions and achievements
ms.openlocfilehash: b40e3835bf1548ff4ced75d1207de9a5b493dc90
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147079534'
---
If you publicize your private contributions, people without access to the private repositories you work in won't be able to see the details of your private contributions. Instead, they'll see the number of private contributions you made on any given day. Your public contributions will include detailed information. For more information, see "[Viewing contributions on your profile page](/articles/viewing-contributions-on-your-profile-page)."
如果公开您的私有贡献,对您处理的私有仓库没有访问权限的人员将无法查看您的私有贡献详情, 而只能看到您在指定日期的贡献数。 您的公共贡献会包含详细信息。 有关详细信息,请参阅“[查看个人资料页面上的贡献](/articles/viewing-contributions-on-your-profile-page)”。
{% note %}
**Note:** {% ifversion fpt or ghes or ghec %}On {% ifversion fpt or ghec %}{% data variables.product.prodname_dotcom_the_website %}{% elsif ghes %}{% data variables.product.product_name %}{% endif %}, public contributions on your profile are visible {% ifversion fpt or ghec %}to anyone in the world who can access {% data variables.product.prodname_dotcom_the_website %}{% elsif ghes %}only to other users of {% data variables.location.product_location%}{% endif %}.{% elsif ghae %}On {% data variables.product.prodname_ghe_managed %}, only other members of your enterprise can see the contributions on your profile.{% endif %}
**注意:** {% ifversion fpt or ghes or ghec %} {% ifversion fpt or ghec %}{% data variables.product.prodname_dotcom_the_website %}{% elsif ghes %}{% data variables.product.product_name %}{% endif %} 上,你的个人资料上的公共贡献{% ifversion fpt or ghec %}对世界上能访问 {% data variables.product.prodname_dotcom_the_website %} 的任何人{% elsif ghes %}仅对其他 {% data variables.product.product_location%} 用户{% endif %}可见。{% elsif ghae %} {% data variables.product.prodname_ghe_managed %} 上,只有你企业的其他成员才可看到你的个人资料上的贡献。{% endif %}
{% endnote %}
## Changing the visibility of your private contributions
## 更改私有贡献的可见性
{% data reusables.profile.access_profile %}
1. Publicize or hide your private contributions on your profile:
- To publicize your private contributions, above your contributions graph, use the **Contribution settings** drop-down menu, and select **Private contributions**. Visitors will see your private contribution counts without further details.
![Enable visitors to see private contributions from contribution settings drop-down menu](/assets/images/help/profile/private-contributions-on.png)
- To hide your private contributions, above your contributions graph, use the **Contribution settings** drop-down menu, and unselect **Private contributions.** Visitors will only see your public contributions.
![Enable visitors to see private contributions from contribution settings drop-down menu](/assets/images/help/profile/private-contributions-off.png)
1. 在个人资料中公开或隐藏您的私有贡献:
- 要公开你的私有贡献,在贡献图上方,使用“贡献设置”下拉菜单,然后选择“私有贡献” 。 访问者将会看到您的私有贡献数,但没有更多详细信息。
![从“贡献设置”下拉菜单允许访问者查看私有贡献](/assets/images/help/profile/private-contributions-on.png)
- 要隐藏你的私有贡献,在贡献图上方,使用“贡献设置”下拉菜单,然后取消选择“私有贡献” 。 访问者将只看到你的公共贡献。
![从“贡献设置”下拉菜单允许访问者查看私有贡献](/assets/images/help/profile/private-contributions-off.png)
## Changing the visibility of Achievements
## 更改成就的可见性
{% data reusables.user-settings.access_settings %}
1. Show or hide Achievements on your profile:
- To show Achievements on your profile, navigate to **Profile settings**, and select the checkbox next to **Show Achievements on my profile.**
![Enable visitors to see Achievements from profile settings](/assets/images/help/profile/achievements-profile-settings-off.png)
- To hide Achievements from your profile, navigate to **Profile settings**, and unselect the checkbox next to **Show Achievements on my profile.**
![Hide Achievements from visitors in profile settings](/assets/images/help/profile/achievements-profile-settings-on.png)
{% ifversion hide-individual-achievements %}
1. Optionally, to hide individual Achievements from your profile:
{% data reusables.profile.access_profile %}
1. Navigate to the Achievements section on the left sidebar of your profile and select the Achievements header. ![Achievements on profile sidebar](/assets/images/help/profile/achievements-on-profile.png)
2. Open the detail view of the achievement you'd like to hide by clicking on the achievement.
3. Once in the detail view, click the {% octicon "eye" aria-label="The eye icon" %} icon to hide the achievement. ![Achievement detail view](/assets/images/help/profile/achievements-detail-view.png) When hidden, badges will be marked by the {% octicon "eye-closed" aria-label="The eye closed icon" %} icon and are only visible to you. ![Hidden achievements](/assets/images/help/profile/achievements-hidden.png)
1. 在个人资料上显示或隐藏成就:
- 要在个人资料上显示成就,请导航到“个人资料设置”,然后选择“在我的个人资料上显示成就”旁边的复选框。
![使访问者能够从配置文件设置查看成就](/assets/images/achievements-profile-settings-off.png)
- 要在个人资料上隐藏成就,请导航到“个人资料设置”,然后取消选中“在我的个人资料上显示成就”旁边的复选框。
![在个人资料设置中隐藏访问者的成就](/assets/images/achievements-profile-settings-on.png)
{% endif %}
## Further reading
## 延伸阅读
- "[Viewing contributions on your profile page](/articles/viewing-contributions-on-your-profile-page)"
- "[Why are my contributions not showing up on my profile?](/articles/why-are-my-contributions-not-showing-up-on-my-profile)"
- [在个人资料页中查看贡献](/articles/viewing-contributions-on-your-profile-page)
- [为什么我的贡献未显示在我的个人资料上?](/articles/why-are-my-contributions-not-showing-up-on-my-profile)

View File

@@ -1,6 +1,6 @@
---
title: Viewing contributions on your profile
intro: 'Your {% data variables.product.product_name %} profile shows off {% ifversion fpt or ghes or ghec %}your pinned repositories, Achievements, and{% endif %} a graph of your repository contributions over the past year.'
title: 在个人资料中查看贡献
intro: '你的 {% data variables.product.product_name %} 个人资料显示{% ifversion fpt or ghes or ghec %}你的固定存储库、成就和{% endif %}过去一年中存储库贡献的图。'
redirect_from:
- /articles/viewing-contributions
- /articles/viewing-contributions-on-your-profile-page
@@ -15,83 +15,89 @@ versions:
topics:
- Profiles
shortTitle: View contributions
ms.openlocfilehash: 81b2242e0c7a07d8941375d044cacc65ca8dd56d
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147079523'
---
{% ifversion fpt or ghes or ghec %}Your contribution graph and Achievements show activity from public repositories. {% endif %}You can choose to show activity from {% ifversion fpt or ghes or ghec %}both public and {% endif %}private repositories, with specific details of your activity in private repositories anonymized. For more information, see "[Publicizing or hiding your private contributions on your profile](/articles/publicizing-or-hiding-your-private-contributions-on-your-profile)."
{% ifversion fpt or ghes or ghec %}你的贡献图和“成就”显示公共存储库的活动。 {% endif %}可以选择显示 {% ifversion fpt or ghes or ghec %} 公共和 {% endif %} 私有存储库的活动,并将私有存储库中活动的具体详细信息匿名化。 有关详细信息,请参阅“[在配置文件中公开或隐藏私人贡献](/articles/publicizing-or-hiding-your-private-contributions-on-your-profile)”。
{% note %}
**Note:** Commits will only appear on your contributions graph if the email address you used to author the commits is connected to your account on {% data variables.product.product_name %}. For more information, see "[Why are my contributions not showing up on my profile?](/articles/why-are-my-contributions-not-showing-up-on-my-profile#your-local-git-commit-email-isnt-connected-to-your-account)"
注意:仅当用于创作提交的电子邮件地址与在 {% data variables.product.product_name %} 上的帐户相连时,提交才会显示在你的贡献图中。 有关详细信息,请参阅“[为什么我的贡献没有在我的配置文件中显示?](/articles/why-are-my-contributions-not-showing-up-on-my-profile#your-local-git-commit-email-isnt-connected-to-your-account)
{% endnote %}
## What counts as a contribution
## 计为贡献的内容
On your profile page, certain actions count as contributions:
在您的个人资料页面上,某些操作计为贡献:
- Committing to a repository's default branch or `gh-pages` branch
- Opening an issue
- Opening a discussion
- Answering a discussion
- Proposing a pull request
- Submitting a pull request review{% ifversion ghes or ghae %}
- Co-authoring commits in a repository's default branch or `gh-pages` branch{% endif %}
- 提交到存储库的默认分支或 `gh-pages` 分支
- 创建问题
- 打开讨论
- 回答讨论
- 提议拉取请求
- 提交拉取请求审查 {% ifversion ghes or ghae %}
- 合作创作存储库默认分支或 `gh-pages` 分支中的提交{% endif %}
{% data reusables.pull_requests.pull_request_merges_and_contributions %}
## Popular repositories
## 受欢迎的仓库
This section displays your repositories with the most watchers. {% ifversion fpt or ghes or ghec %}Once you [pin repositories to your profile](/articles/pinning-repositories-to-your-profile), this section will change to "Pinned repositories."{% endif %}
此部分显示具有最多查看者的仓库。 {% ifversion fpt or ghes or ghec %}[将存储库固定到配置文件](/articles/pinning-repositories-to-your-profile)后,此部分将更改为“固定的存储库”。{% endif %}
![Popular repositories](/assets/images/help/profile/profile_popular_repositories.png)
![受欢迎的仓库](/assets/images/help/profile/profile_popular_repositories.png)
{% ifversion fpt or ghes or ghec %}
## Pinned repositories
## 固定的仓库
This section displays up to six public repositories and can include your repositories as well as repositories you've contributed to. To easily see important details about the repositories you've chosen to feature, each repository in this section includes a summary of the work being done, the number of [stars](/articles/saving-repositories-with-stars/) the repository has received, and the main programming language used in the repository. For more information, see "[Pinning repositories to your profile](/articles/pinning-repositories-to-your-profile)."
此部分显示最多六个公共仓库,并可包括您的仓库以及您对其做出贡献的仓库。 为便于查看关于你选择提供的存储库的重要详细信息,此部分中的每个存储库均包括所做工作的摘要、存储库已收到的[星号](/articles/saving-repositories-with-stars/)数量以及存储库中使用的主要编程语言。 有关详细信息,请参阅“[将存储库固定到配置文件](/articles/pinning-repositories-to-your-profile)”。
![Pinned repositories](/assets/images/help/profile/profile_pinned_repositories.png)
![固定的仓库](/assets/images/help/profile/profile_pinned_repositories.png)
{% endif %}
## Contributions calendar
## 贡献日历
Your contributions calendar shows your contribution activity.
您的贡献日历会显示贡献活动。
### Viewing contributions from specific times
### 查看特定时间的贡献
- Click on a day's square to show the contributions made during that 24-hour period.
- Press *Shift* and click on another day's square to show contributions made during that time span.
- 单击某个日期的方块可显示该 24 小时期间内所做的贡献。
- 按“Shift”并单击任意日期的方块可显示该时间范围内所做的贡献。
{% note %}
**Note:** You can select up to a one-month range on your contributions calendar. If you select a larger time span, we will only display one month of contributions.
注意:可以在贡献日历中选择最多一个月的范围。 如果您选择更大的时间范围,我们将仅显示一个月的贡献。
{% endnote %}
![Your contributions graph](/assets/images/help/profile/contributions_graph.png)
![您的贡献图](/assets/images/help/profile/contributions_graph.png)
### How contribution event times are calculated
### 如何计算贡献事件时间
Timestamps are calculated differently for commits and pull requests:
- **Commits** use the time zone information in the commit timestamp. For more information, see "[Troubleshooting commits on your timeline](/articles/troubleshooting-commits-on-your-timeline)."
- **Pull requests** and **issues** opened on {% data variables.product.product_name %} use your browser's time zone. Those opened via the API use the timestamp or time zone [specified in the API call](https://developer.github.com/changes/2014-03-04-timezone-handling-changes).
对于提交和拉取请求,时间戳的计算方式不同:
- “提交”使用提交时间戳中的时区信息。 有关详细信息,请参阅“[排查日程表上的提交问题](/articles/troubleshooting-commits-on-your-timeline)”。
- {% data variables.product.product_name %} 上打开的“拉取请求”和“议题”使用浏览器的时区 。 通过 API 打开的内容使用 [API 调用中指定的](https://developer.github.com/changes/2014-03-04-timezone-handling-changes)时间戳或时区。
## Activity overview
## 活动概述
{% data reusables.profile.activity-overview-summary %} For more information, see "[Showing an overview of your activity on your profile](/articles/showing-an-overview-of-your-activity-on-your-profile)."
{% data reusables.profile.activity-overview-summary %} 有关详细信息,请参阅“[在配置文件中显示活动概览](/articles/showing-an-overview-of-your-activity-on-your-profile)”。
![Activity overview section on profile](/assets/images/help/profile/activity-overview-section.png)
![个人资料中的活动概览部分](/assets/images/help/profile/activity-overview-section.png)
The organizations featured in the activity overview are prioritized according to how active you are in the organization. If you @mention an organization in your profile bio, and youre an organization member, then that organization is prioritized first in the activity overview. For more information, see "[Mentioning people and teams](/articles/basic-writing-and-formatting-syntax/#mentioning-people-and-teams)" or "[Adding a bio to your profile](/articles/adding-a-bio-to-your-profile/)."
活动概览中提供的组织根据您在组织中的活跃程度确定优先级。 如果在配置文件简历中 @mention 某个组织,并且你是组织成员,则该组织首先在活动概览中确定优先级。 有关详细信息,请参阅“[提及人员和团队](/articles/basic-writing-and-formatting-syntax/#mentioning-people-and-teams)”或“[将个人简介添加到配置文件](/articles/adding-a-bio-to-your-profile/)”。
## Contribution activity
## 贡献活动
The contribution activity section includes a detailed timeline of your work, including commits you've made or co-authored, pull requests you've proposed, and issues you've opened. You can see your contributions over time by either clicking **Show more activity** at the bottom of your contribution activity or by clicking the year you're interested in viewing on the right side of the page. Important moments, like the date you joined an organization, proposed your first pull request, or opened a high-profile issue, are highlighted in your contribution activity. If you can't see certain events in your timeline, check to make sure you still have access to the organization or repository where the event happened.
贡献活动部分包括工作的详细时间表,包括您进行或合作的提交、您提议的拉取请求以及您打开的议题。 可通过单击贡献活动底部的“Show more activity显示更多活动”或通过在查看页面右侧时单击你感兴趣的年份来查看一段时间内你的贡献。 重要时刻(如您加入组织、提议第一个拉取请求或打开一个备受瞩目议题的日期)将在贡献活动中突出显示。 如果您在时间表中无法看到某些事件,请检查以确保您仍具有事件发生位置组织或仓库的访问权限。
![Contribution activity time filter](/assets/images/help/profile/contributions_activity_time_filter.png)
![贡献活动时间过滤器](/assets/images/help/profile/contributions_activity_time_filter.png)
## Viewing contributions from {% data variables.product.prodname_enterprise %} on {% data variables.product.prodname_dotcom_the_website %}
## {% data variables.product.prodname_dotcom_the_website %} 上查看 {% data variables.product.prodname_enterprise %} 中的贡献
If you use {% ifversion fpt or ghec %}{% data variables.product.prodname_ghe_server %}{% ifversion ghae %} or {% data variables.product.prodname_ghe_managed %}{% endif %}{% else %}{% data variables.product.product_name %}{% endif %} and your enterprise owner enables {% data variables.enterprise.prodname_unified_contributions %}, you can send enterprise contribution counts from to your {% data variables.product.prodname_dotcom_the_website %} profile. 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)."
如果使用 {% ifversion fpt or ghec %}{% data variables.product.prodname_ghe_server %}{% ifversion ghae %} {% data variables.product.prodname_ghe_managed %}{% endif %}{% else %}{% data variables.product.product_name %}{% endif %} 并且你的企业所有者启用 {% data variables.product.prodname_unified_contributions %},可以向 {% 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)”。

View File

@@ -0,0 +1,26 @@
---
title: 设置和管理 GitHub 用户帐户
intro: You can manage settings in your GitHub personal account including email preferences, collaborator access for personal repositories, and organization memberships.
shortTitle: Personal accounts
redirect_from:
- /categories/setting-up-and-managing-your-github-user-account
- /github/setting-up-and-managing-your-github-user-account
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
children:
- /managing-user-account-settings
- /managing-email-preferences
- /managing-access-to-your-personal-repositories
- /managing-your-membership-in-organizations
ms.openlocfilehash: 36e4d1280fdc48a7165199e40830417904ae1790
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145085080"
---

View File

@@ -0,0 +1,30 @@
---
title: 管理对个人仓库的访问
intro: You can give people collaborator access to repositories owned by your personal account.
redirect_from:
- /categories/101/articles
- /categories/managing-repository-collaborators
- /articles/managing-access-to-your-personal-repositories
- /github/setting-up-and-managing-your-github-user-account/managing-access-to-your-personal-repositories
product: '{% data reusables.gated-features.user-repo-collaborators %}'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
- Repositories
children:
- /inviting-collaborators-to-a-personal-repository
- /removing-a-collaborator-from-a-personal-repository
- /removing-yourself-from-a-collaborators-repository
- /maintaining-ownership-continuity-of-your-user-accounts-repositories
shortTitle: Access to your repositories
ms.openlocfilehash: fd4ab3f5e29b35c1a222287471a2b310d0240322
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145087339"
---

View File

@@ -0,0 +1,65 @@
---
title: 邀请协作者参加个人仓库
intro: You can {% ifversion fpt or ghec %}invite users to become{% else %}add users as{% endif %} collaborators to your personal repository.
redirect_from:
- /articles/how-do-i-add-a-collaborator
- /articles/adding-collaborators-to-a-personal-repository
- /articles/inviting-collaborators-to-a-personal-repository
- /github/setting-up-and-managing-your-github-user-account/inviting-collaborators-to-a-personal-repository
- /github/setting-up-and-managing-your-github-user-account/managing-access-to-your-personal-repositories/inviting-collaborators-to-a-personal-repository
product: '{% data reusables.gated-features.user-repo-collaborators %}'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
- Repositories
shortTitle: Invite collaborators
ms.openlocfilehash: 6db661abfc48b87ae7eae2c515be2e14e3717ec4
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145085079"
---
组织拥有的仓库可授予更细致的访问权限。 有关详细信息,请参阅“[对 {% data variables.product.prodname_dotcom %} 的访问权限](/articles/access-permissions-on-github)”。
{% data reusables.organizations.org-invite-expiration %}
{% ifversion fpt or ghec %}
如果您是 {% data variables.product.prodname_emu_enterprise %} 的成员,则只能邀请企业的其他成员与您协作。 {% data reusables.enterprise-accounts.emu-more-info-account %}
{% note %}
注意:{% data variables.product.company_short %} 会限制在 24 小时内可受邀加入存储库的人数。 如果您超过此限制,请等待 24 小时后再邀请,或者创建一个组织以与更多的人协作。
{% endnote %}
{% endif %}
1. 询问你邀请作为协助者的用户名。{% ifversion fpt or ghec %} 如果他们还没有用户名,他们可以注册 {% data variables.product.prodname_dotcom %}。有关详细信息,请参阅“[注册新的 {% data variables.product.prodname_dotcom %} 帐户](/articles/signing-up-for-a-new-github-account)”。{% endif %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5658%} {% data reusables.repositories.click-collaborators-teams %}
1. 单击“邀请协作者”。
![“邀请协作者”按钮](/assets/images/help/repository/invite-a-collaborator-button.png)
2. 在搜索字段中,开始键入您想邀请的人员的姓名,然后单击匹配列表中的姓名。
![搜索字段以键入要邀请加入存储库的人员姓名](/assets/images/help/repository/manage-access-invite-search-field-user.png)
3. 单击“将 <NAME> 添加到存储库”。
![用于添加协作者的按钮](/assets/images/help/repository/add-collaborator-user-repo.png) {% else %}
5. 在左侧边栏中,单击“协作者”。
![突出显示协作者的“存储库设置”侧边栏](/assets/images/help/repository/user-account-repo-settings-collaborators.png)
6. 在 "Collaborators"(协作者)下,开始输入协作者的用户名。
7. 从下拉菜单中选择协作者的用户名。
![协作者列表下拉菜单](/assets/images/help/repository/repo-settings-collab-autofill.png)
8. 单击“添加协作者”。
![“添加协作者”按钮](/assets/images/help/repository/repo-settings-collab-add.png) {% endif %} {% ifversion fpt or ghec %}
9. 用户将会收到一封邀请他们参加仓库的电子邮件。 在接受邀请后,他们便对仓库具有协作者访问权限。
{% endif %}
## <a name="further-reading"></a>延伸阅读
- “[个人帐户存储库的权限级别](/articles/permission-levels-for-a-user-account-repository/#collaborator-access-for-a-repository-owned-by-a-personal-account)”
- [从个人存储库中删除协作者](/articles/removing-a-collaborator-from-a-personal-repository)
- [从协作者的存储库中删除你自己](/articles/removing-yourself-from-a-collaborator-s-repository)
- [将成员组织为团队](/organizations/organizing-members-into-teams)

View File

@@ -0,0 +1,44 @@
---
title: 保持用户帐户仓库的所有权连续性
intro: You can invite someone to manage your user owned repositories if you are not able to.
versions:
fpt: '*'
ghec: '*'
topics:
- Accounts
- Repositories
redirect_from:
- /github/setting-up-and-managing-your-github-user-account/maintaining-ownership-continuity-of-your-user-accounts-repositories
- /github/setting-up-and-managing-your-github-user-account/managing-access-to-your-personal-repositories/maintaining-ownership-continuity-of-your-user-accounts-repositories
shortTitle: Ownership continuity
ms.openlocfilehash: f958e3ca640a1180db03361457ec7c185e4ce7ba
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145085078"
---
## <a name="about-successors"></a>关于继承者
如果您无法管理您的用户拥有的仓库,建议邀请其他 {% data variables.product.company_short %} 用户作为继承者管理。 作为继承者,他们拥有以下权限:
- 存档您的公共仓库。
- 将公共仓库转移到他们自己的用户拥有的帐户。
- 将您的公共仓库转移到他们可在其中创建仓库的组织。
继承者不能登录到您的帐户。
指定的继承者在提交死亡证明并等待 7 天或者提交讣告并等待 21 天后,便可管理您的公共仓库。 有关详细信息,请参阅“[{% data variables.product.company_short %} 已故用户政策](/free-pro-team@latest/github/site-policy/github-deceased-user-policy)”。
要请求作为继承者管理存储库,请联系 [GitHub 支持](https://support.github.com/contact?tags=docs-accounts)。
## <a name="inviting-a-successor"></a>邀请继承者
您邀请作为继承者的人必须拥有 {% data variables.product.company_short %} 帐户。
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.account_settings %}
3. 要邀请继承者在“Successor settings继承者设置”下开始输入用户名、全名或电子邮件地址然后单击出现的姓名。
![继承者邀请搜索字段](/assets/images/help/settings/settings-invite-successor-search-field.png)
4. 单击“添加继承者”。
{% data reusables.user-settings.sudo-mode-popup %}
5. 您邀请的用户将被列为“Pending待定直到他们同意成为您的继承者。
![待定继承者邀请](/assets/images/help/settings/settings-pending-successor.png)

View File

@@ -0,0 +1,47 @@
---
title: 从个人仓库中删除协作者
intro: When you remove a collaborator from your project, they lose read/write access to your repository. If the repository is private and the person has created a fork, then that fork is also deleted.
redirect_from:
- /articles/how-do-i-remove-a-collaborator
- /articles/what-happens-when-i-remove-a-collaborator-from-my-private-repository
- /articles/removing-a-collaborator-from-a-private-repository
- /articles/deleting-a-private-fork-of-a-private-user-repository
- /articles/how-do-i-delete-a-fork-of-my-private-repository
- /articles/removing-a-collaborator-from-a-personal-repository
- /github/setting-up-and-managing-your-github-user-account/removing-a-collaborator-from-a-personal-repository
- /github/setting-up-and-managing-your-github-user-account/managing-access-to-your-personal-repositories/removing-a-collaborator-from-a-personal-repository
product: '{% data reusables.gated-features.user-repo-collaborators %}'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
- Repositories
shortTitle: Remove a collaborator
ms.openlocfilehash: eafe4f8bb1cea085910179a95f17c0b4a1358ad2
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145087340"
---
## <a name="deleting-forks-of-private-repositories"></a>删除私有仓库的复刻
尽管删除协作者时将删除私有仓库的复刻,但此人员将仍保留您仓库的任何本地克隆。
## <a name="removing-collaborator-permissions-from-a-person-contributing-to-a-repository"></a>删除为仓库做出贡献的人员的协作者权限
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5658 %} {% data reusables.repositories.click-collaborators-teams %}
4. 在要移除的协作者的右侧,单击 {% octicon "trash" aria-label="The trash icon" %}。
![用于移除协作者的按钮](/assets/images/help/repository/collaborator-remove.png) {% else %}
3. 在左侧边栏中,单击“协作者和团队”。
![“协作者”选项卡](/assets/images/help/repository/repo-settings-collaborators.png)
4. 在要移除的协作者旁边单击“X”图标。
![移除链接](/assets/images/help/organizations/Collaborator-Remove.png) {% endif %}
## <a name="further-reading"></a>延伸阅读
- [从团队中移除组织成员](/articles/removing-organization-members-from-a-team)
- [从组织存储库中移除外部协作者](/articles/removing-an-outside-collaborator-from-an-organization-repository)

View File

@@ -0,0 +1,36 @@
---
title: 从协作者的仓库中删除您自己
intro: If you no longer want to be a collaborator on someone else's repository, you can remove yourself.
redirect_from:
- /leave-a-collaborative-repo
- /leave-a-repo
- /articles/removing-yourself-from-a-collaborator-s-repo
- /articles/removing-yourself-from-a-collaborator-s-repository
- /articles/removing-yourself-from-a-collaborators-repository
- /github/setting-up-and-managing-your-github-user-account/removing-yourself-from-a-collaborators-repository
- /github/setting-up-and-managing-your-github-user-account/managing-access-to-your-personal-repositories/removing-yourself-from-a-collaborators-repository
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
- Repositories
shortTitle: Remove yourself
ms.openlocfilehash: dc9739d84d1794e3111f3b61e0dfd9a7c4bec11b
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145085075"
---
{% data reusables.user-settings.access_settings %} {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5658 %}
2. 在边栏的“代码、规划和自动化”部分,单击“{% octicon "repo" aria-label="The repo icon" %} 存储库”。
{% else %}
2. 在左侧边栏中,单击“存储库”。
![“存储库”选项卡](/assets/images/help/settings/settings-sidebar-repositories.png) {% endif %}
3. 在要离开的存储库旁边,单击“离开”。
![“离开”按钮](/assets/images/help/repository/repo-leave.png)
4. 仔细阅读警告然后单击“I understand, leave this repository我已了解离开此仓库”。
![警告你将离开的对话框](/assets/images/help/repository/repo-leave-confirmation.png)

View File

@@ -0,0 +1,39 @@
---
title: 添加电子邮件地址到 GitHub 帐户
intro: '{% data variables.product.product_name %} allows you to add as many email addresses to your account as you like. If you set an email address in your local Git configuration, you will need to add it to your account settings in order to connect your commits to your account. For more information about your email address and commits, see "[Setting your commit email address](/articles/setting-your-commit-email-address/)."'
redirect_from:
- /articles/adding-an-email-address-to-your-github-account
- /github/setting-up-and-managing-your-github-user-account/adding-an-email-address-to-your-github-account
- /github/setting-up-and-managing-your-github-user-account/managing-email-preferences/adding-an-email-address-to-your-github-account
versions:
fpt: '*'
ghes: '*'
ghec: '*'
topics:
- Accounts
- Notifications
shortTitle: Add an email address
ms.openlocfilehash: 3d7efd2e72ed1ab23ccf2e686f4a1c1c7653cc1f
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145087335"
---
{% ifversion fpt or ghec %}
{% note %}
**注释**
- {% data reusables.user-settings.no-verification-disposable-emails %}
- 如果您是 {% data variables.product.prodname_emu_enterprise %} 的成员,则无法在 {% data variables.product.prodname_dotcom_the_website %} 上更改您的电子邮件地址。 {% data reusables.enterprise-accounts.emu-more-info-account %}
{% endnote %}
{% endif %}
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.emails %} {% data reusables.user-settings.add_and_verify_email %} {% data reusables.user-settings.select_primary_email %}
## <a name="further-reading"></a>延伸阅读
- [管理电子邮件首选项](/articles/managing-email-preferences/)

View File

@@ -0,0 +1,32 @@
---
title: 阻止会暴露个人电子邮件地址的命令行推送
intro: If you've chosen to keep your email address private when performing web-based operations, you can also choose to block command line pushes that may expose your personal email address.
redirect_from:
- /articles/blocking-command-line-pushes-that-expose-your-personal-email-address
- /github/setting-up-and-managing-your-github-user-account/blocking-command-line-pushes-that-expose-your-personal-email-address
- /github/setting-up-and-managing-your-github-user-account/managing-email-preferences/blocking-command-line-pushes-that-expose-your-personal-email-address
versions:
fpt: '*'
ghec: '*'
topics:
- Accounts
- Notifications
shortTitle: Block push with personal email
ms.openlocfilehash: e085c19339cc530537626d9bf987125aebfd3427
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145085074"
---
从命令行推送提交时,[在 Git 中设置](/articles/setting-your-commit-email-address)的电子邮件地址与提交相关联。 如果您启用此设置,则每当您推送到 GitHub 时,我们将检查最近的提交。 如果提交的作者电子邮件地址是您的 GitHub 帐户上的私人电子邮件地址,我们将阻止推送并警告这样会暴露您的私人电子邮件地址。
{% data reusables.user-settings.about-commit-email-addresses %}
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.emails %} {% data reusables.user-settings.keeping_your_email_address_private %}
4. 要使你的电子邮件地址在你通过命令行推送的提交中保持私密,请选择阻止会公开个人电子邮件地址的命令行推送。
![阻止会公开个人电子邮件地址的命令行推送的选项](/assets/images/help/settings/email_privacy_block_command_line_pushes.png)
## <a name="further-reading"></a>延伸阅读
- [设置提交电子邮件地址](/articles/setting-your-commit-email-address)

View File

@@ -0,0 +1,37 @@
---
title: 更改主电子邮件地址
intro: You can change the email address associated with your personal account at any time.
redirect_from:
- /articles/changing-your-primary-email-address
- /github/setting-up-and-managing-your-github-user-account/changing-your-primary-email-address
- /github/setting-up-and-managing-your-github-user-account/managing-email-preferences/changing-your-primary-email-address
versions:
fpt: '*'
ghes: '*'
ghec: '*'
topics:
- Accounts
- Notifications
shortTitle: Primary email address
ms.openlocfilehash: af1443f1f23b8038d2cf1f4e42a1ab0a83214edb
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145087332"
---
{% note %}
注意:不能将主电子邮件地址更改为已设置为备份电子邮件地址的电子邮件。
{% endnote %}
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.emails %}
3. 如果要添加新电子邮件地址以设置为主电子邮件地址,请在“添加电子邮件地址”下键入新电子邮件地址,然后单击“添加”。
![添加其他电子邮件地址按钮](/assets/images/help/settings/add_another_email_address.png)
4. 在“主要电子邮件地址”下,使用下拉菜单单击要设置为主电子邮件地址的电子邮件地址,然后单击“保存”。
![设为主电子邮件地址按钮](/assets/images/help/settings/set_as_primary_email.png)
5. 要从帐户删除旧电子邮件地址,请在旧电子邮件地址旁边,单击 {% octicon "trash" aria-label="The trash symbol" %}。
{% ifversion fpt or ghec %}
6. 验证新的主电子邮件地址。 如果没有经验证的电子邮件地址,您将无法使用 {% data variables.product.product_name %} 的所有功能。 有关详细信息,请参阅“[验证电子邮件地址](/articles/verifying-your-email-address)”。
{% endif %}

View File

@@ -0,0 +1,32 @@
---
title: 管理电子邮件首选项
intro: You can add or change the email addresses associated with your account on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.product.product_location %}{% endif %}. You can also manage emails you receive from {% data variables.product.product_name %}.
redirect_from:
- /categories/managing-email-preferences
- /articles/managing-email-preferences
- /github/setting-up-and-managing-your-github-user-account/managing-email-preferences
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
- Notifications
children:
- /adding-an-email-address-to-your-github-account
- /changing-your-primary-email-address
- /setting-a-backup-email-address
- /setting-your-commit-email-address
- /blocking-command-line-pushes-that-expose-your-personal-email-address
- /remembering-your-github-username-or-email
- /types-of-emails-github-sends
- /managing-marketing-emails-from-github
shortTitle: Manage email preferences
ms.openlocfilehash: ec9c71468c235b07a3e4588c33d791f25e50d7d8
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145085073"
---

View File

@@ -0,0 +1,39 @@
---
title: 管理来自 GitHub 的营销电子邮件
intro: In addition to notifications and account emails, {% data variables.product.prodname_dotcom %} occasionally sends marketing emails with news and information about our products. If you unsubscribe from existing marketing emails, you won't be included in future campaigns unless you change your {% data variables.product.prodname_dotcom %} email settings.
redirect_from:
- /articles/managing-marketing-emails-from-github
- /github/setting-up-and-managing-your-github-user-account/managing-marketing-emails-from-github
- /github/setting-up-and-managing-your-github-user-account/managing-email-preferences/managing-marketing-emails-from-github
versions:
fpt: '*'
ghec: '*'
topics:
- Accounts
- Notifications
shortTitle: Marketing emails
ms.openlocfilehash: e7563a5c35ea60b63fb4b8aa1393e7cec8635781
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145087331"
---
## <a name="unsubscribing-from--data-variablesproductprodname_dotcom--marketing-emails"></a>退订 {% data variables.product.prodname_dotcom %} 营销电子邮件
{% tip %}
提示:如果退订所有营销电子邮件,然后订阅 Explore 通讯,只会收到 Explore 通讯,而不会收到其他营销电子邮件。
{% endtip %}
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.emails %}
3. 在“电子邮件首选项”下,选择“只接收帐户相关的电子邮件和我订阅的电子邮件”。
![退订营销电子邮件的屏幕截图](/assets/images/help/notifications/email_preferences.png)
4. 单击“保存电子邮件首选项”。
![“保存电子邮件首选项”按钮](/assets/images/help/notifications/save_email_preferences.png)
## <a name="further-reading"></a>延伸阅读
- [GitHub 发送的电子邮件类型](/articles/types-of-emails-github-sends)
- [配置通知](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications)

View File

@@ -0,0 +1,80 @@
---
title: 记住您的 GitHub 用户名或电子邮件
intro: Are you signing in to {% data variables.product.product_location %} for the first time in a while? If so, welcome back! If you can't remember the username for your personal account on {% data variables.product.product_name %}, you can try these methods for remembering it.
redirect_from:
- /articles/oh-noes-i-ve-forgotten-my-username-email
- /articles/oh-noes-i-ve-forgotten-my-username-or-email
- /articles/remembering-your-github-username-or-email
- /github/setting-up-and-managing-your-github-user-account/remembering-your-github-username-or-email
- /github/setting-up-and-managing-your-github-user-account/managing-email-preferences/remembering-your-github-username-or-email
versions:
fpt: '*'
ghes: '*'
ghec: '*'
topics:
- Accounts
- Notifications
shortTitle: Find your username or email
ms.openlocfilehash: 79cb3ba65390e384272540bd32a1ec9e598517f4
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145085072"
---
{% mac %}
## <a name="-data-variablesproductprodname_desktop--users"></a>{% data variables.product.prodname_desktop %} 用户
1. 在“GitHub 桌面”菜单中,单击“首选项” 。
2. 在 Preferences首选项窗口中验证以下内容
- 若要查看 {% data variables.product.product_name %} 用户名,请单击“帐户”。
- 若要查看 Git 电子邮件请单击“Git”。 请注意,此电子邮件不保证是 [主要 {% data variables.product.product_name %} 电子邮件](/articles/changing-your-primary-email-address)。
{% endmac %}
{% windows %}
## <a name="-data-variablesproductprodname_desktop--users"></a>{% data variables.product.prodname_desktop %} 用户
1. 在“文件”菜单中,单击“选项” 。
2. 在 Options选项窗口中验证以下内容
- 若要查看 {% data variables.product.product_name %} 用户名,请单击“帐户”。
- 若要查看 Git 电子邮件请单击“Git”。 请注意,此电子邮件不保证是 [主要 {% data variables.product.product_name %} 电子邮件](/articles/changing-your-primary-email-address)。
{% endwindows %}
## <a name="finding-your-username-in-your-username-configuration"></a>在 `user.name` 配置中查找用户名
在设置期间,你可能已[在 Git 中设置用户名](/github/getting-started-with-github/setting-your-username-in-git)。 如果这样,您可以查看此配置设置的值:
```shell
$ git config user.name
# View the setting
<em>YOUR_USERNAME</em>
```
## <a name="finding-your-username-in-the-url-of-remote-repositories"></a>在远程仓库的 URL 中查找您的用户名
如果您有已创建或已复刻的个人仓库的任何本地副本,则可以检查远程仓库的 URL。
{% tip %}
提示:此方法仅当你拥有原始存储库或其他人存储库中你自己的分叉时才有效。 如果您克隆其他人的仓库,将显示他们的用户名而不是您的用户名。 类似地,组织仓库将显示组织的名称,而不是远程 URL 中的特定用户。
{% endtip %}
```shell
$ cd <em>YOUR_REPOSITORY</em>
# Change directories to the initialized Git repository
$ git remote -v
origin https://{% data variables.command_line.codeblock %}/<em>YOUR_USERNAME</em>/<em>YOUR_REPOSITORY</em>.git (fetch)
origin https://{% data variables.command_line.codeblock %}/<em>YOUR_USERNAME</em>/<em>YOUR_REPOSITORY</em>.git (push)
```
用户名紧跟在 `https://{% data variables.command_line.backticks %}/` 后。
{% ifversion fpt or ghec %}
## <a name="further-reading"></a>延伸阅读
- “[验证电子邮件地址](/articles/verifying-your-email-address)”{% endif %}

View File

@@ -0,0 +1,32 @@
---
title: 设置备用电子邮件地址
intro: Use a backup email address as an additional destination for security-relevant account notifications{% ifversion not ghae %} and to securely reset your password if you can no longer access your primary email address{% endif %}.
redirect_from:
- /articles/setting-a-backup-email-address
- /github/setting-up-and-managing-your-github-user-account/setting-a-backup-email-address
- /github/setting-up-and-managing-your-github-user-account/managing-email-preferences/setting-a-backup-email-address
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
- Notifications
shortTitle: Set backup email address
ms.openlocfilehash: 735e78c8f9e58dd6f6fea0f7c81334d8d8206d5a
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145087328"
---
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.emails %}
3. 在“Backup email address备用电子邮件地址”下使用下拉菜单选择您要设置为备用电子邮件地址的地址。
![备用电子邮件地址](/assets/images/help/settings/backup-email-address.png)
4. 单击“ **保存**”。
## <a name="further-reading"></a>延伸阅读
- [管理电子邮件首选项](/articles/managing-email-preferences/)
- [更新 GitHub 访问凭据](/articles/updating-your-github-access-credentials/)

View File

@@ -0,0 +1,106 @@
---
title: 设置提交电子邮件地址
intro: You can set the email address that is used to author commits on {% data variables.product.product_location %} and on your computer.
redirect_from:
- /articles/keeping-your-email-address-private
- /articles/setting-your-commit-email-address-on-github
- /articles/about-commit-email-addresses
- /articles/git-email-settings
- /articles/setting-your-email-in-git
- /articles/set-your-user-name-email-and-github-token
- /articles/setting-your-commit-email-address-in-git
- /articles/setting-your-commit-email-address
- /github/setting-up-and-managing-your-github-user-account/setting-your-commit-email-address
- /github/setting-up-and-managing-your-github-user-account/managing-email-preferences/setting-your-commit-email-address
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
- Notifications
shortTitle: Set commit email address
ms.openlocfilehash: da47c240cc53e18d5f5537f20dd8c1eb2f4127bf
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145085070"
---
## <a name="about-commit-email-addresses"></a>关于提交电子邮件地址
{% data variables.product.prodname_dotcom %} 使用您的提交电子邮件地址将提交与您的 {% data variables.product.product_location %} 关联。 您可以选择要与从命令行以及基于 web 的 Git 操作推送的提交相关联的电子邮件地址。
对于基于 Web 的 Git 操作,您可以在 {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.product.product_location %}{% endif %} 上设置提交电子邮件地址。 对于从命令行推送的提交,您可以在 Git 中设置提交电子邮件地址。
{% ifversion fpt or ghec %} 在更改提交电子邮件地址之前进行的提交仍与之前的电子邮件地址关联。{% else %} 在 {% data variables.product.product_name %} 上更改提交电子邮件地址后,新电子邮件地址默认在所有未来基于 Web 的 Git 操作中可见。 在更改提交电子邮件地址之前进行的任何提交仍与之前的电子邮件地址关联。{% endif %}
{% ifversion fpt or ghec %}
{% note %}
注意:{% data reusables.user-settings.no-verification-disposable-emails %}
{% endnote %}
{% endif %}
{% ifversion fpt or ghec %} 如果想将个人电子邮件地址设为私密,则可以使用 {% data variables.product.product_name %} 的 `no-reply` 电子邮件地址作为提交电子邮件地址。 要将 `noreply` 电子邮件地址用于从命令行推送的提交,请在 Git 中设置提交电子邮件地址时使用该电子邮件地址。 要将 `noreply` 地址用于基于 Web 的 Git 操作,请在 GitHub 上设置提交电子邮件地址并选择“对我的电子邮件地址保密”。
您也可以选择阻止从命令行推送的提交显示您的个人电子邮件地址。 有关详细信息,请参阅“[阻止会暴露个人电子邮件的命令行推送](/articles/blocking-command-line-pushes-that-expose-your-personal-email-address)。”{% endif %}
为确保提交归因于你并且出现在你的贡献图中,请使用已连接到你在 {% data variables.product.product_location %} 上的帐户的电子邮件地址{% ifversion fpt or ghec %},或者在电子邮件设置中提供给你的 `noreply` 电子邮件地址{% endif %}。 {% ifversion not ghae %} 有关详细信息,请参阅“[将电子邮件地址添加到 {% data variables.product.prodname_dotcom %} 帐户](/github/setting-up-and-managing-your-github-user-account/adding-an-email-address-to-your-github-account)”。{% endif %}
{% ifversion fpt or ghec %}
{% note %}
注意:如果于 2017 年 7 月 18 日之后在 {% data variables.product.product_location %} 上创建了帐户,则用于 {% data variables.product.product_name %} 的 `no-reply` 电子邮件地址是一个七位数的 ID 号以及格式为 <code>ID+username@users.noreply.github.com</code> 的用户名。 如果于 2017 年 7 月 18 日之前在 {% data variables.product.product_location %} 上创建了帐户,则来自 {% data variables.product.product_name %} 的 `no-reply` 电子邮件地址是 <code>username@users.noreply.github.com</code>。 可以通过在电子邮件设置中选择(或取消选择并重新选择)“对我的电子邮件地址保密”,为 {% data variables.product.product_name %} 获取基于 ID 的 `no-reply` 电子邮件地址。
{% endnote %}
如果使用 {% data variables.product.product_name %} 的 `noreply` 电子邮件地址进行提交,然后[更改用户名](/articles/changing-your-github-username),则这些提交将不会与你在 {% data variables.product.product_location %} 上的帐户相关联。 如果使用的是基于 ID 的 {% data variables.product.product_name %} `noreply` 地址,则不适用。 有关详细信息,请参阅“[更改 {% data variables.product.prodname_dotcom %} 用户名](/articles/changing-your-github-username)。”{% endif %}
## <a name="setting-your-commit-email-address-on--data-variablesproductprodname_dotcom-"></a>在 {% data variables.product.prodname_dotcom %} 上设置提交电子邮件地址
{% data reusables.files.commit-author-email-options %}
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.emails %} {% data reusables.user-settings.add_and_verify_email %} {% data reusables.user-settings.select_primary_email %}{% ifversion fpt or ghec %} {% data reusables.user-settings.keeping_your_email_address_private %}{% endif %}
## <a name="setting-your-commit-email-address-in-git"></a>在 Git 中设置您的提交电子邮件地址
可以使用 `git config` 命令更改与 Git 提交关联的电子邮件地址。 设置的新电子邮件地址将在从命令行推送到 {% data variables.product.product_location %} 的任何未来提交中显示。 在您更改提交电子邮件地址之前进行的任何提交仍与之前的电子邮件地址关联。
### <a name="setting-your-email-address-for-every-repository-on-your-computer"></a>为计算机上的每个仓库设置电子邮件地址
{% data reusables.command_line.open_the_multi_os_terminal %}
2. {% data reusables.user-settings.set_your_email_address_in_git %}
```shell
$ git config --global user.email "<em>email@example.com</em>"
```
3. {% data reusables.user-settings.confirm_git_email_address_correct %}
```shell
$ git config --global user.email
<span class="output">email@example.com</span>
```
4. {% data reusables.user-settings.link_email_with_your_account %}
### <a name="setting-your-email-address-for-a-single-repository"></a>为一个仓库设置电子邮件地址
{% data variables.product.product_name %} 使用在您的本地 Git 配置中设置的电子邮件地址将从命令行推送的提交与您在 {% data variables.product.product_location %} 上的帐户相关联。
您可以更改与您在一个仓库中所进行的提交关联的电子邮件地址。 此操作将覆盖这一个仓库中的全局 Git 配置设置,但不会影响任何其他仓库。
{% data reusables.command_line.open_the_multi_os_terminal %}
2. 将当前工作目录更改为您想要在其中配置与 Git 提交关联的电子邮件地址的本地仓库。
3. {% data reusables.user-settings.set_your_email_address_in_git %}
```shell
$ git config user.email "<em>email@example.com</em>"
```
4. {% data reusables.user-settings.confirm_git_email_address_correct %}
```shell
$ git config user.email
<span class="output">email@example.com</span>
```
5. {% data reusables.user-settings.link_email_with_your_account %}

View File

@@ -0,0 +1,59 @@
---
title: GitHub 发送的电子邮件类型
intro: There are several types of emails you can receive from {% data variables.product.product_name %}, including notifications, account information, customer research invitations, and marketing communications.
redirect_from:
- /articles/types-of-emails-github-sends
- /github/setting-up-and-managing-your-github-user-account/types-of-emails-github-sends
- /github/setting-up-and-managing-your-github-user-account/managing-email-preferences/types-of-emails-github-sends
versions:
fpt: '*'
ghec: '*'
topics:
- Accounts
- Notifications
shortTitle: Emails from GitHub
ms.openlocfilehash: e06708966ccd9f33564985e7964409fd1e1c55eb
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145087327"
---
## <a name="notification-emails"></a>通知电子邮件
您可以选择通过电子邮件接收部分或全部活动通知。 有关详细信息,请参阅“[关于通知](/github/managing-subscriptions-and-notifications-on-github/about-notifications)”。 通知电子邮件可包括:
- 您具有管理员访问权限的仓库的安全相关活动
- 您正在查看的仓库的活动
- 您正在参与的对话
- 你被 @mentioned 的对话
- 您正在参与的拉取请求的推送
- 要在组织或仓库中协作的邀请
- 您自己的活动,例如打开、评论或关闭议题和拉取请求
您还可以在您正在参与或观看的对话中选择希望接收哪种类型的电子邮件更新。 有关详细信息,请参阅“[配置通知](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications)”。
## <a name="account-emails"></a>帐户电子邮件
如果您已升级为付费产品或功能,则将在帐户的主电子邮件地址收到帐单收据。 有关详细信息,请参阅“[设置计费电子邮件](/articles/setting-your-billing-email)”。
## <a name="customer-research-emails"></a>客户研究电子邮件
{% data variables.product.product_name %} 有时会寻求客户参加研究会议,以帮助我们构建更好的 GitHub。 这些会议是远程进行的,对世界各地的客户开放,可能包括:
- 反馈调查
- 研究访谈
- 可用性测试会议
- 预览早期原型或概念
这些电子邮件并不常见,您可以选择是否参与。 如果您对参加研究会议的机会感兴趣,您可以加入 GitHub 客户研究小组。 有关详细信息,请参阅“[GitHub 客户体验研究](https://cxr.github.com)”。
## <a name="marketing-emails"></a>营销电子邮件
{% data variables.product.product_name %} 偶尔会发送以下类型的营销电子邮件:
- 使用帐户的提示和技巧
- 有关参与项目或新功能的自定义信息
- 您订阅的简报,例如 {% data variables.explore.explore_github %}
有关详细信息,请参阅“[管理来自 GitHub 的营销电子邮件](/articles/managing-marketing-emails-from-github)”。

View File

@@ -0,0 +1,98 @@
---
title: 关于个人仪表板
redirect_from:
- /hidden/about-improved-navigation-to-commonly-accessed-pages-on-github
- /articles/opting-into-the-public-beta-for-a-new-dashboard
- /articles/about-your-personal-dashboard
- /github/setting-up-and-managing-your-github-user-account/about-your-personal-dashboard
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/about-your-personal-dashboard
intro: You can visit your personal dashboard to keep track of issues and pull requests you're working on or following, navigate to your top repositories and team pages, stay updated on recent activities in organizations and repositories you're subscribed to, and explore recommended repositories.
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
shortTitle: Your personal dashboard
ms.openlocfilehash: a6c91f68a30f06bbc5b3b7bc8a0b95dddfbae64a
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145085069"
---
## <a name="accessing-your-personal-dashboard"></a>访问个人仪表板
个人仪表板是登录 {% data variables.product.product_name %} 时显示的第一页。
登录后若要访问个人仪表板,请单击 {% data variables.product.product_name %} 上任何页面左上角的 {% octicon "mark-github" aria-label="The github octocat logo" %}。
## <a name="finding-your-recent-activity"></a>查找近期活动
在消息馈送的“Recent activity最近活动”部分您可以快速找到并跟进最近更新的议题和您正在处理的拉取请求。 在“最近活动”下,最多可以预览过去两周内的 4 次最近更新。
{% data reusables.dashboard.recent-activity-qualifying-events %}
## <a name="finding-your-top-repositories-and-teams"></a>查找常用仓库和团队
在仪表板的左侧栏中,可以访问常用仓库和团队。
![不同组织中的仓库和团队列表](/assets/images/help/dashboard/repositories-and-teams-from-personal-dashboard.png)
常用仓库列表自动生成,可以包括您与之交互的任何仓库,无论它是否由您的帐户直接拥有。 交互包括提交和打开或评论议题和拉取请求。 常用仓库列表无法编辑,但其中的仓库将在您最后一次与之交互 4 个月后从列表中删除。
您也可以点击 {% data variables.product.product_name %} 上任何页面顶部的搜索栏,查找近期访问过的仓库、团队及项目板列表。
## <a name="staying-updated-with-activity-from-the-community"></a>了解社区中活动的最新信息
{% if for-you-feed %} 仪表板的主要部分有两个活动源:
- 关注:您关注的人员和您关注的存储库的活动。
- 为您推荐:根据您的 {% data variables.product.product_name %} 网络开展的活动和推荐。
### <a name="following-feed"></a>关注订阅源
此订阅源通过关注用户或存储库,显示来自您表现出直接兴趣的存储库和用户的活动。 例如,当您关注的用户执行以下操作时,您会看到更新:
{% else %} 在新闻源的“所有活动”部分,可查看所监视的存储库和关注的用户的更新。
当你关注的用户执行以下操作时,会在新闻源中看到更新:{% endif %}
- 对仓库标星。
- 关注其他用户。{% ifversion fpt or ghes or ghec %}
- 创建公共仓库。{% endif %}
- 在您关注的仓库上打开具有“需要帮助”或“良好的第一个议题”标签的议题或拉取请求。
- 将提交内容推送到你关注的存储库。{% ifversion fpt or ghes or ghec %}
- 复刻公共仓库。{% endif %}
- 发布新版本。
若要详细了解如何关注人员和监视存储库,请参阅“[关注他人](/get-started/exploring-projects-on-github/following-people)”和“[社交化](/get-started/quickstart/be-social)”。
{% if for-you-feed %}
### <a name="for-you-feed"></a>供您订阅
{% note %}
注意:这个新选项卡目前为公共 beta 版本,可能会发生更改。
{% endnote %}
此订阅源根据您在 {% data variables.product.product_name %} 上的网络显示活动和建议。 它旨在提供更新,以激励您,让您保持最新状态,并帮助您找到想要参与的新社区。 您的网络包括:
- 您已加星标的存储库
- 您参与的存储库
- 您关注或赞助的用户
- 与您协作的用户
- 您关注的组织
{% endif %}
## <a name="exploring-recommended-repositories"></a>探索推荐的仓库
在仪表板右侧的“Explore repositories浏览仓库”部分您可以浏览社区中推荐的仓库。 推荐内容基于你已加注星标或访问过的存储库、所关注的人员以及有权访问的存储库中的活动。{% ifversion fpt or ghec %}有关详细信息,请参阅“[查找在 {% data variables.product.prodname_dotcom %} 上参与开放源代码的方法](/github/getting-started-with-github/finding-ways-to-contribute-to-open-source-on-github)”。{% endif %}
## <a name="further-reading"></a>延伸阅读
- [关于组织仪表板](/articles/about-your-organization-dashboard)

View File

@@ -0,0 +1,45 @@
---
title: 关于离开公司的最佳实践
intro: If you use your account on {% data variables.product.product_name %} for both personal and work purposes, there are a few things to keep in mind when you leave your company or organization.
redirect_from:
- /articles/best-practices-for-leaving-your-company
- /github/setting-up-and-managing-your-github-user-account/best-practices-for-leaving-your-company
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/best-practices-for-leaving-your-company
versions:
fpt: '*'
ghec: '*'
topics:
- Accounts
shortTitle: Leaving your company
ms.openlocfilehash: 4384955c0b81e887cb2671a537291b438664e621
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145087324"
---
在离开公司之前,请确保在个人帐户中更新以下信息:
- 通过[在电子邮件设置中删除公司电子邮件地址](/articles/changing-your-primary-email-address)来取消其验证。 然后,您可以在不验证的情况下重新添加它,以保留与您的帐户相关联的所有相关提交。
- [将你的主电子邮件地址](/articles/changing-your-primary-email-address)从公司电子邮件地址更改为个人电子邮件地址。
{% ifversion fpt or ghec %}
- [验证新的主电子邮件地址](/articles/verifying-your-email-address)。
{% endif %}
- [更改你的 GitHub 用户名](/articles/changing-your-github-username)以删除对公司或组织的任何引用(如有必要)。
## <a name="leaving-organizations"></a>离开组织
如果你在使用属于组织的存储库,则应[删除自己的组织成员身份](/articles/removing-yourself-from-an-organization)。 请注意,如果你是组织所有者,应先将[组织的所有权转让](/articles/transferring-organization-ownership)给其他人。
## <a name="removing-professional-associations-with-personal-repositories"></a>删除与个人仓库的职业关联
如果你在属于其他人的个人帐户的存储库中与其进行了专业协作,则应从这些存储库中[删除自己的协作者身份](/articles/removing-yourself-from-a-collaborator-s-repository)。
- [停止关注与工作相关的存储库](https://github.com/watching)。 您不再需要这些通知了!
- [转让你拥有的存储库](/articles/how-to-transfer-a-repository),在你离开后,其他人可能需要继续使用该存储库处理工作。
- [删除与你的工作相关且属于你的分支](/articles/deleting-a-repository)。 不用担心,删除复刻不会删除上游仓库。
- 删除您的计算机上可能存在的复刻本地副本:
```shell
$ rm -rf <em>work_directory</em>
```

View File

@@ -0,0 +1,95 @@
---
title: 更改 GitHub 用户名
intro: You can change the username for your account on {% ifversion fpt or ghec %}{% data variables.product.prodname_dotcom_the_website %}{% elsif ghes %}{% data variables.product.product_location %} if your instance uses built-in authentication{% endif %}.
redirect_from:
- /articles/how-to-change-your-username
- /articles/changing-your-github-user-name
- /articles/renaming-a-user
- /articles/what-happens-when-i-change-my-username
- /articles/changing-your-github-username
- /github/setting-up-and-managing-your-github-user-account/changing-your-github-username
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/changing-your-github-username
versions:
fpt: '*'
ghes: '*'
ghec: '*'
topics:
- Accounts
shortTitle: Change your username
ms.openlocfilehash: 30139a0dab508f1e8db0f33174d6e25ec28afef4
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145085068"
---
{% ifversion ghec or ghes %}
{% note %}
{% ifversion ghec %}
注意:{% data variables.product.prodname_emu_enterprise %} 成员不能更改用户名。 企业的 IdP 管理员控制您的 {% data variables.product.product_name %} 用户名。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_emus %}](/admin/authentication/managing-your-enterprise-users-with-your-identity-provider/about-enterprise-managed-users)”。
{% elsif ghes %}
注意:如果你使用 LDAP 凭据或单一登录 (SSO) 登录 {% data variables.product.product_location %},则只有你的本地管理员才能更改你的用户名。 有关 {% data variables.product.product_name %} 身份验证方法的详细信息,请参阅“[对 {% data variables.product.product_location %} 的用户进行身份验证](/admin/authentication/authenticating-users-for-your-github-enterprise-server-instance)”。
{% endif %}
{% endnote %}
{% endif %}
## <a name="about-username-changes"></a>关于用户名更改
您可以将用户名更改为当前未使用的其他用户名。{% ifversion fpt or ghec %} 如果所需的用户名不可用,请考虑其他名称或唯一变体。 使用数字、连字符或其他拼写可能有助于您找到仍可用的类似用户名。
如果你拥有该用户名的商标,可以在我们的[商标政策](/free-pro-team@latest/github/site-policy/github-trademark-policy)页面上找到有关提出商标投诉的更多信息。
如果您没有该名称的商标,则可以选择其他用户名或保留当前用户名。 {% data variables.contact.github_support %} 无法为您释放不可用的用户名。 有关详细信息,请参阅“[更改用户名](#changing-your-username)”。{% endif %}
更改用户名后,您的旧用户名即可供其他人申请使用。 对旧用户名下仓库的大多数引用会自动更改为新用户名。 不过,指向您个人资料的某些链接不会自动重定向。
{% data variables.product.product_name %} 无法为以下各项设置重定向:
- 使用旧用户名的 [@mentions](/articles/basic-writing-and-formatting-syntax/#mentioning-people-and-teams)
- 包含旧用户名的 [gists](/articles/creating-gists) 链接
{% ifversion fpt or ghec %}
如果您是 {% data variables.product.prodname_emu_enterprise %} 的成员,则无法更改用户名。 {% data reusables.enterprise-accounts.emu-more-info-account %}
{% endif %}
## <a name="repository-references"></a>仓库引用
您更改用户名后,{% data variables.product.product_name %} 自动将引用重定向到您的仓库。
- 指向现有仓库的 Web 链接仍然有效。 进行更改后,可能需要几分钟时间才能完成。
- 从本地仓库克隆推送到旧的远程跟踪 URL 的命令行仍然有效。
如果旧用户名的新所有者创建与您的仓库同名的仓库,则会覆盖重定向条目,并且您的重定向将停止工作。 由于这种可能性,我们建议您在更改用户名后更新所有现有的远程仓库 URL。 有关详细信息,请参阅“[管理远程存储库](/github/getting-started-with-github/managing-remote-repositories)”。
## <a name="links-to-your-previous-profile-page"></a>指向以前的个人资料页面的链接
更改用户名后,指向以前的配置文件页面的链接(例如 `https://{% data variables.command_line.backticks %}/previoususername`)将返回 404 错误。 我们建议从其他位置更新指向 {% data variables.product.product_location %} 帐户的所有链接{% ifversion fpt or ghec %},例如您的 LinkedIn 或 Twitter 个人资料{% endif %}。
## <a name="your-git-commits"></a>您的 Git 提交
{% ifversion fpt or ghec %}与你的 {% data variables.product.product_name %} 提供的 `noreply` 电子邮件地址关联的 Git 提交不会归于新的用户名,并且不会在你的贡献图中显示。{% endif %}如果你的 Git 提交与你已[添加到 GitHub 帐户](/articles/adding-an-email-address-to-your-github-account)的其他电子邮件地址关联,{% ifversion fpt or ghec %}包括基于 ID 的 {% data variables.product.product_name %} 提供的 `noreply` 电子邮件地址,{% endif %}它们在你更改用户名后将继续归于你并在你的贡献图中显示。 有关设置电子邮件地址的详细信息,请参阅“[设置提交电子邮件地址](/articles/setting-your-commit-email-address)”。
## <a name="changing-your-username"></a>更改用户名
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.account_settings %}
3. 在“更改用户名”部分中,单击“更改用户名”。
![更改用户名按钮](/assets/images/help/settings/settings-change-username.png){% ifversion fpt or ghec %}
4. 阅读有关更改用户名的警告。 如果你仍要更改用户名,请单击“我了解,让我们更改用户名”。
![更改用户名警告按钮](/assets/images/help/settings/settings-change-username-warning-button.png)
5. 键入新的用户名。
![新用户名字段](/assets/images/help/settings/settings-change-username-enter-new-username.png)
6. 如果你选择的用户名可用,请单击“更改用户名”。 如果您选择的用户名不可用,可以尝试其他用户名或您看到的建议之一。
![更改用户名警告按钮](/assets/images/help/settings/settings-change-my-username-button.png) {% endif %}
## <a name="further-reading"></a>延伸阅读
- [我的提交为什么链接到错误的用户?](/pull-requests/committing-changes-to-your-project/troubleshooting-commits/why-are-my-commits-linked-to-the-wrong-user){% ifversion fpt or ghec %}
- [{% data variables.product.prodname_dotcom %} 用户名策略](/free-pro-team@latest/github/site-policy/github-username-policy){% endif %}

View File

@@ -0,0 +1,72 @@
---
title: 将用户转换为组织
redirect_from:
- /articles/what-is-the-difference-between-create-new-organization-and-turn-account-into-an-organization
- /articles/explaining-the-account-transformation-warning
- /articles/converting-a-user-into-an-organization
- /github/setting-up-and-managing-your-github-user-account/converting-a-user-into-an-organization
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/converting-a-user-into-an-organization
intro: You can convert your personal account into an organization. This allows more granular permissions for repositories that belong to the organization.
versions:
fpt: '*'
ghes: '*'
ghec: '*'
topics:
- Accounts
shortTitle: User into an organization
ms.openlocfilehash: 0c167e3e389230e6ac2dccb9f1f2f3dc67791bd0
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145066883"
---
{% warning %}
警告:在将用户转换为组织之前,请记住以下几点:
- 你将无法再登录转换后的个人帐户。
- 你将无法再创建或修改转换后的个人帐户所拥有的 Gist。
- 组织无法转换回用户。
- 不会将 SSH 密钥、OAuth 标记、作业配置文件、反应和关联的用户信息传输到组织。 这只适用于被转换的个人帐户,而不适用于该个人帐户的任何协作者。
- 使用转换后的个人帐户所做的任何提交将不再链接到该帐户。 提交本身将保持不变。
- 将删除使用转换后的个人帐户创建的任何专用存储库的分支。
{% endwarning %}
## <a name="keep-your-personal-account-and-create-a-new-organization-manually"></a>保留个人帐户并手动创建新组织
如果希望组织的名称与目前用于个人帐户的名称相同,或者要保留个人帐户的信息不变,则必须创建一个新组织,然后将存储库转让给该组织,而不是将个人帐户转换为组织。
1. 要保留当前个人帐户名称以供个人使用,[请将个人帐户名称更改为](/articles/changing-your-github-username)一个好听的新名称。
2. 使用个人帐户的原始名称[创建新组织](/articles/creating-a-new-organization-from-scratch)。
3. [将存储库转移到](/articles/transferring-a-repository)新的组织帐户。
## <a name="convert-your-personal-account-into-an-organization-automatically"></a>自动将个人帐户转换为组织
也可以将个人帐户直接转换为组织。 转换帐户:
- 按原样保留仓库,无需手动将其转让给另一个帐户
- 自动邀请协作者加入具有与其之前相同权限的团队 {% ifversion fpt or ghec %}- 对于 {% data variables.product.prodname_pro %} 上的个人帐户,自动将计费转换到[付费的 {% data variables.product.prodname_team %}](/articles/about-billing-for-github-accounts),无需重新输入付款信息、调整计费周期或随时双倍付款{% endif %}
1. 创建新的个人帐户,转换后您将用它来登录 GitHub 以及访问组织和仓库。
2. [退出组织](/articles/removing-yourself-from-an-organization)(你要转换的个人帐户已加入的组织)。
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.organizations %}
5. 在“转换帐户”下,单击“将 <username> 转换为组织”。
![组织转换按钮](/assets/images/help/settings/convert-to-organization.png)
6. 在 Account Transformation Warning帐户转换警告对话框中查看并确认转换。 请注意,此框中的信息与本文顶部的警告信息相同。
![转换警告](/assets/images/help/organizations/organization-account-transformation-warning.png)
7. 在“Transform your user into an organization将用户转换为组织”页面的“Choose an organization owner选择组织所有者”下选择您在前面创建的备用个人帐户或您信任的其他用户来管理组织。
![添加组织所有者页面](/assets/images/help/organizations/organization-add-owner.png)
8. 选择新组织的订阅,并在提示时输入帐单信息。
9. 单击“创建组织”。
10. 登录在第一步中创建的新个人帐户,然后使用上下文切换器访问新组织。
{% tip %}
提示:将个人帐户转换为组织时,我们会将属于该帐户的存储库中的协作者作为外部协作者添加到新组织。 然后,你可以根据需要邀请外部协作者成为新组织的成员。 有关详细信息,请参阅“[组织中的角色](/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization#outside-collaborators)”。
{% endtip %}
## <a name="further-reading"></a>延伸阅读
- [设置团队](/articles/setting-up-teams) {% ifversion fpt or ghec %}- [邀请用户加入组织](/articles/inviting-users-to-join-your-organization){% endif %}
- [访问组织](/articles/accessing-an-organization)

View File

@@ -0,0 +1,54 @@
---
title: 删除用户帐户
intro: You can delete your personal account on {% data variables.product.product_name %} at any time.
redirect_from:
- /articles/deleting-a-user-account
- /articles/deleting-your-user-account
- /github/setting-up-and-managing-your-github-user-account/deleting-your-user-account
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/deleting-your-user-account
versions:
fpt: '*'
ghes: '*'
ghec: '*'
topics:
- Accounts
shortTitle: Delete your personal account
ms.openlocfilehash: fe18309f93bdb4124fa5a58d22ab7a93b451e6e1
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084774"
---
删除个人帐户将删除帐户所拥有的所有存储库、专用存储库的分支、Wiki、问题、拉取请求和页面。 {% ifversion fpt or ghec %} 在其他用户拥有的存储库中创建的问题和拉取请求以及所做的评论不会被删除,而是与我们的 [Ghost 用户](https://github.com/ghost)关联。{% else %}在其他用户拥有的存储库中创建的问题和拉取请求以及所做的评论不会被删除。{% endif %}
{% ifversion fpt or ghec %} 当您删除帐户时,我们会停止对您计费。 与该帐户关联的电子邮件地址可用于 {% data variables.product.product_location %} 上不同的帐户。 90 天后,该帐户名称也可供其他任何人用于新帐户。 {% endif %}
如果你是组织的唯一所有者,则必须先将所有权转让给其他人或删除该组织,然后才能删除个人帐户。 如果组织中有其他所有者,则必须先从组织中删除自己,然后才能删除个人帐户。
有关详细信息,请参阅:
- [转让组织所有权](/articles/transferring-organization-ownership)
- [删除组织帐户](/articles/deleting-an-organization-account)
- [从组织中删除自己](/articles/removing-yourself-from-an-organization/)
## <a name="back-up-your-account-data"></a>备份帐户数据
在删除个人帐户之前请复制帐户所拥有的所有存储库、专用分支、Wiki、问题和拉取请求。
{% warning %}
警告删除个人帐户后GitHub 将无法还原内容。
{% endwarning %}
## <a name="delete-your-personal-account"></a>删除个人帐户
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.account_settings %}
3. 在帐户设置页面底部的“删除帐户”下,单击“删除帐户”。 在删除个人帐户之前:
- 如果您是组织中的唯一所有者,则必须将所有权转让给其他人或删除您的组织。
- 如果组织中有其他组织所有者,则必须将自己从组织中删除。
![帐户删除按钮](/assets/images/help/settings/settings-account-delete.png)
4. 在“确认要执行此操作”对话框中,完成相关步骤以确认你了解删除帐户的后果:![删除帐户确认对话框](/assets/images/help/settings/settings-account-deleteconfirm.png) {% ifversion fpt or ghec %}- 重新确认帐户拥有的所有存储库、专用存储库分支、wiki、问题、拉取请求和 {% data variables.product.prodname_pages %} 站点都将删除,计费将立即结束,并且 90 天后任何人都可在 {% data variables.product.product_name %} 上使用你的用户名。
{% else %}- 重新考虑一下您帐户拥有的所有仓库、私有仓库分支、wiki、议题、提取请求和网页都将被删除并且任何人将可在 {% data variables.product.product_name %} 上使用您的用户名。
{% endif %}- 在第一个字段中,输入您的 {% data variables.product.product_name %} 用户名或电子邮件。
- 在第二个字段中,键入提示短语。

View File

@@ -0,0 +1,40 @@
---
title: 管理用户帐户设置
intro: You can change several settings for your personal account, including changing your username and deleting your account.
redirect_from:
- /categories/29/articles
- /categories/user-accounts
- /articles/managing-user-account-settings
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
children:
- /about-your-personal-dashboard
- /managing-your-theme-settings
- /managing-your-tab-size-rendering-preference
- /changing-your-github-username
- /merging-multiple-user-accounts
- /converting-a-user-into-an-organization
- /deleting-your-user-account
- /permission-levels-for-a-user-account-repository
- /permission-levels-for-user-owned-project-boards
- /managing-accessibility-settings
- /managing-the-default-branch-name-for-your-repositories
- /managing-security-and-analysis-settings-for-your-user-account
- /managing-access-to-your-user-accounts-project-boards
- /integrating-jira-with-your-personal-projects
- /best-practices-for-leaving-your-company
- /what-does-the-available-for-hire-checkbox-do
shortTitle: Personal account settings
ms.openlocfilehash: 2d62699cda16ed9387e1f19aab5bb6bde4376b7b
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084771"
---

View File

@@ -0,0 +1,32 @@
---
title: 将 Jira 与个人项目集成
intro: You can integrate Jira Cloud with your personal account to scan commits and pull requests, creating relevant metadata and hyperlinks in any mentioned Jira issues.
redirect_from:
- /articles/integrating-jira-with-your-personal-projects
- /github/setting-up-and-managing-your-github-user-account/integrating-jira-with-your-personal-projects
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/integrating-jira-with-your-personal-projects
versions:
ghes: '*'
ghae: '*'
shortTitle: Integrate Jira with projects
ms.openlocfilehash: a9106d979aa0f219bd20fc5b27042dfe8e81fc8c
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084769"
---
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.developer_settings %} {% data reusables.user-settings.oauth_apps %}
1. 单击“注册新应用程序”。
2. 在“应用程序名称”下键入“Jira”。
3. 在“主页 URL”下键入 Jira 实例的完整 URL。
4. 在“授权回叫 URL”下键入 Jira 实例的完整 URL。
5. 单击“注册应用程序”。
![“注册应用程序”按钮](/assets/images/help/oauth/register-application-button.png)
8. 在“开发人员应用程序”下,记下“客户端 ID”和“客户端机密”值。
![客户端 ID 和客户端机密](/assets/images/help/oauth/client-id-and-secret.png){% data reusables.user-settings.jira_help_docs %}
## <a name="further-reading"></a>延伸阅读
- [集成 Jira 与组织项目板](/articles/integrating-jira-with-your-organization-project-board)
- <a href="https://confluence.atlassian.com/adminjiracloud/connect-jira-cloud-to-github-814188429.html" data-proofer-ignore>将 Jira Cloud 连接到 GitHub</a>Atlassian 文档)

View File

@@ -0,0 +1,38 @@
---
title: 管理对用户帐户项目板的访问
intro: As a project board owner, you can add or remove a collaborator and customize their permissions to a project board.
redirect_from:
- /articles/managing-project-boards-in-your-repository-or-organization
- /articles/managing-access-to-your-user-account-s-project-boards
- /articles/managing-access-to-your-user-accounts-project-boards
- /github/setting-up-and-managing-your-github-user-account/managing-access-to-your-user-accounts-project-boards
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/managing-access-to-your-user-accounts-project-boards
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
shortTitle: Manage access project boards
ms.openlocfilehash: 5a5cf08169fec04a896b05b7934c80cfe9f2eded
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084768"
---
协作者是对您拥有的项目板具有访问权限的个人。 协作者的权限默认为读取权限。 有关详细信息,请参阅“[用户拥有的项目板的权限级别](/articles/permission-levels-for-user-owned-project-boards)”。
## <a name="inviting-collaborators-to-a-user-owned-project-board"></a>邀请协作者参加用户拥有的项目板
1. 导航到您要在其中添加协作者的项目板。
{% data reusables.project-management.click-menu %} {% data reusables.project-management.access-collaboration-settings %} {% data reusables.project-management.collaborator-option %}
5. 在 "Search by username, full name or email address"(按用户名、全名或电子邮件地址搜索)下,输入协作者的姓名、用户名或 {% data variables.product.prodname_dotcom %} 电子邮件地址。
![“协作者”部分,其中搜索字段中输入了 Octocat 的用户名](/assets/images/help/projects/org-project-collaborators-find-name.png) {% data reusables.project-management.add-collaborator %}
7. 新协作者默认具有读取权限。 在新协作者名称旁边,可以选择使用下拉菜单选择不同的权限级别。
![选择了“权限”下拉菜单的“协作者”部分](/assets/images/help/projects/user-project-collaborators-edit-permissions.png)
## <a name="removing-a-collaborator-from-a-user-owned-project-board"></a>从用户拥有的项目板删除协作者
{% data reusables.project-management.click-menu %} {% data reusables.project-management.access-collaboration-settings %} {% data reusables.project-management.collaborator-option %} {% data reusables.project-management.remove-collaborator %}

View File

@@ -0,0 +1,24 @@
---
title: 管理辅助功能设置
intro: You can disable character key shortcuts on {% data variables.product.prodname_dotcom %} in your accessibility settings.
versions:
feature: keyboard-shortcut-accessibility-setting
ms.openlocfilehash: 9cd1aa981642a9372731fcbf39a614e5b93b1273
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084767"
---
## <a name="about-accessibility-settings"></a>关于辅助功能设置
{% data variables.product.product_name %} 包括各种键盘快捷键,便于您在整个站点中执行操作,而无需使用鼠标进行导航。 虽然快捷方式有助于节省时间,但它们有时会使 {% data variables.product.prodname_dotcom %} 更难使用且更难以访问。
默认情况下,所有键盘快捷键都在 {% data variables.product.product_name %} 上启用,但您可以选择在辅助功能设置中禁用字符键快捷键。 此设置不影响 Web 浏览器提供的键盘快捷方式,或者使用修改键(如 <kbd>Control</kbd> 或 <kbd>Command</kbd>)的 {% data variables.product.prodname_dotcom %} 快捷方式。
## <a name="managing-character-key-shortcuts"></a>管理字符键快捷方式
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.accessibility_settings %}
1. 选中或取消选中“启用字符键快捷方式”复选框。
![“启用字符键快捷方式”复选框的屏幕截图](/assets/images/help/settings/disable-character-key-shortcuts.png)
2. 单击“保存” 。

View File

@@ -0,0 +1,57 @@
---
title: 管理用户帐户的安全和分析设置
intro: You can control features that secure and analyze the code in your projects on {% data variables.product.prodname_dotcom %}.
versions:
fpt: '*'
ghec: '*'
ghes: '>3.2'
topics:
- Accounts
redirect_from:
- /github/setting-up-and-managing-your-github-user-account/managing-security-and-analysis-settings-for-your-user-account
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/managing-security-and-analysis-settings-for-your-user-account
shortTitle: Manage security & analysis
ms.openlocfilehash: 1a025a46dc42252a2e3c0facbe6b3beffa48cf45
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084764"
---
## <a name="about-management-of-security-and-analysis-settings"></a>关于安全性和分析设置的管理
{% data variables.product.prodname_dotcom %} 可保护您的仓库。 本主题介绍如何管理所有现有或新仓库的安全和分析功能。
您仍然可以管理单个仓库的安全和分析功能。 有关详细信息,请参阅“[管理存储库的安全和分析设置](/github/administering-a-repository/managing-security-and-analysis-settings-for-your-repository)”。
你还可以查看个人帐户上所有活动的安全日志。 有关详细信息,请参阅“[查看安全日志](/authentication/keeping-your-account-and-data-secure/reviewing-your-security-log)”。
{% data reusables.security.some-security-and-analysis-features-are-enabled-by-default %}
{% data reusables.security.security-and-analysis-features-enable-read-only %}
有关存储库级安全性的概述,请参阅“[保护存储库](/code-security/getting-started/securing-your-repository)”。
## <a name="enabling-or-disabling-features-for-existing-repositories"></a>启用或禁用现有仓库的功能
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.security-analysis %}
3. 在“代码安全和分析”下,单击功能右侧的“全部禁用”或“全部启用” 。
{% ifversion ghes > 3.2 %}![用于“配置安全和分析”功能的“全部启用”或“全部禁用”按钮](/assets/images/enterprise/3.3/settings/security-and-analysis-disable-or-enable-all.png){% else %}![用于“配置安全和分析”功能的“全部启用”或“全部禁用”按钮](/assets/images/help/settings/security-and-analysis-disable-or-enable-all.png){% endif %}
6. (可选)默认情况下为您拥有的新存储库启用该功能。
{% ifversion ghes > 3.2 %}![用于新建存储库的“默认启用”选项](/assets/images/enterprise/3.3/settings/security-and-analysis-enable-by-default-in-modal.png){% else %}![用于新建存储库的“默认启用”选项](/assets/images/help/settings/security-and-analysis-enable-by-default-in-modal.png){% endif %}
7. 单击“禁用功能”或“启用功能”,以为所拥有的所有存储库禁用或启用该功能 。
{% ifversion ghes > 3.2 %}![用于禁用或启用功能的按钮](/assets/images/enterprise/3.3/settings/security-and-analysis-enable-dependency-graph.png){% else %}![用于禁用或启用功能的按钮](/assets/images/help/settings/security-and-analysis-enable-dependency-graph.png){% endif %}
{% data reusables.security.displayed-information %}
## <a name="enabling-or-disabling-features-for-new-repositories"></a>对新仓库启用或禁用功能
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.security-analysis %}
3. 在“Code security and analysis代码安全和分析”下在功能右侧默认为您拥有的新存储库启用或禁用该功能。
{% ifversion ghes > 3.2 %}![用于启用或禁用新建存储库功能的复选框](/assets/images/enterprise/3.3/settings/security-and-analysis-enable-or-disable-feature-checkbox.png){% else %}![用于启用或禁用新建存储库功能的复选框](/assets/images/help/settings/security-and-analysis-enable-or-disable-feature-checkbox.png){% endif %}
## <a name="further-reading"></a>延伸阅读
- “[关于依赖项图](/github/visualizing-repository-data-with-graphs/about-the-dependency-graph)”
- “[关于 {% data variables.product.prodname_dependabot_alerts %}](/code-security/supply-chain-security/about-alerts-for-vulnerable-dependencies)”
- “[自动更新依赖项](/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically)”

View File

@@ -0,0 +1,40 @@
---
title: 管理仓库的默认分支名称
intro: You can set the default branch name for new repositories that you create on {% data variables.product.product_location %}.
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
redirect_from:
- /github/setting-up-and-managing-your-github-user-account/managing-the-default-branch-name-for-your-repositories
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/managing-the-default-branch-name-for-your-repositories
shortTitle: Manage default branch name
ms.openlocfilehash: 5bf934f246a2d0e447a99d0f63888b5b87ecc033
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084763"
---
## <a name="about-management-of-the-default-branch-name"></a>About the default branch name
当您在 {% data variables.product.product_location %} 上创建一个新仓库时,仓库将包含一个分支,它就是默认分支。 您可以更改 {% data variables.product.product_name %} 用于您新建仓库中默认分支的名称。 有关默认分支的详细信息,请参阅“[关于分支](/github/collaborating-with-issues-and-pull-requests/about-branches#about-the-default-branch)”。
{% data reusables.branches.change-default-branch %}
## <a name="setting-the-default-branch-name"></a>设置默认分支名称
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.repo-tab %}
3. 在“存储库默认分支”下,单击“立即更改默认分支名称”。
![“替代”按钮](/assets/images/help/settings/repo-default-name-button.png)
4. 键入要用于新分支的默认名称。
![用于输入默认名称的文本框](/assets/images/help/settings/repo-default-name-text.png)
5. 单击“更新”。
![“更新”按钮](/assets/images/help/settings/repo-default-name-update.png)
## <a name="further-reading"></a>延伸阅读
- “[管理组织中存储库的默认分支名称](/organizations/managing-organization-settings/managing-the-default-branch-name-for-repositories-in-your-organization)”

View File

@@ -0,0 +1,24 @@
---
title: 管理选项卡大小呈现首选项
intro: You can manage the number of spaces a tab is equal to for your personal account.
versions:
fpt: '*'
ghae: issue-5083
ghes: '>=3.4'
ghec: '*'
topics:
- Accounts
shortTitle: Managing your tab size
ms.openlocfilehash: 2313c9e09d7f203f88ad2536aaffd3f508e15b79
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084762"
---
如果您觉得在 {% data variables.product.product_name %} 上呈现的选项卡式代码缩进占用了太多或太少的空间,可以在设置中更改。
{% data reusables.user-settings.access_settings %}
1. 在左侧边栏中,单击“{% octicon "paintbrush" aria-label="The paintbrush icon" %} 外观”。
2. 在“Tab size preference选项卡大小首选项”下选择下拉菜单然后选择您的首选项。
![“选项卡大小首选项”按钮](/assets/images/help/settings/tab-size-preference.png )

View File

@@ -0,0 +1,56 @@
---
title: 管理主题设置
intro: You can manage how {% data variables.product.product_name %} looks to you by setting a theme preference that either follows your system settings or always uses a light or dark mode.
versions:
fpt: '*'
ghae: '*'
ghes: '>=3.2'
ghec: '*'
topics:
- Accounts
redirect_from:
- /github/setting-up-and-managing-your-github-user-account/managing-your-theme-settings
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/managing-your-theme-settings
shortTitle: Manage theme settings
ms.openlocfilehash: 238af803ead331a9323e9457024a85dff05fc5d4
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084757"
---
为了选择和灵活地使用 {% data variables.product.product_name %},您可以配置主题设置来更改 {% data variables.product.product_name %} 的外观。 您可以在浅色和深色两个主题中进行选择,也可以配置 {% data variables.product.product_name %} 遵循系统设置。
您可能需要使用深色主题来减少某些设备的功耗,以在低光条件下减小眼睛的压力,或者因为您更喜欢主题的外观。
{% ifversion fpt or ghes > 3.2 or ghae or ghec %}如果你视力低下,你可能会受益于高对比度主题,其前景和背景元素之间的对比度更高。{% endif %}{% ifversion fpt or ghae or ghec %} 如果你有色盲,你可能会从我们的浅色和深色色盲主题中受益。
{% endif %}
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.appearance-settings %}
1. 在“Theme mode主题模式”下选择下拉菜单然后单击主题首选项。
![“主题模式”下的下拉菜单,用于选择主题首选项](/assets/images/help/settings/theme-mode-drop-down-menu.png)
1. 单击想要使用的主题。
- 如果您选择单个主题,请单击一个主题。
{% ifversion fpt or ghes > 3.2 or ghae or ghec %}![用于选择单个主题的单选按钮](/assets/images/help/settings/theme-choose-a-single-theme-highcontrast.png){% else %}![用于选择单个主题的单选按钮](/assets/images/help/settings/theme-choose-a-single-theme.png){% endif %}
- 如果您选择遵循系统设置,请单击白天主题和夜间主题。
{% ifversion fpt or ghes > 3.2 or ghae or ghec %}![用于选择要与系统设置同步的主题的按钮](/assets/images/help/settings/theme-choose-a-day-and-night-theme-to-sync-highcontrast.png){% else %}![用于选择与系统设置同步的主题的按钮](/assets/images/help/settings/theme-choose-a-day-and-night-theme-to-sync.png){% endif %} {% ifversion fpt or ghec %}
- 如果您想选择当前处于公开测试阶段的主题,则首先需要通过功能预览启用它。 有关详细信息,请参阅“[使用功能预览探索抢先体验版](/get-started/using-github/exploring-early-access-releases-with-feature-preview)”。{% endif %}
{% if command-palette %}
{% note %}
注意:你还可以使用命令面板更改主题设置。 有关详细信息,请参阅“[{% data variables.product.prodname_command_palette %}](/get-started/using-github/github-command-palette)”。
{% endnote %}
{% endif %}
## <a name="further-reading"></a>延伸阅读
- [为 {% data variables.product.prodname_desktop %} 设置主题](/desktop/installing-and-configuring-github-desktop/setting-a-theme-for-github-desktop)

View File

@@ -0,0 +1,52 @@
---
title: 合并多个用户帐户
intro: If you have separate accounts for work and personal use, you can merge the accounts.
redirect_from:
- /articles/can-i-merge-two-accounts
- /articles/keeping-work-and-personal-repositories-separate
- /articles/merging-multiple-user-accounts
- /github/setting-up-and-managing-your-github-user-account/merging-multiple-user-accounts
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/merging-multiple-user-accounts
versions:
fpt: '*'
ghec: '*'
topics:
- Accounts
shortTitle: Merge multiple personal accounts
ms.openlocfilehash: 128a6c99f8a6208150067bb2c3668557b184c255
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084756"
---
{% tip %}
{% ifversion ghec %}
提示:{% data variables.product.prodname_emus %} 允许企业通过标识提供者 (IdP) 为其成员预配唯一的个人帐户。 有关详细信息,请参阅“[关于企业托管用户](/admin/identity-and-access-management/managing-iam-with-enterprise-managed-users/about-enterprise-managed-users)”。 对于其他用例,我们建议仅使用一个个人帐户来管理个人和专业存储库。
{% else %}
提示:我们建议仅使用一个个人帐户来管理个人和专业存储库。
{% endif %}
{% endtip %}
{% warning %}
**警告:**
- 组织和存储库访问权限不能在帐户之间转让。 如果要删除的帐户具有现有访问权限,则组织所有者或存储库管理员将需要邀请您要保留的帐户。
- 无法将使用 GitHub 提供的 `noreply` 电子邮件地址创作的任何提交从一个帐户转移到另一个帐户。 如果要删除的帐户使用了“将我的电子邮件地址设为私有”选项,则无法将要删除的帐户创作的提交转移到要保留的帐户。
{% endwarning %}
1. [将任何存储库从要删除的帐户转移](/articles/how-to-transfer-a-repository)到要保留的帐户。 议题、拉取请求和 wiki 也会转让。 确认要保留的帐户中存在仓库。
2. [更新已移动存储库的任何本地克隆中的远程 URL](/github/getting-started-with-github/managing-remote-repositories)。
3. [删除不会再使用的帐户](/articles/deleting-your-user-account)。
4. 要将过去的提交归因于新帐户,请将用于创作提交的电子邮件地址添加到要保留的帐户。 有关详细信息,请参阅“[为什么我的贡献没有在我的个人资料中显示?](/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/why-are-my-contributions-not-showing-up-on-my-profile#your-local-git-commit-email-isnt-connected-to-your-account)”
## <a name="further-reading"></a>延伸阅读
- [{% data variables.product.prodname_dotcom %} 帐户类型](/articles/types-of-github-accounts)

View File

@@ -0,0 +1,96 @@
---
title: 用户帐户仓库的权限级别
intro: 'A repository owned by a personal account has two permission levels: the repository owner and collaborators.'
redirect_from:
- /articles/permission-levels-for-a-user-account-repository
- /github/setting-up-and-managing-your-github-user-account/permission-levels-for-a-user-account-repository
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/permission-levels-for-a-user-account-repository
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
shortTitle: Permission user repositories
ms.openlocfilehash: 3fed88f8c31f5d3dd788f7b977c214499856f27e
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084752"
---
## <a name="about-permissions-levels-for-a-personal-account-repository"></a>关于个人帐户存储库的权限级别
个人帐户拥有的存储库有一个所有者。 所有权权限无法与其他个人帐户共享。
还可以{% ifversion fpt or ghec %}邀请{% else %}添加{% endif %} {% data variables.product.product_name %} 上的用户成为存储库的协作者。 有关详细信息,请参阅“[邀请协作者访问个人存储库](/github/setting-up-and-managing-your-github-user-account/inviting-collaborators-to-a-personal-repository)”。
{% tip %}
提示:如果需要对个人帐户拥有的存储库实施更精细的访问控制,请考虑将存储库转让给组织。 有关详细信息,请参阅“[转让存储库](/github/administering-a-repository/transferring-a-repository#transferring-a-repository-owned-by-your-personal-account)”。
{% endtip %}
## <a name="owner-access-for-a-repository-owned-by-a-personal-account"></a>所有者对个人帐户拥有的存储库的权限
仓库所有者对仓库具有完全控制权。 除了任何协作者可以执行的操作外,仓库所有者还可以执行以下操作。
| 操作 | 详细信息 |
| :- | :- |
| {% ifversion fpt or ghec %}邀请协作者{% else %}添加协作者{% endif %} | [邀请协作者加入个人存储库](/github/setting-up-and-managing-your-github-user-account/inviting-collaborators-to-a-personal-repository) |
| 更改仓库的可见性 | [设置存储库可见性](/github/administering-a-repository/setting-repository-visibility) |{% ifversion fpt or ghec %}
| 限制与仓库的交互 | [限制存储库中的交互](/communities/moderating-comments-and-conversations/limiting-interactions-in-your-repository) |{% endif %}
| 重命名分支,包括默认分支 | [重命名分支](/github/administering-a-repository/renaming-a-branch) |
| 合并受保护分支上的拉取请求(即使没有批准审查) | [关于受保护分支](/github/administering-a-repository/about-protected-branches) |
| 删除仓库 | [删除存储库](/repositories/creating-and-managing-repositories/deleting-a-repository) |
| 管理仓库的主题 | [使用主题对存储库分类](/github/administering-a-repository/classifying-your-repository-with-topics) |{% ifversion fpt or ghec %}
| 管理仓库的安全性和分析设置 | [管理存储库的安全和分析设置](/github/administering-a-repository/managing-security-and-analysis-settings-for-your-repository) |{% endif %}{% ifversion fpt or ghec %}
| 为私有仓库启用依赖项图 | [探索存储库的依赖项](/github/visualizing-repository-data-with-graphs/exploring-the-dependencies-of-a-repository#enabling-and-disabling-the-dependency-graph-for-a-private-repository) |{% endif %}{% ifversion fpt or ghes > 3.1 or ghec or ghae %}
| 删除和恢复包 | [删除和恢复包](/packages/learn-github-packages/deleting-and-restoring-a-package) |{% endif %}
| 自定义仓库的社交媒体预览 | [自定义存储库的社交媒体预览](/github/administering-a-repository/customizing-your-repositorys-social-media-preview) |
| 从仓库创建模板 | [创建模板存储库](/github/creating-cloning-and-archiving-repositories/creating-a-template-repository) |{% ifversion fpt or ghes or ghae or ghec %}
| 控制对易受攻击依赖项的 {% data variables.product.prodname_dependabot_alerts %} 访问 | [管理存储库的安全和分析设置](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-security-and-analysis-settings-for-your-repository#granting-access-to-security-alerts) |{% endif %}{% ifversion fpt or ghec %}
| 忽略仓库中的 {% data variables.product.prodname_dependabot_alerts %} | [查看漏洞依赖项的 {% data variables.product.prodname_dependabot_alerts %}](/github/managing-security-vulnerabilities/viewing-and-updating-vulnerable-dependencies-in-your-repository) |
| 管理私有仓库的数据使用 | [管理专用存储库的数据使用设置](/get-started/privacy-on-github/managing-data-use-settings-for-your-private-repository)|{% endif %}
| 定义仓库的代码所有者 | [关于代码所有者](/github/creating-cloning-and-archiving-repositories/about-code-owners) |
| 存档仓库 | [存档存储库](/repositories/archiving-a-github-repository/archiving-repositories) |{% ifversion fpt or ghec %}
| 创建安全通告 | [关于 {% data variables.product.prodname_security_advisories %}](/github/managing-security-vulnerabilities/about-github-security-advisories) |
| 显示赞助按钮 | [在存储库中显示赞助者按钮](/github/administering-a-repository/displaying-a-sponsor-button-in-your-repository) |{% endif %}
| 允许或禁止自动合并拉取请求 | [管理存储库中拉取请求的自动合并](/github/administering-a-repository/managing-auto-merge-for-pull-requests-in-your-repository) |
## <a name="collaborator-access-for-a-repository-owned-by-a-personal-account"></a>协作者对个人帐户拥有的存储库的权限
个人仓库的协作者可以拉取(读取)仓库的内容并向仓库推送(写入)更改。
{% note %}
注意:在专用存储库中,存储库所有者只能为协作者授予写入权限。 协作者不能对个人帐户拥有的存储库具有只读权限。
{% endnote %}
协作者还可以执行以下操作。
| 操作 | 详细信息 |
| :- | :- |
| 为存储库创建分支 | [关于分支](/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks) |{% ifversion fpt or ghes > 3.1 or ghae or ghec %}
| 重命名除默认分支以外的分支 | [重命名分支](/github/administering-a-repository/renaming-a-branch) |{% endif %}
| 在仓库中创建、编辑和删除关于提交、拉取请求和议题的评论 | <ul><li>[关于问题](/github/managing-your-work-on-github/about-issues)</li><li>[评论拉取请求](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/commenting-on-a-pull-request)</li><li>[管理中断性注释](/communities/moderating-comments-and-conversations/managing-disruptive-comments)</li></ul> |
| 在仓库中创建、分配、关闭和重新打开议题 | [使用问题管理工作](/github/managing-your-work-on-github/managing-your-work-with-issues) |
| 在仓库中管理议题和拉取请求的标签 | [标记问题和拉取请求](/github/managing-your-work-on-github/labeling-issues-and-pull-requests) |
| 在仓库中管理议题和拉取请求的里程碑 | [创建和编辑问题和拉取请求的里程碑](/github/managing-your-work-on-github/creating-and-editing-milestones-for-issues-and-pull-requests) |
| 将仓库中的议题或拉取请求标记为重复项 | [关于重复的问题和拉取请求](/github/managing-your-work-on-github/about-duplicate-issues-and-pull-requests) |
| 在仓库中创建、合并和关闭拉取请求 | [通过拉取请求提议工作更改](/github/collaborating-with-issues-and-pull-requests/proposing-changes-to-your-work-with-pull-requests) |
| 启用或禁用自动合并拉取请求 | [自动合并拉取请求](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request)
| 将建议的更改应用于仓库中的拉取请求 |[在拉取请求中加入反馈](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/incorporating-feedback-in-your-pull-request) |
| 从仓库的复刻创建拉取请求 | [从分支创建拉取请求](/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) |
| 提交影响拉取请求可合并性的拉取请求审查 | [查看拉取请求中的建议更改](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request) |
| 为仓库创建和编辑 wiki | [关于 Wiki](/communities/documenting-your-project-with-wikis/about-wikis) |
| 为仓库创建和编辑发行版 | [管理存储库中的发行版](/github/administering-a-repository/managing-releases-in-a-repository) |
| 作为仓库的代码所有者 | [关于代码所有者](/articles/about-code-owners) |{% ifversion fpt or ghae or ghec %}
| 发布、查看或安装包 | [发布和管理包](/github/managing-packages-with-github-packages/publishing-and-managing-packages) |{% endif %}
| 作为仓库协作者删除自己 | [从协作者的存储库中删除你自己](/github/setting-up-and-managing-your-github-user-account/removing-yourself-from-a-collaborators-repository) |
## <a name="further-reading"></a>延伸阅读
- [组织的存储库角色](/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization)

View File

@@ -0,0 +1,69 @@
---
title: 用户拥有的项目板的权限级别
intro: 'A project board owned by a personal account has two permission levels: the project board owner and collaborators.'
redirect_from:
- /articles/permission-levels-for-user-owned-project-boards
- /github/setting-up-and-managing-your-github-user-account/permission-levels-for-user-owned-project-boards
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/permission-levels-for-user-owned-project-boards
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
shortTitle: Permission user project boards
ms.openlocfilehash: 535ef830e9ee0d8d5a3bb81ea208711cf4060943
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084751"
---
## <a name="permissions-overview"></a>权限概述
用户拥有的项目板只有一个所有者,此权限无法与其他个人帐户共享。 除了所有者之外,其他人可以在项目板上协作。
项目板协作者有三种权限级别:
{% data reusables.project-management.project-board-permissions %}
## <a name="owner-and-admin-permissions-for-a-user-owned-project-board"></a>用户拥有的项目板的所有者和管理员权限
项目板所有者和具有管理员权限的协作者对项目板有完全控制权限。 除了项目板协作者拥有的所有权限之外,项目板所有者和具有管理员权限的协作者还可以:
- [管理、查看和添加协作者](/articles/managing-access-to-your-user-account-s-project-boards)
- [将项目板配置为{% ifversion ghae %}内部{% else %}公共{% endif %}或专用](/articles/changing-project-board-visibility)
- [删除项目板](/articles/deleting-a-project-board/)
- [关闭项目板](/articles/closing-a-project-board/)
- [重新打开关闭的项目板](/articles/reopening-a-closed-project-board)
## <a name="read-and-write-permissions-for-a-user-owned-project-board"></a>用户拥有的项目板的读取和写入权限
对用户拥有的项目板具有读取权限的协作者可以:
- 查看项目板
- 复制项目板
- 过滤项目板上的卡
对用户拥有的项目板具有写入权限的协作者可以:
- 查看项目板
- 复制项目板
- 过滤项目板上的卡
- 编辑项目板
- 将仓库链接到项目板
- 配置项目板的自动化
- 复制项目板
- 添加议题和拉取请求到项目板
- 添加注释到项目板
- 跟踪项目板上的进度
- 存档项目板上的卡
## <a name="project-board-visibility"></a>项目板可见性
可以将项目板的可见性从专用更改为{% ifversion ghae %}内部{% else %}公共{% endif %},反之亦然。 默认情况下,用户拥有的项目板为私有。 有关详细信息,请参阅“[更改项目板可见性](/articles/changing-project-board-visibility)”。
## <a name="further-reading"></a>延伸阅读
- “[管理对个人帐户的项目板的访问权限](/articles/managing-access-to-your-user-account-s-project-boards)”

View File

@@ -0,0 +1,33 @@
---
title: “招聘职位”复选框有什么作用?
intro: Use the **Available for hire** checkbox to view GitHub Jobs posts within GitHub.
redirect_from:
- /articles/what-does-the-available-for-hire-checkbox-do
- /github/setting-up-and-managing-your-github-user-account/what-does-the-available-for-hire-checkbox-do
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/what-does-the-available-for-hire-checkbox-do
versions:
fpt: '*'
ghec: '*'
topics:
- Accounts
shortTitle: Available for hire checkbox
ms.openlocfilehash: d3acf444423db8aacce8d33d1062b32e435a751a
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084750"
---
{% warning %}
弃用说明GitHub Jobs 现已弃用。 最后一次发布工作日期是 2021 年 5 月 19 日。 GitHub Jobs 网站已于 2021 年 8 月 19 日完全关闭,现在重定向到 [GitHub 博客文章](https://github.blog/changelog/2021-04-19-deprecation-notice-github-jobs-site/)通知,其中包含有关 GitHub Jobs 现已完成的弃用的详细信息。
{% endwarning %}
[GitHub Jobs](https://jobs.github.com/) 板是找到技术方面的工作的不错方法。 您可选择查看在 GitHub 仪表板上发布的职位。
![仪表板上的 GitHub Jobs 广告](/assets/images/help/settings/jobs-ads-on-dashboard.png)
{% data reusables.user-settings.access_settings %}
2. 在“工作简介”下,选择“可供雇用”,然后单击“保存工作简介” 。
![工作简介设置](/assets/images/help/settings/jobs-profile-settings.png)

View File

@@ -0,0 +1,58 @@
---
title: 关于组织成员资格
intro: You can become a member of an organization to collaborate with coworkers or open-source contributors across many repositories at once.
redirect_from:
- /articles/about-organization-membership
- /github/setting-up-and-managing-your-github-user-account/about-organization-membership
- /github/setting-up-and-managing-your-github-user-account/managing-your-membership-in-organizations/about-organization-membership
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
shortTitle: Organization membership
ms.openlocfilehash: 6a7afd8aee12e2c471f564122fb21f07d710f808
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084749"
---
组织所有者可邀请您作为成员、帐单管理员或所有者加入其组织。 组织所有者或者对仓库具有管理员权限的成员可邀请您作为外部协作者,协作处理一个或多个仓库。 有关详细信息,请参阅“[组织中的角色](/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization)”。
您可以在个人资料页面上访问您是其成员的组织。 有关详细信息,请参阅“[访问组织](/articles/accessing-an-organization)”。
当您接受加入组织的邀请后,组织所有者可能会看到:
- 您的公共资料信息
- 你的电子邮件地址
- 您是否启用双重身份验证
- 您在组织内可以访问的仓库以及您的权限级别
- 组织内的特定活动
- 申请来源国家/地区
- 您的 IP 地址
有关详细信息,请参阅 <a href="/articles/github-privacy-statement/" class="dotcom-only">{% data variables.product.prodname_dotcom %} 隐私声明</a>。
{% note %}
注意:所有者无法在组织的审核日志中查看成员 IP 地址。 在发生安全事件时,例如帐户被盗或因疏忽而共享敏感数据,组织所有者可能会申请详细访问私有仓库。 我们返回的信息可能包含您的 IP 地址。
{% endnote %}
默认情况下,您的组织成员资格可见性会设为私密。 您可以选择在您的个人资料中公开个人组织成员资格。 有关详细信息,请参阅“[公开或隐藏组织成员身份](/articles/publicizing-or-hiding-organization-membership)”。
{% ifversion fpt or ghec %}
如果您的组织属于某个企业帐户,您会自动成为该企业帐户的成员,企业帐户所有者能够看到您。 有关详细信息,请参阅 {% data variables.product.prodname_ghe_cloud %} 文档中的“[关于企业帐户](/enterprise-cloud@latest/admin/overview/about-enterprise-accounts){% ifversion fpt %}”。{% else %}."{% endif %}
{% endif %}
您可以随时离开组织。 有关详细信息,请参阅“[从组织中删除自己](/articles/removing-yourself-from-an-organization)”。
## <a name="further-reading"></a>延伸阅读
- [关于组织](/articles/about-organizations)
- [管理组织中的成员身份](/articles/managing-your-membership-in-organizations)

View File

@@ -0,0 +1,31 @@
---
title: 访问组织
intro: To access an organization that you're a member of, you must sign in to your personal account.
redirect_from:
- /articles/error-cannot-log-in-that-account-is-an-organization
- /articles/cannot-log-in-that-account-is-an-organization
- /articles/how-do-i-access-my-organization-account
- /articles/accessing-an-organization
- /github/setting-up-and-managing-your-github-user-account/accessing-an-organization
- /github/setting-up-and-managing-your-github-user-account/managing-your-membership-in-organizations/accessing-an-organization
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
ms.openlocfilehash: 61d05267792ec59cef5f5b41d7680d1dc4c3f9fe
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084746"
---
{% tip %}
提示:只有组织所有者才可查看和更改组织的帐户设置。
{% endtip %}
{% data reusables.profile.access_org %} {% data reusables.user-settings.access_org %}

View File

@@ -0,0 +1,29 @@
---
title: 管理组织中的成员资格
intro: If you're a member of an organization, you can publicize or hide your membership, view other people's roles, and remove yourself from the organization.
redirect_from:
- /articles/managing-your-membership-in-organizations
- /github/setting-up-and-managing-your-github-user-account/managing-your-membership-in-organizations
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
children:
- /about-organization-membership
- /accessing-an-organization
- /viewing-peoples-roles-in-an-organization
- /requesting-organization-approval-for-oauth-apps
- /publicizing-or-hiding-organization-membership
- /managing-your-scheduled-reminders
- /removing-yourself-from-an-organization
shortTitle: Manage organization membership
ms.openlocfilehash: cb0fbd62c63098fb3cbf5a786147499aa6d63c61
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084745"
---

View File

@@ -0,0 +1,53 @@
---
title: 管理您的预定提醒
intro: Get reminders in Slack when you or your team have pull requests waiting for review.
versions:
fpt: '*'
ghec: '*'
topics:
- Accounts
redirect_from:
- /github/setting-up-and-managing-your-github-user-account/managing-your-scheduled-reminders
- /github/setting-up-and-managing-your-github-user-account/managing-your-membership-in-organizations/managing-your-scheduled-reminders
shortTitle: Manage scheduled reminders
ms.openlocfilehash: 41670a8c8b8aa1e6eade16c42f5a146f1ec0f5ee
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084744"
---
## <a name="about-scheduled-reminders-for-users"></a>关于用户的预定提醒
预定提醒用于确保用户将重点放在需要他们关注的最重要审查请求上。 拉取请求的预定提醒将会在指定的时间在 Slack 中向您发送一条消息,提醒已经打开、需要您审查的拉取请求。 例如,您可以设置预定提醒,以便每天早上 10 点在 Slack 中向您发送消息,提醒需要由您或您的一个团队审查的拉取请求。
对于某些事件,您还可以为预定提醒启用实时警报。 实时警报会在重要事件(例如分配审查时)发生时立即发送到您的 Slack 通道。
对于您所在组织的拉取请求,您可以为个人或团队级审查请求设置预定提醒。 组织所有者必须先授权您的 Slack 工作区,然后您才可为自己创建预定提醒。 有关详细信息,请参阅“[管理组织的预定提醒](/organizations/managing-organization-settings/managing-scheduled-reminders-for-your-organization)”。
{% data reusables.reminders.scheduled-reminders-limitations %}
## <a name="creating-scheduled-reminders-for-your-personal-account"></a>为你的个人帐户创建预定提醒
{% data reusables.user-settings.access_settings %} {% data reusables.reminders.scheduled-reminders %}
1. 在要预定提醒的组织旁边,单击“编辑”。
![预定提醒编辑按钮](/assets/images/help/settings/scheduled-reminders-org-choice.png) {% data reusables.reminders.add-reminder %} {% data reusables.reminders.authorize-slack %} {% data reusables.reminders.days-dropdown %} {% data reusables.reminders.times-dropdowns %}
8. 或者,要对分配给你的审查接收预定提醒,请选择“审查分配给你的请求”。
![审查分配给你的请求复选框](/assets/images/help/profile/scheduled-reminders-your-requests.png)
9. 或者,要对分配给你所属团队的审查接受预定提醒,请选择“审查分配给你的团队的请求”。
![审查分配给你的团队的请求复选框](/assets/images/help/profile/scheduled-reminders-your-team-requests.png) {% data reusables.reminders.real-time-alerts %} ![启用实时警报复选框](/assets/images/help/settings/scheduled-reminders-real-time-alerts-personal.png) {% data reusables.reminders.create-reminder %}
## <a name="managing-scheduled-reminders-for-your-personal-account"></a>为你的个人帐户管理预定提醒
{% data reusables.user-settings.access_settings %} {% data reusables.reminders.scheduled-reminders %}
1. 在要编辑预定提醒的组织旁边,单击“编辑”。
![预定提醒编辑按钮](/assets/images/help/settings/scheduled-reminders-org-choice.png) {% data reusables.reminders.edit-page %} {% data reusables.reminders.update-buttons %}
## <a name="deleting-scheduled-reminders-for-your-personal-account"></a>为你的个人帐户删除预定提醒
{% data reusables.user-settings.access_settings %} {% data reusables.reminders.scheduled-reminders %}
1. 在要删除提醒的组织旁边,单击“编辑”。
![预定提醒编辑按钮](/assets/images/help/settings/scheduled-reminders-org-choice.png) {% data reusables.reminders.delete %}
## <a name="further-reading"></a>延伸阅读
- [管理组织的预定提醒](/organizations/managing-organization-settings/managing-scheduled-reminders-for-your-organization)
- [管理团队的预定提醒](/organizations/organizing-members-into-teams/managing-scheduled-reminders-for-your-team)

View File

@@ -0,0 +1,34 @@
---
title: 公开或隐藏组织成员关系
intro: If you'd like to tell the world which organizations you belong to, you can display the avatars of the organizations on your profile.
redirect_from:
- /articles/publicizing-or-concealing-organization-membership
- /articles/publicizing-or-hiding-organization-membership
- /github/setting-up-and-managing-your-github-user-account/publicizing-or-hiding-organization-membership
- /github/setting-up-and-managing-your-github-user-account/managing-your-membership-in-organizations/publicizing-or-hiding-organization-membership
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
shortTitle: Show or hide membership
ms.openlocfilehash: a85c9c40f24506ef2e8a9673093b8d7821954cb3
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084740"
---
![个人资料组织框](/assets/images/help/profile/profile_orgs_box.png)
## <a name="changing-the-visibility-of-your-organization-membership"></a>更改组织成员关系的可见性
{% data reusables.profile.access_org %} {% data reusables.user-settings.access_org %} {% data reusables.organizations.people %}
4. 在成员列表中找到您的用户名。 如果列表很长,可在搜索框中搜索您的用户名。
![组织成员搜索框x](/assets/images/help/organizations/member-search-box.png)
5. 在用户名右边的菜单中,选择新的可见性选项:
- 若要公开成员身份,请选择“公开”。
- 若要隐藏成员身份,请选择“隐藏”。
![组织成员可见性链接](/assets/images/help/organizations/member-visibility-link.png)

View File

@@ -0,0 +1,38 @@
---
title: 从组织中删除自己
intro: If you're an outside collaborator or a member of an organization, you can leave the organization at any time.
redirect_from:
- /articles/how-do-i-remove-myself-from-an-organization
- /articles/removing-yourself-from-an-organization
- /github/setting-up-and-managing-your-github-user-account/removing-yourself-from-an-organization
- /github/setting-up-and-managing-your-github-user-account/managing-your-membership-in-organizations/removing-yourself-from-an-organization
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
shortTitle: Leave an organization
ms.openlocfilehash: 72fcc393be287ace20d6c1412f769505117ccef9
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084739"
---
{% ifversion fpt or ghec %}
{% warning %}
警告:如果你目前在组织中负责为 {% data variables.product.product_name %} 付款,从组织中删除自己不会更新组织的存档帐单信息 。 如果你目前负责计费,则必须让组织的其他所有者或帐单管理员[更新组织的付款方式](/articles/adding-or-editing-a-payment-method)。
有关详细信息,请参阅“[转让组织所有权](/articles/transferring-organization-ownership)”。
{% endwarning %}
{% endif %}
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.organizations %}
3. 在“组织”下,找到你想要从中删除自己的组织,然后单击“离开”。
![显示角色的离开组织按钮](/assets/images/help/organizations/context-leave-organization-with-roles-shown.png)

View File

@@ -0,0 +1,35 @@
---
title: 请求组织批准 OAuth 应用程序
intro: Organization members can request that an owner approve access to organization resources for {% data variables.product.prodname_oauth_app %}.
redirect_from:
- /articles/requesting-organization-approval-for-third-party-applications
- /articles/requesting-organization-approval-for-your-authorized-applications
- /articles/requesting-organization-approval-for-oauth-apps
- /github/setting-up-and-managing-your-github-user-account/requesting-organization-approval-for-oauth-apps
- /github/setting-up-and-managing-your-github-user-account/managing-your-membership-in-organizations/requesting-organization-approval-for-oauth-apps
versions:
fpt: '*'
ghec: '*'
topics:
- Accounts
shortTitle: Request OAuth App approval
ms.openlocfilehash: 4e0f553ebbf8655da6230474e3d2051b6dc5ff2d
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084735"
---
## <a name="requesting-organization-approval-for-an--data-variablesproductprodname_oauth_app--youve-already-authorized-for-your-personal-account"></a>请求组织批准您已为个人帐户授权的 {% data variables.product.prodname_oauth_app %}
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.access_applications %} {% data reusables.user-settings.access_authorized_oauth_apps %}
3. 在应用程序列表中,单击您想要请求访问权限的 {% data variables.product.prodname_oauth_app %}的名称。
![查看应用按钮](/assets/images/help/settings/settings-third-party-view-app.png)
4. 在你想要 {% data variables.product.prodname_oauth_app %} 访问的组织旁边,单击“请求访问权限”。
![“请求访问权限”按钮](/assets/images/help/settings/settings-third-party-request-access.png)
5. 审查关于请求 {% data variables.product.prodname_oauth_app %} 访问权限的信息后,单击“请求所有者的批准”。
![“请求审批”按钮](/assets/images/help/settings/oauth-access-request-approval.png)
## <a name="further-reading"></a>延伸阅读
- [关于 {% data variables.product.prodname_oauth_app %} 访问限制](/articles/about-oauth-app-access-restrictions)

View File

@@ -0,0 +1,67 @@
---
title: 查看组织中人员的角色
intro: You can view a list of the people in your organization and filter by their role. For more information on organization roles, see "[Roles in an organization](/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization)."
permissions: Organization members can see people's roles in the organization.
redirect_from:
- /articles/viewing-people-s-roles-in-an-organization
- /articles/viewing-peoples-roles-in-an-organization
- /github/setting-up-and-managing-your-github-user-account/viewing-peoples-roles-in-an-organization
- /github/setting-up-and-managing-your-github-user-account/managing-your-membership-in-organizations/viewing-peoples-roles-in-an-organization
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
shortTitle: View people in an organization
ms.openlocfilehash: d492821546b16a7c863d96867ef431362e7056ce
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145084733"
---
## <a name="view-organization-roles"></a>查看组织角色
{% data reusables.profile.access_org %} {% data reusables.user-settings.access_org %} {% data reusables.organizations.people %}
4. 您将看到组织中人员的列表。 若要按角色筛选列表,请单击“角色”并选择要搜索的角色。
![click-role](/assets/images/help/organizations/view-list-of-people-in-org-by-role.png)
{% ifversion fpt %}
如果您的组织使用 {% data variables.product.prodname_ghe_cloud %},您还可以查看管理所有企业组织的计费设置和策略的企业所有者。 有关详细信息,请参阅 [{% data variables.product.prodname_ghe_cloud %} 文档](/enterprise-cloud@latest/account-and-profile/setting-up-and-managing-your-github-user-account/managing-your-membership-in-organizations/viewing-peoples-roles-in-an-organization#view-enterprise-owners-and-their-roles-in-an-organization)。
{% endif %}
{% if enterprise-owners-visible-for-org-members %}
## <a name="view-enterprise-owners-and-their-roles-in-an-organization"></a>查看企业所有者及其在组织中的角色
如果您的组织由企业帐户管理,则可以查看管理企业所有组织的帐单设置和策略的企业所有者。 有关企业帐户的详细信息,请参阅“[{% data variables.product.prodname_dotcom %} 帐户的类型](/get-started/learning-about-github/types-of-github-accounts)”。
您还可以查看企业所有者是否在组织中具有特定角色。 企业所有者也可以是组织成员、任何其他组织角色,或者是与组织无关的角色。
{% note %}
**注意:** 如果你是组织所有者,还可以邀请企业所有者在组织中担任角色。 如果企业所有者接受邀请,则会从企业的可用许可证中使用组织中的席位或许可证。 有关许可工作原理的详细信息,请参阅“[企业中的角色](/admin/user-management/managing-users-in-your-enterprise/roles-in-an-enterprise#enterprise-owner)”。
{% endnote %}
| **企业角色** | **组织角色** | **组织访问或影响** |
|----|----|----|----|
| 企业所有者 | 非附属角色或非官方组织角色 | 无法访问组织内容或存储库,但可管理影响组织的企业设置和策略。 |
| 企业所有者 | 组织所有者 | 能够配置组织设置并通过团队等管理对组织资源的访问。 |
| 企业所有者 | 组织成员 | 能够访问组织资源和内容(如存储库),而无需访问组织的设置。 |
若要查看组织中的所有角色,请参阅“[组织中的角色](/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization)”。 {% if custom-repository-roles %} 组织成员还可以具有特定存储库的自定义角色。 有关详细信息,请参阅“[管理组织的自定义存储库角色](/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization)”。{% endif %}
有关企业所有者角色的详细信息,请参阅“[企业中的角色](/admin/user-management/managing-users-in-your-enterprise/roles-in-an-enterprise#enterprise-owner)”。
{% data reusables.profile.access_org %} {% data reusables.user-settings.access_org %} {% data reusables.organizations.people %}
4. 在左侧边栏的“企业权限”下,单击“企业所有者”。
![边栏菜单中“企业所有者”选项的屏幕截图](/assets/images/help/organizations/enterprise-owners-sidebar.png)
5. 查看企业的企业所有者列表。 如果企业所有者也是您组织的成员,则您可以看到他们在组织中的角色。
![企业所有者列表及其在组织中的角色的屏幕截图](/assets/images/help/organizations/enterprise-owners-list-on-org-page.png)
{% endif %}

View File

@@ -1,6 +1,6 @@
---
title: Inviting collaborators to a personal repository
intro: 'You can {% ifversion fpt or ghec %}invite users to become{% else %}add users as{% endif %} collaborators to your personal repository.'
title: 邀请协作者参加个人仓库
intro: '你可以{% ifversion fpt or ghec %}邀请用户成为{% else %}添加用户作为{% endif %}个人存储库的协作者。'
redirect_from:
- /articles/how-do-i-add-a-collaborator
- /articles/adding-collaborators-to-a-personal-repository
@@ -18,50 +18,49 @@ topics:
- Accounts
- Repositories
shortTitle: Invite collaborators
ms.openlocfilehash: b8cf147e94d4dd0a76d0bebcb07a58d03d7cbc9e
ms.sourcegitcommit: fb047f9450b41b24afc43d9512a5db2a2b750a2a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/11/2022
ms.locfileid: '145164797'
---
Repositories owned by an organization can grant more granular access. For more information, see "[Access permissions on {% data variables.product.prodname_dotcom %}](/articles/access-permissions-on-github)."
组织拥有的仓库可授予更细致的访问权限。 有关详细信息,请参阅“[ {% data variables.product.prodname_dotcom %} 的访问权限](/articles/access-permissions-on-github)”。
{% data reusables.organizations.org-invite-expiration %}
{% ifversion fpt or ghec %}
If you're a member of an {% data variables.enterprise.prodname_emu_enterprise %}, you can only invite other members of your enterprise to collaborate with you. {% data reusables.enterprise-accounts.emu-more-info-account %}
如果您是 {% data variables.product.prodname_emu_enterprise %} 的成员,则只能邀请企业的其他成员与您协作。 {% data reusables.enterprise-accounts.emu-more-info-account %}
{% note %}
**Note:** {% data variables.product.company_short %} limits the number of people who can be invited to a repository within a 24-hour period. If you exceed this limit, either wait 24 hours or create an organization to collaborate with more people.
注意:{% data variables.product.company_short %} 会限制在 24 小时内可受邀加入存储库的人数。 如果您超过此限制,请等待 24 小时后再邀请,或者创建一个组织以与更多的人协作。
{% endnote %}
{% endif %}
1. Ask for the username of the person you're inviting as a collaborator.{% ifversion fpt or ghec %} If they don't have a username yet, they can sign up for {% data variables.product.prodname_dotcom %} For more information, see "[Signing up for a new {% data variables.product.prodname_dotcom %} account](/articles/signing-up-for-a-new-github-account)".{% endif %}
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.sidebar-settings %}
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4%}
{% data reusables.repositories.click-collaborators-teams %}
1. Click **Invite a collaborator**.
!["Invite a collaborator" button](/assets/images/help/repository/invite-a-collaborator-button.png)
2. In the search field, start typing the name of person you want to invite, then click a name in the list of matches.
![Search field for typing the name of a person to invite to the repository](/assets/images/help/repository/manage-access-invite-search-field-user.png)
3. Click **Add NAME to REPOSITORY**.
![Button to add collaborator](/assets/images/help/repository/add-collaborator-user-repo.png)
{% else %}
5. In the left sidebar, click **Collaborators**.
![Repository settings sidebar with Collaborators highlighted](/assets/images/help/repository/user-account-repo-settings-collaborators.png)
6. Under "Collaborators", start typing the collaborator's username.
7. Select the collaborator's username from the drop-down menu.
![Collaborator list drop-down menu](/assets/images/help/repository/repo-settings-collab-autofill.png)
8. Click **Add collaborator**.
!["Add collaborator" button](/assets/images/help/repository/repo-settings-collab-add.png)
{% endif %}
{% ifversion fpt or ghec %}
9. The user will receive an email inviting them to the repository. Once they accept your invitation, they will have collaborator access to your repository.
1. 询问你邀请作为协助者的用户名。{% ifversion fpt or ghec %} 如果他们还没有用户名,他们可以注册 {% data variables.product.prodname_dotcom %}。有关详细信息,请参阅“[注册新的 {% data variables.product.prodname_dotcom %} 帐户](/articles/signing-up-for-a-new-github-account)”。{% endif %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5658%} {% data reusables.repositories.click-collaborators-teams %}
1. 单击“邀请协作者”。
![“邀请协作者”按钮](/assets/images/help/repository/invite-a-collaborator-button.png)
2. 在搜索字段中,开始键入您想邀请的人员的姓名,然后单击匹配列表中的姓名。
![搜索字段以键入要邀请加入存储库的人员姓名](/assets/images/help/repository/manage-access-invite-search-field-user.png)
3. 单击“将 <NAME> 添加到存储库”。
![用于添加协作者的按钮](/assets/images/help/repository/add-collaborator-user-repo.png) {% else %}
5. 在左侧边栏中,单击“协作者”。
![突出显示协作者的“存储库设置”侧边栏](/assets/images/help/repository/user-account-repo-settings-collaborators.png)
6. 在 "Collaborators"(协作者)下,开始输入协作者的用户名。
7. 从下拉菜单中选择协作者的用户名。
![协作者列表下拉菜单](/assets/images/help/repository/repo-settings-collab-autofill.png)
8. 单击“添加协作者”。
![“添加协作者”按钮](/assets/images/help/repository/repo-settings-collab-add.png) {% endif %} {% ifversion fpt or ghec %}
9. 用户将会收到一封邀请他们参加仓库的电子邮件。 在接受邀请后,他们便对仓库具有协作者访问权限。
{% endif %}
## Further reading
## 延伸阅读
- "[Permission levels for a personal account repository](/articles/permission-levels-for-a-user-account-repository/#collaborator-access-for-a-repository-owned-by-a-personal-account)"
- "[Removing a collaborator from a personal repository](/articles/removing-a-collaborator-from-a-personal-repository)"
- "[Removing yourself from a collaborator's repository](/articles/removing-yourself-from-a-collaborator-s-repository)"
- "[Organizing members into teams](/organizations/organizing-members-into-teams)"
- [个人帐户存储库的权限级别](/articles/permission-levels-for-a-user-account-repository/#collaborator-access-for-a-repository-owned-by-a-personal-account)
- [从个人存储库中删除协作者](/articles/removing-a-collaborator-from-a-personal-repository)
- [从协作者的存储库中删除你自己](/articles/removing-yourself-from-a-collaborator-s-repository)
- [将成员组织为团队](/organizations/organizing-members-into-teams)

View File

@@ -1,6 +1,6 @@
---
title: Removing a collaborator from a personal repository
intro: 'When you remove a collaborator from your project, they lose read/write access to your repository. If the repository is private and the person has created a fork, then that fork is also deleted.'
title: 从个人仓库中删除协作者
intro: 当您从项目中删除协作者时,他们将失去对您仓库的读取/写入权限。 如果仓库为私有并且该人员已创建复刻,则该复刻也将删除。
redirect_from:
- /articles/how-do-i-remove-a-collaborator
- /articles/what-happens-when-i-remove-a-collaborator-from-my-private-repository
@@ -21,27 +21,28 @@ topics:
- Accounts
- Repositories
shortTitle: Remove a collaborator
ms.openlocfilehash: 24b128b5858c695b0e559302fac05812d3218b8c
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '145164728'
---
## Deleting forks of private repositories
## 删除私有仓库的复刻
While forks of private repositories are deleted when a collaborator is removed, the person will still retain any local clones of your repository.
尽管删除协作者时将删除私有仓库的复刻,但此人员将仍保留您仓库的任何本地克隆。
## Removing collaborator permissions from a person contributing to a repository
## 删除为仓库做出贡献的人员的协作者权限
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.sidebar-settings %}
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
{% data reusables.repositories.click-collaborators-teams %}
4. To the right of the collaborator you want to remove, click {% octicon "trash" aria-label="The trash icon" %}.
![Button to remove collaborator](/assets/images/help/repository/collaborator-remove.png)
{% else %}
3. In the left sidebar, click **Collaborators & teams**.
![Collaborators tab](/assets/images/help/repository/repo-settings-collaborators.png)
4. Next to the collaborator you want to remove, click the **X** icon.
![Remove link](/assets/images/help/organizations/Collaborator-Remove.png)
{% endif %}
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5658 %} {% data reusables.repositories.click-collaborators-teams %}
4. 在要移除的协作者的右侧,单击 {% octicon "trash" aria-label="The trash icon" %}
![用于移除协作者的按钮](/assets/images/help/repository/collaborator-remove.png) {% else %}
3. 在左侧边栏中,单击“协作者和团队”。
![“协作者”选项卡](/assets/images/help/repository/repo-settings-collaborators.png)
4. 在要移除的协作者旁边单击“X”图标。
![移除链接](/assets/images/help/organizations/Collaborator-Remove.png) {% endif %}
## Further reading
## 延伸阅读
- "[Removing organization members from a team](/articles/removing-organization-members-from-a-team)"
- "[Removing an outside collaborator from an organization repository](/articles/removing-an-outside-collaborator-from-an-organization-repository)"
- [从团队中移除组织成员](/articles/removing-organization-members-from-a-team)
- [从组织存储库中移除外部协作者](/articles/removing-an-outside-collaborator-from-an-organization-repository)

View File

@@ -1,6 +1,6 @@
---
title: Removing yourself from a collaborator's repository
intro: 'If you no longer want to be a collaborator on someone else''s repository, you can remove yourself.'
title: 从协作者的仓库中删除您自己
intro: 如果您不再想要成为其他人仓库中的协作者,您可以删除自己。
redirect_from:
- /leave-a-collaborative-repo
- /leave-a-repo
@@ -19,15 +19,19 @@ topics:
- Accounts
- Repositories
shortTitle: Remove yourself
ms.openlocfilehash: 3b760d7947d734d8fa6e1e366795ce698f9c0b7f
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '145164723'
---
{% data reusables.user-settings.access_settings %}
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
2. In the "Code, planning, and automation" section of the sidebar, click **{% octicon "repo" aria-label="The repo icon" %} Repositories**.
{% data reusables.user-settings.access_settings %} {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-5658 %}
2. 在边栏的“代码、规划和自动化”部分,单击“{% octicon "repo" aria-label="The repo icon" %} 存储库”。
{% else %}
2. In the left sidebar, click **Repositories**.
![Repositories tab](/assets/images/help/settings/settings-sidebar-repositories.png)
{% endif %}
3. Next to the repository you want to leave, click **Leave**.
![Leave button](/assets/images/help/repository/repo-leave.png)
4. Read the warning carefully, then click "I understand, leave this repository."
![Dialog box warning you to leave](/assets/images/help/repository/repo-leave-confirmation.png)
2. 在左侧边栏中,单击“存储库”。
![“存储库”选项卡](/assets/images/help/settings/settings-sidebar-repositories.png) {% endif %}
3. 在要离开的存储库旁边,单击“离开”。
![“离开”按钮](/assets/images/help/repository/repo-leave.png)
4. 仔细阅读警告然后单击“I understand, leave this repository我已了解离开此仓库”。
![警告你将离开的对话框](/assets/images/help/repository/repo-leave-confirmation.png)

View File

@@ -1,6 +1,6 @@
---
title: Adding an email address to your GitHub account
intro: '{% data variables.product.product_name %} allows you to add as many email addresses to your account as you like. If you set an email address in your local Git configuration, you will need to add it to your account settings in order to connect your commits to your account. For more information about your email address and commits, see "[Setting your commit email address](/articles/setting-your-commit-email-address/)."'
title: 添加电子邮件地址到 GitHub 帐户
intro: '{% data variables.product.product_name %} 允许您根据需要为帐户添加多个电子邮件地址。 如果在本地 Git 配置中设置电子邮件地址,您需要将其添加到帐户设置,以将提交连接到帐户。 有关电子邮件地址和提交的详细信息,请参阅“[设置提交电子邮件地址](/articles/setting-your-commit-email-address/)”。'
redirect_from:
- /articles/adding-an-email-address-to-your-github-account
- /github/setting-up-and-managing-your-github-user-account/adding-an-email-address-to-your-github-account
@@ -14,24 +14,27 @@ topics:
- Accounts
- Notifications
shortTitle: Add an email address
ms.openlocfilehash: 082326d96da4b36d1f29830491223ce9b649a15d
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '145164618'
---
{% ifversion fpt or ghec %}
{% note %}
**Notes**:
**注释**
- {% data reusables.user-settings.no-verification-disposable-emails %}
- If you're a member of an {% data variables.enterprise.prodname_emu_enterprise %}, you cannot make changes to your email address on {% data variables.product.prodname_dotcom_the_website %}. {% data reusables.enterprise-accounts.emu-more-info-account %}
- 如果您是 {% data variables.product.prodname_emu_enterprise %} 的成员,则无法在 {% data variables.product.prodname_dotcom_the_website %} 上更改您的电子邮件地址。 {% data reusables.enterprise-accounts.emu-more-info-account %}
{% endnote %}
{% endif %}
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.emails %}
{% data reusables.user-settings.add_and_verify_email %}
{% data reusables.user-settings.select_primary_email %}
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.emails %} {% data reusables.user-settings.add_and_verify_email %} {% data reusables.user-settings.select_primary_email %}
## Further reading
## 延伸阅读
- "[Managing email preferences](/articles/managing-email-preferences/)"
- [管理电子邮件首选项](/articles/managing-email-preferences/)

View File

@@ -1,6 +1,6 @@
---
title: Managing email preferences
intro: 'You can add or change the email addresses associated with your account on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %}. You can also manage emails you receive from {% data variables.product.product_name %}.'
title: 管理电子邮件首选项
intro: '您可以在 {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.product.product_location %}{% endif %}上添加或更改与您的帐户关联的电子邮件地址。 您也可以管理从 {% data variables.product.product_name %} 收到的电子邮件。'
redirect_from:
- /categories/managing-email-preferences
- /articles/managing-email-preferences
@@ -24,5 +24,11 @@ children:
- /types-of-emails-github-sends
- /managing-marketing-emails-from-github
shortTitle: Manage email preferences
ms.openlocfilehash: 8295d9884f7b2a9bfdef329f693c6492db636a61
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '145164719'
---

View File

@@ -1,6 +1,6 @@
---
title: Remembering your GitHub username or email
intro: 'Are you signing in to {% data variables.location.product_location %} for the first time in a while? If so, welcome back! If you can''t remember the username for your personal account on {% data variables.product.product_name %}, you can try these methods for remembering it.'
title: 记住您的 GitHub 用户名或电子邮件
intro: '是否距离您第一次登录 {% data variables.product.product_location %} 已经有一段时间? 如果是这样,欢迎回来! 如果无法记住 {% data variables.product.product_name %} 上个人帐户的用户名,可以尝试使用以下方法来记住它。'
redirect_from:
- /articles/oh-noes-i-ve-forgotten-my-username-email
- /articles/oh-noes-i-ve-forgotten-my-username-or-email
@@ -16,61 +16,66 @@ topics:
- Accounts
- Notifications
shortTitle: Find your username or email
ms.openlocfilehash: e65ba973a5ca7865aa642ce5d64f8efa0a996742
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '145164771'
---
{% mac %}
## {% data variables.product.prodname_desktop %} users
## {% data variables.product.prodname_desktop %} 用户
1. In the **GitHub Desktop** menu, click **Preferences**.
2. In the Preferences window, verify the following:
- To view your {% data variables.product.product_name %} username, click **Accounts**.
- To view your Git email, click **Git**. Note that this email is not guaranteed to be [your primary {% data variables.product.product_name %} email](/articles/changing-your-primary-email-address).
1. 在“GitHub 桌面”菜单中,单击“首选项” 。
2. Preferences(首选项)窗口中,验证以下内容:
- 若要查看 {% data variables.product.product_name %} 用户名,请单击“帐户”。
- 若要查看 Git 电子邮件请单击“Git”。 请注意,此电子邮件不保证是 [主要 {% data variables.product.product_name %} 电子邮件](/articles/changing-your-primary-email-address)
{% endmac %}
{% windows %}
## {% data variables.product.prodname_desktop %} users
## {% data variables.product.prodname_desktop %} 用户
1. In the **File** menu, click **Options**.
2. In the Options window, verify the following:
- To view your {% data variables.product.product_name %} username, click **Accounts**.
- To view your Git email, click **Git**. Note that this email is not guaranteed to be [your primary {% data variables.product.product_name %} email](/articles/changing-your-primary-email-address).
1. 在“文件”菜单中,单击“选项” 。
2. Options(选项)窗口中,验证以下内容:
- 若要查看 {% data variables.product.product_name %} 用户名,请单击“帐户”。
- 若要查看 Git 电子邮件请单击“Git”。 请注意,此电子邮件不保证是 [主要 {% data variables.product.product_name %} 电子邮件](/articles/changing-your-primary-email-address)
{% endwindows %}
## Finding your username in your `user.name` configuration
## `user.name` 配置中查找用户名
During set up, you may have [set your username in Git](/github/getting-started-with-github/setting-your-username-in-git). If so, you can review the value of this configuration setting:
在设置期间,你可能已[在 Git 中设置用户名](/github/getting-started-with-github/setting-your-username-in-git)。 如果这样,您可以查看此配置设置的值:
```shell
$ git config user.name
# View the setting
YOUR_USERNAME
<em>YOUR_USERNAME</em>
```
## Finding your username in the URL of remote repositories
## 在远程仓库的 URL 中查找您的用户名
If you have any local copies of personal repositories you have created or forked, you can check the URL of the remote repository.
如果您有已创建或已复刻的个人仓库的任何本地副本,则可以检查远程仓库的 URL。
{% tip %}
**Tip**: This method only works if you have an original repository or your own fork of someone else's repository. If you clone someone else's repository, their username will show instead of yours. Similarly, organization repositories will show the name of the organization instead of a particular user in the remote URL.
提示:此方法仅当你拥有原始存储库或其他人存储库中你自己的分叉时才有效。 如果您克隆其他人的仓库,将显示他们的用户名而不是您的用户名。 类似地,组织仓库将显示组织的名称,而不是远程 URL 中的特定用户。
{% endtip %}
```shell
$ cd YOUR_REPOSITORY
$ cd <em>YOUR_REPOSITORY</em>
# Change directories to the initialized Git repository
$ git remote -v
origin https://{% data variables.command_line.codeblock %}/YOUR_USERNAME/YOUR_REPOSITORY.git (fetch)
origin https://{% data variables.command_line.codeblock %}/YOUR_USERNAME/YOUR_REPOSITORY.git (push)
origin https://{% data variables.command_line.codeblock %}/<em>YOUR_USERNAME</em>/<em>YOUR_REPOSITORY</em>.git (fetch)
origin https://{% data variables.command_line.codeblock %}/<em>YOUR_USERNAME</em>/<em>YOUR_REPOSITORY</em>.git (push)
```
Your user name is what immediately follows the `https://{% data variables.command_line.backticks %}/`.
用户名紧跟在 `https://{% data variables.command_line.backticks %}/` 后。
{% ifversion fpt or ghec %}
## Further reading
## 延伸阅读
- "[Verifying your email address](/articles/verifying-your-email-address)"
{% endif %}
- [验证电子邮件地址](/articles/verifying-your-email-address)”{% endif %}

View File

@@ -1,6 +1,6 @@
---
title: Setting your commit email address
intro: 'You can set the email address that is used to author commits on {% data variables.location.product_location %} and on your computer.'
title: 设置提交电子邮件地址
intro: '你可以设置用于在 {% data variables.product.product_location %} 和计算机上创作提交的电子邮件地址。'
redirect_from:
- /articles/keeping-your-email-address-private
- /articles/setting-your-commit-email-address-on-github
@@ -22,61 +22,63 @@ topics:
- Accounts
- Notifications
shortTitle: Set commit email address
ms.openlocfilehash: 76b0af2a1afa776281434c36cf33fa0e082c2c56
ms.sourcegitcommit: fb047f9450b41b24afc43d9512a5db2a2b750a2a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/10/2022
ms.locfileid: '146338947'
---
## About commit email addresses
## 关于提交电子邮件地址
{% data variables.product.prodname_dotcom %} uses your commit email address to associate commits with your account on {% data variables.location.product_location %}. You can choose the email address that will be associated with the commits you push from the command line as well as web-based Git operations you make.
{% data variables.product.prodname_dotcom %} 使用您的提交电子邮件地址将提交与您的 {% data variables.product.product_location %} 关联。 您可以选择要与从命令行以及基于 web 的 Git 操作推送的提交相关联的电子邮件地址。
For web-based Git operations, you can set your commit email address on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %}. For commits you push from the command line, you can set your commit email address in Git.
对于基于 Web 的 Git 操作,您可以在 {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.product.product_location %}{% endif %} 上设置提交电子邮件地址。 对于从命令行推送的提交,您可以在 Git 中设置提交电子邮件地址。
{% ifversion fpt or ghec %}Any commits you made prior to changing your commit email address are still associated with your previous email address.{% else %}After changing your commit email address on {% data variables.product.product_name %}, the new email address will be visible in all of your future web-based Git operations by default. Any commits you made prior to changing your commit email address are still associated with your previous email address.{% endif %}
{% ifversion fpt or ghec %} 在更改提交电子邮件地址之前进行的提交仍与之前的电子邮件地址关联。{% else %} 在 {% data variables.product.product_name %} 上更改提交电子邮件地址后,新电子邮件地址默认在所有未来基于 Web 的 Git 操作中可见。 在更改提交电子邮件地址之前进行的任何提交仍与之前的电子邮件地址关联。{% endif %}
{% ifversion fpt or ghec %}
{% note %}
**Note**: {% data reusables.user-settings.no-verification-disposable-emails %}
注意:{% data reusables.user-settings.no-verification-disposable-emails %}
{% endnote %}
{% endif %}
{% ifversion fpt or ghec %}If you'd like to keep your personal email address private, you can use a `noreply` email address from {% data variables.product.product_name %} as your commit email address. To use your `noreply` email address for commits you push from the command line, use that email address when you set your commit email address in Git. To use your `noreply` address for web-based Git operations, set your commit email address on GitHub and choose to **Keep my email address private**.
{% ifversion fpt or ghec %} 如果想将个人电子邮件地址设为私密,则可以使用 {% data variables.product.product_name %} 的 `noreply` 电子邮件地址作为提交电子邮件地址。 要将 `noreply` 电子邮件地址用于从命令行推送的提交,请在 Git 中设置提交电子邮件地址时使用该电子邮件地址。 要将 `noreply` 地址用于基于 Web 的 Git 操作,请在 GitHub 上设置提交电子邮件地址并选择“对我的电子邮件地址保密”。
You can also choose to block commits you push from the command line that expose your personal email address. For more information, see "[Blocking command line pushes that expose your personal email](/articles/blocking-command-line-pushes-that-expose-your-personal-email-address)."{% endif %}
您也可以选择阻止从命令行推送的提交显示您的个人电子邮件地址。 有关详细信息,请参阅“[阻止会暴露个人电子邮件的命令行推送](/articles/blocking-command-line-pushes-that-expose-your-personal-email-address)。”{% endif %}
To ensure that commits are attributed to you and appear in your contributions graph, use an email address that is connected to your account on {% data variables.location.product_location %}{% ifversion fpt or ghec %}, or the `noreply` email address provided to you in your email settings{% endif %}. {% ifversion not ghae %}For more information, see "[Adding an email address to your {% data variables.product.prodname_dotcom %} account](/github/setting-up-and-managing-your-github-user-account/adding-an-email-address-to-your-github-account)."{% endif %}
为确保提交归因于你并且出现在你的贡献图中,请使用已连接到你在 {% data variables.product.product_location %} 上的帐户的电子邮件地址{% ifversion fpt or ghec %},或者在电子邮件设置中提供给你的 `noreply` 电子邮件地址{% endif %} {% ifversion not ghae %} 有关详细信息,请参阅“[将电子邮件地址添加到 {% data variables.product.prodname_dotcom %} 帐户](/github/setting-up-and-managing-your-github-user-account/adding-an-email-address-to-your-github-account)”。{% endif %}
{% ifversion fpt or ghec %}
{% note %}
**Note:** If you created your account on {% data variables.location.product_location %} _after_ July 18, 2017, your `noreply` email address for {% data variables.product.product_name %} is an ID number and your username in the form of <code>ID+USERNAME@users.noreply.github.com</code>. If you created your account on {% data variables.location.product_location %} _prior to_ July 18, 2017, your `noreply` email address from {% data variables.product.product_name %} is <code>USERNAME@users.noreply.github.com</code>. You can get an ID-based `noreply` email address for {% data variables.product.product_name %} by selecting (or deselecting and reselecting) **Keep my email address private** in your email settings.
注意:如果于 2017 年 7 月 18 日之后在 {% data variables.product.product_location %} 上创建了帐户,则用于 {% data variables.product.product_name %} 的 `noreply` 电子邮件地址是一个七位数的 ID 号以及格式为 <code>ID+username@users.noreply.github.com</code> 的用户名。 如果于 2017 年 7 月 18 日之前在 {% data variables.product.product_location %} 上创建了帐户,则来自 {% data variables.product.product_name %} 的 `noreply` 电子邮件地址是 <code>username@users.noreply.github.com</code>。 可以通过在电子邮件设置中选择(或取消选择并重新选择)“对我的电子邮件地址保密”,为 {% data variables.product.product_name %} 获取基于 ID 的 `noreply` 电子邮件地址。
{% endnote %}
If you use your `noreply` email address for {% data variables.product.product_name %} to make commits and then [change your username](/articles/changing-your-github-username), those commits will not be associated with your account on {% data variables.location.product_location %}. This does not apply if you're using the ID-based `noreply` address from {% data variables.product.product_name %}. For more information, see "[Changing your {% data variables.product.prodname_dotcom %} username](/articles/changing-your-github-username)."{% endif %}
如果使用 {% data variables.product.product_name %} 的 `noreply` 电子邮件地址进行提交,然后[更改用户名](/articles/changing-your-github-username),则这些提交将不会与你在 {% data variables.product.product_location %} 上的帐户相关联。 如果使用的是基于 ID 的 {% data variables.product.product_name %} `noreply` 地址,则不适用。 有关详细信息,请参阅“[更改 {% data variables.product.prodname_dotcom %} 用户名](/articles/changing-your-github-username)。”{% endif %}
## Setting your commit email address on {% data variables.product.prodname_dotcom %}
## {% data variables.product.prodname_dotcom %} 上设置提交电子邮件地址
{% data reusables.files.commit-author-email-options %}
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.emails %}
{% data reusables.user-settings.add_and_verify_email %}
{% data reusables.user-settings.select_primary_email %}{% ifversion fpt or ghec %}
{% data reusables.user-settings.keeping_your_email_address_private %}{% endif %}
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.emails %} {% data reusables.user-settings.add_and_verify_email %} {% data reusables.user-settings.select_primary_email %}{% ifversion fpt or ghec %} {% data reusables.user-settings.keeping_your_email_address_private %}{% endif %}
## Setting your commit email address in Git
## 在 Git 中设置您的提交电子邮件地址
You can use the `git config` command to change the email address you associate with your Git commits. The new email address you set will be visible in any future commits you push to {% data variables.location.product_location %} from the command line. Any commits you made prior to changing your commit email address are still associated with your previous email address.
可以使用 `git config` 命令更改与 Git 提交关联的电子邮件地址。 设置的新电子邮件地址将在从命令行推送到 {% data variables.product.product_location %} 的任何未来提交中显示。 在您更改提交电子邮件地址之前进行的任何提交仍与之前的电子邮件地址关联。
### Setting your email address for every repository on your computer
### 为计算机上的每个仓库设置电子邮件地址
{% data reusables.command_line.open_the_multi_os_terminal %}
2. {% data reusables.user-settings.set_your_email_address_in_git %}
```shell
$ git config --global user.email "YOUR_EMAIL"
$ git config --global user.email "<em>email@example.com</em>"
```
3. {% data reusables.user-settings.confirm_git_email_address_correct %}
```shell
@@ -85,17 +87,17 @@ You can use the `git config` command to change the email address you associate w
```
4. {% data reusables.user-settings.link_email_with_your_account %}
### Setting your email address for a single repository
### 为一个仓库设置电子邮件地址
{% data variables.product.product_name %} uses the email address set in your local Git configuration to associate commits pushed from the command line with your account on {% data variables.location.product_location %}.
{% data variables.product.product_name %} 使用在您的本地 Git 配置中设置的电子邮件地址将从命令行推送的提交与您在 {% data variables.product.product_location %} 上的帐户相关联。
You can change the email address associated with commits you make in a single repository. This will override your global Git configuration settings in this one repository, but will not affect any other repositories.
您可以更改与您在一个仓库中所进行的提交关联的电子邮件地址。 此操作将覆盖这一个仓库中的全局 Git 配置设置,但不会影响任何其他仓库。
{% data reusables.command_line.open_the_multi_os_terminal %}
2. Change the current working directory to the local repository where you want to configure the email address that you associate with your Git commits.
2. 将当前工作目录更改为您想要在其中配置与 Git 提交关联的电子邮件地址的本地仓库。
3. {% data reusables.user-settings.set_your_email_address_in_git %}
```shell
$ git config user.email "YOUR_EMAIL"
$ git config user.email "<em>email@example.com</em>"
```
4. {% data reusables.user-settings.confirm_git_email_address_correct %}
```shell

View File

@@ -0,0 +1,47 @@
---
title: 关于离开公司的最佳实践
intro: 如果你的 {% data variables.product.product_name %} 帐户同时用于个人和工作用途,那么你在离开公司或组织的时候需要注意一些问题。
redirect_from:
- /articles/best-practices-for-leaving-your-company
- /github/setting-up-and-managing-your-github-user-account/best-practices-for-leaving-your-company
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/best-practices-for-leaving-your-company
- /account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings/best-practices-for-leaving-your-company
versions:
fpt: '*'
ghec: '*'
topics:
- Accounts
shortTitle: Leaving your company
ms.openlocfilehash: e7de0fa01082731ae54e988ed49310b5ce6afbea
ms.sourcegitcommit: 8544f120269257d01adfe4a27b62f08fc8691727
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 08/02/2022
ms.locfileid: "147444643"
---
在离开公司之前,请确保在个人帐户中更新以下信息:
- 通过[在电子邮件设置中删除公司电子邮件地址](/articles/changing-your-primary-email-address)来取消其验证。 然后,您可以在不验证的情况下重新添加它,以保留与您的帐户相关联的所有相关提交。
- [将你的主电子邮件地址](/articles/changing-your-primary-email-address)从公司电子邮件地址更改为个人电子邮件地址。
- [验证新的主电子邮件地址](/articles/verifying-your-email-address)。
- [更改你的 GitHub 用户名](/articles/changing-your-github-username)以删除对公司或组织的任何引用(如有必要)。
- 如果为个人帐户启用了双重 (2FA) 身份验证,请确保由自己(而不是你的公司)控制你已配置的 2FA 身份验证方法。 有关详细信息,请参阅“[配置双因素身份验证](/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication)”。
## <a name="leaving-organizations"></a>离开组织
如果你在使用属于组织的存储库,则应[删除自己的组织成员身份](/articles/removing-yourself-from-an-organization)。 请注意,如果你是组织所有者,应先将[组织的所有权转让](/articles/transferring-organization-ownership)给其他人。
除非使用的是 {% data variables.product.prodname_managed_user %},否则即使离开组织,你仍然可以访问你的个人帐户。 有关 {% data variables.product.prodname_emus %} 的详细信息,请参阅 {% data variables.product.prodname_ghe_cloud %} 文档中的“[关于 {% data variables.product.prodname_emus %}]({% ifversion not ghec%}/enterprise-cloud@latest{% endif %}/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/about-enterprise-managed-users){% ifversion not ghec %}”。{% else %}。{% endif %}
## <a name="removing-professional-associations-with-personal-repositories"></a>删除与个人仓库的职业关联
如果你在属于其他人的个人帐户的存储库中与其进行了专业协作,则应从这些存储库中[删除自己的协作者身份](/articles/removing-yourself-from-a-collaborator-s-repository)。
- [停止关注与工作相关的存储库](https://github.com/watching)。 您不再需要这些通知了!
- [转让你拥有的存储库](/articles/how-to-transfer-a-repository),在你离开后,其他人可能需要继续使用该存储库处理工作。
- [删除与你的工作相关且属于你的分支](/articles/deleting-a-repository)。 不用担心,删除复刻不会删除上游仓库。
- 删除您的计算机上可能存在的复刻本地副本:
```shell
$ rm -rf <em>work_directory</em>
```

View File

@@ -1,6 +1,6 @@
---
title: Changing your GitHub username
intro: 'You can change the username for your account on {% ifversion fpt or ghec %}{% data variables.product.prodname_dotcom_the_website %}{% elsif ghes %}{% data variables.location.product_location %} if your instance uses built-in authentication{% endif %}.'
title: 更改 GitHub 用户名
intro: '如果您的实例使用内置身份验证{% endif %},则可以在 {% ifversion fpt or ghec %}{% data variables.product.prodname_dotcom_the_website %}{% elsif ghes %}{% data variables.product.product_location %} 上更改帐户的用户名。'
redirect_from:
- /articles/how-to-change-your-username
- /articles/changing-your-github-user-name
@@ -17,19 +17,24 @@ versions:
topics:
- Accounts
shortTitle: Change your username
ms.openlocfilehash: 28f4d0ea1a16fed0e44f34312abfd507e2f991b7
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '145164758'
---
{% ifversion ghec or ghes %}
{% note %}
{% ifversion ghec %}
**Note**: Members of an {% data variables.enterprise.prodname_emu_enterprise %} cannot change usernames. Your enterprise's IdP administrator controls your username for {% data variables.product.product_name %}. For more information, see "[About {% data variables.product.prodname_emus %}](/admin/authentication/managing-your-enterprise-users-with-your-identity-provider/about-enterprise-managed-users)."
注意:{% data variables.product.prodname_emu_enterprise %} 成员不能更改用户名。 企业的 IdP 管理员控制您的 {% data variables.product.product_name %} 用户名。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_emus %}](/admin/authentication/managing-your-enterprise-users-with-your-identity-provider/about-enterprise-managed-users)”。
{% elsif ghes %}
**Note**: If you sign into {% data variables.location.product_location %} with LDAP credentials or single sign-on (SSO), only your local administrator can change your username. For more information about authentication methods for {% data variables.product.product_name %}, see "[Authenticating users for {% data variables.location.product_location %}](/admin/authentication/authenticating-users-for-your-github-enterprise-server-instance)."
注意:如果你使用 LDAP 凭据或单一登录 (SSO) 登录 {% data variables.product.product_location %},则只有你的本地管理员才能更改你的用户名。 有关 {% data variables.product.product_name %} 身份验证方法的详细信息,请参阅“[ {% data variables.product.product_location %} 的用户进行身份验证](/admin/authentication/authenticating-users-for-your-github-enterprise-server-instance)”。
{% endif %}
@@ -37,61 +42,55 @@ shortTitle: Change your username
{% endif %}
## About username changes
## 关于用户名更改
You can change your username to another username that is not currently in use.{% ifversion fpt or ghec %} If the username you want is not available, consider other names or unique variations. Using a number, hyphen, or an alternative spelling might help you find a similar username that's still available.
您可以将用户名更改为当前未使用的其他用户名。{% ifversion fpt or ghec %} 如果所需的用户名不可用,请考虑其他名称或唯一变体。 使用数字、连字符或其他拼写可能有助于您找到仍可用的类似用户名。
If you hold a trademark for the username, you can find more information about making a trademark complaint on our [Trademark Policy](/free-pro-team@latest/github/site-policy/github-trademark-policy) page.
如果你拥有该用户名的商标,可以在我们的[商标政策](/free-pro-team@latest/github/site-policy/github-trademark-policy)页面上找到有关提出商标投诉的更多信息。
If you do not hold a trademark for the name, you can choose another username or keep your current username. {% data variables.contact.github_support %} cannot release the unavailable username for you. For more information, see "[Changing your username](#changing-your-username)."{% endif %}
如果您没有该名称的商标,则可以选择其他用户名或保留当前用户名。 {% data variables.contact.github_support %} 无法为您释放不可用的用户名。 有关详细信息,请参阅“[更改用户名](#changing-your-username)”。{% endif %}
After changing your username, your old username becomes available for anyone else to claim. Most references to your repositories under the old username automatically change to the new username. However, some links to your profile won't automatically redirect.
更改用户名后,您的旧用户名即可供其他人申请使用。 对旧用户名下仓库的大多数引用会自动更改为新用户名。 不过,指向您个人资料的某些链接不会自动重定向。
{% data variables.product.product_name %} cannot set up redirects for:
- [@mentions](/articles/basic-writing-and-formatting-syntax/#mentioning-people-and-teams) using your old username
- Links to [gists](/articles/creating-gists) that include your old username
{% data variables.product.product_name %} 无法为以下各项设置重定向:
- 使用旧用户名的 [@mentions](/articles/basic-writing-and-formatting-syntax/#mentioning-people-and-teams)
- 包含旧用户名的 [gists](/articles/creating-gists) 链接
{% ifversion fpt or ghec %}
If you're a member of an {% data variables.enterprise.prodname_emu_enterprise %}, you cannot make changes to your username. {% data reusables.enterprise-accounts.emu-more-info-account %}
如果您是 {% data variables.product.prodname_emu_enterprise %} 的成员,则无法更改用户名。 {% data reusables.enterprise-accounts.emu-more-info-account %}
{% endif %}
## Repository references
## 仓库引用
After you change your username, {% data variables.product.product_name %} will automatically redirect references to your repositories.
- Web links to your existing repositories will continue to work. This can take a few minutes to complete after you make the change.
- Command line pushes from your local repository clones to the old remote tracking URLs will continue to work.
您更改用户名后,{% data variables.product.product_name %} 自动将引用重定向到您的仓库。
- 指向现有仓库的 Web 链接仍然有效。 进行更改后,可能需要几分钟时间才能完成。
- 从本地仓库克隆推送到旧的远程跟踪 URL 的命令行仍然有效。
If the new owner of your old username creates a repository with the same name as your repository, that will override the redirect entry and your redirect will stop working. Because of this possibility, we recommend you update all existing remote repository URLs after changing your username. For more information, see "[Managing remote repositories](/github/getting-started-with-github/managing-remote-repositories)."
如果旧用户名的新所有者创建与您的仓库同名的仓库,则会覆盖重定向条目,并且您的重定向将停止工作。 由于这种可能性,我们建议您在更改用户名后更新所有现有的远程仓库 URL。 有关详细信息,请参阅“[管理远程存储库](/github/getting-started-with-github/managing-remote-repositories)”。
## Links to your previous profile page
## 指向以前的个人资料页面的链接
After changing your username, links to your previous profile page, such as `https://{% data variables.command_line.backticks %}/previoususername`, will return a 404 error. We recommend updating any links to your account on {% data variables.location.product_location %} from elsewhere{% ifversion fpt or ghec %}, such as your LinkedIn or Twitter profile{% endif %}.
更改用户名后,指向以前的配置文件页面的链接(例如 `https://{% data variables.command_line.backticks %}/previoususername`)将返回 404 错误。 我们建议从其他位置更新指向 {% data variables.product.product_location %} 帐户的所有链接{% ifversion fpt or ghec %},例如您的 LinkedIn Twitter 个人资料{% endif %}
## Your Git commits
## 您的 Git 提交
{% ifversion fpt or ghec %}Git commits that were associated with your {% data variables.product.product_name %}-provided `noreply` email address won't be attributed to your new username and won't appear in your contributions graph.{% endif %} If your Git commits are associated with another email address you've [added to your GitHub account](/articles/adding-an-email-address-to-your-github-account), {% ifversion fpt or ghec %}including the ID-based {% data variables.product.product_name %}-provided `noreply` email address, {% endif %}they'll continue to be attributed to you and appear in your contributions graph after you've changed your username. For more information on setting your email address, see "[Setting your commit email address](/articles/setting-your-commit-email-address)."
{% ifversion fpt or ghec %}与你的 {% data variables.product.product_name %} 提供的 `noreply` 电子邮件地址关联的 Git 提交不会归于新的用户名,并且不会在你的贡献图中显示。{% endif %}如果你的 Git 提交与你已[添加到 GitHub 帐户](/articles/adding-an-email-address-to-your-github-account)的其他电子邮件地址关联,{% ifversion fpt or ghec %}包括基于 ID 的 {% data variables.product.product_name %} 提供的 `noreply` 电子邮件地址,{% endif %}它们在你更改用户名后将继续归于你并在你的贡献图中显示。 有关设置电子邮件地址的详细信息,请参阅“[设置提交电子邮件地址](/articles/setting-your-commit-email-address)”。
## Your gists
## 更改用户名
After changing your username, the URLs to any public or secret gists will also change and previous links to these will return a 404 error. We recommend updating the links to these gists anywhere you may have shared them.
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.account_settings %}
3. 在“更改用户名”部分中,单击“更改用户名”。
![更改用户名按钮](/assets/images/help/settings/settings-change-username.png){% ifversion fpt or ghec %}
4. 阅读有关更改用户名的警告。 如果你仍要更改用户名,请单击“我了解,让我们更改用户名”。
![更改用户名警告按钮](/assets/images/help/settings/settings-change-username-warning-button.png)
5. 键入新的用户名。
![新用户名字段](/assets/images/help/settings/settings-change-username-enter-new-username.png)
6. 如果你选择的用户名可用,请单击“更改用户名”。 如果您选择的用户名不可用,可以尝试其他用户名或您看到的建议之一。
![更改用户名警告按钮](/assets/images/help/settings/settings-change-my-username-button.png) {% endif %}
## Changing your username
## 延伸阅读
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.account_settings %}
3. In the "Change username" section, click **Change username**.
![Change Username button](/assets/images/help/settings/settings-change-username.png){% ifversion fpt or ghec %}
4. Read the warnings about changing your username. If you still want to change your username, click **I understand, let's change my username**.
![Change Username warning button](/assets/images/help/settings/settings-change-username-warning-button.png)
5. Type a new username.
![New username field](/assets/images/help/settings/settings-change-username-enter-new-username.png)
6. If the username you've chosen is available, click **Change my username**. If the username you've chosen is unavailable, you can try a different username or one of the suggestions you see.
![Change Username warning button](/assets/images/help/settings/settings-change-my-username-button.png)
{% endif %}
## Further reading
- "[Why are my commits linked to the wrong user?](/pull-requests/committing-changes-to-your-project/troubleshooting-commits/why-are-my-commits-linked-to-the-wrong-user)"{% ifversion fpt or ghec %}
- "[{% data variables.product.prodname_dotcom %} Username Policy](/free-pro-team@latest/github/site-policy/github-username-policy)"{% endif %}
- [我的提交为什么链接到错误的用户?](/pull-requests/committing-changes-to-your-project/troubleshooting-commits/why-are-my-commits-linked-to-the-wrong-user){% ifversion fpt or ghec %}
- [{% data variables.product.prodname_dotcom %} 用户名策略](/free-pro-team@latest/github/site-policy/github-username-policy){% endif %}

View File

@@ -0,0 +1,75 @@
---
title: 将用户转换为组织
redirect_from:
- /articles/what-is-the-difference-between-create-new-organization-and-turn-account-into-an-organization
- /articles/explaining-the-account-transformation-warning
- /articles/converting-a-user-into-an-organization
- /github/setting-up-and-managing-your-github-user-account/converting-a-user-into-an-organization
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/converting-a-user-into-an-organization
- /account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings/converting-a-user-into-an-organization
intro: 可以将个人帐户转换为组织。 这样可以对属于组织的仓库设置更细化的权限。
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Accounts
shortTitle: User into an organization
ms.openlocfilehash: 641172d82581ad83bd7281fed941171ce6c817b7
ms.sourcegitcommit: 2298858ef68ffb4e79490ddbb9d6a64081dfbc39
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 07/21/2022
ms.locfileid: "147389391"
---
{% warning %}
警告:在将用户转换为组织之前,请记住以下几点。
* 你将无法再登录转换后的个人帐户。
* 你将无法再创建或修改转换后的个人帐户所拥有的 Gist。
* 组织无法转换回用户。
* 不会将 SSH 密钥、OAuth 标记、作业配置文件、反应和关联的用户信息传输到组织。 这只适用于被转换的个人帐户,而不适用于该个人帐户的任何协作者。
* 使用转换后的个人帐户所做的任何提交将不再链接到该帐户。 提交本身将保持不变。
* 转换后的个人帐户所做的任何现有注释将不再链接至该帐户。 注释本身将保持不变,但会与 `ghost` 用户关联。
* 将删除使用转换后的个人帐户创建的任何专用存储库的分支。
{% endwarning %}
{% ifversion fpt or ghec or ghes %}
## <a name="keep-your-personal-account-and-create-a-new-organization-manually"></a>保留个人帐户并手动创建新组织
如果希望组织的名称与目前用于个人帐户的名称相同,或者要保留个人帐户的信息不变,则必须创建一个新组织,然后将存储库转让给该组织,而不是将个人帐户转换为组织。
1. 要保留当前个人帐户名称以供个人使用,[请将个人帐户名称更改为](/articles/changing-your-github-username)一个好听的新名称。
2. 使用个人帐户的原始名称[创建新组织](/articles/creating-a-new-organization-from-scratch)。
3. [将存储库转移到](/articles/transferring-a-repository)新的组织帐户。{% endif %}
## <a name="convert-your-personal-account-into-an-organization-automatically"></a>自动将个人帐户转换为组织
也可以将个人帐户直接转换为组织。 转换帐户:
- 按原样保留仓库,无需手动将其转让给另一个帐户
- 自动邀请协作者加入具有与其之前相同权限的团队 {% ifversion fpt or ghec %}- 对于 {% data variables.product.prodname_pro %} 上的个人帐户,自动将计费转换到[付费的 {% data variables.product.prodname_team %}](/articles/about-billing-for-github-accounts),无需重新输入付款信息、调整计费周期或随时双倍付款{% endif %}
1. 创建新的个人帐户,转换后您将用它来登录 GitHub 以及访问组织和仓库。
2. [退出组织](/articles/removing-yourself-from-an-organization)(你要转换的个人帐户已加入的组织)。
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.organizations %}
5. 在“转换帐户”下,单击“将 <username> 转换为组织”。
![组织转换按钮](/assets/images/help/settings/convert-to-organization.png)
6. 在 Account Transformation Warning帐户转换警告对话框中查看并确认转换。 请注意,此框中的信息与本文顶部的警告信息相同。
![转换警告](/assets/images/help/organizations/organization-account-transformation-warning.png)
7. 在“Transform your user into an organization将用户转换为组织”页面的“Choose an organization owner选择组织所有者”下选择您在前面创建的备用个人帐户或您信任的其他用户来管理组织。
![添加组织所有者页面](/assets/images/help/organizations/organization-add-owner.png)
8. 选择新组织的订阅,并在提示时输入帐单信息。
9. 单击“创建组织”。
10. 登录在第一步中创建的新个人帐户,然后使用上下文切换器访问新组织。
{% tip %}
提示:将个人帐户转换为组织时,我们会将属于该帐户的存储库中的协作者作为外部协作者添加到新组织。 然后,你可以根据需要邀请外部协作者成为新组织的成员。 有关详细信息,请参阅“[组织中的角色](/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization#outside-collaborators)”。
{% endtip %}
## <a name="further-reading"></a>延伸阅读
- [设置团队](/articles/setting-up-teams) {% ifversion fpt or ghec %}- [邀请用户加入组织](/articles/inviting-users-to-join-your-organization){% endif %}
- [访问组织](/articles/accessing-an-organization)

View File

@@ -0,0 +1,55 @@
---
title: 删除个人帐户
intro: 可随时删除 {% data variables.product.product_name %} 上的个人帐户。
redirect_from:
- /articles/deleting-a-user-account
- /articles/deleting-your-user-account
- /github/setting-up-and-managing-your-github-user-account/deleting-your-user-account
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/deleting-your-user-account
- /account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings/deleting-your-user-account
versions:
fpt: '*'
ghes: '*'
ghec: '*'
topics:
- Accounts
shortTitle: Delete your personal account
ms.openlocfilehash: 4c02698cbe312d3f13553e49dd324fde4f3ad7bb
ms.sourcegitcommit: dc42bb4a4826b414751ffa9eed38962c3e3fea8e
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 07/13/2022
ms.locfileid: "145164757"
---
删除个人帐户将删除帐户所拥有的所有存储库、专用存储库的分支、Wiki、问题、拉取请求和页面。 {% ifversion fpt or ghec %} 在其他用户拥有的存储库中创建的问题和拉取请求以及所做的评论不会被删除,而是与我们的 [Ghost 用户](https://github.com/ghost)关联。{% else %}在其他用户拥有的存储库中创建的问题和拉取请求以及所做的评论不会被删除。{% endif %}
{% ifversion fpt or ghec %} 当您删除帐户时,我们会停止对您计费。 与该帐户关联的电子邮件地址可用于 {% data variables.product.product_location %} 上不同的帐户。 90 天后,该帐户名称也可供其他任何人用于新帐户。 {% endif %}
如果你是组织的唯一所有者,则必须先将所有权转让给其他人或删除该组织,然后才能删除个人帐户。 如果组织中有其他所有者,则必须先从组织中删除自己,然后才能删除个人帐户。
有关详细信息,请参阅:
- [转让组织所有权](/articles/transferring-organization-ownership)
- [删除组织帐户](/articles/deleting-an-organization-account)
- [从组织中删除自己](/articles/removing-yourself-from-an-organization/)
## <a name="back-up-your-account-data"></a>备份帐户数据
在删除个人帐户之前请复制帐户所拥有的所有存储库、专用分支、Wiki、问题和拉取请求。
{% warning %}
警告删除个人帐户后GitHub 将无法还原内容。
{% endwarning %}
## <a name="delete-your-personal-account"></a>删除个人帐户
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.account_settings %}
3. 在帐户设置页面底部的“删除帐户”下,单击“删除帐户”。 在删除个人帐户之前:
- 如果您是组织中的唯一所有者,则必须将所有权转让给其他人或删除您的组织。
- 如果组织中有其他组织所有者,则必须将自己从组织中删除。
![帐户删除按钮](/assets/images/help/settings/settings-account-delete.png)
4. 在“确认要执行此操作”对话框中,完成相关步骤以确认你了解删除帐户的后果:![删除帐户确认对话框](/assets/images/help/settings/settings-account-deleteconfirm.png) {% ifversion fpt or ghec %}- 重新确认帐户拥有的所有存储库、专用存储库分支、wiki、问题、拉取请求和 {% data variables.product.prodname_pages %} 站点都将删除,计费将立即结束,并且 90 天后任何人都可在 {% data variables.product.product_name %} 上使用你的用户名。
{% else %}- 重新考虑一下您帐户拥有的所有仓库、私有仓库分支、wiki、议题、提取请求和网页都将被删除并且任何人将可在 {% data variables.product.product_name %} 上使用您的用户名。
{% endif %}- 在第一个字段中,输入您的 {% data variables.product.product_name %} 用户名或电子邮件。
- 在第二个字段中,键入提示短语。

View File

@@ -1,6 +1,6 @@
---
title: Managing the default branch name for your repositories
intro: 'You can set the default branch name for new repositories that you create on {% data variables.location.product_location %}.'
title: 管理仓库的默认分支名称
intro: '您可以为在 {% data variables.product.product_location %} 上创建的新资料库设置默认分支名称。'
versions:
fpt: '*'
ghes: '*'
@@ -13,24 +13,29 @@ redirect_from:
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/managing-the-default-branch-name-for-your-repositories
- /account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings/managing-the-default-branch-name-for-your-repositories
shortTitle: Manage default branch name
ms.openlocfilehash: a3943f32860f55becaa840f7ca40c13ba87b5ce2
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '145193760'
---
## About management of the default branch name
## About the default branch name
When you create a new repository on {% data variables.location.product_location %}, the repository contains one branch, which is the default branch. You can change the name that {% data variables.product.product_name %} uses for the default branch in new repositories you create. For more information about the default branch, see "[About branches](/github/collaborating-with-issues-and-pull-requests/about-branches#about-the-default-branch)."
当您在 {% data variables.product.product_location %} 上创建一个新仓库时,仓库将包含一个分支,它就是默认分支。 您可以更改 {% data variables.product.product_name %} 用于您新建仓库中默认分支的名称。 有关默认分支的详细信息,请参阅“[关于分支](/github/collaborating-with-issues-and-pull-requests/about-branches#about-the-default-branch)”。
{% data reusables.branches.change-default-branch %}
## Setting the default branch name
## 设置默认分支名称
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.repo-tab %}
3. Under "Repository default branch", click **Change default branch name now**.
![Override button](/assets/images/help/settings/repo-default-name-button.png)
4. Type the default name that you would like to use for new branches.
![Text box for entering default name](/assets/images/help/settings/repo-default-name-text.png)
5. Click **Update**.
![Update button](/assets/images/help/settings/repo-default-name-update.png)
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.repo-tab %}
3. 在“存储库默认分支”下,单击“立即更改默认分支名称”。
![“替代”按钮](/assets/images/help/settings/repo-default-name-button.png)
4. 键入要用于新分支的默认名称。
![用于输入默认名称的文本框](/assets/images/help/settings/repo-default-name-text.png)
5. 单击“更新”。
![“更新”按钮](/assets/images/help/settings/repo-default-name-update.png)
## Further reading
## 延伸阅读
- "[Managing the default branch name for repositories in your organization](/organizations/managing-organization-settings/managing-the-default-branch-name-for-repositories-in-your-organization)"
- [管理组织中存储库的默认分支名称](/organizations/managing-organization-settings/managing-the-default-branch-name-for-repositories-in-your-organization)

View File

@@ -0,0 +1,53 @@
---
title: 合并多个个人帐户
intro: 如果工作和个人分别使用不同的帐户,您可以合并这些帐户。
redirect_from:
- /articles/can-i-merge-two-accounts
- /articles/keeping-work-and-personal-repositories-separate
- /articles/merging-multiple-user-accounts
- /github/setting-up-and-managing-your-github-user-account/merging-multiple-user-accounts
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/merging-multiple-user-accounts
- /account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings/merging-multiple-user-accounts
versions:
fpt: '*'
ghec: '*'
topics:
- Accounts
shortTitle: Merge multiple personal accounts
ms.openlocfilehash: 71e2b280fad682f3ee8e9ac85141aedc3bde3d06
ms.sourcegitcommit: dc42bb4a4826b414751ffa9eed38962c3e3fea8e
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 07/13/2022
ms.locfileid: "145164791"
---
{% tip %}
{% ifversion ghec %}
提示:{% data variables.product.prodname_emus %} 允许企业通过标识提供者 (IdP) 为其成员预配唯一的个人帐户。 有关详细信息,请参阅“[关于企业托管用户](/admin/identity-and-access-management/managing-iam-with-enterprise-managed-users/about-enterprise-managed-users)”。 对于其他用例,我们建议仅使用一个个人帐户来管理个人和专业存储库。
{% else %}
提示:我们建议仅使用一个个人帐户来管理个人和专业存储库。
{% endif %}
{% endtip %}
{% warning %}
**警告:**
- 组织和存储库访问权限不能在帐户之间转让。 如果要删除的帐户具有现有访问权限,则组织所有者或存储库管理员将需要邀请您要保留的帐户。
- 无法将使用 GitHub 提供的 `noreply` 电子邮件地址创作的任何提交从一个帐户转移到另一个帐户。 如果要删除的帐户使用了“将我的电子邮件地址设为私有”选项,则无法将要删除的帐户创作的提交转移到要保留的帐户。
{% endwarning %}
1. [将任何存储库从要删除的帐户转移](/articles/how-to-transfer-a-repository)到要保留的帐户。 议题、拉取请求和 wiki 也会转让。 确认要保留的帐户中存在仓库。
2. [更新已移动存储库的任何本地克隆中的远程 URL](/github/getting-started-with-github/managing-remote-repositories)。
3. [删除不会再使用的帐户](/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-personal-account-settings/deleting-your-personal-account)。
4. 要将过去的提交归因于新帐户,请将用于创作提交的电子邮件地址添加到要保留的帐户。 有关详细信息,请参阅“[为什么我的贡献没有在我的个人资料中显示?](/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/why-are-my-contributions-not-showing-up-on-my-profile#your-local-git-commit-email-isnt-connected-to-your-account)”
## <a name="further-reading"></a>延伸阅读
- [{% data variables.product.prodname_dotcom %} 帐户类型](/articles/types-of-github-accounts)

View File

@@ -1,6 +1,6 @@
---
title: Best practices for leaving your company
intro: 'If you use your account on {% data variables.product.product_name %} for both personal and work purposes, there are a few things to keep in mind when you leave your company or organization.'
title: 关于离开公司的最佳实践
intro: '如果你的 {% data variables.product.product_name %} 帐户同时用于个人和工作用途,那么你在离开公司或组织的时候需要注意一些问题。'
redirect_from:
- /articles/best-practices-for-leaving-your-company
- /github/setting-up-and-managing-your-github-user-account/best-practices-for-leaving-your-company
@@ -13,31 +13,36 @@ versions:
topics:
- Accounts
shortTitle: Leaving your company
ms.openlocfilehash: c288584891981eab7ffe4204e2028b0e70cf1d08
ms.sourcegitcommit: 478f2931167988096ae6478a257f492ecaa11794
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/09/2022
ms.locfileid: '147687113'
---
在离开公司之前,请确保在个人帐户中更新以下信息:
Before you leave your company, make sure you update the following information in your personal account:
- 通过[在电子邮件设置中删除公司电子邮件地址](/articles/changing-your-primary-email-address)来取消其验证。 然后,您可以在不验证的情况下重新添加它,以保留与您的帐户相关联的所有相关提交。
- [将你的主电子邮件地址](/articles/changing-your-primary-email-address)从公司电子邮件地址更改为个人电子邮件地址。
- [验证新的主电子邮件地址](/articles/verifying-your-email-address)。
- [更改你的 GitHub 用户名](/articles/changing-your-github-username)以删除对公司或组织的任何引用(如有必要)。
- 如果为个人帐户启用了双重 (2FA) 身份验证,请确保由自己(而不是你的公司)控制你已配置的 2FA 身份验证方法。 有关详细信息,请参阅“[配置双因素身份验证](/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication)”。
- Unverify your company email address by [deleting it in your Email settings](/articles/changing-your-primary-email-address). You can then re-add it without verifying to keep any associated commits linked to your account.
- [Change your primary email address](/articles/changing-your-primary-email-address) from your company email to your personal email.
- [Verify your new primary email address](/articles/verifying-your-email-address).
- [Change your GitHub username](/articles/changing-your-github-username) to remove any references to your company or organization, if necessary.
- If you've enabled two-factor (2FA) authentication for your personal account, make sure that you (not your company) control the 2FA authentication method you have configured. For more information, see "[Configuring two-factor authentication](/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication)."
## 离开组织
## Leaving organizations
如果你在使用属于组织的存储库,则应[删除自己的组织成员身份](/articles/removing-yourself-from-an-organization)。 请注意,如果你是组织所有者,应先将[组织的所有权转让](/articles/transferring-organization-ownership)给其他人。
If you've been working with repositories that belong to an organization, you'll want to [remove yourself as a member of the organization](/articles/removing-yourself-from-an-organization). Note that if you are the organization owner, you should first [transfer ownership of the organization](/articles/transferring-organization-ownership) to another person.
除非使用的是 {% data variables.product.prodname_managed_user %},否则即使离开组织,你仍然可以访问你的个人帐户。 有关 {% data variables.product.prodname_emus %} 的详细信息,请参阅 {% data variables.product.prodname_ghe_cloud %} 文档中的“[关于 {% data variables.product.prodname_emus %}]({% ifversion not ghec%}/enterprise-cloud@latest{% endif %}/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/about-enterprise-managed-users){% ifversion not ghec %}”。{% else %}。{% endif %}
Unless you're using a {% data variables.enterprise.prodname_managed_user %}, you'll still be able to access your personal account, even after leaving the organization. For more information about {% data variables.product.prodname_emus %}, see "[About {% data variables.product.prodname_emus %}]({% ifversion not ghec%}/enterprise-cloud@latest{% endif %}/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/about-enterprise-managed-users){% ifversion not ghec %}" in the {% data variables.product.prodname_ghe_cloud %} documentation.{% else %}."{% endif %}
## 删除与个人仓库的职业关联
## Removing professional associations with personal repositories
如果你在属于其他人的个人帐户的存储库中与其进行了专业协作,则应从这些存储库中[删除自己的协作者身份](/articles/removing-yourself-from-a-collaborator-s-repository)。
If you've been collaborating professionally with another person on repositories that belong to their personal account, you'll want to [remove yourself as a collaborator](/articles/removing-yourself-from-a-collaborator-s-repository) from those repositories.
- [Stop watching repositories](https://github.com/watching) related to your work. You won't want those notifications anymore!
- [Transfer repositories you own](/articles/how-to-transfer-a-repository) that others may need to continue working on after you leave.
- [Delete forks that belong to you](/articles/deleting-a-repository) that are related to the work you were doing. Don't worry, deleting a fork doesn't delete the upstream repository.
- Delete local copies of your forks that may exist on your computer:
- [停止关注与工作相关的存储库](https://github.com/watching)。 您不再需要这些通知了!
- [转让你拥有的存储库](/articles/how-to-transfer-a-repository),在你离开后,其他人可能需要继续使用该存储库处理工作。
- [删除与你的工作相关且属于你的分支](/articles/deleting-a-repository)。 不用担心,删除复刻不会删除上游仓库。
- 删除您的计算机上可能存在的复刻本地副本:
```shell
$ rm -rf WORK_DIRECTORY
$ rm -rf <em>work_directory</em>
```

View File

@@ -1,5 +1,5 @@
---
title: Converting a user into an organization
title: 将用户转换为组织
redirect_from:
- /articles/what-is-the-difference-between-create-new-organization-and-turn-account-into-an-organization
- /articles/explaining-the-account-transformation-warning
@@ -8,7 +8,7 @@ redirect_from:
- /github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/converting-a-user-into-an-organization
- /account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings/converting-a-user-into-an-organization
- /account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-personal-account-settings/converting-a-user-into-an-organization
intro: You can convert your personal account into an organization. This allows more granular permissions for repositories that belong to the organization.
intro: 可以将个人帐户转换为组织。 这样可以对属于组织的仓库设置更细化的权限。
versions:
fpt: '*'
ghes: '*'
@@ -17,58 +17,60 @@ versions:
topics:
- Accounts
shortTitle: User into an organization
ms.openlocfilehash: 8b99bd119a9fa061c025a4fcc299d7ace31d23eb
ms.sourcegitcommit: 478f2931167988096ae6478a257f492ecaa11794
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/09/2022
ms.locfileid: '147687079'
---
{% warning %}
**Warning**: Before converting a user into an organization, keep these points in mind.
警告:在将用户转换为组织之前,请记住以下几点。
* You will **no longer** be able to sign into the converted personal account.
* You will **no longer** be able to create or modify gists owned by the converted personal account.
* An organization **cannot** be converted back to a user.
* The SSH keys, OAuth tokens, job profile, reactions, and associated user information, **will not** be transferred to the organization. This is only true for the personal account that's being converted, not any of the personal account's collaborators.
* Any {% data variables.product.prodname_github_apps %} installed on the converted personal account will be uninstalled.
* Any commits made with the converted personal account **will no longer be linked** to that account. The commits themselves **will** remain intact.
* Any existing comments made by the converted personal account **will no longer be linked** to that account. The comments themselves **will** remain intact, but will be associated with the `ghost` user.
* Any forks of private repositories made with the converted personal account will be deleted.
* 你将无法再登录转换后的个人帐户。
* 你将无法再创建或修改转换后的个人帐户所拥有的 Gist。
* 组织无法转换回用户。
* 不会将 SSH 密钥、OAuth 标记、作业配置文件、反应和关联的用户信息传输到组织。 这只适用于被转换的个人帐户,而不适用于该个人帐户的任何协作者。
* 使用转换后的个人帐户所做的任何提交将不再链接到该帐户。 提交本身将保持不变。
* 转换后的个人帐户所做的任何现有注释将不再链接至该帐户。 注释本身将保持不变,但会与 `ghost` 用户关联。
* 将删除使用转换后的个人帐户创建的任何专用存储库的分支。
{% endwarning %}
{% ifversion fpt or ghec or ghes %}
## Keep your personal account and create a new organization manually
## 保留个人帐户并手动创建新组织
If you want your organization to have the same name that you are currently using for your personal account, or if you want to keep your personal account's information intact, then you must create a new organization and transfer your repositories to it instead of converting your personal account into an organization.
如果希望组织的名称与目前用于个人帐户的名称相同,或者要保留个人帐户的信息不变,则必须创建一个新组织,然后将存储库转让给该组织,而不是将个人帐户转换为组织。
1. To retain your current personal account name for your personal use, [change the name of your personal account](/articles/changing-your-github-username) to something new and wonderful.
2. [Create a new organization](/articles/creating-a-new-organization-from-scratch) with the original name of your personal account.
3. [Transfer your repositories](/articles/transferring-a-repository) to your new organization account.{% endif %}
1. 要保留当前个人帐户名称以供个人使用,[请将个人帐户名称更改为](/articles/changing-your-github-username)一个好听的新名称。
2. 使用个人帐户的原始名称[创建新组织](/articles/creating-a-new-organization-from-scratch)
3. [将存储库转移到](/articles/transferring-a-repository)新的组织帐户。{% endif %}
## Convert your personal account into an organization automatically
## 自动将个人帐户转换为组织
You can also convert your personal account directly into an organization. Converting your account:
- Preserves the repositories as they are without the need to transfer them to another account manually
- Automatically invites collaborators to teams with permissions equivalent to what they had before
{% ifversion fpt or ghec %}- For personal accounts on {% data variables.product.prodname_pro %}, automatically transitions billing to [the paid {% data variables.product.prodname_team %}](/articles/about-billing-for-github-accounts) without the need to re-enter payment information, adjust your billing cycle, or double pay at any time{% endif %}
也可以将个人帐户直接转换为组织。 转换帐户:
- 按原样保留仓库,无需手动将其转让给另一个帐户
- 自动邀请协作者加入具有与其之前相同权限的团队 {% ifversion fpt or ghec %}- 对于 {% data variables.product.prodname_pro %} 上的个人帐户,自动将计费转换到[付费的 {% data variables.product.prodname_team %}](/articles/about-billing-for-github-accounts),无需重新输入付款信息、调整计费周期或随时双倍付款{% endif %}
1. Create a new personal account, which you'll use to sign into GitHub and access the organization and your repositories after you convert.
2. [Leave any organizations](/articles/removing-yourself-from-an-organization) the personal account you're converting has joined.
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.organizations %}
5. Under "Transform account", click **Turn <username> into an organization**.
![Organization conversion button](/assets/images/help/settings/convert-to-organization.png)
6. In the Account Transformation Warning dialog box, review and confirm the conversion. Note that the information in this box is the same as the warning at the top of this article.
![Conversion warning](/assets/images/help/organizations/organization-account-transformation-warning.png)
7. On the "Transform your user into an organization" page, under "Choose an organization owner", choose either the secondary personal account you created in the previous section or another user you trust to manage the organization.
![Add organization owner page](/assets/images/help/organizations/organization-add-owner.png)
8. Choose your new organization's subscription and enter your billing information if prompted.
9. Click **Create Organization**.
10. Sign in to the new personal account you created in step one, then use the context switcher to access your new organization.
1. 创建新的个人帐户,转换后您将用它来登录 GitHub 以及访问组织和仓库。
2. [退出组织](/articles/removing-yourself-from-an-organization)(你要转换的个人帐户已加入的组织)。
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.organizations %}
5. 在“转换帐户”下,单击“将 <username> 转换为组织”。
![组织转换按钮](/assets/images/help/settings/convert-to-organization.png)
6. 在 Account Transformation Warning帐户转换警告对话框中查看并确认转换。 请注意,此框中的信息与本文顶部的警告信息相同。
![转换警告](/assets/images/help/organizations/organization-account-transformation-warning.png)
7. 在“Transform your user into an organization将用户转换为组织”页面的“Choose an organization owner选择组织所有者”下选择您在前面创建的备用个人帐户或您信任的其他用户来管理组织。
![添加组织所有者页面](/assets/images/help/organizations/organization-add-owner.png)
8. 选择新组织的订阅,并在提示时输入帐单信息。
9. 单击“创建组织”。
10. 登录在第一步中创建的新个人帐户,然后使用上下文切换器访问新组织。
{% tip %}
**Tip**: When you convert a personal account into an organization, we'll add collaborators on repositories that belong to the account to the new organization as *outside collaborators*. You can then invite *outside collaborators* to become members of your new organization if you wish. For more information, see "[Roles in an organization](/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization#outside-collaborators)."
提示:将个人帐户转换为组织时,我们会将属于该帐户的存储库中的协作者作为外部协作者添加到新组织。 然后,你可以根据需要邀请外部协作者成为新组织的成员。 有关详细信息,请参阅“[组织中的角色](/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization#outside-collaborators)”。
{% endtip %}
## Further reading
- "[Setting up teams](/articles/setting-up-teams)"
{% ifversion fpt or ghec %}- "[Inviting users to join your organization](/articles/inviting-users-to-join-your-organization)"{% endif %}
- "[Accessing an organization](/articles/accessing-an-organization)"
## 延伸阅读
- [设置团队](/articles/setting-up-teams) {% ifversion fpt or ghec %}- [邀请用户加入组织](/articles/inviting-users-to-join-your-organization){% endif %}
- [访问组织](/articles/accessing-an-organization)

View File

@@ -1,6 +1,6 @@
---
title: About continuous integration
intro: 'You can create custom continuous integration (CI) workflows directly in your {% data variables.product.prodname_dotcom %} repository with {% data variables.product.prodname_actions %}.'
title: 关于持续集成
intro: '您可以直接在 {% data variables.product.prodname_dotcom %} 仓库中通过 {% data variables.product.prodname_actions %} 创建自定义持续集成 (CI) 工作流程。'
redirect_from:
- /articles/about-continuous-integration
- /github/automating-your-workflow-with-github-actions/about-continuous-integration
@@ -16,45 +16,48 @@ type: overview
topics:
- CI
shortTitle: Continuous integration
ms.openlocfilehash: 26b9088133ad561900d06a0c885d6b06b9b55861
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/10/2022
ms.locfileid: '147880659'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 关于持续集成
## About continuous integration
持续集成 (CI) 是一种需要频繁提交代码到共享仓库的软件实践。 频繁提交代码能较早检测到错误,减少在查找错误来源时开发者需要调试的代码量。 频繁的代码更新也更便于从软件开发团队的不同成员合并更改。 这对开发者非常有益,他们可以将更多时间用于编写代码,而减少在调试错误或解决合并冲突上所花的时间。
Continuous integration (CI) is a software practice that requires frequently committing code to a shared repository. Committing code more often detects errors sooner and reduces the amount of code a developer needs to debug when finding the source of an error. Frequent code updates also make it easier to merge changes from different members of a software development team. This is great for developers, who can spend more time writing code and less time debugging errors or resolving merge conflicts.
提交代码到仓库时,可以持续创建并测试代码,以确保提交未引入错误。 您的测试可以包括代码语法检查(检查样式格式)、安全性检查、代码覆盖率、功能测试及其他自定义检查。
When you commit code to your repository, you can continuously build and test the code to make sure that the commit doesn't introduce errors. Your tests can include code linters (which check style formatting), security checks, code coverage, functional tests, and other custom checks.
创建和测试代码需要服务器。 您可以在推送代码到仓库之前在本地创建并测试更新,也可以使用 CI 服务器检查仓库中的新代码提交。
Building and testing your code requires a server. You can build and test updates locally before pushing code to a repository, or you can use a CI server that checks for new code commits in a repository.
## 关于使用 {% data variables.product.prodname_actions %} 的持续集成
## About continuous integration using {% data variables.product.prodname_actions %}
{% ifversion ghae %}CI using {% data variables.product.prodname_actions %} offers workflows that can build the code in your repository and run your tests. Workflows can run on runner systems that you host. For more information, see "[About self-hosted runners](/actions/hosting-your-own-runners/about-self-hosted-runners)."
{% else %} CI using {% data variables.product.prodname_actions %} offers workflows that can build the code in your repository and run your tests. Workflows can run on {% data variables.product.prodname_dotcom %}-hosted virtual machines, or on machines that you host yourself. For more information, see "[About {% data variables.product.prodname_dotcom %}-hosted runners](/actions/using-github-hosted-runners/about-github-hosted-runners)" and "[About self-hosted runners](/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners)."
{% ifversion ghae %}使用 {% data variables.product.prodname_actions %} 的 CI 提供可以在存储库中生成代码并运行测试的工作流。 工作流程可以在您托管的运行器系统上运行。 有关详细信息,请参阅[关于自承载运行器](/actions/hosting-your-own-runners/about-self-hosted-runners)。
{% else %}使用 {% data variables.product.prodname_actions %} 的 CI 提供可以在仓库中构建代码并运行测试的工作流程。 工作流程可在 {% data variables.product.prodname_dotcom %} 托管的虚拟机或您自行托管的机器上运行。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_dotcom %} 托管的运行器](/actions/using-github-hosted-runners/about-github-hosted-runners)”和“[关于自托管运行器](/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners)”。
{% endif %}
You can configure your CI workflow to run when a {% data variables.product.prodname_dotcom %} event occurs (for example, when new code is pushed to your repository), on a set schedule, or when an external event occurs using the repository dispatch webhook.
可以配置 CI 工作流,使其在 {% data variables.product.prodname_dotcom %} 事件发生时(例如,当新代码推送到存储库时)运行、按设定的时间表运行,或在使用存储库分发 Webhook 的外部事件发生时运行。
{% data variables.product.product_name %} runs your CI tests and provides the results of each test in the pull request, so you can see whether the change in your branch introduces an error. When all CI tests in a workflow pass, the changes you pushed are ready to be reviewed by a team member or merged. When a test fails, one of your changes may have caused the failure.
{% data variables.product.product_name %} 运行 CI 测试并在拉取请求中提供每次测试的结果,因此您可以查看分支中的更改是否引入错误。 如果工作流程中的所有 CI 测试通过,您推送的更改可供团队成员审查或合并 如果测试失败,则是其中某项更改导致了失败。
When you set up CI in your repository, {% data variables.product.product_name %} analyzes the code in your repository and recommends CI workflows based on the language and framework in your repository. For example, if you use [Node.js](https://nodejs.org/en/), {% data variables.product.product_name %} will suggest a starter workflow that installs your Node.js packages and runs your tests. You can use the CI starter workflow suggested by {% data variables.product.product_name %}, customize the suggested starter workflow, or create your own custom workflow file to run your CI tests.
如果在仓库中设置了 CI{% data variables.product.product_name %} 会分析仓库中的代码,并根据仓库中的语言和框架推荐 CI 工作流程。 例如,如果使用 [Node.js](https://nodejs.org/en/){% data variables.product.product_name %} 将建议使用入门工作流来安装 Node.js 包并运行测试。 您可以使用 {% data variables.product.product_name %} 建议的 CI 入门工作流程,自定义建议的入门工作流程,或创建自己的自定义工作流程文件来运行 CI 测试。
![Screenshot of suggested continuous integration starter workflows](/assets/images/help/repository/ci-with-actions-template-picker.png)
![建议的持续集成入门工作流程屏幕截图](/assets/images/help/repository/ci-with-actions-template-picker.png)
In addition to helping you set up CI workflows for your project, you can use {% data variables.product.prodname_actions %} to create workflows across the full software development life cycle. For example, you can use actions to deploy, package, or release your project. For more information, see "[About {% data variables.product.prodname_actions %}](/articles/about-github-actions)."
除了帮助设置项目的 CI 工作流程之外,您还可以使用 {% data variables.product.prodname_actions %} 创建跨整个软件开发生命周期的工作流程。 例如,您可以使用操作来部署、封装或发行项目。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_actions %}](/articles/about-github-actions)”。
For a definition of common terms, see "[Core concepts for {% data variables.product.prodname_actions %}](/github/automating-your-workflow-with-github-actions/core-concepts-for-github-actions)."
有关常用术语的定义,请参阅“[{% data variables.product.prodname_actions %} 的核心概念](/github/automating-your-workflow-with-github-actions/core-concepts-for-github-actions)”。
## Starter workflow
## 入门工作流程
{% data variables.product.product_name %} offers CI starter workflow for a variety of languages and frameworks.
{% data variables.product.product_name %} 为各种语言和框架提供 CI 入门工作流程。
Browse the complete list of CI starter workflow offered by {% data variables.product.company_short %} in the {% ifversion fpt or ghec %}[actions/starter-workflows](https://github.com/actions/starter-workflows/tree/main/ci) repository{% else %} `actions/starter-workflows` repository on {% data variables.location.product_location %}{% endif %}.
{% ifversion fpt or ghec %}[actions/starter-workflows](https://github.com/actions/starter-workflows/tree/main/ci) 存储库{% else %} {% data variables.product.product_location %} 上的 `actions/starter-workflows` 存储库{% endif %}中浏览 {% data variables.product.company_short %} 提供的 CI 入门工作流的完整列表。
## Further reading
## 延伸阅读
{% ifversion fpt or ghec %}
- "[Managing billing for {% data variables.product.prodname_actions %}](/billing/managing-billing-for-github-actions)"
{% endif %}
- [管理 {% data variables.product.prodname_actions %} 的计费](/billing/managing-billing-for-github-actions){% endif %}

View File

@@ -0,0 +1,22 @@
---
title: 构建并测试 Node.js 或 Python
shortTitle: Build & test Node.js or Python
intro: You can create a continuous integration (CI) workflow to build and test your project. Use the language selector to show examples for your language of choice.
redirect_from:
- /actions/guides/building-and-testing-nodejs-or-python
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
type: tutorial
topics:
- CI
ms.openlocfilehash: aa03416907eb05ac6c31081d51dcb50980a3501f
ms.sourcegitcommit: 67064b14c9d4d18819db8f6398358b77a1c8002a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 05/17/2022
ms.locfileid: "145086739"
---
<!-- This article is specially rendered via the pages/ directory -->

View File

@@ -1,7 +1,6 @@
---
title: Creating a Docker container action
shortTitle: Create a Docker container action
intro: 'This guide shows you the minimal steps required to build a Docker container action. '
title: 创建 Docker 容器操作
intro: '本指南向您展示构建 Docker 容器操作所需的最少步骤。 '
redirect_from:
- /articles/creating-a-docker-container-action
- /github/automating-your-workflow-with-github-actions/creating-a-docker-container-action
@@ -16,47 +15,50 @@ type: tutorial
topics:
- Action development
- Docker
shortTitle: Docker container action
ms.openlocfilehash: f22b361f25f406dfdb1233f4d9ce62f2b6b919dc
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147518782'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 简介
## Introduction
在本指南中,您将了解创建和使用打包的 Docker 容器操作所需的基本组件。 本指南的重点是打包操作所需的组件,因此很少讲操作代码的功能。 操作将在日志文件中打印“Hello World”或“Hello [who-to-greet]”(如果您提供自定义名称)。
In this guide, you'll learn about the basic components needed to create and use a packaged Docker container action. To focus this guide on the components needed to package the action, the functionality of the action's code is minimal. The action prints "Hello World" in the logs or "Hello [who-to-greet]" if you provide a custom name.
Once you complete this project, you should understand how to build your own Docker container action and test it in a workflow.
完成此项目后,您应了解如何构建自己的 Docker 容器操作和在工作流程测试该操作。
{% data reusables.actions.self-hosted-runner-reqs-docker %}
{% data reusables.actions.context-injection-warning %}
## Prerequisites
## 先决条件
You may find it helpful to have a basic understanding of {% data variables.product.prodname_actions %} environment variables and the Docker container filesystem:
您可能会发现它有助于基本了解 {% data variables.product.prodname_actions %} 环境变量和 Docker 容器文件系统:
- "[Using environment variables](/actions/automating-your-workflow-with-github-actions/using-environment-variables)"
{% ifversion ghae %}
- "[Docker container filesystem](/actions/using-github-hosted-runners/about-ae-hosted-runners#docker-container-filesystem)."
{% else %}
- "[About {% data variables.product.prodname_dotcom %}-hosted runners](/actions/using-github-hosted-runners/about-github-hosted-runners#docker-container-filesystem)"
{% endif %}
- [使用环境变量](/actions/automating-your-workflow-with-github-actions/using-environment-variables)”{% ifversion ghae %}
- “[Docker 容器文件系统](/actions/using-github-hosted-runners/about-ae-hosted-runners#docker-container-filesystem)”
{% else %}
- “[关于 {% data variables.product.prodname_dotcom %} 托管的运行器](/actions/using-github-hosted-runners/about-github-hosted-runners#docker-container-filesystem)”{% endif %}
Before you begin, you'll need to create a {% data variables.product.prodname_dotcom %} repository.
在开始之前,您需要创建 {% data variables.product.prodname_dotcom %} 仓库。
1. Create a new repository on {% data variables.location.product_location %}. You can choose any repository name or use "hello-world-docker-action" like this example. For more information, see "[Create a new repository](/articles/creating-a-new-repository)."
1. {% data variables.product.product_location %} 上新建存储库。 您可以选择任何仓库名称或如本例一样使用“hello-world-docker-action”。 有关详细信息,请参阅“[创建新存储库](/articles/creating-a-new-repository)”。
1. Clone your repository to your computer. For more information, see "[Cloning a repository](/articles/cloning-a-repository)."
1. 将仓库克隆到计算机。 有关详细信息,请参阅“[克隆存储库](/articles/cloning-a-repository)”。
1. From your terminal, change directories into your new repository.
1. 从您的终端,将目录更改为新仓库。
```shell{:copy}
cd hello-world-docker-action
```
## Creating a Dockerfile
## 创建 Dockerfile
In your new `hello-world-docker-action` directory, create a new `Dockerfile` file. Make sure that your filename is capitalized correctly (use a capital `D` but not a capital `f`) if you're having issues. For more information, see "[Dockerfile support for {% data variables.product.prodname_actions %}](/actions/creating-actions/dockerfile-support-for-github-actions)."
在新的 `hello-world-docker-action` 目录中,创建一个新的 `Dockerfile` 文件。 如果你有问题,请确保你的文件名正确大写(使用大写字母 `D` 但不要大写 `f`)。 有关详细信息,请参阅“[{% data variables.product.prodname_actions %} 的 Dockerfile 支持](/actions/creating-actions/dockerfile-support-for-github-actions)”。
**Dockerfile**
```Dockerfile{:copy}
@@ -70,12 +72,11 @@ COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
```
## Creating an action metadata file
## 创建操作元数据文件
Create a new `action.yml` file in the `hello-world-docker-action` directory you created above. For more information, see "[Metadata syntax for {% data variables.product.prodname_actions %}](/actions/creating-actions/metadata-syntax-for-github-actions)."
在上面创建的 `hello-world-docker-action` 目录中创建一个新的 `action.yml` 文件。 有关详细信息,请参阅“[{% data variables.product.prodname_actions %} 的元数据语法](/actions/creating-actions/metadata-syntax-for-github-actions)”。
{% raw %}
**action.yml**
{% raw %} action.yml
```yaml{:copy}
# action.yml
name: 'Hello World'
@@ -96,63 +97,50 @@ runs:
```
{% endraw %}
This metadata defines one `who-to-greet` input and one `time` output parameter. To pass inputs to the Docker container, you should declare the input using `inputs` and pass the input in the `args` keyword. Everything you include in `args` is passed to the container, but for better discoverability for users of your action, we recommended using inputs.
此元数据定义一个 `who-to-greet` 输入和一个 `time` 输出参数。 若要将输入传递给 Docker 容器,应使用 `inputs` 声明输入并在 `args` 关键字中传递输入。 你包含在 `args` 中的所有内容都会传递给容器,但为了让用户更好地发现你的操作,建议使用输入。
{% data variables.product.prodname_dotcom %} will build an image from your `Dockerfile`, and run commands in a new container using this image.
{% data variables.product.prodname_dotcom %} 将从 `Dockerfile` 构建映像,然后使用此映像在新容器中运行命令。
## Writing the action code
## 编写操作代码
You can choose any base Docker image and, therefore, any language for your action. The following shell script example uses the `who-to-greet` input variable to print "Hello [who-to-greet]" in the log file.
您可以选择任何基础 Docker 映像,并因此为您的操作选择任何语言。 以下 shell 脚本示例使用 `who-to-greet` 输入变量在日志文件中打印“Hello [who-to-greet]”。
Next, the script gets the current time and sets it as an output variable that actions running later in a job can use. In order for {% data variables.product.prodname_dotcom %} to recognize output variables, you must {% ifversion actions-save-state-set-output-envs %}write them to the `$GITHUB_OUTPUT` environment file: `echo "<output name>=<value>" >> $GITHUB_OUTPUT`{% else %}use a workflow command in a specific syntax: `echo "::set-output name=<output name>::<value>"`{% endif %}. For more information, see "[Workflow commands for {% data variables.product.prodname_actions %}](/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter)."
接下来,该脚本会获取当前时间并将其设置为作业中稍后运行的操作可以使用的输出变量。 为便于 {% data variables.product.prodname_dotcom %} 识别输出变量,必须以特定语法使用工作流命令:`echo "::set-output name=<output name>::<value>"`。 有关详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流命令](/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter)”。
1. Create a new `entrypoint.sh` file in the `hello-world-docker-action` directory.
1. `hello-world-docker-action` 目录中创建一个新的 `entrypoint.sh` 文件。
1. Add the following code to your `entrypoint.sh` file.
1. 将以下代码添加到 `entrypoint.sh` 文件。
**entrypoint.sh**
entrypoint.sh
```shell{:copy}
#!/bin/sh -l
echo "Hello $1"
time=$(date)
{%- ifversion actions-save-state-set-output-envs %}
echo "time=$time" >> $GITHUB_OUTPUT
{%- else %}
echo "::set-output name=time::$time"
{%- endif %}
```
If `entrypoint.sh` executes without any errors, the action's status is set to `success`. You can also explicitly set exit codes in your action's code to provide an action's status. For more information, see "[Setting exit codes for actions](/actions/creating-actions/setting-exit-codes-for-actions)."
如果 `entrypoint.sh` 执行没有任何错误,则操作的状态设置为 `success`。 您还可以在操作的代码中显式设置退出代码以提供操作的状态。 有关详细信息,请参阅“[为操作设置退出代码](/actions/creating-actions/setting-exit-codes-for-actions)”。
1. Make your `entrypoint.sh` file executable. Git provides a way to explicitly change the permission mode of a file so that it doesnt get reset every time there is a clone/fork.
1. 通过在系统上运行以下命令使 `entrypoint.sh` 文件可执行。
```shell{:copy}
$ git update-index --chmod=+x entrypoint.sh
$ chmod +x entrypoint.sh
```
1. Optionally, to check the permission mode of the file in the git index, run the following command.
## 创建自述文件
```shell{:copy}
$ git ls-files --stage entrypoint.sh
```
要让人们了解如何使用您的操作,您可以创建自述文件。 自述文件在您计划公开分享操作时最有用,但也是提醒您或您的团队如何使用该操作的绝佳方式。
An output like `100755 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 entrypoint.sh` means the file has the executable permission. In this example, `755` denotes the executable permission.
`hello-world-docker-action` 目录中,创建一个用于指定以下信息的 `README.md` 文件:
## Creating a README
- 操作用途的详细说明。
- 必需的输入和输出参数。
- 可选输入和输出参数。
- 操作使用的密钥。
- 操作使用的环境变量。
- 如何在工作流中使用操作的示例。
To let people know how to use your action, you can create a README file. A README is most helpful when you plan to share your action publicly, but is also a great way to remind you or your team how to use the action.
In your `hello-world-docker-action` directory, create a `README.md` file that specifies the following information:
- A detailed description of what the action does.
- Required input and output arguments.
- Optional input and output arguments.
- Secrets the action uses.
- Environment variables the action uses.
- An example of how to use your action in a workflow.
**README.md**
README.md
```markdown{:copy}
# Hello world docker action
@@ -172,16 +160,16 @@ The time we greeted you.
## Example usage
uses: actions/hello-world-docker-action@{% ifversion actions-save-state-set-output-envs %}v2{% else %}v1{% endif %}
uses: actions/hello-world-docker-action@v1
with:
who-to-greet: 'Mona the Octocat'
```
## Commit, tag, and push your action to {% data variables.product.product_name %}
## 提交、标记和推送操作到 {% data variables.product.product_name %}
From your terminal, commit your `action.yml`, `entrypoint.sh`, `Dockerfile`, and `README.md` files.
从终端中提交 `action.yml``entrypoint.sh``Dockerfile` `README.md` 文件。
It's best practice to also add a version tag for releases of your action. For more information on versioning your action, see "[About actions](/actions/automating-your-workflow-with-github-actions/about-actions#using-release-management-for-actions)."
最佳做法是同时为操作版本添加版本标记。 有关对操作进行版本控制的详细信息,请参阅“[关于操作](/actions/automating-your-workflow-with-github-actions/about-actions#using-release-management-for-actions)”。
```shell{:copy}
git add action.yml entrypoint.sh Dockerfile README.md
@@ -190,17 +178,17 @@ git tag -a -m "My first action release" v1
git push --follow-tags
```
## Testing out your action in a workflow
## 在工作流程中测试您的操作
Now you're ready to test your action out in a workflow. When an action is in a private repository, the action can only be used in workflows in the same repository. Public actions can be used by workflows in any repository.
现在,您已准备好在工作流程中测试您的操作。 当某项操作位于专用存储库中时,该操作只能在同一存储库的工作流中使用。 位于任何存储库内的工作流均可使用公共操作。
{% data reusables.actions.enterprise-marketplace-actions %}
### Example using a public action
### 使用公共操作的示例
The following workflow code uses the completed _hello world_ action in the public [`actions/hello-world-docker-action`](https://github.com/actions/hello-world-docker-action) repository. Copy the following workflow example code into a `.github/workflows/main.yml` file, but replace the `actions/hello-world-docker-action` with your repository and action name. You can also replace the `who-to-greet` input with your name. {% ifversion fpt or ghec %}Public actions can be used even if they're not published to {% data variables.product.prodname_marketplace %}. For more information, see "[Publishing an action](/actions/creating-actions/publishing-actions-in-github-marketplace#publishing-an-action)." {% endif %}
以下工作流代码使用公共 [`actions/hello-world-docker-action`](https://github.com/actions/hello-world-docker-action) 存储库中已完成的 hello world 操作。 将以下工作流示例代码复制到 `.github/workflows/main.yml` 文件中,但将 `actions/hello-world-docker-action` 替换为存储库和操作名称。 还可以将 `who-to-greet` 输入替换为你的名称。 {% ifversion fpt or ghec %}公共操作即使未发布到 {% data variables.product.prodname_marketplace %} 也可使用。 有关详细信息,请参阅“[发布操作](/actions/creating-actions/publishing-actions-in-github-marketplace#publishing-an-action)”。 {% endif %}
**.github/workflows/main.yml**
{% raw %} .github/workflows/main.yml
```yaml{:copy}
on: [push]
@@ -211,19 +199,20 @@ jobs:
steps:
- name: Hello world action step
id: hello
uses: actions/hello-world-docker-action{% ifversion actions-save-state-set-output-envs %}v2{% else %}v1{% endif %}
uses: actions/hello-world-docker-action@v1
with:
who-to-greet: 'Mona the Octocat'
# Use the output from the `hello` step
- name: Get the output time
run: echo "The time was {% raw %}${{ steps.hello.outputs.time }}"{% endraw %}
run: echo "The time was ${{ steps.hello.outputs.time }}"
```
{% endraw %}
### Example using a private action
### 使用私有操作的示例
Copy the following example workflow code into a `.github/workflows/main.yml` file in your action's repository. You can also replace the `who-to-greet` input with your name. {% ifversion fpt or ghec %}This private action can't be published to {% data variables.product.prodname_marketplace %}, and can only be used in this repository.{% endif %}
将以下示例工作流代码复制到操作存储库中的 `.github/workflows/main.yml` 文件中。 还可以将 `who-to-greet` 输入替换为你的名称。 {% ifversion fpt or ghec %}此操作不能发布到 {% data variables.product.prodname_marketplace %},并且只能在此仓库中使用。{% endif %}
**.github/workflows/main.yml**
.github/workflows/main.yml
```yaml{:copy}
on: [push]
@@ -246,7 +235,7 @@ jobs:
run: echo "The time was {% raw %}${{ steps.hello.outputs.time }}"{% endraw %}
```
From your repository, click the **Actions** tab, and select the latest workflow run. Under **Jobs** or in the visualization graph, click **A job to say hello**. You should see "Hello Mona the Octocat" or the name you used for the `who-to-greet` input and the timestamp printed in the log.
从存储库中,单击“操作”选项卡,然后选择最新的工作流运行。 在“作业”下或可视化图中,单击“表示问候的作业” 。 应会看到“Hello Mona the Octocat”或你用于 `who-to-greet` 输入的名称以及日志中打印的时间戳。
![A screenshot of using your action in a workflow](/assets/images/help/repository/docker-action-workflow-run-updated.png)
![在工作流中使用操作的屏幕截图](/assets/images/help/repository/docker-action-workflow-run-updated.png)

View File

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

View File

@@ -21,7 +21,9 @@ children:
- /dockerfile-support-for-github-actions
- /setting-exit-codes-for-actions
- /publishing-actions-in-github-marketplace
- /sharing-actions-and-workflows-from-your-private-repository
- /sharing-actions-and-workflows-with-your-enterprise
- /sharing-actions-and-workflows-with-your-organization
- /releasing-and-maintaining-actions
- /developing-a-third-party-cli-action
ms.openlocfilehash: b60bd1031bc7e9958a146cbf9755a000679edff3

View File

@@ -1,6 +1,6 @@
---
title: About continuous deployment
intro: 'You can create custom continuous deployment (CD) workflows directly in your {% data variables.product.prodname_dotcom %} repository with {% data variables.product.prodname_actions %}.'
title: 关于持续部署
intro: '您可以直接在 {% data variables.product.prodname_dotcom %} 仓库中通过 {% data variables.product.prodname_actions %} 创建自定义持续部署 (CD) 工作流程。'
versions:
fpt: '*'
ghes: '*'
@@ -12,40 +12,44 @@ redirect_from:
topics:
- CD
shortTitle: About continuous deployment
ms.openlocfilehash: 379afa0088f7f10302f5bf8202f5259ac4777bec
ms.sourcegitcommit: fb047f9450b41b24afc43d9512a5db2a2b750a2a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/11/2022
ms.locfileid: '147060136'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 关于持续部署
## About continuous deployment
持续部署 (CD) 是使用自动化发布和部署软件更新的做法。 作为典型 CD 过程的一部分,代码在部署之前会自动构建并测试。
_Continuous deployment_ (CD) is the practice of using automation to publish and deploy software updates. As part of the typical CD process, the code is automatically built and tested before deployment.
持续部署通常与持续集成相结合。 有关持续集成的详细信息,请参阅“[关于持续集成](/actions/guides/about-continuous-integration)”。
Continuous deployment is often coupled with continuous integration. For more information about continuous integration, see "[About continuous integration](/actions/guides/about-continuous-integration)".
## 关于使用 {% data variables.product.prodname_actions %} 的持续部署
## About continuous deployment using {% data variables.product.prodname_actions %}
您可以设置 {% data variables.product.prodname_actions %} 工作流程来部署软件产品。 要验证产品是否按预期工作,您的工作流程可以在存储库中构建代码,并在部署之前运行测试。
You can set up a {% data variables.product.prodname_actions %} workflow to deploy your software product. To verify that your product works as expected, your workflow can build the code in your repository and run your tests before deploying.
您可以配置 CD 工作流程在发生 {% data variables.product.product_name %} 事件(例如,将新代码推送到存储库的默认分支)时运行、按设定的时间表运行、手动运行或者在使用存储库分发 web 挂钩的外部事件发生时运行。 有关工作流何时可以运行的详细信息,请参阅“[触发工作流的事件](/actions/reference/events-that-trigger-workflows)”。
You can configure your CD workflow to run when a {% data variables.product.product_name %} event occurs (for example, when new code is pushed to the default branch of your repository), on a set schedule, manually, or when an external event occurs using the repository dispatch webhook. For more information about when your workflow can run, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows)."
{% data variables.product.prodname_actions %} 提供的功能使您可以更好地控制部署。 例如,您可以使用环境来要求批准才能继续作业,限制哪些分支可以触发工作流程,或限制对机密的访问。 你可以使用并发性将 CD 管道限制为最多一个正在进行的部署和一个挂起的部署。 有关这些功能的详细信息,请参阅“[使用 GitHub Actions 进行部署](/actions/deployment/deploying-with-github-actions)”和“[使用环境进行部署](/actions/deployment/using-environments-for-deployment)”。
{% data variables.product.prodname_actions %} provides features that give you more control over deployments. For example, you can use environments to require approval for a job to proceed, restrict which branches can trigger a workflow, or limit access to secrets. You can use concurrency to limit your CD pipeline to a maximum of one in-progress deployment and one pending deployment. For more information about these features, see "[Deploying with GitHub Actions](/actions/deployment/deploying-with-github-actions)" and "[Using environments for deployment](/actions/deployment/using-environments-for-deployment)."
{% ifversion fpt or ghec or ghae-issue-4856 or ghes > 3.4 %}
{% ifversion fpt or ghec or ghes > 3.4 %}
## Using OpenID Connect to access cloud resources
## 使用 OpenID Connect 访问云资源
{% data reusables.actions.about-oidc-short-overview %}
{% endif %}
## Starter workflows and third party actions
## 初学者工作流程和第三方操作
{% data reusables.actions.cd-templates-actions %}
## Further reading
## 延伸阅读
- [Deploying with GitHub Actions](/actions/deployment/deploying-with-github-actions)
- [Using environments for deployment](/actions/deployment/using-environments-for-deployment){% ifversion fpt or ghec %}
- "[Managing billing for {% data variables.product.prodname_actions %}](/billing/managing-billing-for-github-actions)"{% endif %}
- [使用 GitHub Actions 进行部署](/actions/deployment/deploying-with-github-actions)
- [使用环境进行部署](/actions/deployment/using-environments-for-deployment){% ifversion fpt or ghec %}
- [管理 {% data variables.product.prodname_actions %} 的计费](/billing/managing-billing-for-github-actions){% endif %}

View File

@@ -1,6 +1,6 @@
---
title: Deploying with GitHub Actions
intro: Learn how to control deployments with features like environments and concurrency.
title: 使用 GitHub Actions 进行部署
intro: 了解如何使用环境和并发性等功能控制部署。
versions:
fpt: '*'
ghes: '*'
@@ -12,34 +12,38 @@ redirect_from:
topics:
- CD
shortTitle: Deploy with GitHub Actions
ms.openlocfilehash: 533d85d83bea53d34af3d8b9a47d0d4426ea4bc6
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '145179182'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 简介
## Introduction
{% data variables.product.prodname_actions %} 提供了允许您控制部署的功能。 方法:
{% data variables.product.prodname_actions %} offers features that let you control deployments. You can:
- 使用各种事件触发工作流程。
- 配置环境以在作业可以继续之前设置规则,并限制对机密的访问。
- 使用并发性来控制一次运行的部署数。
- Trigger workflows with a variety of events.
- Configure environments to set rules before a job can proceed and to limit access to secrets.
- Use concurrency to control the number of deployments running at a time.
有关持续部署的详细信息,请参阅“[关于持续部署](/actions/deployment/about-continuous-deployment)”。
For more information about continuous deployment, see "[About continuous deployment](/actions/deployment/about-continuous-deployment)."
## 先决条件
## Prerequisites
您应该熟悉 {% data variables.product.prodname_actions %} 的语法。 有关详细信息,请参阅“[了解 {% data variables.product.prodname_actions %}](/actions/learn-github-actions)”。
You should be familiar with the syntax for {% data variables.product.prodname_actions %}. For more information, see "[Learn {% data variables.product.prodname_actions %}](/actions/learn-github-actions)."
## 触发部署
## Triggering your deployment
您可以使用各种事件来触发您的部署工作流程。 一些最常见的事件包括:`pull_request``push``workflow_dispatch`
You can use a variety of events to trigger your deployment workflow. Some of the most common are: `pull_request`, `push`, and `workflow_dispatch`.
例如,具有以下触发器的工作流在以下情况下会运行:
For example, a workflow with the following triggers runs whenever:
- There is a push to the `main` branch.
- A pull request targeting the `main` branch is opened, synchronized, or reopened.
- Someone manually triggers it.
- 存在针对 `main` 分支的推送。
- 以 `main` 分支为目标的拉取请求已打开、已同步或重新打开。
- 有人手动触发它。
```yaml
on:
@@ -52,23 +56,23 @@ on:
workflow_dispatch:
```
For more information, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows)."
有关详细信息,请参阅“[触发工作流的事件](/actions/reference/events-that-trigger-workflows)”。
## Using environments
## 使用环境
{% data reusables.actions.about-environments %}
## Using concurrency
## 使用并发
Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. You can use concurrency so that an environment has a maximum of one deployment in progress and one deployment pending at a time.
并发确保只有使用相同并发组的单一作业或工作流程才会同时运行。 您可以使用并发,以便环境中每次最多有一个正在进行的部署和一个待处理的部署。
{% note %}
**Note:** `concurrency` and `environment` are not connected. The concurrency value can be any string; it does not need to be an environment name. Additionally, if another workflow uses the same environment but does not specify concurrency, that workflow will not be subject to any concurrency rules.
注意:`concurrency` `environment` 未连接。 并发值可以是任何字符串;它无需是环境名称。 此外,如果另一个工作流程使用相同的环境,但未指定并发性,则该工作流程将不受任何并发规则的约束。
{% endnote %}
For example, when the following workflow runs, it will be paused with the status `pending` if any job or workflow that uses the `production` concurrency group is in progress. It will also cancel any job or workflow that uses the `production` concurrency group and has the status `pending`. This means that there will be a maximum of one running and one pending job or workflow in that uses the `production` concurrency group.
例如,当以下工作流运行时,如果使用 `production` 并发组的任何作业或工作流正在进行中,则它将暂停并且状态为 `pending`。 它还将取消使用 `production` 并发组且状态为 `pending` 的任何作业或工作流。 这意味着,由于使用了 `production` 并发组,因此最多有一个正在运行和一个待处理的作业或工作流。
```yaml
name: Deployment
@@ -89,7 +93,7 @@ jobs:
# ...deployment-specific steps
```
You can also specify concurrency at the job level. This will allow other jobs in the workflow to proceed even if the concurrent job is `pending`.
您也可以在作业级别指定并发性。 这将允许工作流中的其他作业继续,即使并发作业的状态为 `pending`
```yaml
name: Deployment
@@ -109,7 +113,7 @@ jobs:
# ...deployment-specific steps
```
You can also use `cancel-in-progress` to cancel any currently running job or workflow in the same concurrency group.
还可以使用 `cancel-in-progress` 取消同一并发组中任何当前正在运行的作业或工作流。
```yaml
name: Deployment
@@ -132,42 +136,41 @@ jobs:
# ...deployment-specific steps
```
For guidance on writing deployment-specific steps, see "[Finding deployment examples](#finding-deployment-examples)."
有关如何编写特定于部署的步骤的指导,请参阅“[查找部署示例](#finding-deployment-examples)”。
## Viewing deployment history
## 查看部署历史记录
When a {% data variables.product.prodname_actions %} workflow deploys to an environment, the environment is displayed on the main page of the repository. For more information about viewing deployments to environments, see "[Viewing deployment history](/developers/overview/viewing-deployment-history)."
{% data variables.product.prodname_actions %} 工作流部署到某个环境时,该环境将显示在存储库的主页上。 有关如何查看环境部署的详细信息,请参阅“[查看部署历史记录](/developers/overview/viewing-deployment-history)”。
## Monitoring workflow runs
## 监控工作流程运行
Every workflow run generates a real-time graph that illustrates the run progress. You can use this graph to monitor and debug deployments. For more information see, "[Using the visualization graph](/actions/monitoring-and-troubleshooting-workflows/using-the-visualization-graph)."
每个工作流程运行都会生成一个实时图表,说明运行进度。 您可以使用此图表来监控和调试部署。 有关详细信息,请参阅“[使用可视化效果图](/actions/monitoring-and-troubleshooting-workflows/using-the-visualization-graph)”。
You can also view the logs of each workflow run and the history of workflow runs. For more information, see "[Viewing workflow run history](/actions/monitoring-and-troubleshooting-workflows/viewing-workflow-run-history)."
您还可以查看每个工作流程运行的日志和工作流程运行的历史记录。 有关详细信息,请参阅“[查看工作流运行历史记录](/actions/monitoring-and-troubleshooting-workflows/viewing-workflow-run-history)”。
## Tracking deployments through apps
## 通过应用跟踪部署
{% ifversion fpt or ghec %}
If your personal account or organization on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %} is integrated with Microsoft Teams or Slack, you can track deployments that use environments through Microsoft Teams or Slack. For example, you can receive notifications through the app when a deployment is pending approval, when a deployment is approved, or when the deployment status changes. For more information about integrating Microsoft Teams or Slack, see "[GitHub extensions and integrations](/github/customizing-your-github-workflow/exploring-integrations/github-extensions-and-integrations#team-communication-tools)."
{% ifversion fpt or ghec %} 如果在 {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.product.product_location %}{% endif %} 上的个人帐户或组织与 Microsoft Teams 或 Slack 集成,可以通过 Microsoft Teams 或 Slack 跟踪使用环境的部署。 例如,当部署正在等待批准、部署获得批准或部署状态更改时,您可以通过应用接收通知。 有关如何集成 Microsoft Teams 或 Slack 的详细信息,请参阅“[GitHub 扩展和集成](/github/customizing-your-github-workflow/exploring-integrations/github-extensions-and-integrations#team-communication-tools)”。
{% endif %}
You can also build an app that uses deployment and deployment status webhooks to track deployments. {% data reusables.actions.environment-deployment-event %} For more information, see "[Apps](/developers/apps)" and "[Webhook events and payloads](/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#deployment)."
你还可以构建一个应用,该应用使用部署和部署状态 web 挂钩来跟踪部署。 {% data reusables.actions.environment-deployment-event %} 有关详细信息,请参阅“[应用](/developers/apps)”和“[Webhook 事件和有效负载](/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#deployment)”。
{% ifversion fpt or ghes or ghec %}
## Choosing a runner
## 选择运行器
You can run your deployment workflow on {% data variables.product.company_short %}-hosted runners or on self-hosted runners. Traffic from {% data variables.product.company_short %}-hosted runners can come from a [wide range of network addresses](/rest/reference/meta#get-github-meta-information). If you are deploying to an internal environment and your company restricts external traffic into private networks, {% data variables.product.prodname_actions %} workflows running on {% data variables.product.company_short %}-hosted runners may not be able to communicate with your internal services or resources. To overcome this, you can host your own runners. For more information, see "[About self-hosted runners](/actions/hosting-your-own-runners/about-self-hosted-runners)" and "[About GitHub-hosted runners](/actions/using-github-hosted-runners/about-github-hosted-runners)."
您可以在 {% data variables.product.company_short %} 托管的运行器或自托管运行器上运行部署工作流程。 来自 {% data variables.product.company_short %} 托管的运行器的流量可能来自[各种网络地址](/rest/reference/meta#get-github-meta-information)。 如果要部署到内部环境,并且公司将外部流量限制到专用网络,则在 {% data variables.product.company_short %} 托管的运行器上运行的 {% data variables.product.prodname_actions %} 工作流可能无法与内部服务或资源通信。 为了克服这一点,您可以托管自己的运行器。 有关详细信息,请参阅“[关于自托管运行器](/actions/hosting-your-own-runners/about-self-hosted-runners)”和“[关于 GitHub 托管的运行器](/actions/using-github-hosted-runners/about-github-hosted-runners)”。
{% endif %}
## Displaying a status badge
## 显示状态徽章
You can use a status badge to display the status of your deployment workflow. {% data reusables.repositories.actions-workflow-status-badge-intro %}
您可以使用状态徽章来显示您的部署工作流程状态。 {% data reusables.repositories.actions-workflow-status-badge-intro %}
For more information, see "[Adding a workflow status badge](/actions/managing-workflow-runs/adding-a-workflow-status-badge)."
有关详细信息,请参阅“[添加工作流状态徽章](/actions/managing-workflow-runs/adding-a-workflow-status-badge)”。
## Finding deployment examples
## 查找部署示例
This article demonstrated features of {% data variables.product.prodname_actions %} that you can add to your deployment workflows.
本文演示了可添加到部署工作流程的 {% data variables.product.prodname_actions %} 的功能。
{% data reusables.actions.cd-templates-actions %}

View File

@@ -1,6 +1,6 @@
---
title: Deploying to Amazon Elastic Container Service
intro: You can deploy to Amazon Elastic Container Service (ECS) as part of your continuous deployment (CD) workflows.
title: 部署到 Amazon Elastic Container Service
intro: 您可以部署到 Amazon Elastic Container Service (ECS),作为持续部署 (CD) 工作流程的一部分。
redirect_from:
- /actions/guides/deploying-to-amazon-elastic-container-service
- /actions/deployment/deploying-to-amazon-elastic-container-service
@@ -15,37 +15,40 @@ topics:
- Containers
- Amazon ECS
shortTitle: Deploy to Amazon ECS
ms.openlocfilehash: 259a3fd5bc0076f60d0c08f356b3ec9914effe89
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/11/2022
ms.locfileid: '147881104'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 简介
## Introduction
本指南介绍如何使用 {% data variables.product.prodname_actions %} 构建容器化应用程序,将其推送到 [Amazon 弹性容器注册表 (ECR)](https://aws.amazon.com/ecr/),以及要推送到 `main` 分支时将其部署到 [Amazon 弹性容器服务 (ECS)](https://aws.amazon.com/ecs/)。
This guide explains how to use {% data variables.product.prodname_actions %} to build a containerized application, push it to [Amazon Elastic Container Registry (ECR)](https://aws.amazon.com/ecr/), and deploy it to [Amazon Elastic Container Service (ECS)](https://aws.amazon.com/ecs/) when there is a push to the `main` branch.
在每次推送到 {% data variables.product.company_short %} 存储库中的 `main` 时,{% data variables.product.prodname_actions %} 工作流将生成新的容器映像并将其推送到 Amazon ECR然后将新的任务定义部署到 Amazon ECS。
On every new push to `main` in your {% data variables.product.company_short %} repository, the {% data variables.product.prodname_actions %} workflow builds and pushes a new container image to Amazon ECR, and then deploys a new task definition to Amazon ECS.
{% ifversion fpt or ghec or ghes > 3.4 %}
{% ifversion fpt or ghec or ghae-issue-4856 or ghes > 3.4 %}
{% note %}
**Note**: {% data reusables.actions.about-oidc-short-overview %} and ["Configuring OpenID Connect in Amazon Web Services"](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services).
注意:{% data reusables.actions.about-oidc-short-overview %} 和“[ Amazon Web Services 中配置 OpenID Connect](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services)”。
{% endnote %}
{% endif %}
## Prerequisites
## 先决条件
Before creating your {% data variables.product.prodname_actions %} workflow, you will first need to complete the following setup steps for Amazon ECR and ECS:
在创建 {% data variables.product.prodname_actions %} 工作流程之前,首先需要对 Amazon ECR ECS 完成以下设置步骤:
1. Create an Amazon ECR repository to store your images.
1. 创建 Amazon ECR 仓库以存储映像。
For example, using [the AWS CLI](https://aws.amazon.com/cli/):
例如,使用 [AWS CLI](https://aws.amazon.com/cli/)
{% raw %}```bash{:copy}
aws ecr create-repository \
{% raw %}```bash{:copy} aws ecr create-repository \
--repository-name MY_ECR_REPOSITORY \
--region MY_AWS_REGION
```{% endraw %}
@@ -143,12 +146,8 @@ jobs:
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG{% endraw %}
{%- ifversion actions-save-state-set-output-envs %}
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
{%- else %}
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
{%- endif %}{% raw %}
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
@@ -167,14 +166,14 @@ jobs:
wait-for-service-stability: true{% endraw %}
```
## Additional resources
## 其他资源
For the original starter workflow, see [`aws.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/aws.yml) in the {% data variables.product.prodname_actions %} `starter-workflows` repository.
对于原始初学者工作流,请参阅 {% data variables.product.prodname_actions %} `starter-workflows` 存储库中的 [`aws.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/aws.yml)
For more information on the services used in these examples, see the following documentation:
有关这些示例中使用的服务的详细信息,请参阅以下文档:
* "[Security best practices in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)" in the Amazon AWS documentation.
* Official AWS "[Configure AWS Credentials](https://github.com/aws-actions/configure-aws-credentials)" action.
* Official AWS [Amazon ECR "Login"](https://github.com/aws-actions/amazon-ecr-login) action.
* Official AWS [Amazon ECS "Render Task Definition"](https://github.com/aws-actions/amazon-ecs-render-task-definition) action.
* Official AWS [Amazon ECS "Deploy Task Definition"](https://github.com/aws-actions/amazon-ecs-deploy-task-definition) action.
* Amazon AWS 文档中的“[IAM 安全最佳做法](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)”。
* 官方 AWS“[配置 AWS 凭据](https://github.com/aws-actions/configure-aws-credentials)”操作。
* 官方 AWS [Amazon ECR“登录”](https://github.com/aws-actions/amazon-ecr-login)操作。
* 官方 AWS [Amazon ECS“呈现任务定义”](https://github.com/aws-actions/amazon-ecs-render-task-definition)操作。
* 官方 AWS [Amazon ECS“部署任务定义”](https://github.com/aws-actions/amazon-ecs-deploy-task-definition)操作。

View File

@@ -1,6 +1,6 @@
---
title: Deploying Docker to Azure App Service
intro: You can deploy a Docker container to Azure App Service as part of your continuous deployment (CD) workflows.
title: Docker 部署到 Azure App Service
intro: 作为持续部署 (CD) 工作流程的一部分,您可以将 Docker 容器部署到 Azure App Service。
versions:
fpt: '*'
ghes: '*'
@@ -12,34 +12,38 @@ topics:
- Containers
- Docker
- Azure App Service
ms.openlocfilehash: bfae92b757e4d3224efc1e94f1f4377a4183e4d2
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147410353'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 简介
## Introduction
本指南说明如何使用 {% data variables.product.prodname_actions %} 构建 Docker 容器并将其部署到 [Azure 应用服务](https://azure.microsoft.com/services/app-service/)。
This guide explains how to use {% data variables.product.prodname_actions %} to build and deploy a Docker container to [Azure App Service](https://azure.microsoft.com/services/app-service/).
{% ifversion fpt or ghec or ghes > 3.4 %}
{% ifversion fpt or ghec or ghae-issue-4856 or ghes > 3.4 %}
{% note %}
**Note**: {% data reusables.actions.about-oidc-short-overview %} and "[Configuring OpenID Connect in Azure](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure)."
注意:{% data reusables.actions.about-oidc-short-overview %} 和“[在 Azure 中配置 OpenID Connect](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure)”。
{% endnote %}
{% endif %}
## Prerequisites
## 先决条件
Before creating your {% data variables.product.prodname_actions %} workflow, you will first need to complete the following setup steps:
在创建 {% data variables.product.prodname_actions %} 工作流程之前,首先需要完成以下设置步骤:
{% data reusables.actions.create-azure-app-plan %}
1. Create a web app.
1. 创建 Web 应用。
For example, you can use the Azure CLI to create an Azure App Service web app:
例如,可以使用 Azure CLI 创建 Azure App Service web app
```bash{:copy}
az webapp create \
@@ -49,15 +53,15 @@ Before creating your {% data variables.product.prodname_actions %} workflow, you
--deployment-container-image-name nginx:latest
```
In the command above, replace the parameters with your own values, where `MY_WEBAPP_NAME` is a new name for the web app.
在上面的命令中,将参数替换为你自己的值,其中 `MY_WEBAPP_NAME` 是 Web 应用的新名称。
{% data reusables.actions.create-azure-publish-profile %}
1. Set registry credentials for your web app.
1. 设置 web app 的注册表凭据。
Create a {% data variables.product.pat_v1 %} with the `repo` and `read:packages` scopes. For more information, see "[Creating a {% data variables.product.pat_generic %}](/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)."
使用 `repo` `read:packages` 范围创建个人访问令牌。 有关详细信息,请参阅“[创建个人访问令牌](/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)”。
Set `DOCKER_REGISTRY_SERVER_URL` to `https://ghcr.io`, `DOCKER_REGISTRY_SERVER_USERNAME` to the GitHub username or organization that owns the repository, and `DOCKER_REGISTRY_SERVER_PASSWORD` to your {% data variables.product.pat_generic %} from above. This will give your web app credentials so it can pull the container image after your workflow pushes a newly built image to the registry. You can do this with the following Azure CLI command:
`DOCKER_REGISTRY_SERVER_URL` 设置为 `https://ghcr.io`,将 `DOCKER_REGISTRY_SERVER_USERNAME` 设置为拥有存储库的 GitHub 用户名或组织,并将 `DOCKER_REGISTRY_SERVER_PASSWORD` 设置为你的个人访问令牌。 这将提供 Web 应用凭据,以便在工作流程将新构建的映像推送到注册表后,它可以拉取容器映像。 可以使用以下 Azure CLI 命令执行此操作:
```shell
az webapp config appsettings set \
@@ -68,13 +72,13 @@ Before creating your {% data variables.product.prodname_actions %} workflow, you
5. Optionally, configure a deployment environment. {% data reusables.actions.about-environments %}
## Creating the workflow
## 创建工作流程
Once you've completed the prerequisites, you can proceed with creating the workflow.
完成先决条件后,可以继续创建工作流程。
The following example workflow demonstrates how to build and deploy a Docker container to Azure App Service when there is a push to the `main` branch.
以下示例工作流演示如何在推送到 `main` 分支时构建 Docker 容器并将其部署到 Azure 应用服务。
Ensure that you set `AZURE_WEBAPP_NAME` in the workflow `env` key to the name of the web app you created.
确保在工作流 `env` 中将 `AZURE_WEBAPP_NAME` 密钥设置为创建的 Web 应用的名称。
{% data reusables.actions.delete-env-key %}
@@ -146,10 +150,10 @@ jobs:
images: 'ghcr.io/{% raw %}${{ env.REPO }}{% endraw %}:{% raw %}${{ github.sha }}{% endraw %}'
```
## Additional resources
## 其他资源
The following resources may also be useful:
以下资源也可能有用:
* For the original starter workflow, see [`azure-container-webapp.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-container-webapp.yml) in the {% data variables.product.prodname_actions %} `starter-workflows` repository.
* The action used to deploy the web app is the official Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) action.
* For more examples of GitHub Action workflows that deploy to Azure, see the [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository.
* 对于原始初学者工作流,请参阅 {% data variables.product.prodname_actions %} `starter-workflows` 存储库中的 [`azure-container-webapp.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-container-webapp.yml)
* 用于部署 Web 应用的操作是官方 Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) 操作。
* 有关部署到 Azure 的 GitHub 操作工作流的更多示例,请参阅 [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) 存储库。

View File

@@ -1,6 +1,6 @@
---
title: Deploying Java to Azure App Service
intro: You can deploy your Java project to Azure App Service as part of your continuous deployment (CD) workflows.
title: Java 部署到 Azure App Service
intro: 作为持续部署 (CD) 工作流程的一部分,您可以将 Java 项目部署到 Azure App Service。
versions:
fpt: '*'
ghes: '*'
@@ -11,34 +11,38 @@ topics:
- CD
- Java
- Azure App Service
ms.openlocfilehash: ede24c0173cfe0493ad529b2f5d8a03f97ade7b9
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147410097'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 简介
## Introduction
本指南说明如何使用 {% data variables.product.prodname_actions %} 构建 Java 项目并将其部署到 [Azure 应用服务](https://azure.microsoft.com/services/app-service/)。
This guide explains how to use {% data variables.product.prodname_actions %} to build and deploy a Java project to [Azure App Service](https://azure.microsoft.com/services/app-service/).
{% ifversion fpt or ghec or ghes > 3.4 %}
{% ifversion fpt or ghec or ghae-issue-4856 or ghes > 3.4 %}
{% note %}
**Note**: {% data reusables.actions.about-oidc-short-overview %} and "[Configuring OpenID Connect in Azure](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure)."
注意:{% data reusables.actions.about-oidc-short-overview %} 和“[在 Azure 中配置 OpenID Connect](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure)”。
{% endnote %}
{% endif %}
## Prerequisites
## 先决条件
Before creating your {% data variables.product.prodname_actions %} workflow, you will first need to complete the following setup steps:
在创建 {% data variables.product.prodname_actions %} 工作流程之前,首先需要完成以下设置步骤:
{% data reusables.actions.create-azure-app-plan %}
1. Create a web app.
1. 创建 Web 应用。
For example, you can use the Azure CLI to create an Azure App Service web app with a Java runtime:
例如,可以使用 Azure CLI 创建具有 Java 运行时的 Azure App Service Web 应用:
```bash{:copy}
az webapp create \
@@ -48,19 +52,19 @@ Before creating your {% data variables.product.prodname_actions %} workflow, you
--runtime "JAVA|11-java11"
```
In the command above, replace the parameters with your own values, where `MY_WEBAPP_NAME` is a new name for the web app.
在上面的命令中,将参数替换为你自己的值,其中 `MY_WEBAPP_NAME` 是 Web 应用的新名称。
{% data reusables.actions.create-azure-publish-profile %}
1. Optionally, configure a deployment environment. {% data reusables.actions.about-environments %}
## Creating the workflow
## 创建工作流程
Once you've completed the prerequisites, you can proceed with creating the workflow.
完成先决条件后,可以继续创建工作流程。
The following example workflow demonstrates how to build and deploy a Java project to Azure App Service when there is a push to the `main` branch.
以下示例工作流演示如何在推送到 `main` 分支时构建 Java 项目并将其部署到 Azure 应用服务。
Ensure that you set `AZURE_WEBAPP_NAME` in the workflow `env` key to the name of the web app you created. If you want to use a Java version other than `11`, change `JAVA_VERSION`.
确保在工作流 `env` 中将 `AZURE_WEBAPP_NAME` 密钥设置为创建的 Web 应用的名称。 如果要使用 `11` 以外的 Java 版本,请更改 `JAVA_VERSION`
{% data reusables.actions.delete-env-key %}
@@ -124,10 +128,10 @@ jobs:
package: '*.jar'
```
## Additional resources
## 其他资源
The following resources may also be useful:
以下资源也可能有用:
* For the original starter workflow, see [`azure-webapps-java-jar.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-webapps-java-jar.yml) in the {% data variables.product.prodname_actions %} `starter-workflows` repository.
* The action used to deploy the web app is the official Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) action.
* For more examples of GitHub Action workflows that deploy to Azure, see the [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository.
* 对于原始初学者工作流,请参阅 {% data variables.product.prodname_actions %} `starter-workflows` 存储库中的 [`azure-webapps-java-jar.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-webapps-java-jar.yml)
* 用于部署 Web 应用的操作是官方 Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) 操作。
* 有关部署到 Azure 的 GitHub 操作工作流的更多示例,请参阅 [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) 存储库。

View File

@@ -1,6 +1,6 @@
---
title: Deploying .NET to Azure App Service
intro: You can deploy your .NET project to Azure App Service as part of your continuous deployment (CD) workflows.
title: .NET 部署到 Azure App Service
intro: 作为持续部署 (CD) 工作流程的一部分,您可以将 .NET 项目部署到 Azure App Service。
versions:
fpt: '*'
ghes: '*'
@@ -10,34 +10,38 @@ type: tutorial
topics:
- CD
- Azure App Service
ms.openlocfilehash: cb71e0016157d7d1fdd366819840ea90d104e8dc
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147410033'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 简介
## Introduction
本指南说明如何使用 {% data variables.product.prodname_actions %} 构建 .NET 项目并将其部署到 [Azure 应用服务](https://azure.microsoft.com/services/app-service/)。
This guide explains how to use {% data variables.product.prodname_actions %} to build and deploy a .NET project to [Azure App Service](https://azure.microsoft.com/services/app-service/).
{% ifversion fpt or ghec or ghes > 3.4 %}
{% ifversion fpt or ghec or ghae-issue-4856 or ghes > 3.4 %}
{% note %}
**Note**: {% data reusables.actions.about-oidc-short-overview %} and "[Configuring OpenID Connect in Azure](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure)."
注意:{% data reusables.actions.about-oidc-short-overview %} 和“[在 Azure 中配置 OpenID Connect](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure)”。
{% endnote %}
{% endif %}
## Prerequisites
## 先决条件
Before creating your {% data variables.product.prodname_actions %} workflow, you will first need to complete the following setup steps:
在创建 {% data variables.product.prodname_actions %} 工作流程之前,首先需要完成以下设置步骤:
{% data reusables.actions.create-azure-app-plan %}
2. Create a web app.
2. 创建 Web 应用。
For example, you can use the Azure CLI to create an Azure App Service web app with a .NET runtime:
例如,可以使用 Azure CLI 创建具有 .NET 运行时的 Azure App Service Web 应用:
```bash{:copy}
az webapp create \
@@ -47,19 +51,19 @@ Before creating your {% data variables.product.prodname_actions %} workflow, you
--runtime "DOTNET|5.0"
```
In the command above, replace the parameters with your own values, where `MY_WEBAPP_NAME` is a new name for the web app.
在上面的命令中,将参数替换为你自己的值,其中 `MY_WEBAPP_NAME` 是 Web 应用的新名称。
{% data reusables.actions.create-azure-publish-profile %}
5. Optionally, configure a deployment environment. {% data reusables.actions.about-environments %}
## Creating the workflow
## 创建工作流程
Once you've completed the prerequisites, you can proceed with creating the workflow.
完成先决条件后,可以继续创建工作流程。
The following example workflow demonstrates how to build and deploy a .NET project to Azure App Service when there is a push to the `main` branch.
以下示例工作流演示如何在推送到 `main` 分支时构建 .NET 项目并将其部署到 Azure 应用服务。
Ensure that you set `AZURE_WEBAPP_NAME` in the workflow `env` key to the name of the web app you created. If the path to your project is not the repository root, change `AZURE_WEBAPP_PACKAGE_PATH`. If you use a version of .NET other than `5`, change `DOTNET_VERSION`.
确保在工作流 `env` 中将 `AZURE_WEBAPP_NAME` 密钥设置为创建的 Web 应用的名称。 如果项目的路径不是存储库根路径,请更改 `AZURE_WEBAPP_PACKAGE_PATH` 如果使用 `5` 以外的 .NET 版本,请更改 `DOTNET_VERSION`
{% data reusables.actions.delete-env-key %}
@@ -134,10 +138,10 @@ jobs:
package: {% raw %}${{ env.AZURE_WEBAPP_PACKAGE_PATH }}{% endraw %}
```
## Additional resources
## 其他资源
The following resources may also be useful:
以下资源也可能有用:
* For the original starter workflow, see [`azure-webapps-dotnet-core.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-webapps-dotnet-core.yml) in the {% data variables.product.prodname_actions %} `starter-workflows` repository.
* The action used to deploy the web app is the official Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) action.
* For more examples of GitHub Action workflows that deploy to Azure, see the [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository.
* 对于原始初学者工作流,请参阅 {% data variables.product.prodname_actions %} `starter-workflows` 存储库中的 [`azure-webapps-dotnet-core.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-webapps-dotnet-core.yml)
* 用于部署 Web 应用的操作是官方 Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) 操作。
* 有关部署到 Azure 的 GitHub 操作工作流的更多示例,请参阅 [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) 存储库。

View File

@@ -1,6 +1,6 @@
---
title: Deploying Node.js to Azure App Service
intro: You can deploy your Node.js project to Azure App Service as part of your continuous deployment (CD) workflows.
title: Node.js 部署到 Azure App Service
intro: 作为持续部署 (CD) 工作流程的一部分,您可以将 Node.js 部署到 Azure App Service。
redirect_from:
- /actions/guides/deploying-to-azure-app-service
- /actions/deployment/deploying-to-azure-app-service
@@ -16,34 +16,38 @@ topics:
- Node
- JavaScript
- Azure App Service
ms.openlocfilehash: d4b5a5f19098d2b84b63ae56791814eadb0fcb72
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147410169'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 简介
## Introduction
本指南说明如何使用 {% data variables.product.prodname_actions %} 构建、测试 Node.js 项目并将其部署到 [Azure 应用服务](https://azure.microsoft.com/services/app-service/)。
This guide explains how to use {% data variables.product.prodname_actions %} to build, test, and deploy a Node.js project to [Azure App Service](https://azure.microsoft.com/services/app-service/).
{% ifversion fpt or ghec or ghes > 3.4 %}
{% ifversion fpt or ghec or ghae-issue-4856 or ghes > 3.4 %}
{% note %}
**Note**: {% data reusables.actions.about-oidc-short-overview %} and "[Configuring OpenID Connect in Azure](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure)."
注意:{% data reusables.actions.about-oidc-short-overview %} 和“[在 Azure 中配置 OpenID Connect](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure)”。
{% endnote %}
{% endif %}
## Prerequisites
## 先决条件
Before creating your {% data variables.product.prodname_actions %} workflow, you will first need to complete the following setup steps:
在创建 {% data variables.product.prodname_actions %} 工作流程之前,首先需要完成以下设置步骤:
{% data reusables.actions.create-azure-app-plan %}
2. Create a web app.
2. 创建 Web 应用。
For example, you can use the Azure CLI to create an Azure App Service web app with a Node.js runtime:
例如,可以使用 Azure CLI 创建具有 Node.js 运行时的 Azure App Service Web 应用:
```bash{:copy}
az webapp create \
@@ -53,19 +57,19 @@ Before creating your {% data variables.product.prodname_actions %} workflow, you
--runtime "NODE|14-lts"
```
In the command above, replace the parameters with your own values, where `MY_WEBAPP_NAME` is a new name for the web app.
在上面的命令中,将参数替换为你自己的值,其中 `MY_WEBAPP_NAME` 是 Web 应用的新名称。
{% data reusables.actions.create-azure-publish-profile %}
5. Optionally, configure a deployment environment. {% data reusables.actions.about-environments %}
## Creating the workflow
## 创建工作流程
Once you've completed the prerequisites, you can proceed with creating the workflow.
完成先决条件后,可以继续创建工作流程。
The following example workflow demonstrates how to build, test, and deploy the Node.js project to Azure App Service when there is a push to the `main` branch.
以下示例工作流演程示在推送到 `main` 分支时,如何构建、测试 Node.js 项目并将其部署到 Azure 应用服务。
Ensure that you set `AZURE_WEBAPP_NAME` in the workflow `env` key to the name of the web app you created. If the path to your project is not the repository root, change `AZURE_WEBAPP_PACKAGE_PATH` to your project path. If you use a version of Node.js other than `10.x`, change `NODE_VERSION` to the version that you use.
确保在工作流 `env` 中将 `AZURE_WEBAPP_NAME` 密钥设置为创建的 Web 应用的名称。 如果项目的路径不是存储库根路径,请将 `AZURE_WEBAPP_PACKAGE_PATH` 更改为你的项目路径。 如果使用的 Node.js 版本不是 `10.x`,请将 `NODE_VERSION` 更改为你使用的版本。
{% data reusables.actions.delete-env-key %}
@@ -129,12 +133,11 @@ jobs:
package: {% raw %}${{ env.AZURE_WEBAPP_PACKAGE_PATH }}{% endraw %}
```
## Additional resources
## 其他资源
The following resources may also be useful:
以下资源也可能有用:
* For the original starter workflow, see [`azure-webapps-node.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-webapps-node.yml) in the {% data variables.product.prodname_actions %} `starter-workflows` repository.
* The action used to deploy the web app is the official Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) action.
* For more examples of GitHub Action workflows that deploy to Azure, see the
[actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository.
* The "[Create a Node.js web app in Azure](https://docs.microsoft.com/azure/app-service/quickstart-nodejs)" quickstart in the Azure web app documentation demonstrates using {% data variables.product.prodname_vscode %} with the [Azure App Service extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureappservice).
* 对于原始初学者工作流,请参阅 {% data variables.product.prodname_actions %} `starter-workflows` 存储库中的 [`azure-webapps-node.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-webapps-node.yml)
* 用于部署 Web 应用的操作是官方 Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) 操作。
* 有关部署到 Azure 的 GitHub 操作工作流的更多示例,请参阅 [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) 存储库。
* Azure Web 应用文档中的“[在 Azure 中创建 Node.js Web 应用](https://docs.microsoft.com/azure/app-service/quickstart-nodejs)”快速入门演示了如何将 {% data variables.product.prodname_vscode %} 与 [Azure 应用服务扩展](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureappservice)配合使用。

View File

@@ -1,6 +1,6 @@
---
title: Deploying PHP to Azure App Service
intro: You can deploy your PHP project to Azure App Service as part of your continuous deployment (CD) workflows.
title: PHP 部署到 Azure App Service
intro: 作为持续部署 (CD) 工作流程的一部分,您可以将 PHP 项目部署到 Azure App Service。
versions:
fpt: '*'
ghes: '*'
@@ -10,34 +10,38 @@ type: tutorial
topics:
- CD
- Azure App Service
ms.openlocfilehash: 28314e1ccea9af232ff86712e86d7e6aec2d61a7
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147410161'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 简介
## Introduction
本指南说明如何使用 {% data variables.product.prodname_actions %} 构建 PHP 项目并将其部署到 [Azure 应用服务](https://azure.microsoft.com/services/app-service/)。
This guide explains how to use {% data variables.product.prodname_actions %} to build and deploy a PHP project to [Azure App Service](https://azure.microsoft.com/services/app-service/).
{% ifversion fpt or ghec or ghes > 3.4 %}
{% ifversion fpt or ghec or ghae-issue-4856 or ghes > 3.4 %}
{% note %}
**Note**: {% data reusables.actions.about-oidc-short-overview %} and "[Configuring OpenID Connect in Azure](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure)."
注意:{% data reusables.actions.about-oidc-short-overview %} 和“[在 Azure 中配置 OpenID Connect](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure)”。
{% endnote %}
{% endif %}
## Prerequisites
## 先决条件
Before creating your {% data variables.product.prodname_actions %} workflow, you will first need to complete the following setup steps:
在创建 {% data variables.product.prodname_actions %} 工作流程之前,首先需要完成以下设置步骤:
{% data reusables.actions.create-azure-app-plan %}
2. Create a web app.
2. 创建 Web 应用。
For example, you can use the Azure CLI to create an Azure App Service web app with a PHP runtime:
例如,可以使用 Azure CLI 创建具有 PHP 运行时的 Azure App Service Web 应用:
```bash{:copy}
az webapp create \
@@ -47,19 +51,19 @@ Before creating your {% data variables.product.prodname_actions %} workflow, you
--runtime "php|7.4"
```
In the command above, replace the parameters with your own values, where `MY_WEBAPP_NAME` is a new name for the web app.
在上面的命令中,将参数替换为你自己的值,其中 `MY_WEBAPP_NAME` 是 Web 应用的新名称。
{% data reusables.actions.create-azure-publish-profile %}
5. Optionally, configure a deployment environment. {% data reusables.actions.about-environments %}
## Creating the workflow
## 创建工作流程
Once you've completed the prerequisites, you can proceed with creating the workflow.
完成先决条件后,可以继续创建工作流程。
The following example workflow demonstrates how to build and deploy a PHP project to Azure App Service when there is a push to the `main` branch.
以下示例工作流演示如何在推送到 `main` 分支时构建 PHP 项目并将其部署到 Azure 应用服务。
Ensure that you set `AZURE_WEBAPP_NAME` in the workflow `env` key to the name of the web app you created. If the path to your project is not the repository root, change `AZURE_WEBAPP_PACKAGE_PATH` to the path to your project. If you use a version of PHP other than `8.x`, change`PHP_VERSION` to the version that you use.
确保在工作流 `env` 中将 `AZURE_WEBAPP_NAME` 密钥设置为创建的 Web 应用的名称。 如果项目的路径不是存储库根路径,请将 `AZURE_WEBAPP_PACKAGE_PATH` 更改为你的项目路径。 如果使用的 PHP 版本不是 `8.x`,请将 `PHP_VERSION` 更改为你使用的版本。
{% data reusables.actions.delete-env-key %}
@@ -102,11 +106,7 @@ jobs:
id: composer-cache
if: steps.check_files.outputs.files_exists == 'true'
run: |
{%- ifversion actions-save-state-set-output-envs %}
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
{%- else %}
echo "::set-output name=dir::$(composer config cache-files-dir)"
{%- endif %}
- name: Set up dependency caching for faster installs
uses: {% data reusables.actions.action-cache %}
@@ -149,10 +149,10 @@ jobs:
package: .
```
## Additional resources
## 其他资源
The following resources may also be useful:
以下资源也可能有用:
* For the original starter workflow, see [`azure-webapps-php.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-webapps-php.yml) in the {% data variables.product.prodname_actions %} `starter-workflows` repository.
* The action used to deploy the web app is the official Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) action.
* For more examples of GitHub Action workflows that deploy to Azure, see the [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository.
* 对于原始初学者工作流,请参阅 {% data variables.product.prodname_actions %} `starter-workflows` 存储库中的 [`azure-webapps-php.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-webapps-php.yml)
* 用于部署 Web 应用的操作是官方 Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) 操作。
* 有关部署到 Azure 的 GitHub 操作工作流的更多示例,请参阅 [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) 存储库。

View File

@@ -1,6 +1,6 @@
---
title: Deploying Python to Azure App Service
intro: You can deploy your Python project to Azure App Service as part of your continuous deployment (CD) workflows.
title: Python 部署到 Azure App Service
intro: 作为持续部署 (CD) 工作流程的一部分,您可以将 Python 项目部署到 Azure App Service。
versions:
fpt: '*'
ghes: '*'
@@ -11,34 +11,38 @@ topics:
- CD
- Python
- Azure App Service
ms.openlocfilehash: c9f1bc719068a250aaabfbb8dcb3581335dabdb1
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147409457'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 简介
## Introduction
本指南说明如何使用 {% data variables.product.prodname_actions %} 构建 Python 项目并将其部署到 [Azure 应用服务](https://azure.microsoft.com/services/app-service/)。
This guide explains how to use {% data variables.product.prodname_actions %} to build and deploy a Python project to [Azure App Service](https://azure.microsoft.com/services/app-service/).
{% ifversion fpt or ghec or ghes > 3.4 %}
{% ifversion fpt or ghec or ghae-issue-4856 or ghes > 3.4 %}
{% note %}
**Note**: {% data reusables.actions.about-oidc-short-overview %} and "[Configuring OpenID Connect in Azure](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure)."
注意:{% data reusables.actions.about-oidc-short-overview %} 和“[在 Azure 中配置 OpenID Connect](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure)”。
{% endnote %}
{% endif %}
## Prerequisites
## 先决条件
Before creating your {% data variables.product.prodname_actions %} workflow, you will first need to complete the following setup steps:
在创建 {% data variables.product.prodname_actions %} 工作流程之前,首先需要完成以下设置步骤:
{% data reusables.actions.create-azure-app-plan %}
1. Create a web app.
1. 创建 Web 应用。
For example, you can use the Azure CLI to create an Azure App Service web app with a Python runtime:
例如,可以使用 Azure CLI 创建具有 Python 运行时的 Azure App Service Web 应用:
```bash{:copy}
az webapp create \
@@ -48,21 +52,21 @@ Before creating your {% data variables.product.prodname_actions %} workflow, you
--runtime "python|3.8"
```
In the command above, replace the parameters with your own values, where `MY_WEBAPP_NAME` is a new name for the web app.
在上面的命令中,将参数替换为你自己的值,其中 `MY_WEBAPP_NAME` 是 Web 应用的新名称。
{% data reusables.actions.create-azure-publish-profile %}
1. Add an app setting called `SCM_DO_BUILD_DURING_DEPLOYMENT` and set the value to `1`.
1. 添加名为 `SCM_DO_BUILD_DURING_DEPLOYMENT` 的应用设置并将值设置为 `1`
5. Optionally, configure a deployment environment. {% data reusables.actions.about-environments %}
## Creating the workflow
## 创建工作流程
Once you've completed the prerequisites, you can proceed with creating the workflow.
完成先决条件后,可以继续创建工作流程。
The following example workflow demonstrates how to build and deploy a Python project to Azure App Service when there is a push to the `main` branch.
以下示例工作流演示如何在推送到 `main` 分支时构建 Python 项目并将其部署到 Azure 应用服务。
Ensure that you set `AZURE_WEBAPP_NAME` in the workflow `env` key to the name of the web app you created. If you use a version of Python other than `3.8`, change `PYTHON_VERSION` to the version that you use.
确保在工作流 `env` 中将 `AZURE_WEBAPP_NAME` 密钥设置为创建的 Web 应用的名称。 如果使用的 Python 版本不是 `3.8`,请将 `PYTHON_VERSION` 更改为你使用的版本。
{% data reusables.actions.delete-env-key %}
@@ -141,10 +145,10 @@ jobs:
publish-profile: {% raw %}${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}{% endraw %}
```
## Additional resources
## 其他资源
The following resources may also be useful:
以下资源也可能有用:
* For the original starter workflow, see [`azure-webapps-python.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-webapps-python.yml) in the {% data variables.product.prodname_actions %} `starter-workflows` repository.
* The action used to deploy the web app is the official Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) action.
* For more examples of GitHub Action workflows that deploy to Azure, see the [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository.
* 对于原始初学者工作流,请参阅 {% data variables.product.prodname_actions %} `starter-workflows` 存储库中的 [`azure-webapps-python.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-webapps-python.yml)
* 用于部署 Web 应用的操作是官方 Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) 操作。
* 有关部署到 Azure 的 GitHub 操作工作流的更多示例,请参阅 [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) 存储库。

View File

@@ -1,6 +1,6 @@
---
title: Deploying to Azure Kubernetes Service
intro: You can deploy your project to Azure Kubernetes Service (AKS) as part of your continuous deployment (CD) workflows.
title: 部署到 Azure Kubernetes Service
intro: 作为持续部署 (CD) 工作流程的一部分,您可以将项目部署到 Azure Kubernetes Service (AKS)
versions:
fpt: '*'
ghes: '*'
@@ -10,47 +10,51 @@ type: tutorial
topics:
- CD
- Azure Kubernetes Service
ms.openlocfilehash: 5c3052f1f432663a38be6aa15376c186c96193ca
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147410121'
---
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
## Introduction
## 简介
This guide explains how to use {% data variables.product.prodname_actions %} to build and deploy a project to [Azure Kubernetes Service](https://azure.microsoft.com/services/kubernetes-service/).
本指南说明如何使用 {% data variables.product.prodname_actions %} 构建项目并将其部署到 [Azure Kubernetes 服务](https://azure.microsoft.com/services/kubernetes-service/)
{% ifversion fpt or ghec or ghes > 3.4 %}
{% ifversion fpt or ghec or ghae-issue-4856 or ghes > 3.4 %}
{% note %}
**Note**: {% data reusables.actions.about-oidc-short-overview %} and "[Configuring OpenID Connect in Azure](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure)."
注意:{% data reusables.actions.about-oidc-short-overview %} 和“[在 Azure 中配置 OpenID Connect](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure)”。
{% endnote %}
{% endif %}
## Prerequisites
## 先决条件
Before creating your {% data variables.product.prodname_actions %} workflow, you will first need to complete the following setup steps:
在创建 {% data variables.product.prodname_actions %} 工作流程之前,首先需要完成以下设置步骤:
1. Create a target AKS cluster and an Azure Container Registry (ACR). For more information, see "[Quickstart: Deploy an AKS cluster by using the Azure portal - Azure Kubernetes Service](https://docs.microsoft.com/azure/aks/kubernetes-walkthrough-portal)" and "[Quickstart - Create registry in portal - Azure Container Registry](https://docs.microsoft.com/azure/container-registry/container-registry-get-started-portal)" in the Azure documentation.
1. 创建目标 AKS 群集和 Azure 容器注册表 (ACR)。 有关详细信息,请参阅 Azure 文档中的“[快速入门:使用 Azure 门户部署 AKS 群集 - Azure Kubernetes 服务](https://docs.microsoft.com/azure/aks/kubernetes-walkthrough-portal)”和“[快速入门 - 在门户中创建注册表 - Azure 容器注册表](https://docs.microsoft.com/azure/container-registry/container-registry-get-started-portal)”。
1. Create a secret called `AZURE_CREDENTIALS` to store your Azure credentials. For more information about how to find this information and structure the secret, see [the `Azure/login` action documentation](https://github.com/Azure/login#configure-a-service-principal-with-a-secret).
1. 创建名为 `AZURE_CREDENTIALS` 的机密来存储 Azure 凭据。 有关如何查找此信息和构造机密的详细信息,请参阅 [`Azure/login` 操作文档](https://github.com/Azure/login#configure-a-service-principal-with-a-secret)
## Creating the workflow
## 创建工作流程
Once you've completed the prerequisites, you can proceed with creating the workflow.
完成先决条件后,可以继续创建工作流程。
The following example workflow demonstrates how to build and deploy a project to Azure Kubernetes Service when code is pushed to your repository.
以下示例工作流程演示在将代码推送到存储库时,如何构建项目并将其部署到 Azure Kubernetes Service。
Under the workflow `env` key, change the following values:
- `AZURE_CONTAINER_REGISTRY` to the name of your container registry
- `PROJECT_NAME` to the name of your project
- `RESOURCE_GROUP` to the resource group containing your AKS cluster
- `CLUSTER_NAME` to the name of your AKS cluster
在工作流 `env` 键下,更改以下值:
- `AZURE_CONTAINER_REGISTRY` 更改为容器注册表的名称
- `PROJECT_NAME` 更改为项目的名称
- `RESOURCE_GROUP` 更改为包含 AKS 群集的资源组
- `CLUSTER_NAME` 更改为 AKS 群集名称
This workflow uses the `helm` render engine for the [`azure/k8s-bake` action](https://github.com/Azure/k8s-bake). If you will use the `helm` render engine, change the value of `CHART_PATH` to the path to your helm file. Change `CHART_OVERRIDE_PATH` to an array of override file paths. If you use a different render engine, update the input parameters sent to the `azure/k8s-bake` action.
此工作流使用 `helm` 呈现引擎来执行 [`azure/k8s-bake` 操作](https://github.com/Azure/k8s-bake)。 如果将使用 `helm` 呈现引擎,请将 `CHART_PATH` 的值更改为 helm 文件的路径。 将 `CHART_OVERRIDE_PATH` 更改为覆盖文件路径的数组。 如果使用其他呈现引擎,请更新发送到 `azure/k8s-bake` 操作的输入参数。
```yaml{:copy}
{% data reusables.actions.actions-not-certified-by-github-comment %}
@@ -119,10 +123,10 @@ jobs:
{% raw %}${{ env.PROJECT_NAME }}{% endraw %}
```
## Additional resources
## 其他资源
The following resources may also be useful:
以下资源也可能有用:
* For the original starter workflow, see [`azure-kubernetes-service.yml `](https://github.com/actions/starter-workflows/blob/main/deployments/azure-kubernetes-service.yml) in the {% data variables.product.prodname_actions %} `starter-workflows` repository.
* The actions used to in this workflow are the official Azure [`Azure/login`](https://github.com/Azure/login),[`Azure/aks-set-context`](https://github.com/Azure/aks-set-context), [`Azure/CLI`](https://github.com/Azure/CLI), [`Azure/k8s-bake`](https://github.com/Azure/k8s-bake), and [`Azure/k8s-deploy`](https://github.com/Azure/k8s-deploy)actions.
* For more examples of GitHub Action workflows that deploy to Azure, see the [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository.
* 对于原始初学者工作流,请参阅 {% data variables.product.prodname_actions %} `starter-workflows` 存储库中的 [`azure-kubernetes-service.yml `](https://github.com/actions/starter-workflows/blob/main/deployments/azure-kubernetes-service.yml)
* 此工作流中使用的操作是官方 Azure [`Azure/login`](https://github.com/Azure/login)[`Azure/aks-set-context`](https://github.com/Azure/aks-set-context)[`Azure/CLI`](https://github.com/Azure/CLI)[`Azure/k8s-bake`](https://github.com/Azure/k8s-bake),以及 [`Azure/k8s-deploy`](https://github.com/Azure/k8s-deploy) 操作。
* 有关部署到 Azure 的 GitHub 操作工作流的更多示例,请参阅 [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) 存储库。

View File

@@ -1,6 +1,6 @@
---
title: Deploying to Azure Static Web App
intro: You can deploy your web app to Azure Static Web App as part of your continuous deployment (CD) workflows.
title: 部署到 Azure Static Web App
intro: 作为持续部署 (CD) 工作流程的一部分,可以将 Web 应用部署到 Azure Static Web App。
versions:
fpt: '*'
ghes: '*'
@@ -10,46 +10,50 @@ type: tutorial
topics:
- CD
- Azure Static Web Apps
ms.openlocfilehash: 3e5b9a90e91e237fbd1b5679624ed3cdb3865856
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/11/2022
ms.locfileid: '147410545'
---
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
## Introduction
## 简介
This guide explains how to use {% data variables.product.prodname_actions %} to build and deploy a web app to [Azure Static Web Apps](https://azure.microsoft.com/services/app-service/static/).
本指南说明如何使用 {% data variables.product.prodname_actions %} 构建 Web 应用并将其部署到 [Azure Static Web Apps](https://azure.microsoft.com/services/app-service/static/)
{% ifversion fpt or ghec or ghes > 3.4 %}
{% ifversion fpt or ghec or ghae-issue-4856 or ghes > 3.4 %}
{% note %}
**Note**: {% data reusables.actions.about-oidc-short-overview %} and "[Configuring OpenID Connect in Azure](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure)."
注意:{% data reusables.actions.about-oidc-short-overview %} 和“[在 Azure 中配置 OpenID Connect](/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure)”。
{% endnote %}
{% endif %}
## Prerequisites
## 先决条件
Before creating your {% data variables.product.prodname_actions %} workflow, you will first need to complete the following setup steps:
在创建 {% data variables.product.prodname_actions %} 工作流程之前,首先需要完成以下设置步骤:
1. Create an Azure Static Web App using the 'Other' option for deployment source. For more information, see "[Quickstart: Building your first static site in the Azure portal](https://docs.microsoft.com/azure/static-web-apps/get-started-portal)" in the Azure documentation.
1. 对部署源使用“Other其他”选项创建 Azure Static Web App。 有关详细信息,请参阅 Azure 文档中的“[快速入门:在 Azure 门户中构建第一个静态站点](https://docs.microsoft.com/azure/static-web-apps/get-started-portal)”。
2. Create a secret called `AZURE_STATIC_WEB_APPS_API_TOKEN` with the value of your static web app deployment token. For more information about how to find your deployment token, see "[Reset deployment tokens in Azure Static Web Apps](https://docs.microsoft.com/azure/static-web-apps/deployment-token-management)" in the Azure documentation.
2. 使用静态 Web 应用部署令牌的值创建名为 `AZURE_STATIC_WEB_APPS_API_TOKEN` 的机密。 有关如何查找部署令牌的详细信息,请参阅 Azure 文档中的“[在 Azure 静态 Web 应用中重置部署令牌](https://docs.microsoft.com/azure/static-web-apps/deployment-token-management)”。
## Creating the workflow
## 创建工作流程
Once you've completed the prerequisites, you can proceed with creating the workflow.
完成先决条件后,可以继续创建工作流程。
The following example workflow demonstrates how to build and deploy an Azure static web app when there is a push to the `main` branch or when a pull request targeting `main` is opened, synchronized, or reopened. The workflow also tears down the corresponding pre-production deployment when a pull request targeting `main` is closed.
以下示例工作流演示了在推送到 `main` 分支时,或者在打开、同步或重新打开面向 `main` 的拉取请求时,如何生成和部署 Azure 静态 Web 应用。 当面向 `main` 的拉取请求关闭时,工作流还会破坏相应的预生产部署。
Under the workflow `env` key, change the following values:
- `APP_LOCATION` to the location of your client code
- `API_LOCATION` to the location of your API source code. If `API_LOCATION` is not relevant, you can delete the variable and the lines where it is used.
- `APP_ARTIFACT_LOCATION` to the location of your client code build output
在工作流 `env` 键下,更改以下值:
- `APP_LOCATION` 更改为客户端代码的位置
- `API_LOCATION` 更改为 API 源代码的位置。 如果 `API_LOCATION` 不相关,则可以删除该变量以及使用它的行。
- `APP_ARTIFACT_LOCATION` 更改为客户端代码构建输出的位置
For more information about these values, see "[Build configuration for Azure Static Web Apps](https://docs.microsoft.com/azure/static-web-apps/build-configuration?tabs=github-actions)" in the Azure documentation.
有关这些值的详细信息,请参阅 Azure 文档中的“[ Azure Static Web Apps 生成配置](https://docs.microsoft.com/azure/static-web-apps/build-configuration?tabs=github-actions)”。
```yaml{:copy}
{% data reusables.actions.actions-not-certified-by-github-comment %}
@@ -107,10 +111,10 @@ jobs:
action: "close"
```
## Additional resources
## 其他资源
The following resources may also be useful:
以下资源也可能有用:
* For the original starter workflow, see [`azure-staticwebapp.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-staticwebapp.yml) in the {% data variables.product.prodname_actions %} `starter-workflows` repository.
* The action used to deploy the web app is the official Azure [`Azure/static-web-apps-deploy`](https://github.com/Azure/static-web-apps-deploy) action.
* For more examples of GitHub Action workflows that deploy to Azure, see the [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository.
* 对于原始初学者工作流,请参阅 {% data variables.product.prodname_actions %} `starter-workflows` 存储库中的 [`azure-staticwebapp.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-staticwebapp.yml)
* 用于部署 Web 应用的操作是官方 Azure [`Azure/static-web-apps-deploy`](https://github.com/Azure/static-web-apps-deploy) 操作。
* 有关部署到 Azure 的 GitHub 操作工作流的更多示例,请参阅 [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) 存储库。

View File

@@ -1,6 +1,6 @@
---
title: Deploying to Google Kubernetes Engine
intro: You can deploy to Google Kubernetes Engine as part of your continuous deployment (CD) workflows.
title: 部署到 Google Kubernetes Engine
intro: 您可以部署到 Google Kubernetes Engine 引擎,作为持续部署 (CD) 工作流程的一部分。
redirect_from:
- /actions/guides/deploying-to-google-kubernetes-engine
- /actions/deployment/deploying-to-google-kubernetes-engine
@@ -15,122 +15,121 @@ topics:
- Containers
- Google Kubernetes Engine
shortTitle: Deploy to Google Kubernetes Engine
ms.openlocfilehash: 0572a326d52654b256e0e1ad7fe9c9c4e9d547ac
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147409545'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 简介
## Introduction
本指南介绍如何使用 {% data variables.product.prodname_actions %} 构建容器化应用程序,将其推送到 Google 容器注册表 (GCR),以及要推送到 `main` 分支时将其部署到 Google Kubernetes Engine (GKE)。
This guide explains how to use {% data variables.product.prodname_actions %} to build a containerized application, push it to Google Container Registry (GCR), and deploy it to Google Kubernetes Engine (GKE) when there is a push to the `main` branch.
GKE 是 Google Cloud 的托管 Kubernetes 群集服务,可以在云中或您自己的数据中心中托管您的容器化工作负载。 有关详细信息,请参阅 [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine)。
GKE is a managed Kubernetes cluster service from Google Cloud that can host your containerized workloads in the cloud or in your own datacenter. For more information, see [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine).
{% ifversion fpt or ghec or ghes > 3.4 %}
{% ifversion fpt or ghec or ghae-issue-4856 or ghes > 3.4 %}
{% note %}
**Note**: {% data reusables.actions.about-oidc-short-overview %}
注意:{% data reusables.actions.about-oidc-short-overview %}
{% endnote %}
{% endif %}
## Prerequisites
## 先决条件
Before you proceed with creating the workflow, you will need to complete the following steps for your Kubernetes project. This guide assumes the root of your project already has a `Dockerfile` and a Kubernetes Deployment configuration file. For an example, see [google-github-actions](https://github.com/google-github-actions/setup-gcloud/tree/master/example-workflows/gke).
在继续创建工作流程之前,您需要完成 Kubernetes 项目的以下步骤。 本指南假定项目的根目录已有 `Dockerfile` Kubernetes 部署配置文件。 有关示例,请参阅 [google-github-actions](https://github.com/google-github-actions/setup-gcloud/tree/master/example-workflows/gke)
### Creating a GKE cluster
### 创建 GKE 群集
To create the GKE cluster, you will first need to authenticate using the `gcloud` CLI. For more information on this step, see the following articles:
要创建 GKE 群集,首先需要使用 `gcloud` CLI 进行身份验证。 有关此步骤的更多信息,请参阅以下文章:
- [`gcloud auth login`](https://cloud.google.com/sdk/gcloud/reference/auth/login)
- [`gcloud` CLI](https://cloud.google.com/sdk/gcloud/reference)
- [`gcloud` CLI and Cloud SDK](https://cloud.google.com/sdk/gcloud#the_gcloud_cli_and_cloud_sdk)
- [`gcloud` CLI Cloud SDK](https://cloud.google.com/sdk/gcloud#the_gcloud_cli_and_cloud_sdk)
For example:
例如:
{% raw %}
```bash{:copy}
$ gcloud container clusters create $GKE_CLUSTER \
--project=$GKE_PROJECT \
--zone=$GKE_ZONE
--project=$GKE_PROJECT \
--zone=$GKE_ZONE
```
{% endraw %}
### Enabling the APIs
### 启用 API
Enable the Kubernetes Engine and Container Registry APIs. For example:
启用 Kubernetes Engine Container Registry API。 例如:
{% raw %}
```bash{:copy}
$ gcloud services enable \
containerregistry.googleapis.com \
container.googleapis.com
containerregistry.googleapis.com \
container.googleapis.com
```
{% endraw %}
### Configuring a service account and storing its credentials
### 配置服务帐户并存储其凭据
This procedure demonstrates how to create the service account for your GKE integration. It explains how to create the account, add roles to it, retrieve its keys, and store them as a base64-encoded encrypted repository secret named `GKE_SA_KEY`.
此程序显示如何为您的 GKE 集成创建服务帐户。 它说明了如何创建帐户、向其添加角色、检索其密钥,以及将它们存储为名为 `GKE_SA_KEY` 以 base64 编码的加密存储库机密。
1. Create a new service account:
{% raw %}
1. 创建新服务帐户:{% raw %}
```
$ gcloud iam service-accounts create $SA_NAME
```
{% endraw %}
1. Retrieve the email address of the service account you just created:
{% raw %}
1. 检索你刚刚创建的服务帐户的电子邮件地址:{% raw %}
```
$ gcloud iam service-accounts list
```
{% endraw %}
1. Add roles to the service account. Note: Apply more restrictive roles to suit your requirements.
1. 向服务帐户添加角色。 注意:应用限制更严格的角色以满足您的要求。
{% raw %}
```
$ gcloud projects add-iam-policy-binding $GKE_PROJECT \
--member=serviceAccount:$SA_EMAIL \
--role=roles/container.admin
--member=serviceAccount:$SA_EMAIL \
--role=roles/container.admin
$ gcloud projects add-iam-policy-binding $GKE_PROJECT \
--member=serviceAccount:$SA_EMAIL \
--role=roles/storage.admin
--member=serviceAccount:$SA_EMAIL \
--role=roles/storage.admin
$ gcloud projects add-iam-policy-binding $GKE_PROJECT \
--member=serviceAccount:$SA_EMAIL \
--role=roles/container.clusterViewer
--member=serviceAccount:$SA_EMAIL \
--role=roles/container.clusterViewer
```
{% endraw %}
1. Download the JSON keyfile for the service account:
{% raw %}
1. 下载服务帐户的 JSON 密钥文件:{% raw %}
```
$ gcloud iam service-accounts keys create key.json --iam-account=$SA_EMAIL
```
{% endraw %}
1. Store the service account key as a secret named `GKE_SA_KEY`:
{% raw %}
1. 将服务帐户密钥存储为名为 `GKE_SA_KEY` 的机密:{% raw %}
```
$ export GKE_SA_KEY=$(cat key.json | base64)
```
{% endraw %}
For more information about how to store a secret, see "[Encrypted secrets](/actions/security-guides/encrypted-secrets)."
{% endraw %} 有关如何存储机密的详细信息,请参阅“[加密机密](/actions/security-guides/encrypted-secrets)”。
### Storing your project name
### 存储项目名称
Store the name of your project as a secret named `GKE_PROJECT`. For more information about how to store a secret, see "[Encrypted secrets](/actions/security-guides/encrypted-secrets)."
将项目的名称存储为名为 `GKE_PROJECT` 的机密。 有关如何存储机密的详细信息,请参阅“[加密机密](/actions/security-guides/encrypted-secrets)”。
### (Optional) Configuring kustomize
Kustomize is an optional tool used for managing YAML specs. After creating a `kustomization` file, the workflow below can be used to dynamically set fields of the image and pipe in the result to `kubectl`. For more information, see [kustomize usage](https://github.com/kubernetes-sigs/kustomize#usage).
### (可选)配置 kustomize
Kustomize 是用于管理 YAML 规范的可选工具。 在创建 `kustomization` 文件之后, 下面的工作流可用于将结果中的图像和管道字段动态设置为 `kubectl`。 有关详细信息,请参阅 [Kustomize 用法](https://github.com/kubernetes-sigs/kustomize#usage)
### (Optional) Configure a deployment environment
### (可选)配置部署环境
{% data reusables.actions.about-environments %}
## Creating the workflow
## 创建工作流程
Once you've completed the prerequisites, you can proceed with creating the workflow.
完成先决条件后,可以继续创建工作流程。
The following example workflow demonstrates how to build a container image and push it to GCR. It then uses the Kubernetes tools (such as `kubectl` and `kustomize`) to pull the image into the cluster deployment.
下面的示例工作流程演示如何生成容器映像并推送到 GCR。 然后,它使用 Kubernetes 工具(如 `kubectl` `kustomize`)将映像拉取入群集部署。
Under the `env` key, change the value of `GKE_CLUSTER` to the name of your cluster, `GKE_ZONE` to your cluster zone, `DEPLOYMENT_NAME` to the name of your deployment, and `IMAGE` to the name of your image.
`env` 密钥下,将值 `GKE_CLUSTER` 更改为群集的名称,将 `GKE_ZONE` 更改为群集区域,将 `DEPLOYMENT_NAME` 更改为部署的名称以及将 `IMAGE` 更改为映像的名称。
{% data reusables.actions.delete-env-key %}
@@ -210,11 +209,11 @@ jobs:
kubectl get services -o wide
```
## Additional resources
## 其他资源
For more information on the tools used in these examples, see the following documentation:
有关这些示例中使用的工具的详细信息,请参阅以下文档:
* For the full starter workflow, see the ["Build and Deploy to GKE" workflow](https://github.com/actions/starter-workflows/blob/main/deployments/google.yml).
* For more starter workflows and accompanying code, see Google's [{% data variables.product.prodname_actions %} example workflows](https://github.com/google-github-actions/setup-gcloud/tree/master/example-workflows/).
* The Kubernetes YAML customization engine: [Kustomize](https://kustomize.io/).
* "[Deploying a containerized web application](https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app)" in the Google Kubernetes Engine documentation.
* 有关完整的初学者工作流,请参阅[“生成并部署到 GKE”工作流](https://github.com/actions/starter-workflows/blob/main/deployments/google.yml)
* 有关更多初学者工作流和随附的代码,请参阅 Google [{% data variables.product.prodname_actions %} 示例工作流](https://github.com/google-github-actions/setup-gcloud/tree/master/example-workflows/)
* Kubernetes YAML 自定义引擎:[Kustomize](https://kustomize.io/)
* Google Kubernetes Engine 文档中的“[部署容器化 Web 应用程序](https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app)”。

View File

@@ -1,7 +1,7 @@
---
title: 'Using concurrency, expressions, and a test matrix'
shortTitle: 'Use concurrency, expressions, and a test matrix'
intro: 'How to use advanced {% data variables.product.prodname_actions %} features for continuous integration (CI).'
title: 使用并发、表达式和测试矩阵
shortTitle: 'Using concurrency, expressions, and a test matrix'
intro: '如何使用高级 {% data variables.product.prodname_actions %} 功能进行持续集成 (CI)'
versions:
fpt: '*'
ghes: '>= 3.5'
@@ -10,40 +10,34 @@ versions:
type: how_to
topics:
- Workflows
ms.openlocfilehash: f4edac59fdbcc8f8825a51e25b737b94b17128b0
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147496578'
---
{% data reusables.actions.enterprise-github-hosted-runners %}
## Example overview
## 示例概述
{% data reusables.actions.example-workflow-intro-ci %} When this workflow is triggered, it tests your code using a matrix of test combinations with `npm test`.
{% data reusables.actions.example-workflow-intro-ci %}触发此工作流时,它将使用 `npm test` 的测试组合矩阵来测试代码。
{% data reusables.actions.example-diagram-intro %}
![Overview diagram of workflow steps](/assets/images/help/images/overview-actions-using-concurrency-expressions-and-a-test-matrix.png)
![工作流步骤概述图](/assets/images/help/images/overview-actions-using-concurrency-expressions-and-a-test-matrix.png)
## Features used in this example
## 此示例中使用的功能
{% data reusables.actions.example-table-intro %}
| **Feature** | **Implementation** |
| **功能** | **实现** |
| --- | --- |
{% data reusables.actions.workflow-dispatch-table-entry %}
{% data reusables.actions.pull-request-table-entry %}
{% data reusables.actions.cron-table-entry %}
{% data reusables.actions.permissions-table-entry %}
{% data reusables.actions.concurrency-table-entry %}
| Running the job on different runners, depending on the repository: | [`runs-on`](/actions/using-jobs/choosing-the-runner-for-a-job)|
{% data reusables.actions.if-conditions-table-entry %}
| Using a matrix to create different test configurations: | [`matrix`](/actions/using-jobs/using-a-build-matrix-for-your-jobs)|
{% data reusables.actions.checkout-action-table-entry %}
{% data reusables.actions.setup-node-table-entry %}
| Caching dependencies: | [`actions/cache`](/actions/advanced-guides/caching-dependencies-to-speed-up-workflows)|
| Running tests on the runner: | `npm test`|
{% data reusables.actions.workflow-dispatch-table-entry %} {% data reusables.actions.pull-request-table-entry %} {% data reusables.actions.cron-table-entry %} {% data reusables.actions.permissions-table-entry %} {% data reusables.actions.concurrency-table-entry %} | 根据存储库的不同,在不同的运行器上运行作业: | [`runs-on`](/actions/using-jobs/choosing-the-runner-for-a-job)| {% data reusables.actions.if-conditions-table-entry %} | 使用矩阵创建不同的测试配置: | [`matrix`](/actions/using-jobs/using-a-build-matrix-for-your-jobs)| {% data reusables.actions.checkout-action-table-entry %} {% data reusables.actions.setup-node-table-entry %} | 缓存依赖项:| [`actions/cache`](/actions/advanced-guides/caching-dependencies-to-speed-up-workflows)| | 在运行器上运行测试:| `npm test`|
## Example workflow
## 示例工作流
{% data reusables.actions.example-docs-engineering-intro %} [`test.yml`](https://github.com/github/docs/blob/main/.github/workflows/test.yml).
{% data reusables.actions.example-docs-engineering-intro %} [`test.yml`](https://github.com/github/docs/blob/main/.github/workflows/test.yml)
{% data reusables.actions.note-understanding-example %}
@@ -112,7 +106,7 @@ jobs:
# NOT clone them initially and instead, include them manually
# only for the test groups that we know need the files.
lfs: {% raw %}${{ matrix.test-group == 'content' }}{% endraw %}
# Enables cloning the Early Access repo later with the relevant {% data variables.product.pat_generic %}
# Enables cloning the Early Access repo later with the relevant PAT
persist-credentials: 'false'
- name: Figure out which docs-early-access branch to checkout, if internal repo
@@ -211,15 +205,15 @@ jobs:
</tbody>
</table>
## Understanding the example
## 了解示例
 {% data reusables.actions.example-explanation-table-intro %}
{% data reusables.actions.example-explanation-table-intro %}
<table style="table-layout: fixed;">
<thead>
<tr>
<th style="width:60%"><b>Code</b></th>
<th style="width:40%"><b>Explanation</b></th>
<th style="width:60%"><b>代码</b></th>
<th style="width:40%"><b>解释</b></th>
</tr>
</thead>
<tbody>
@@ -244,7 +238,7 @@ on:
</td>
<td>
The `on` keyword lets you define the events that trigger when the workflow is run. You can define multiple events here. For more information, see "[Triggering a workflow](/actions/using-workflows/triggering-a-workflow#using-events-to-trigger-workflows)."
通过 `on` 关键字,可以定义运行工作流时触发的事件。 可在此处定义多个事件。 有关详细信息,请参阅“[触发工作流](/actions/using-workflows/triggering-a-workflow#using-events-to-trigger-workflows)”。
</td>
</tr>
<tr>
@@ -256,7 +250,7 @@ The `on` keyword lets you define the events that trigger when the workflow is ru
</td>
<td>
Add the `workflow_dispatch` event if you want to be able to manually run this workflow in the UI. For more information, see [`workflow_dispatch`](/actions/reference/events-that-trigger-workflows#workflow_dispatch).
如果要在 UI 中手动运行此工作流,请添加 `workflow_dispatch` 事件。 有关详细信息,请参阅 [`workflow_dispatch`](/actions/reference/events-that-trigger-workflows#workflow_dispatch)
</td>
</tr>
<tr>
@@ -268,7 +262,7 @@ Add the `workflow_dispatch` event if you want to be able to manually run this wo
</td>
<td>
Add the `pull_request` event, so that the workflow runs automatically every time a pull request is created or updated. For more information, see [`pull_request`](/actions/using-workflows/events-that-trigger-workflows#pull_request).
添加 `pull_request` 事件,以便每次创建或更新拉取请求时,工作流都会自动运行。 有关详细信息,请参阅 [`pull_request`](/actions/using-workflows/events-that-trigger-workflows#pull_request)
</td>
</tr>
<tr>
@@ -282,7 +276,7 @@ Add the `pull_request` event, so that the workflow runs automatically every time
</td>
<td>
Add the `push` event, so that the workflow runs automatically every time a commit is pushed to a branch matching the filter `main`. For more information, see [`push`](/actions/using-workflows/events-that-trigger-workflows#push).
添加 `push` 事件,以便每次将提交推送到匹配筛选器 `main` 的分支时,工作流都会自动运行。 有关详细信息,请参阅 [`push`](/actions/using-workflows/events-that-trigger-workflows#push)
</td>
</tr>
<tr>
@@ -296,7 +290,7 @@ permissions:
</td>
<td>
Modifies the default permissions granted to `GITHUB_TOKEN`. This will vary depending on the needs of your workflow. For more information, see "[Assigning permissions to jobs](/actions/using-jobs/assigning-permissions-to-jobs)."
修改授予 `GITHUB_TOKEN` 的默认权限。 这将因工作流的需求而异。 有关详细信息,请参阅“[为作业分配权限](/actions/using-jobs/assigning-permissions-to-jobs)”。
</td>
</tr>
<tr>
@@ -310,7 +304,7 @@ concurrency:
</td>
<td>
Creates a concurrency group for specific events, and uses the `||` operator to define fallback values. For more information, see "[Using concurrency](/actions/using-jobs/using-concurrency)."
为特定事件创建并发组,并使用 `||` 运算符定义回退值。 有关详细信息,请参阅“[使用并发](/actions/using-jobs/using-concurrency)”。
</td>
</tr>
<tr>
@@ -322,7 +316,7 @@ Creates a concurrency group for specific events, and uses the `||` operator to d
</td>
<td>
Cancels any currently running job or workflow in the same concurrency group.
取消同一并发组中任何当前正在运行的作业或工作流。
</td>
</tr>
<tr>
@@ -334,7 +328,7 @@ jobs:
</td>
<td>
Groups together all the jobs that run in the workflow file.
将工作流文件中运行的所有作业组合在一起。
</td>
</tr>
<tr>
@@ -346,7 +340,7 @@ Groups together all the jobs that run in the workflow file.
</td>
<td>
Defines a job with the ID `test` that is stored within the `jobs` key.
定义 ID `test` 的作业,该作业存储在 `jobs` 键中。
</td>
</tr>
<tr>
@@ -358,7 +352,7 @@ Defines a job with the ID `test` that is stored within the `jobs` key.
</td>
<td>
Configures the job to run on a {% data variables.product.prodname_dotcom %}-hosted runner or a self-hosted runner, depending on the repository running the workflow. In this example, the job will run on a self-hosted runner if the repository is named `docs-internal` and is within the `github` organization. If the repository doesn't match this path, then it will run on an `ubuntu-latest` runner hosted by {% data variables.product.prodname_dotcom %}. For more information on these options see "[Choosing the runner for a job](/actions/using-jobs/choosing-the-runner-for-a-job)."
根据运行工作流的存储库,将作业配置为在 {% data variables.product.prodname_dotcom %} 托管的运行器或自托管运行器上运行。 在此示例中,如果存储库名为 `docs-internal` 且位于 `github` 组织内,则作业将在自托管运行器上运行。 如果存储库与此路径不匹配,则其会在由 {% data variables.product.prodname_dotcom %} 托管的 `ubuntu-latest` 运行器上运行。 有关这些选项的详细信息,请参阅“[为作业选择运行器](/actions/using-jobs/choosing-the-runner-for-a-job)”。
</td>
</tr>
<tr>
@@ -370,7 +364,7 @@ Configures the job to run on a {% data variables.product.prodname_dotcom %}-host
</td>
<td>
Sets the maximum number of minutes to let the job run before it is automatically canceled. For more information, see [`timeout-minutes`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes).
设置作业在自动取消之前运行的最大分钟数。 有关详细信息,请参阅 [`timeout-minutes`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes)
</td>
</tr>
<tr>
@@ -381,7 +375,7 @@ Sets the maximum number of minutes to let the job run before it is automatically
```
</td>
<td>
This section defines the build matrix for your jobs.
本部分定义作业的生成矩阵。
</td>
</tr>
<tr>
@@ -393,7 +387,7 @@ Sets the maximum number of minutes to let the job run before it is automatically
</td>
<td>
Setting `fail-fast` to `false` prevents {% data variables.product.prodname_dotcom %} from cancelling all in-progress jobs if any matrix job fails.
`fail-fast` 设置为 `false` 可以防止 {% data variables.product.prodname_dotcom %} 在矩阵作业失败时取消所有正在进行的作业。
</td>
</tr>
<tr>
@@ -416,7 +410,7 @@ Setting `fail-fast` to `false` prevents {% data variables.product.prodname_dotco
</td>
<td>
Creates a matrix named `test-group`, with an array of test groups. These values match the names of test groups that will be run by `npm test`.
创建名为 `test-group` 的矩阵,其中包含测试组数组。 这些值与将由 `npm test` 运行的测试组的名称匹配。
</td>
</tr>
<tr>
@@ -428,7 +422,7 @@ Creates a matrix named `test-group`, with an array of test groups. These values
</td>
<td>
Groups together all the steps that will run as part of the `test` job. Each job in a workflow has its own `steps` section.
将作为 `test` 作业一部分运行的所有步骤组合在一起。 工作流中的每个作业都有其自己的 `steps` 部分。
</td>
</tr>
<tr>
@@ -444,7 +438,7 @@ Groups together all the steps that will run as part of the `test` job. Each job
</td>
<td>
The `uses` keyword tells the job to retrieve the action named `actions/checkout`. This is an action that checks out your repository and downloads it to the runner, allowing you to run actions against your code (such as testing tools). You must use the checkout action any time your workflow will run against the repository's code or you are using an action defined in the repository. Some extra options are provided to the action using the `with` key.
`uses` 关键字指示作业检索名为 `actions/checkout` 的操作。 这是检出仓库并将其下载到运行器的操作,允许针对您的代码运行操作(例如测试工具)。 只要工作流程针对仓库的代码运行,或者您使用仓库中定义的操作,您都必须使用检出操作。 使用 `with` 键为操作提供了一些额外的选项。
</td>
</tr>
<tr>
@@ -484,7 +478,7 @@ The `uses` keyword tells the job to retrieve the action named `actions/checkout`
</td>
<td>
If the current repository is the `github/docs-internal` repository, this step uses the `actions/github-script` action to run a script to check if there is a branch called `docs-early-access`.
如果当前存储库是 `github/docs-internal` 存储库,此步骤将使用 `actions/github-script` 操作运行脚本,检查是否存在名为 `docs-early-access` 的分支。
</td>
</tr>
<tr>
@@ -503,7 +497,7 @@ If the current repository is the `github/docs-internal` repository, this step us
</td>
<td>
If the current repository is the `github/docs-internal` repository, this step checks out the branch from the `github/docs-early-access` that was identified in the previous step.
如果当前存储库是 `github/docs-internal` 存储库,此步骤将从上一步中标识的 `github/docs-early-access` 签出分支。
</tr>
<tr>
<td>
@@ -520,7 +514,7 @@ If the current repository is the `github/docs-internal` repository, this step ch
</td>
<td>
If the current repository is the `github/docs-internal` repository, this step uses the `run` keyword to execute shell commands to move the `docs-early-access` repository's folders into the main repository's folders.
如果当前存储库是 `github/docs-internal` 存储库,则此步骤将使用 `run` 关键字执行 shell 命令,将 `docs-early-access` 存储库的文件夹移动到主存储库的文件夹中。
</td>
</tr>
<tr>
@@ -533,7 +527,7 @@ If the current repository is the `github/docs-internal` repository, this step us
</td>
<td>
This step runs a command to check out LFS objects from the repository.
此步骤运行一个命令,从存储库签出 LFS 对象。
</td>
</tr>
<tr>
@@ -552,7 +546,7 @@ This step runs a command to check out LFS objects from the repository.
</td>
<td>
This step uses the `trilom/file-changes-action` action to gather the files changed in the pull request, so they can be analyzed in the next step. This example is pinned to a specific version of the action, using the `a6ca26c14274c33b15e6499323aac178af06ad4b` SHA.
此步骤使用 `trilom/file-changes-action` 操作收集拉取请求中更改的文件,以便在下一步中分析它们。 此示例使用 `a6ca26c14274c33b15e6499323aac178af06ad4b` SHA 固定到操作的特定版本。
</td>
</tr>
<tr>
@@ -566,7 +560,7 @@ This step uses the `trilom/file-changes-action` action to gather the files chang
</td>
<td>
This step runs a shell command that uses an output from the previous step to create a file containing the list of files changed in the pull request.
此步骤运行 shell 命令,该命令使用上一步的输出创建文件,其中包含在拉取请求中更改的文件列表。
</td>
</tr>
<tr>
@@ -582,7 +576,7 @@ This step runs a shell command that uses an output from the previous step to cre
</td>
<td>
This step uses the `actions/setup-node` action to install the specified version of the `node` software package on the runner, which gives you access to the `npm` command.
此步骤使用 `actions/setup-node` 操作在运行器上安装指定版本的 `node` 软件包,以便你可访问 `npm` 命令。
</td>
</tr>
<tr>
@@ -595,7 +589,7 @@ This step uses the `actions/setup-node` action to install the specified version
</td>
<td>
This step runs the `npm ci` shell command to install the npm software packages for the project.
此步骤运行 `npm ci` shell 命令来安装项目的 npm 软件包。
</td>
</tr>
<tr>
@@ -611,7 +605,7 @@ This step runs the `npm ci` shell command to install the npm software packages f
</td>
<td>
This step uses the `actions/cache` action to cache the Next.js build, so that the workflow will attempt to retrieve a cache of the build, and not rebuild it from scratch every time. For more information, see "[Caching dependencies to speed up workflows](/actions/using-workflows/caching-dependencies-to-speed-up-workflows)."
此步骤使用 `actions/cache` 操作来缓存 Next.js 生成,以便工作流将尝试检索生成的缓存,而不是每次都从头重新生成它。 有关详细信息,请参阅“[缓存依赖项以加快工作流](/actions/using-workflows/caching-dependencies-to-speed-up-workflows)”。
</td>
</tr>
<tr>
@@ -624,7 +618,7 @@ This step uses the `actions/cache` action to cache the Next.js build, so that th
</td>
<td>
This step runs the build script.
此步骤运行生成脚本。
</td>
</tr>
<tr>
@@ -640,12 +634,12 @@ This step runs the build script.
</td>
<td>
This step runs the tests using `npm test`, and the test matrix provides a different value for {% raw %}`${{ matrix.test-group }}`{% endraw %} for each job in the matrix. It uses the `DIFF_FILE` environment variable to know which files have changed, and uses the `CHANGELOG_CACHE_FILE_PATH` environment variable for the changelog cache file.
此步骤使用 `npm test` 运行测试,测试矩阵为矩阵中的每个作业提供不同的 {% raw %}`${{ matrix.test-group }}`{% endraw %} 值。 它使用 `DIFF_FILE` 环境变量来识别已更改的文件,并将 `CHANGELOG_CACHE_FILE_PATH` 环境变量用于 changelog 缓存文件。
</td>
</tr>
</tbody>
</table>
## Next steps
## 后续步骤
{% data reusables.actions.learning-actions %}

View File

@@ -1,7 +1,6 @@
---
title: Configuring the self-hosted runner application as a service
shortTitle: Run the runner app as a service
intro: You can configure the self-hosted runner application as a service to automatically start the runner application when the machine starts.
title: 将自托管的运行应用程序配置为服务
intro: 您可以将自托管的运行器应用程序配置为服务,以在机器启动时自动启动运行器应用程序。
redirect_from:
- /actions/automating-your-workflow-with-github-actions/configuring-the-self-hosted-runner-application-as-a-service
versions:
@@ -11,31 +10,24 @@ versions:
ghec: '*'
type: tutorial
defaultPlatform: linux
shortTitle: Run runner app on startup
ms.openlocfilehash: de50bfe5caa8072bf5262c65a4fa471bff3c2106
ms.sourcegitcommit: 399f27841ff88f14a3880d351c282db85182ac25
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 07/13/2022
ms.locfileid: '147092924'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
{% capture service_first_step %}1. 如果自托管运行器应用程序当前正在运行,请停止该应用程序。{% endcapture %} {% capture service_non_windows_intro_shell %}在运行器计算机上,在安装了自托管运行器应用程序的目录中打开 shell。 使用以下命令安装和管理自托管运行器服务。{% endcapture %} {% capture service_nonwindows_intro %}必须先将运行器添加到 {% data variables.product.product_name %},然后才能将自托管运行器应用程序配置为服务。 有关详细信息,请参阅“[添加自托管运行器](/github/automating-your-workflow-with-github-actions/adding-self-hosted-runners)”。{% endcapture %} {% capture service_win_name %}actions.runner.*{% endcapture %}
{% capture service_first_step %}1. Stop the self-hosted runner application if it is currently running.{% endcapture %}
{% capture service_non_windows_intro_shell %}On the runner machine, open a shell in the directory where you installed the self-hosted runner application. Use the commands below to install and manage the self-hosted runner service.{% endcapture %}
{% capture service_nonwindows_intro %}
{% note %}
**Note:** You must add a runner to {% data variables.product.product_name %} before you can configure the self-hosted runner application as a service.
For more information, see "[Adding self-hosted runners](/github/automating-your-workflow-with-github-actions/adding-self-hosted-runners)."
{% endnote %}
{% endcapture %}
{% capture service_win_name %}actions.runner.*{% endcapture %}
{% linux %}
{{ service_nonwindows_intro }}
For Linux systems that use `systemd`, you can use the `svc.sh` script that is created after successfully adding the runner to install and manage using the application as a service.
对于使用 `systemd` 的 Linux 系统,你可使用随自托管运行器应用程序分发的 `svc.sh` 脚本,将应用程序作为服务进行安装和管理。
{{ service_non_windows_intro_shell }}
@@ -45,13 +37,13 @@ For Linux systems that use `systemd`, you can use the `svc.sh` script that is cr
{% note %}
**Note:** Configuring the self-hosted runner application as a service on Windows is part of the application configuration process. If you have already configured the self-hosted runner application but did not choose to configure it as a service, you must remove the runner from {% data variables.product.prodname_dotcom %} and re-configure the application. When you re-configure the application, choose the option to configure the application as a service.
注意:在 Windows 上将自托管运行器应用程序配置为服务是应用程序配置过程的一部分。 如果已配置自托管运行器应用程序,但没有选择将其配置为服务,则必须从 {% data variables.product.prodname_dotcom %} 中删除运行器并重新配置应用程序。 当您重新配置应用程序时,选择将应用程序配置为服务的选项。
For more information, see "[Removing self-hosted runners](/actions/automating-your-workflow-with-github-actions/removing-self-hosted-runners)" and "[Adding self-hosted runners](/actions/automating-your-workflow-with-github-actions/adding-self-hosted-runners)."
有关详细信息,请参阅“[删除自托管运行器](/actions/automating-your-workflow-with-github-actions/removing-self-hosted-runners)”和“[添加自托管运行器](/actions/automating-your-workflow-with-github-actions/adding-self-hosted-runners)”。
{% endnote %}
You can manage the runner service in the Windows **Services** application, or you can use PowerShell to run the commands below.
可以在 Windows Services 应用程序中管理运行器服务,也可以使用 PowerShell 来运行下面的命令。
{% endwindows %}
@@ -65,113 +57,105 @@ You can manage the runner service in the Windows **Services** application, or yo
{% linux %}
## Installing the service
## <a name="installing-the-service"></a>安装服务
{{ service_first_step }}
1. Install the service with the following command:
1. 使用以下命令安装服务:
```shell
sudo ./svc.sh install
```
1. Alternatively, the command takes an optional `user` argument to install the service as a different user.
1. 或者,该命令采用可选的 `user` 参数,以其他用户的身份安装服务。
```shell
./svc.sh install USERNAME
./svc.sh install <em>USERNAME</em>
```
{% endlinux %}
{% mac %}
## Installing the service
## <a name="installing-the-service"></a>安装服务
{{ service_first_step }}
1. Install the service with the following command:
1. 使用以下命令安装服务:
```shell
./svc.sh install
```
{% endmac %}
## Starting the service
## <a name="starting-the-service"></a>启动服务
Start the service with the following command:
使用以下命令启动服务:
{% linux %}
```shell
sudo ./svc.sh start
```
{% endlinux %}
{% windows %}
{% endlinux %} {% windows %}
```shell
Start-Service "{{ service_win_name }}"
```
{% endwindows %}
{% mac %}
{% endwindows %} {% mac %}
```shell
./svc.sh start
```
{% endmac %}
## Checking the status of the service
## <a name="checking-the-status-of-the-service"></a>检查服务状态
Check the status of the service with the following command:
使用以下命令检查服务状态:
{% linux %}
```shell
sudo ./svc.sh status
```
{% endlinux %}
{% windows %}
{% endlinux %} {% windows %}
```shell
Get-Service "{{ service_win_name }}"
```
{% endwindows %}
{% mac %}
{% endwindows %} {% mac %}
```shell
./svc.sh status
```
{% endmac %}
For more information on viewing the status of your self-hosted runner, see "[Monitoring and troubleshooting self-hosted runners](/actions/hosting-your-own-runners/monitoring-and-troubleshooting-self-hosted-runners)."
有关查看自托管运行器状态的更多信息,请参阅“[对自托管运行器进行监视和故障排除](/actions/hosting-your-own-runners/monitoring-and-troubleshooting-self-hosted-runners)”。
## Stopping the service
## <a name="stopping-the-service"></a>停止服务
Stop the service with the following command:
使用以下命令停止服务:
{% linux %}
```shell
sudo ./svc.sh stop
```
{% endlinux %}
{% windows %}
{% endlinux %} {% windows %}
```shell
Stop-Service "{{ service_win_name }}"
```
{% endwindows %}
{% mac %}
{% endwindows %} {% mac %}
```shell
./svc.sh stop
```
{% endmac %}
## Uninstalling the service
## <a name="uninstalling-the-service"></a>卸载服务
1. Stop the service if it is currently running.
1. Uninstall the service with the following command:
1. 停止正在运行的服务。
1. 使用以下命令卸载服务:
{% linux %}
```shell
sudo ./svc.sh uninstall
```
{% endlinux %}
{% windows %}
{% endlinux %} {% windows %}
```shell
Remove-Service "{{ service_win_name }}"
```
{% endwindows %}
{% mac %}
{% endwindows %} {% mac %}
```shell
./svc.sh uninstall
```
@@ -180,16 +164,16 @@ Stop-Service "{{ service_win_name }}"
{% linux %}
## Customizing the self-hosted runner service
## <a name="customizing-the-self-hosted-runner-service"></a>自定义自托管运行器服务
If you don't want to use the above default `systemd` service configuration, you can create a customized service or use whichever service mechanism you prefer. Consider using the `serviced` template at `actions-runner/bin/actions.runner.service.template` as a reference. If you use a customized service, the self-hosted runner service must always be invoked using the `runsvc.sh` entry point.
如果你不想使用上述默认 `systemd` 服务配置,可创建自定义服务或使用喜欢的服务机制。 请考虑使用 `actions-runner/bin/actions.runner.service.template` 中的 `serviced` 模板作为参考。 如果使用自定义服务,必须始终使用 `runsvc.sh` 入口点来调用自托管运行器服务。
{% endlinux %}
{% mac %}
## Customizing the self-hosted runner service
## <a name="customizing-the-self-hosted-runner-service"></a>自定义自托管运行器服务
If you don't want to use the above default launchd service configuration, you can create a customized service or use whichever service mechanism you prefer. Consider using the `plist` template at `actions-runner/bin/actions.runner.plist.template` as a reference. If you use a customized service, the self-hosted runner service must always be invoked using the `runsvc.sh` entry point.
如果您不想使用上述默认 launchd 服务配置,您可以创建自定义服务或使用您喜欢的服务机制。 请考虑使用 `actions-runner/bin/actions.runner.plist.template` 中的 `plist` 模板作为参考。 如果使用自定义服务,必须始终使用 `runsvc.sh` 入口点来调用自托管运行器服务。
{% endmac %}

View File

@@ -1,6 +1,6 @@
---
title: Monitoring and troubleshooting self-hosted runners
intro: You can monitor your self-hosted runners to view their activity and diagnose common issues.
title: 对自托管运行程序进行监视和故障排除
intro: 您可以监控自托管运行器,查看它们的活动并诊断常见问题。
redirect_from:
- /actions/hosting-your-own-runners/checking-the-status-of-self-hosted-runners
- /github/automating-your-workflow-with-github-actions/checking-the-status-of-self-hosted-runners
@@ -11,119 +11,117 @@ versions:
ghae: '*'
ghec: '*'
type: tutorial
miniTocMaxHeadingLevel: 3
defaultPlatform: linux
shortTitle: Monitor & troubleshoot
ms.openlocfilehash: 57ca9cad51c1936171fcadd73497cf313dd86dd7
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147065632'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## Checking the status of a self-hosted runner
## 检查自托管运行器的状态
{% data reusables.actions.self-hosted-runner-management-permissions-required %}
{% data reusables.actions.self-hosted-runner-navigate-repo-and-org %}
{% data reusables.organizations.settings-sidebar-actions-runners %}
1. Under "Runners", you can view a list of registered runners, including the runner's name, labels, and status.
{% data reusables.actions.self-hosted-runner-navigate-repo-and-org %} {% data reusables.organizations.settings-sidebar-actions-runners %}
1. 在“运行器”下,可以查看已注册运行器的列表,包括运行器的名称、标签和状态。
The status can be one of the following:
状态可以是下列其中一项:
* **Idle**: The runner is connected to {% data variables.product.product_name %} and is ready to execute jobs.
* **Active**: The runner is currently executing a job.
* **Offline**: The runner is not connected to {% data variables.product.product_name %}. This could be because the machine is offline, the self-hosted runner application is not running on the machine, or the self-hosted runner application cannot communicate with {% data variables.product.product_name %}.
* 空闲:运行器已连接到 {% data variables.product.product_name %},并已准备好执行作业。
* 活动:运行器当前正在执行作业。
* 脱机:运行器未连接到 {% data variables.product.product_name %}。 这可能是因为机器处于离线状态,自托管运行器应用程序未在机器上运行,或者自托管运行器应用程序无法与 {% data variables.product.product_name %} 通信。
## Troubleshooting network connectivity
## 网络连接疑难解答
### Checking self-hosted runner network connectivity
### 检查自托管运行器网络连接
You can use the self-hosted runner application's `run` script with the `--check` parameter to check that a self-hosted runner can access all required network services on {% data variables.location.product_location %}.
可以结合使用自托管运行器应用程序的 `run` 脚本与 `--check` 参数,以检查自托管运行器是否可以访问 {% data variables.product.product_location %} 上所有必需的网络服务。
In addition to `--check`, you must provide two arguments to the script:
除了 `--check` 外,还必须为脚本提供两个参数:
* `--url` with the URL to your {% data variables.product.company_short %} repository, organization, or enterprise. For example, `--url https://github.com/octo-org/octo-repo`.
* `--pat` with the value of a {% data variables.product.pat_v1 %}, which must have the `workflow` scope{% ifversion pat-v2%}, or a {% data variables.product.pat_v2 %} with workflows read and write access {% endif %}. For example, `--pat ghp_abcd1234`. For more information, see "[Creating a {% data variables.product.pat_generic %}](/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)."
* `--url`,其中包含指向 {% data variables.product.company_short %} 存储库、组织或企业的 URL。 例如,`--url https://github.com/octo-org/octo-repo`
* `--pat`,其中包含必须具有 `workflow` 作用域的个人访问令牌的值。 例如,`--pat ghp_abcd1234`。 有关详细信息,请参阅“[创建个人访问令牌](/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)”。
For example:
例如:
{% mac %}
{% data reusables.actions.self-hosted-runner-check-mac-linux %}
{% endmac %}
{% linux %}
{% endmac %} {% linux %}
{% data reusables.actions.self-hosted-runner-check-mac-linux %}
{% endlinux %}
{% windows %}
{% endlinux %} {% windows %}
```shell
run.cmd --check --url https://github.com/YOUR-ORG/YOUR-REPO --pat GHP_ABCD1234
run.cmd --check --url <em>https://github.com/octo-org/octo-repo</em> --pat <em>ghp_abcd1234</em>
```
{% endwindows %}
The script tests each service, and outputs either a `PASS` or `FAIL` for each one. If you have any failing checks, you can see more details on the problem in the log file for the check. The log files are located in the `_diag` directory where you installed the runner application, and the path of the log file for each check is shown in the console output of the script.
该脚本测试每项服务,并为每项服务输出 `PASS` `FAIL`。 如有任何失败的检查,您可以在日志文件中看到更多关于问题的详细信息。 日志文件位于安装了运行器应用程序的 `_diag` 目录中,每个检查的日志文件的路径显示在脚本的控制台输出中。
If you have any failing checks, you should also verify that your self-hosted runner machine meets all the communication requirements. For more information, see "[About self-hosted runners](/actions/hosting-your-own-runners/about-self-hosted-runners#communication-requirements)."
如有任何失败的检查,您也应该验证您自己托管的运行器是否符合所有通信要求。 有关详细信息,请参阅[关于自承载运行器](/actions/hosting-your-own-runners/about-self-hosted-runners#communication-requirements)
### Disabling TLS certificate verification
{% ifversion ghes %}
By default, the self-hosted runner application verifies the TLS certificate for {% data variables.product.product_name %}. If your {% data variables.product.product_name %} has a self-signed or internally-issued certificate, you may wish to disable TLS certificate verification for testing purposes.
{% else %}
By default, the self-hosted runner application verifies the TLS certificate for {% data variables.product.product_name %}. If you encounter network problems, you may wish to disable TLS certificate verification for testing purposes.
### 禁用 TLS 证书验证
{% ifversion ghes %} 默认情况下,自托管运行器应用程序验证 {% data variables.product.product_name %} 的 TLS 证书。 如果您的 {% data variables.product.product_name %} 具有自签名证书或内部颁发的证书,则出于测试目的,您可能希望禁用 TLS 证书验证。
{% else %} 默认情况下,自托管运行器应用程序验证 {% data variables.product.product_name %} 的 TLS 证书。 如果遇到网络问题,您可能希望禁用 TLS 证书验证以进行测试。
{% endif %}
To disable TLS certification verification in the self-hosted runner application, set the `GITHUB_ACTIONS_RUNNER_TLS_NO_VERIFY` environment variable to `1` before configuring and running the self-hosted runner application.
若要在自托管运行器应用程序中禁用 TLS 证书验证,请在配置和运行自托管运行器应用程序之前将 `GITHUB_ACTIONS_RUNNER_TLS_NO_VERIFY` 环境变量设置为 `1`
```shell
export GITHUB_ACTIONS_RUNNER_TLS_NO_VERIFY=1
./config.sh --url https://github.com/YOUR-ORG/YOUR-REPO --token
./config.sh --url <em>https://github.com/octo-org/octo-repo</em> --token
./run.sh
```
{% warning %}
**Warning**: Disabling TLS verification is not recommended since TLS provides privacy and data integrity between the self-hosted runner application and {% data variables.product.product_name %}. We recommend that you install the {% data variables.product.product_name %} certificate in the operating system certificate store for your self-hosted runner. For guidance on how to install the {% data variables.product.product_name %} certificate, check with your operating system vendor.
警告:不建议禁用 TLS 验证,因为 TLS 在自托管运行器应用程序和 {% data variables.product.product_name %} 之间提供了隐私和数据完整性。 我们建议您在自托管运行器的操作系统证书存储中安装 {% data variables.product.product_name %} 证书。 有关如何安装 {% data variables.product.product_name %} 证书的指导,请咨询您的操作系统供应商。
{% endwarning %}
## Reviewing the self-hosted runner application log files
## 查阅自托管运行应用程序日志文件
You can monitor the status of the self-hosted runner application and its activities. Log files are kept in the `_diag` directory where you installed the runner application, and a new log is generated each time the application is started. The filename begins with *Runner_*, and is followed by a UTC timestamp of when the application was started.
您可以监控自托管运行器应用程序的状态及其活动。 日志文件保存在你安装运行器应用程序的 `_diag` 目录中,每次启动应用程序时都会生成新的日志。 文件名开头为 Runner_后接应用程序启动时的 UTC 时间戳。
For detailed logs on workflow job executions, see the next section describing the *Worker_* files.
有关工作流作业执行的详细日志,请参阅介绍 Worker_ 文件的下一节。
## Reviewing a job's log file
## 查看作业日志文件
The self-hosted runner application creates a detailed log file for each job that it processes. These files are stored in the `_diag` directory where you installed the runner application, and the filename begins with *Worker_*.
自托管的运行器应用程序为它处理的每个作业创建详细的日志文件。 这些文件存储在安装运行器应用程序的 `_diag` 目录中,文件名以 Worker_ 开头。
{% linux %}
## Using journalctl to check the self-hosted runner application service
## 使用 journalctl 检查自托管的运行器应用程序服务
For Linux-based self-hosted runners running the application using a service, you can use `journalctl` to monitor their real-time activity. The default systemd-based service uses the following naming convention: `actions.runner.<org>-<repo>.<runnerName>.service`. This name is truncated if it exceeds 80 characters, so the preferred way of finding the service's name is by checking the _.service_ file. For example:
对于使用服务运行应用程序的 Linux 自托管运行器,可以使用 `journalctl` 来监视其实时活动。 基于系统的默认服务使用以下命名约定:`actions.runner.<org>-<repo>.<runnerName>.service`。 此名称在超过 80 个字符时将被截断,因此查找服务名称的首选方式是检查 .service 文件。 例如:
```shell
$ cat ~/actions-runner/.service
actions.runner.octo-org-octo-repo.runner01.service
```
If this fails due to the service being installed elsewhere, you can find the service name in the list of running services. For example, on most Linux systems you can use the `systemctl` command:
如果因为服务安装在其他地方而失败,您可以在运行服务列表中找到服务名称。 例如,在大多数 Linux 系统上,可以使用 `systemctl` 命令:
```shell
$ systemctl --type=service | grep actions.runner
actions.runner.octo-org-octo-repo.hostname.service loaded active running GitHub Actions Runner (octo-org-octo-repo.hostname)
```
You can use `journalctl` to monitor the real-time activity of the self-hosted runner:
可使用 `journalctl` 监视自托管运行器的实时活动:
```shell
$ sudo journalctl -u actions.runner.octo-org-octo-repo.runner01.service -f
```
In this example output, you can see `runner01` start, receive a job named `testAction`, and then display the resulting status:
在此示例输出中,可以看到 `runner01` 启动,接收名为 `testAction` 的作业,然后显示结果状态:
```shell
Feb 11 14:57:07 runner01 runsvc.sh[962]: Starting Runner listener with startup type: service
@@ -135,23 +133,23 @@ Feb 11 16:06:54 runner01 runsvc.sh[962]: 2020-02-11 16:06:54Z: Running job: test
Feb 11 16:07:10 runner01 runsvc.sh[962]: 2020-02-11 16:07:10Z: Job testAction completed with result: Succeeded
```
To view the `systemd` configuration, you can locate the service file here: `/etc/systemd/system/actions.runner.<org>-<repo>.<runnerName>.service`.
If you want to customize the self-hosted runner application service, do not directly modify this file. Follow the instructions described in "[Configuring the self-hosted runner application as a service](/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service#customizing-the-self-hosted-runner-service)."
若要查看 `systemd` 配置,可在此处找到服务文件:`/etc/systemd/system/actions.runner.<org>-<repo>.<runnerName>.service`
如果您想要自定义自托管的运行器应用程序服务,不要直接修改此文件。 按照“[将自托管运行器应用程序配置为服务](/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service#customizing-the-self-hosted-runner-service)”中所述的说明进行操作。
{% endlinux %}
{% mac %}
## Using `launchd` to check the self-hosted runner application service
## 使用 `launchd` 检查自托管运行器应用程序服务
For macOS-based self-hosted runners running the application as a service, you can use `launchctl` to monitor their real-time activity. The default launchd-based service uses the following naming convention: `actions.runner.<org>-<repo>.<runnerName>`. This name is truncated if it exceeds 80 characters, so the preferred way of finding the service's name is by checking the _.service_ file in the runner directory:
对于将应用程序作为服务运行的 macOS 自托管运行器,可以使用 `launchctl` 来监视其实时活动。 基于 launchd 的默认服务使用以下命名约定:`actions.runner.<org>-<repo>.<runnerName>`。 此名称在超过 80 个字符时将被截断,因此查找服务名称的首选方式是检查运行器目录中的 .service 文件:
```shell
% cat ~/actions-runner/.service
/Users/exampleUsername/Library/LaunchAgents/actions.runner.octo-org-octo-repo.runner01.plist
```
The `svc.sh` script uses `launchctl` to check whether the application is running. For example:
`svc.sh` 脚本使用 `launchctl` 来检查应用程序是否正在运行。 例如:
```shell
$ ./svc.sh status
@@ -161,25 +159,25 @@ Started:
379 0 actions.runner.example.runner01
```
The resulting output includes the process ID and the name of the applications `launchd` service.
生成的输出包括进程 ID 和应用程序的 `launchd` 服务的名称。
To view the `launchd` configuration, you can locate the service file here: `/Users/exampleUsername/Library/LaunchAgents/actions.runner.<repoName>.<runnerName>.service`.
If you want to customize the self-hosted runner application service, do not directly modify this file. Follow the instructions described in "[Configuring the self-hosted runner application as a service](/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service#customizing-the-self-hosted-runner-service-1)."
若要查看 `launchd` 配置,可在此处找到服务文件:`/Users/exampleUsername/Library/LaunchAgents/actions.runner.<repoName>.<runnerName>.service`
如果您想要自定义自托管的运行器应用程序服务,不要直接修改此文件。 按照“[将自托管运行器应用程序配置为服务](/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service#customizing-the-self-hosted-runner-service-1)”中所述的说明进行操作。
{% endmac %}
{% windows %}
## Using PowerShell to check the self-hosted runner application service
## 使用 PowerShell 检查自托管的运行器应用程序服务
For Windows-based self-hosted runners running the application as a service, you can use PowerShell to monitor their real-time activity. The service uses the naming convention `GitHub Actions Runner (<org>-<repo>.<runnerName>)`. You can also find the service's name by checking the _.service_ file in the runner directory:
对于将应用程序运行为服务的 Windows 自托管运行器,您可以使用 PowerShell 来监控其实时活动。 服务使用命名约定 `GitHub Actions Runner (<org>-<repo>.<runnerName>)`。 还可以通过检查运行器目录中的 .service 文件来查找服务的名称:
```shell
PS C:\actions-runner> Get-Content .service
actions.runner.octo-org-octo-repo.runner01.service
```
You can view the status of the runner in the Windows _Services_ application (`services.msc`). You can also use PowerShell to check whether the service is running:
可以在 Windows 服务应用程序 (`services.msc`) 中查看运行器的状态。 您也可以使用 PowerShell 来检查服务是否在运行:
```shell
PS C:\actions-runner> Get-Service "actions.runner.octo-org-octo-repo.runner01.service" | Select-Object Name, Status
@@ -188,7 +186,7 @@ Name Status
actions.runner.octo-org-octo-repo.runner01.service Running
```
You can use PowerShell to check the recent activity of the self-hosted runner. In this example output, you can see the application start, receive a job named `testAction`, and then display the resulting status:
您可以使用 PowerShell 来检查自托管运行器的近期活动。 在此示例输出中,可以看到应用程序启动,接收名为 `testAction` 的作业,然后显示结果状态:
```shell
PS C:\actions-runner> Get-EventLog -LogName Application -Source ActionsRunnerService
@@ -207,34 +205,34 @@ PS C:\actions-runner> Get-EventLog -LogName Application -Source ActionsRunnerSer
{% endwindows %}
## Monitoring the automatic update process
## 监控自动更新过程
We recommend that you regularly check the automatic update process, as the self-hosted runner will not be able to process jobs if it falls below a certain version threshold. The self-hosted runner application automatically updates itself, but note that this process does not include any updates to the operating system or other software; you will need to separately manage these updates.
建议定期检查自动更新过程,因为如果自托管的运行器低于某个版本阈值,将会无法处理作业。 自托管的运行器应用程序自动更新本身,但请注意,此过程不包括对操作系统或其他软件的任何更新;您需要单独管理这些更新。
You can view the update activities in the *Runner_* log files. For example:
可以在 Runner_ 日志文件中查看更新活动。 例如:
```shell
[Feb 12 12:37:07 INFO SelfUpdater] An update is available.
```
In addition, you can find more information in the _SelfUpdate_ log files located in the `_diag` directory where you installed the runner application.
此外,还可以在位于安装了运行器应用程序的 `_diag` 目录中的 SelfUpdate 日志文件中找到详细信息。
{% linux %}
## Troubleshooting containers in self-hosted runners
## 自行托管运行器中的容器故障排除
### Checking that Docker is installed
### 检查 Docker 是否安装
If your jobs require containers, then the self-hosted runner must be Linux-based and needs to have Docker installed. Check that your self-hosted runner has Docker installed and that the service is running.
如果您的作业需要容器,则自托管的运行器必须基于 Linux并且需要安装 Docker。 检查自托管运行器是否安装 Docker以及服务是否正在运行。
You can use `systemctl` to check the service status:
可以使用 `systemctl` 检查服务状态:
```shell
$ sudo systemctl is-active docker.service
active
```
If Docker is not installed, then dependent actions will fail with the following errors:
如果 Docker 未安装,则依赖的操作将因以下错误而失败:
```shell
[2020-02-13 16:56:10Z INFO DockerCommandManager] Which: 'docker'
@@ -242,15 +240,15 @@ If Docker is not installed, then dependent actions will fail with the following
[2020-02-13 16:56:10Z ERR StepsRunner] Caught exception from step: System.IO.FileNotFoundException: File not found: 'docker'
```
### Checking the Docker permissions
### 检查 Docker 权限
If your job fails with the following error:
如果作业失败,出现以下错误:
```shell
dial unix /var/run/docker.sock: connect: permission denied
```
Check that the self-hosted runner's service account has permission to use the Docker service. You can identify this account by checking the configuration of the self-hosted runner in `systemd`. For example:
检查自托管运行器的服务帐户是否有使用 Docker 服务的权限。 可以通过检查 `systemd` 中的自托管运行器的配置来识别此帐户。 例如:
```shell
$ sudo systemctl show -p User actions.runner.octo-org-octo-repo.runner01.service
@@ -260,26 +258,9 @@ User=runner-user
{% endlinux %}
{% ifversion ghes %}
## Resolving runners that are offline after an upgrade of {% data variables.location.product_location %}
## 解析在 {% data variables.product.product_location %} 升级后处于脱机状态的运行器
{% data reusables.actions.upgrade-runners-before-upgrade-ghes %}
If your runners are offline for this reason, manually update the runners. For more information, see the installation instructions for [the latest release](https://github.com/actions/runner/releases/latest) in the actions/runner repository.
如果运行器出于此原因处于脱机状态,请手动更新运行器。 有关详细信息,请参阅操作/运行器存储库中[最新版本](https://github.com/actions/runner/releases/latest)的安装说明。
{% endif %}
### Checking which Docker engine is installed on the runner
If your build fails with the following error:
```shell
Error: Input required and not supplied: java-version
```
Check which Docker engine is installed on your self-hosted runner. To pass the inputs of an action into the Docker container, the runner uses environment variables that might contain dashes as part of their names. The action may not able to get the inputs if the Docker engine is not a binary executable, but is instead a shell wrapper or a link (for example, a Docker engine installed on Linux using `snap`). To address this error, configure your self-hosted runner to use a different Docker engine.
To check if your Docker engine was installed using `snap`, use the `which` command. In the following example, the Docker engine was installed using `snap`:
```shell
$ which docker
/snap/bin/docker
```

View File

@@ -1,6 +1,6 @@
---
title: Removing self-hosted runners
intro: 'You can permanently remove a self-hosted runner from a repository{% ifversion fpt %} or organization{% elsif ghec or ghes or gahe %}, an organization, or an enterprise{% endif %}.'
title: 删除自托管的运行器
intro: '您可以从仓库{% ifversion fpt %} 或组织{% elsif ghec or ghes or gahe %}、 组织或{% endif %} 企业永久删除自托管运行器。'
redirect_from:
- /github/automating-your-workflow-with-github-actions/removing-self-hosted-runners
- /actions/automating-your-workflow-with-github-actions/removing-self-hosted-runners
@@ -11,92 +11,54 @@ versions:
ghec: '*'
type: tutorial
shortTitle: Remove self-hosted runners
ms.openlocfilehash: d47a2e348f2d1a79342934e70115314d9e62f6f0
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/10/2022
ms.locfileid: '145086684'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## Removing a runner from a repository
## 从仓库中删除运行器
{% note %}
**Note:** {% data reusables.actions.self-hosted-runner-removal-impact %}
注意:{% data reusables.actions.self-hosted-runner-removal-impact %}
{% data reusables.actions.self-hosted-runner-auto-removal %}
{% endnote %}
To remove a self-hosted runner from a user repository you must be the repository owner. For an organization repository, you must be an organization owner or have admin access to the repository. We recommend that you also have access to the self-hosted runner machine. For information about how to remove a self-hosted runner with the REST API, see "[Self-hosted runners](/rest/reference/actions#self-hosted-runners)."
要从用户仓库删除自托管的运行器,您必须是仓库所有者。 对于组织仓库,您必须是组织所有者或拥有该仓库管理员的权限。 建议您也访问自托管的运行器机器。 有关如何使用 REST API 删除自承载运行器的信息,请参阅“[自承载运行器](/rest/reference/actions#self-hosted-runners)”。
{% data reusables.actions.self-hosted-runner-reusing %}
{% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.sidebar-settings %}
{% data reusables.repositories.settings-sidebar-actions-runners %}
{% data reusables.actions.settings-sidebar-actions-runner-selection %}
{% data reusables.actions.self-hosted-runner-removing-a-runner-updated %}
{% elsif ghae or ghes < 3.4 %}
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.sidebar-settings %}
{% data reusables.repositories.settings-sidebar-actions-runners %}
{% data reusables.actions.self-hosted-runner-removing-a-runner %}
{% endif %}
{% data reusables.actions.self-hosted-runner-reusing %} {% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5091 %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.settings-sidebar-actions-runners %} {% data reusables.actions.settings-sidebar-actions-runner-selection %} {% data reusables.actions.self-hosted-runner-removing-a-runner-updated %} {% elsif ghae or ghes < 3.4 %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.settings-sidebar-actions-runners %} {% data reusables.actions.self-hosted-runner-removing-a-runner %} {% endif %}
## Removing a runner from an organization
## 从组织中删除运行器
{% note %}
**Note:** {% data reusables.actions.self-hosted-runner-removal-impact %}
注意:{% data reusables.actions.self-hosted-runner-removal-impact %}
{% data reusables.actions.self-hosted-runner-auto-removal %}
{% endnote %}
To remove a self-hosted runner from an organization, you must be an organization owner. We recommend that you also have access to the self-hosted runner machine. For information about how to remove a self-hosted runner with the REST API, see "[Self-hosted runners](/rest/reference/actions#self-hosted-runners)."
要从组织删除自托管的运行器,您必须是组织所有者。 建议您也访问自托管的运行器机器。 有关如何使用 REST API 删除自承载运行器的信息,请参阅“[自承载运行器](/rest/reference/actions#self-hosted-runners)”。
{% data reusables.actions.self-hosted-runner-reusing %}
{% ifversion fpt or ghes > 3.3 or ghec %}
{% data reusables.organizations.navigate-to-org %}
{% data reusables.organizations.org_settings %}
{% data reusables.organizations.settings-sidebar-actions-runners %}
{% data reusables.actions.settings-sidebar-actions-runner-selection %}
{% data reusables.actions.self-hosted-runner-removing-a-runner-updated %}
{% elsif ghes < 3.4 or ghae %}
{% data reusables.organizations.navigate-to-org %}
{% data reusables.organizations.org_settings %}
{% data reusables.organizations.settings-sidebar-actions-runners %}
{% data reusables.actions.self-hosted-runner-removing-a-runner %}
{% endif %}
{% data reusables.actions.self-hosted-runner-reusing %} {% ifversion fpt or ghes > 3.3 or ghec %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org_settings %} {% data reusables.organizations.settings-sidebar-actions-runners %} {% data reusables.actions.settings-sidebar-actions-runner-selection %} {% data reusables.actions.self-hosted-runner-removing-a-runner-updated %} {% elsif ghes < 3.4 or ghae %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org_settings %} {% data reusables.organizations.settings-sidebar-actions-runners %} {% data reusables.actions.self-hosted-runner-removing-a-runner %} {% endif %}
## Removing a runner from an enterprise
## 从企业中删除运行器
{% ifversion fpt %}
If you use {% data variables.product.prodname_ghe_cloud %}, you can also remove runners from an enterprise. For more information, see the [{% data variables.product.prodname_ghe_cloud %} documentation](/enterprise-cloud@latest/actions/hosting-your-own-runners/removing-self-hosted-runners#removing-a-runner-from-an-enterprise).
{% endif %}
{% ifversion ghec or ghes or ghae %}
{% note %}
{% ifversion fpt %} 如果使用 {% data variables.product.prodname_ghe_cloud %},还可以从企业中删除运行器。 有关详细信息,请参阅 [{% data variables.product.prodname_ghe_cloud %} 文档](/enterprise-cloud@latest/actions/hosting-your-own-runners/removing-self-hosted-runners#removing-a-runner-from-an-enterprise)。
{% endif %} {% ifversion ghec or ghes or ghae %} {% note %}
**Note:** {% data reusables.actions.self-hosted-runner-removal-impact %}
注意:{% data reusables.actions.self-hosted-runner-removal-impact %}
{% data reusables.actions.self-hosted-runner-auto-removal %}
{% endnote %}
To remove a self-hosted runner from an enterprise, you must be an enterprise owner. We recommend that you also have access to the self-hosted runner machine. For information about how to remove a self-hosted runner with the REST API, see the enterprise endpoints in the [{% data variables.product.prodname_actions %} REST API](/rest/reference/actions#self-hosted-runners).
要从企业帐户删除自托管运行器,您必须是企业所有者。 建议您也访问自托管的运行器机器。 有关如何使用 REST API 删除自承载运行器的信息,请参阅 [{% data variables.product.prodname_actions %} REST API](/rest/reference/actions#self-hosted-runners) 中的企业终结点。
{% data reusables.actions.self-hosted-runner-reusing %}
{% ifversion ghec or ghes > 3.3 or ghae > 3.3 %}
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.policies-tab %}
{% data reusables.enterprise-accounts.actions-tab %}
{% data reusables.enterprise-accounts.actions-runners-tab %}
{% data reusables.actions.settings-sidebar-actions-runner-selection %}
{% data reusables.actions.self-hosted-runner-removing-a-runner-updated %}
{% elsif ghae or ghes < 3.4 %}
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.policies-tab %}
{% data reusables.enterprise-accounts.actions-tab %}
{% data reusables.enterprise-accounts.actions-runners-tab %}
{% data reusables.actions.self-hosted-runner-removing-a-runner %}
{% endif %}
{% endif %}
{% data reusables.actions.self-hosted-runner-reusing %} {% ifversion ghec or ghes > 3.3 or ghae-issue-5091 %} {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.enterprise-accounts.actions-runners-tab %} {% data reusables.actions.settings-sidebar-actions-runner-selection %} {% data reusables.actions.self-hosted-runner-removing-a-runner-updated %} {% elsif ghae or ghes < 3.4 %} {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.enterprise-accounts.actions-runners-tab %} {% data reusables.actions.self-hosted-runner-removing-a-runner %} {% endif %} {% endif %}

View File

@@ -1,76 +1,81 @@
---
title: Running scripts before or after a job
intro: 'Scripts can automatically execute on a self-hosted runner, directly before or after a job.'
title: 在作业之前或之后运行脚本
intro: 脚本可以直接在作业之前或之后在自托管运行器上自动执行。
versions:
feature: job-hooks-for-runners
type: tutorial
miniTocMaxHeadingLevel: 3
shortTitle: Run a script before or after a job
ms.openlocfilehash: 11b2f63cd70c5276f0626a6016593553d1bedd0c
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147067648'
---
{% note %}
**Note**: This feature is currently in beta and is subject to change.
注意:此功能目前为 beta 版本,可能会有变动。
{% endnote %}
## About pre- and post-job scripts
## 关于作业前脚本和作业后脚本
You can automatically execute scripts on a self-hosted runner, either before a job runs, or after a job finishes running. You could use these scripts to support the job's requirements, such as building or tearing down a runner environment, or cleaning out directories. You could also use these scripts to track telemetry of how your runners are used.
可在作业运行之前或在作业完成运行之后,在自托管运行器上自动执行脚本。 可使用这些脚本来满足作业需求,例如生成或关闭运行器环境,或清理目录。 还可使用这些脚本来跟踪运行器使用情况的遥测数据。
The custom scripts are automatically triggered when a specific environment variable is set on the runner; the environment variable must contain the absolute path to the script. For more information, see "[Triggering the scripts](#triggering-the-scripts)" below.
当运行器上设置了特定环境变量时,自定义脚本会自动触发;环境变量必须包含该脚本的绝对路径。 有关详细信息,请参阅下面的“[触发脚本](#triggering-the-scripts)”。
The following scripting languages are supported:
支持以下脚本语言:
- **Bash**: Uses `bash` and can fallback to `sh`. Executes by running `-e {pathtofile}`.
- **PowerShell**: Uses `pwsh` and can fallback to `powershell`. Executes by running `-command \". '{pathtofile}'\"`.
- **Bash**:使用 `bash` 并可以回退到 `sh`。 通过运行 `-e {pathtofile}` 执行。
- **PowerShell**:使用 `pwsh` 并可以回退到 `powershell`。 通过运行 `-command \". '{pathtofile}'\"` 执行。
## Writing the scripts
## 编写脚本
Your custom scripts can use the following features:
自定义脚本可以使用以下功能:
- **Environment variables**: Scripts have access to the default environment variables. The full webhook event payload can be found in `GITHUB_EVENT_PATH`. For more information, see "[Environment variables](/actions/learn-github-actions/environment-variables#default-environment-variables)."
- **Workflow commands**: Scripts can use workflow commands. For more information, see ["Workflow commands for {% data variables.product.prodname_actions %}"](/actions/using-workflows/workflow-commands-for-github-actions){% ifversion actions-save-state-set-output-envs %}{% else %}, with the exception of `save-state` and `set-output`, which are not supported by these scripts{% endif %}. Scripts can also use environment files. For more information, see [Environment files](/actions/using-workflows/workflow-commands-for-github-actions#environment-files).
- **环境变量**:脚本有权访问默认环境变量。 完整的 Webhook 事件有效负载可在 `GITHUB_EVENT_PATH` 中找到。 有关详细信息,请参阅“[环境变量](/actions/learn-github-actions/environment-variables#default-environment-variables)”。
- **工作流命令**:脚本可以使用工作流命令。 有关详细信息,请参阅[{% data variables.product.prodname_actions %} 的工作流命令”](/actions/using-workflows/workflow-commands-for-github-actions)`save-state` `set-output` 除外(这些脚本不支持)。 脚本还可以使用环境文件。 有关详细信息,请参阅“[环境文件](/actions/using-workflows/workflow-commands-for-github-actions#environment-files)”。
{% note %}
**Note**: Avoid using your scripts to output sensitive information to the console, as anyone with read access to the repository might be able to see the output in the UI logs.
注意:避免使用脚本将敏感信息输出到控制台,因为拥有存储库读取访问权限的任何人都可以在 UI 日志中查看输出。
{% endnote %}
### Handling exit codes
### 处理退出代码
For pre-job scripts, exit code `0` indicates that the script completed successfully, and the job will then proceed to run. If there is any other exit code, the job will not run and will be marked as failed. To see the results of your pre-job scripts, check the logs for `Set up runner` entries. For more information on checking the logs, see "[Viewing logs to diagnose failures](/actions/monitoring-and-troubleshooting-workflows/using-workflow-run-logs#viewing-logs-to-diagnose-failures)."
对于作业前脚本,退出代码 `0` 指示脚本成功完成并且作业随后继续运行。 如果存在任何其他退出代码,该作业将不会运行,并标记为失败。 要查看作业前脚本的结果,请检查日志中的 `Set up runner` 条目。 有关检查日志的详细信息,请参阅“[查看日志以诊断故障](/actions/monitoring-and-troubleshooting-workflows/using-workflow-run-logs#viewing-logs-to-diagnose-failures)”。
The [`continue-on-error`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idcontinue-on-error) setting is not supported for use by these scripts.
这些脚本不支持使用 [`continue-on-error`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idcontinue-on-error) 设置。
## Triggering the scripts
## 触发脚本
The custom scripts must be located on the runner, but should not be stored in the `actions-runner` application directory. The scripts are executed in the security context of the service account that's running the runner service.
自定义脚本必须位于运行器上,但不应存储在 `actions-runner` 应用程序目录中。 脚本在运行运行器服务的服务帐户的安全性上下文中执行。
{% note %}
**Note**: The triggered scripts are processed synchronously, so they will block job execution while they are running.
注意:触发的脚本是同步处理的,因此它们会在运行时阻止作业执行。
{% endnote %}
The scripts are automatically executed when the runner has the following environment variables containing an absolute path to the script:
- `ACTIONS_RUNNER_HOOK_JOB_STARTED`: The script defined in this environment variable is triggered when a job has been assigned to a runner, but before the job starts running.
- `ACTIONS_RUNNER_HOOK_JOB_COMPLETED`: The script defined in this environment variable is triggered after the job has finished processing.
当运行器具有以下包含脚本绝对路径的环境变量时,脚本会自动执行:
- `ACTIONS_RUNNER_HOOK_JOB_STARTED`:此环境变量中定义的脚本在作业分配给运行器之后且作业开始运行之前触发。
- `ACTIONS_RUNNER_HOOK_JOB_COMPLETED`:此环境变量中定义的脚本在作业完成处理后触发。
To set these environment variables, you can either add them to the operating system, or add them to a file named `.env` within the self-hosted runner application directory. For example, the following `.env` entry will have the runner automatically run a script named `cleanup_script.sh` before each job runs:
要设置这些环境变量,可将它们添加到操作系统中,或将它们添加到自托管运行器应用程序目录中名为 `.env` 的文件中。 例如,以下 `.env` 条目将使运行器在每个作业运行之前自动运行一个名为 `cleanup_script.sh` 的脚本:
```bash
ACTIONS_RUNNER_HOOK_JOB_STARTED=/cleanup_script.sh
```
## Troubleshooting
## 故障排除
### No timeout setting
### 无超时设置
There is currently no timeout setting available for scripts executed by `ACTIONS_RUNNER_HOOK_JOB_STARTED` or `ACTIONS_RUNNER_HOOK_JOB_COMPLETED`. As a result, you could consider adding timeout handling to your script.
目前没有可供 `ACTIONS_RUNNER_HOOK_JOB_STARTED` `ACTIONS_RUNNER_HOOK_JOB_COMPLETED` 执行的脚本使用的超时设置。 因此,可以考虑向脚本添加超时处理。
### Reviewing the workflow run log
### 查看工作流运行日志
To confirm whether your scripts are executing, you can review the logs for that job. The scripts will be listed within separate steps for either `Set up runner` or `Complete runner`, depending on which environment variable is triggering the script. For more information on checking the logs, see "[Viewing logs to diagnose failures](/actions/monitoring-and-troubleshooting-workflows/using-workflow-run-logs#viewing-logs-to-diagnose-failures)."
要确认脚本是否正在执行,可查看该作业的日志。 脚本将在 `Set up runner` `Complete runner` 的单独步骤中列出,具体取决于触发脚本的环境变量。 有关检查日志的详细信息,请参阅“[查看日志以诊断故障](/actions/monitoring-and-troubleshooting-workflows/using-workflow-run-logs#viewing-logs-to-diagnose-failures)”。

View File

@@ -1,35 +1,38 @@
---
title: Expressions
title: 表达式
shortTitle: Expressions
intro: You can evaluate expressions in workflows and actions.
intro: 你可以对工作流和操作中的表达式求值。
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
miniTocMaxHeadingLevel: 3
ms.openlocfilehash: 94bd9f7a43d4325e497a776357711adf64c0d7ba
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147614221'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 关于表达式
## About expressions
您可以使用表达式程序化设置工作流程文件中的环境变量和访问上下文。 表达式可以是文字值、上下文引用或函数的任意组合。 您可以使用运算符组合文字、上下文引用和函数。 有关上下文的详细信息,请参阅“[上下文](/actions/learn-github-actions/contexts)”。
You can use expressions to programmatically set environment variables in workflow files and access contexts. An expression can be any combination of literal values, references to a context, or functions. You can combine literals, context references, and functions using operators. For more information about contexts, see "[Contexts](/actions/learn-github-actions/contexts)."
表达式通常与工作流文件中的条件 `if` 关键字一起使用,以确定是否应运行步骤。 如果 `if` 条件为 `true`,该步骤将运行。
Expressions are commonly used with the conditional `if` keyword in a workflow file to determine whether a step should run. When an `if` conditional is `true`, the step will run.
您需要使用特定语法指示 {% data variables.product.prodname_dotcom %} 对表达式求值,而不是将其视为字符串。
You need to use specific syntax to tell {% data variables.product.prodname_dotcom %} to evaluate an expression rather than treat it as a string.
{% raw %}
`${{ <expression> }}`
{% raw %} `${{ <expression> }}`
{% endraw %}
{% data reusables.actions.expression-syntax-if %} For more information about `if` conditionals, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/articles/workflow-syntax-for-github-actions/#jobsjob_idif)."
{% data reusables.actions.expression-syntax-if %} 有关 `if` 条件的详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流语法](/articles/workflow-syntax-for-github-actions/#jobsjob_idif)”。
{% data reusables.actions.context-injection-warning %}
#### Example expression in an `if` conditional
#### `if` 条件中的示例表达式
```yaml
steps:
@@ -37,7 +40,7 @@ steps:
if: {% raw %}${{ <expression> }}{% endraw %}
```
#### Example setting an environment variable
#### 设置环境变量的示例
{% raw %}
```yaml
@@ -46,18 +49,18 @@ env:
```
{% endraw %}
## Literals
## 文本
As part of an expression, you can use `boolean`, `null`, `number`, or `string` data types.
作为表达式的一部分,可使用 `boolean``null``number` `string` 数据类型。
| Data type | Literal value |
| 数据类型 | 文本值 |
|-----------|---------------|
| `boolean` | `true` or `false` |
| `boolean` | `true` `false` |
| `null` | `null` |
| `number` | Any number format supported by JSON. |
| `string` | You don't need to enclose strings in `{% raw %}${{{% endraw %}` and `{% raw %}}}{% endraw %}`. However, if you do, you must use single quotes (`'`) around the string. To use a literal single quote, escape the literal single quote using an additional single quote (`''`). Wrapping with double quotes (`"`) will throw an error. |
| `number` | JSON 支持的任何数字格式。 |
| `string` | 无需将字符串括在 `{% raw %}${{{% endraw %}` `{% raw %}}}{% endraw %}` 中。 但是,如果这样做,则必须在字符串两边使用单引号 (`'`)。 若要使用文本单引号,请使用额外的单引号 (`''`) 转义文本单引号。 用双引号 (`"`) 括起来会引发错误。 |
#### Example
#### 示例
{% raw %}
@@ -75,105 +78,105 @@ env:
{% endraw %}
## Operators
## 运算符
| Operator | Description |
| 运算符 | 说明 |
| --- | --- |
| `( )` | Logical grouping |
| `[ ]` | Index
| `.` | Property de-reference |
| `( )` | 逻辑分组 |
| `[ ]` | 索引
| `.` | 属性取消引用 |
| `!` | Not |
| `<` | Less than |
| `<=` | Less than or equal |
| `>` | Greater than |
| `>=` | Greater than or equal |
| `==` | Equal |
| `!=` | Not equal |
| `&&` | And |
| <code>\|\|</code> | Or |
| `<` | 小于 |
| `<=` | 小于或等于 |
| `>` | 大于 |
| `>=` | 大于或等于 |
| `==` | 等于 |
| `!=` | 不等于 |
| `&&` | |
| <code>\|\|</code> | |
{% data variables.product.prodname_dotcom %} performs loose equality comparisons.
{% data variables.product.prodname_dotcom %} 进行宽松的等式比较。
* If the types do not match, {% data variables.product.prodname_dotcom %} coerces the type to a number. {% data variables.product.prodname_dotcom %} casts data types to a number using these conversions:
* 如果类型不匹配,{% data variables.product.prodname_dotcom %} 强制转换类型为数字。 {% data variables.product.prodname_dotcom %} 使用这些转换将数据类型转换为数字:
| Type | Result |
| 类型 | 结果 |
| --- | --- |
| Null | `0` |
| Boolean | `true` returns `1` <br /> `false` returns `0` |
| String | Parsed from any legal JSON number format, otherwise `NaN`. <br /> Note: empty string returns `0`. |
| Array | `NaN` |
| Object | `NaN` |
* A comparison of one `NaN` to another `NaN` does not result in `true`. For more information, see the "[NaN Mozilla docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN)."
* {% data variables.product.prodname_dotcom %} ignores case when comparing strings.
* Objects and arrays are only considered equal when they are the same instance.
| 布尔 | `true` 返回 `1` <br /> `false` 返回 `0` |
| String | 从任何合法的 JSON 数字格式进行分析,否则为 `NaN` <br /> 注意:空字符串返回 `0` |
| 数组 | `NaN` |
| 对象 | `NaN` |
* 一个 `NaN` 与另一个 `NaN` 的比较不会生成 `true`。 有关详细信息,请参阅“[NaN Mozilla 文档](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN)”。
* {% data variables.product.prodname_dotcom %} 在比较字符串时忽略大小写。
* 对象和数组仅在为同一实例时才视为相等。
## Functions
## 函数
{% data variables.product.prodname_dotcom %} offers a set of built-in functions that you can use in expressions. Some functions cast values to a string to perform comparisons. {% data variables.product.prodname_dotcom %} casts data types to a string using these conversions:
{% data variables.product.prodname_dotcom %} 提供一组内置的函数,可用于表达式。 有些函数抛出值到字符串以进行比较。 {% data variables.product.prodname_dotcom %} 使用这些转换将数据类型转换为字符串:
| Type | Result |
| 类型 | 结果 |
| --- | --- |
| Null | `''` |
| Boolean | `'true'` or `'false'` |
| Number | Decimal format, exponential for large numbers |
| Array | Arrays are not converted to a string |
| Object | Objects are not converted to a string |
| 布尔 | `'true'` `'false'` |
| 数字 | 十进制格式,对大数字使用指数 |
| 数组 | 数组不转换为字符串 |
| 对象 | 对象不转换为字符串 |
### contains
`contains( search, item )`
Returns `true` if `search` contains `item`. If `search` is an array, this function returns `true` if the `item` is an element in the array. If `search` is a string, this function returns `true` if the `item` is a substring of `search`. This function is not case sensitive. Casts values to a string.
如果 `search` 包含 `item`,则返回 `true`。 如果 `search` 是一个数组,`item` 是数组中的一个元素,此函数将返回 `true`。 如果 `search` 是一个字符串,`item``search` 的 substring此函数将返回 `true`。 此函数不区分大小写。 抛出值到字符串。
#### Example using a string
#### 使用字符串的示例
`contains('Hello world', 'llo')` returns `true`.
`contains('Hello world', 'llo')` 返回 `true`
#### Example using an object filter
#### 使用对象筛选器的示例
`contains(github.event.issue.labels.*.name, 'bug')` returns `true` if the issue related to the event has a label "bug".
如果与事件相关的问题具有标签“bug”`contains(github.event.issue.labels.*.name, 'bug')` 便会返回 `true`
For more information, see "[Object filters](#object-filters)."
有关详细信息,请参阅“[对象筛选器](#object-filters)”。
#### Example matching an array of strings
#### 匹配字符串数组的示例
Instead of writing `github.event_name == "push" || github.event_name == "pull_request"`, you can use `contains()` with `fromJson()` to check if an array of strings contains an `item`.
可以将 `contains()``fromJson()` 配合使用来检查字符串数组是否包含 `item`,而不是编写 `github.event_name == "push" || github.event_name == "pull_request"`
For example, `contains(fromJson('["push", "pull_request"]'), github.event_name)` returns `true` if `github.event_name` is "push" or "pull_request".
例如,如果 `github.event_name` 是“push”或“pull_request”`contains(fromJson('["push", "pull_request"]'), github.event_name)` 便会返回 `true`
### startsWith
`startsWith( searchString, searchValue )`
Returns `true` when `searchString` starts with `searchValue`. This function is not case sensitive. Casts values to a string.
如果 `searchString` `searchValue` 开头,将返回 `true`。 此函数不区分大小写。 抛出值到字符串。
#### Example
#### 示例
`startsWith('Hello world', 'He')` returns `true`.
`startsWith('Hello world', 'He')` 返回 `true`
### endsWith
`endsWith( searchString, searchValue )`
Returns `true` if `searchString` ends with `searchValue`. This function is not case sensitive. Casts values to a string.
如果 `true` `searchString` 结尾,则返回 `searchValue`。 此函数不区分大小写。 抛出值到字符串。
#### Example
#### 示例
`endsWith('Hello world', 'ld')` returns `true`.
`endsWith('Hello world', 'ld')` 返回 `true`
### format
`format( string, replaceValue0, replaceValue1, ..., replaceValueN)`
Replaces values in the `string`, with the variable `replaceValueN`. Variables in the `string` are specified using the `{N}` syntax, where `N` is an integer. You must specify at least one `replaceValue` and `string`. There is no maximum for the number of variables (`replaceValueN`) you can use. Escape curly braces using double braces.
`string` 中的值替换为变量 `replaceValueN``string` 中的变量是使用 `{N}` 语法指定的,其中 `N` 是一个整数。 必须至少指定一个 `replaceValue` `string`。 可使用的变量 (`replaceValueN`) 的数量没有上限。 使用双小括号逸出大括号。
#### Example
#### 示例
`format('Hello {0} {1} {2}', 'Mona', 'the', 'Octocat')`
Returns 'Hello Mona the Octocat'.
返回“Hello Mona the Octocat”。
#### Example escaping braces
#### 逸出括号示例
{% raw %}
```js
@@ -181,37 +184,37 @@ format('{{Hello {0} {1} {2}!}}', 'Mona', 'the', 'Octocat')
```
{% endraw %}
Returns '{Hello Mona the Octocat!}'.
返回“{Hello Mona the Octocat!}”。
### join
`join( array, optionalSeparator )`
The value for `array` can be an array or a string. All values in `array` are concatenated into a string. If you provide `optionalSeparator`, it is inserted between the concatenated values. Otherwise, the default separator `,` is used. Casts values to a string.
`array` 的值可以是数组,也可以是字符串。 `array` 中的所有值都连接成一个字符串。 如果提供 `optionalSeparator`,则它将插入到连接的值之间, 否则使用默认分隔符 `,`。 抛出值到字符串。
#### Example
#### 示例
`join(github.event.issue.labels.*.name, ', ')` may return 'bug, help wanted'
`join(github.event.issue.labels.*.name, ', ')` 可能会返回“出现 bug需要帮助”
### toJSON
`toJSON(value)`
Returns a pretty-print JSON representation of `value`. You can use this function to debug the information provided in contexts.
`value` 返回适合打印的 JSON 表示形式。 您可以使用此函数调试上下文中提供的信息。
#### Example
#### 示例
`toJSON(job)` might return `{ "status": "Success" }`
`toJSON(job)` 可能会返回 `{ "status": "Success" }`
### fromJSON
`fromJSON(value)`
Returns a JSON object or JSON data type for `value`. You can use this function to provide a JSON object as an evaluated expression or to convert environment variables from a string.
返回 `value` 的 JSON 对象或 JSON 数据类型。 您可以使用此函数来提供 JSON 对象作为评估表达式或从字符串转换环境变量。
#### Example returning a JSON object
#### 返回 JSON 对象的示例
This workflow sets a JSON matrix in one job, and passes it to the next job using an output and `fromJSON`.
此工作流在一个作业中设置 JSON 矩阵,并使用输出和 `fromJSON` 将其传递给下一个作业。
{% raw %}
```yaml
@@ -223,12 +226,8 @@ jobs:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix{% endraw %}
{%- ifversion actions-save-state-set-output-envs %}
run: echo "matrix={\"include\":[{\"project\":\"foo\",\"config\":\"Debug\"},{\"project\":\"bar\",\"config\":\"Release\"}]}" >> $GITHUB_OUTPUT
{%- else %}
- id: set-matrix
run: echo "::set-output name=matrix::{\"include\":[{\"project\":\"foo\",\"config\":\"Debug\"},{\"project\":\"bar\",\"config\":\"Release\"}]}"
{%- endif %}{% raw %}
job2:
needs: job1
runs-on: ubuntu-latest
@@ -239,9 +238,9 @@ jobs:
```
{% endraw %}
#### Example returning a JSON data type
#### 返回 JSON 数据类型的示例
This workflow uses `fromJSON` to convert environment variables from a string to a Boolean or integer.
此工作流使用 `fromJSON` 将环境变量从字符串转换为布尔值或整数。
{% raw %}
```yaml
@@ -264,37 +263,37 @@ jobs:
`hashFiles(path)`
Returns a single hash for the set of files that matches the `path` pattern. You can provide a single `path` pattern or multiple `path` patterns separated by commas. The `path` is relative to the `GITHUB_WORKSPACE` directory and can only include files inside of the `GITHUB_WORKSPACE`. This function calculates an individual SHA-256 hash for each matched file, and then uses those hashes to calculate a final SHA-256 hash for the set of files. If the `path` pattern does not match any files, this returns an empty string. For more information about SHA-256, see "[SHA-2](https://en.wikipedia.org/wiki/SHA-2)."
返回与 `path` 模式匹配的文件集的单个哈希。 可以提供用逗号分隔的单个 `path` 模式或多个 `path` 模式。 `path``GITHUB_WORKSPACE` 目录相关,且仅包含 `GITHUB_WORKSPACE` 内的文件。 此函数为每个匹配的文件计算单独的 SHA-256 哈希, 然后使用这些哈希来计算文件集的最终 SHA-256 哈希。 如果 `path` 模式与任何文件都不匹配,则返回空字符串。 有关 SHA-256 的详细信息,请参阅“[SHA-2](https://en.wikipedia.org/wiki/SHA-2)”。
You can use pattern matching characters to match file names. Pattern matching is case-insensitive on Windows. For more information about supported pattern matching characters, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/using-workflows/workflow-syntax-for-github-actions/#filter-pattern-cheat-sheet)."
您可以使用模式匹配字符来匹配文件名。 模式匹配在 Windows 上不区分大小写。 有关受支持的模式匹配字符的详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流语法](/actions/using-workflows/workflow-syntax-for-github-actions/#filter-pattern-cheat-sheet)”。
#### Example with a single pattern
#### 单一模式示例
Matches any `package-lock.json` file in the repository.
匹配存储库中的任何 `package-lock.json` 文件。
`hashFiles('**/package-lock.json')`
#### Example with multiple patterns
#### 多个模式示例
Creates a hash for any `package-lock.json` and `Gemfile.lock` files in the repository.
为存储库中的任何 `package-lock.json` `Gemfile.lock` 文件创建哈希。
`hashFiles('**/package-lock.json', '**/Gemfile.lock')`
{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}
## Status check functions
{% ifversion fpt or ghes > 3.3 or ghae-issue-5504 or ghec %}
## 状态检查函数
You can use the following status check functions as expressions in `if` conditionals. A default status check of `success()` is applied unless you include one of these functions. For more information about `if` conditionals, see "[Workflow syntax for GitHub Actions](/articles/workflow-syntax-for-github-actions/#jobsjob_idif)" and "[Metadata syntax for GitHub Composite Actions](/actions/creating-actions/metadata-syntax-for-github-actions/#runsstepsif)".
可以将以下状态检查函数用作 `if` 条件中的表达式。 除非包含这些函数之一,否则将应用 `success()` 的默认状态检查。 有关 `if` 条件的详细信息,请参阅“[GitHub Actions 的工作流语法](/articles/workflow-syntax-for-github-actions/#jobsjob_idif)”和“[GitHub Composite Actions 的元数据语法](/actions/creating-actions/metadata-syntax-for-github-actions/#runsstepsif)”。
{% else %}
## Check Functions
You can use the following status check functions as expressions in `if` conditionals. A default status check of `success()` is applied unless you include one of these functions. For more information about `if` conditionals, see "[Workflow syntax for GitHub Actions](/articles/workflow-syntax-for-github-actions/#jobsjob_idif)".
## 检查函数
可以将以下状态检查函数用作 `if` 条件中的表达式。 除非包含这些函数之一,否则将应用 `success()` 的默认状态检查。 有关 `if` 条件的详细信息,请参阅“[GitHub Actions 的工作流语法](/articles/workflow-syntax-for-github-actions/#jobsjob_idif)”。
{% endif %}
### success
Returns `true` when none of the previous steps have failed or been canceled.
如果前面的步骤都没有失败或被取消,则返回 `true`
#### Example
#### 示例
```yaml
steps:
@@ -303,11 +302,11 @@ steps:
if: {% raw %}${{ success() }}{% endraw %}
```
### always
### 通用
Causes the step to always execute, and returns `true`, even when canceled. A job or step will not run when a critical failure prevents the task from running. For example, if getting sources failed.
导致步骤始终执行,并返回 `true`,即使取消也一样。 作业或步骤在重大故障阻止任务运行时不会运行。 例如,如果获取来源失败。
#### Example
#### 示例
```yaml
if: {% raw %}${{ always() }}{% endraw %}
@@ -315,19 +314,19 @@ if: {% raw %}${{ always() }}{% endraw %}
### cancelled
Returns `true` if the workflow was canceled.
如果工作流被取消,则返回 `true`
#### Example
#### 示例
```yaml
if: {% raw %}${{ cancelled() }}{% endraw %}
```
### failure
### 失败
Returns `true` when any previous step of a job fails. If you have a chain of dependent jobs, `failure()` returns `true` if any ancestor job fails.
如果作业的任何先前步骤失败,将返回 `true`。 如果有一系列依赖项作业,则 `failure()` 在任何上级作业失败时返回 `true`
#### Example
#### 示例
```yaml
steps:
@@ -336,11 +335,11 @@ steps:
if: {% raw %}${{ failure() }}{% endraw %}
```
#### failure with conditions
#### 有条件的失败
You can include extra conditions for a step to run after a failure, but you must still include `failure()` to override the default status check of `success()` that is automatically applied to `if` conditions that don't contain a status check function.
可以包含一个在失败后运行的步骤的额外条件,但仍必须包含 `failure()` 以覆盖自动应用于不包含状态检查函数的 `if` 条件的默认 `success()` 状态检查。
##### Example
##### 示例
```yaml
steps:
@@ -352,11 +351,11 @@ steps:
if: {% raw %}${{ failure() && steps.demo.conclusion == 'failure' }}{% endraw %}
```
## Object filters
## 对象过滤器
You can use the `*` syntax to apply a filter and select matching items in a collection.
可使用 `*` 语法来应用筛选器并选择集合中的匹配项。
For example, consider an array of objects named `fruits`.
例如,考虑名为 `fruits` 的对象数组。
```json
[
@@ -366,9 +365,9 @@ For example, consider an array of objects named `fruits`.
]
```
The filter `fruits.*.name` returns the array `[ "apple", "orange", "pear" ]`.
筛选器 `fruits.*.name` 返回数组 `[ "apple", "orange", "pear" ]`
You may also use the `*` syntax on an object. For example, suppose you have an object named `vegetables`.
还可以对某个对象使用 `*` 语法。 例如,假设有一个名为 `vegetables` 的对象。
```json
@@ -391,7 +390,7 @@ You may also use the `*` syntax on an object. For example, suppose you have an o
}
```
The filter `vegetables.*.ediblePortions` could evaluate to:
筛选器 `vegetables.*.ediblePortions` 的计算结果如下:
```json
@@ -402,4 +401,4 @@ The filter `vegetables.*.ediblePortions` could evaluate to:
]
```
Since objects don't preserve order, the order of the output can not be guaranteed.
由于对象不保留顺序,因此无法保证输出的顺序。

View File

@@ -1,7 +1,7 @@
---
title: Finding and customizing actions
shortTitle: Find and customize actions
intro: 'Actions are the building blocks that power your workflow. A workflow can contain actions created by the community, or you can create your own actions directly within your application''s repository. This guide will show you how to discover, use, and customize actions.'
title: 查找和自定义操作
shortTitle: Finding and customizing actions
intro: 操作是支持工作流程的构建块。 工作流程可以包含社区创建的操作,您也可以直接在应用程序的仓库中创建您自己的操作。 本指南说明如何发现、使用和自定义操作。
redirect_from:
- /actions/automating-your-workflow-with-github-actions/using-github-marketplace-actions
- /actions/automating-your-workflow-with-github-actions/using-actions-from-github-marketplace-in-your-workflow
@@ -15,71 +15,75 @@ versions:
type: how_to
topics:
- Fundamentals
ms.openlocfilehash: cb2b8bb24e044bd559b0823ec7b0e4be7be1becb
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/11/2022
ms.locfileid: '147063792'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 概述
## Overview
在工作流程中使用的操作可以定义于:
The actions you use in your workflow can be defined in:
- 与工作流文件相同的存储库{% ifversion internal-actions %}
- 在同一企业帐户中被配置为允许访问工作流程的内部仓库{% endif %}
- 任何公共仓库
- Docker Hub 上发布的 Docker 容器图像
- The same repository as your workflow file{% ifversion internal-actions %}
- An internal repository within the same enterprise account that is configured to allow access to workflows{% endif %}
- Any public repository
- A published Docker container image on Docker Hub
{% data variables.product.prodname_marketplace %} is a central location for you to find actions created by the {% data variables.product.prodname_dotcom %} community.{% ifversion fpt or ghec %} [{% data variables.product.prodname_marketplace %} page](https://github.com/marketplace/actions/) enables you to filter for actions by category. {% endif %}
{% data variables.product.prodname_marketplace %} 是你用来查找 {% data variables.product.prodname_dotcom %} 社区创建的操作的中心位置。{% ifversion fpt or ghec %} 利用[{% data variables.product.prodname_marketplace %} 页面](https://github.com/marketplace/actions/)页面可按类别筛选操作。 {% endif %}
{% data reusables.actions.enterprise-marketplace-actions %}
{% ifversion fpt or ghec %}
## Browsing Marketplace actions in the workflow editor
## 在工作流程编辑器中浏览 Marketplace 操作
You can search and browse actions directly in your repository's workflow editor. From the sidebar, you can search for a specific action, view featured actions, and browse featured categories. You can also view the number of stars an action has received from the {% data variables.product.prodname_dotcom %} community.
您可以直接在仓库的工作流程编辑器中搜索和浏览操作。 从边栏可以搜索特定的操作、查看特色操作和浏览特色类别。 您也可以查看操作从 {% data variables.product.prodname_dotcom %} 社区获得的星标数。
1. In your repository, browse to the workflow file you want to edit.
1. In the upper right corner of the file view, to open the workflow editor, click {% octicon "pencil" aria-label="The edit icon" %}.
![Edit workflow file button](/assets/images/help/repository/actions-edit-workflow-file.png)
1. To the right of the editor, use the {% data variables.product.prodname_marketplace %} sidebar to browse actions. Actions with the {% octicon "verified" aria-label="The verified badge" %} badge indicate {% data variables.product.prodname_dotcom %} has verified the creator of the action as a partner organization.
![Marketplace workflow sidebar](/assets/images/help/repository/actions-marketplace-sidebar.png)
1. 在仓库中,浏览至要编辑的工作流程文件。
1. 要打开工作流编辑器,在文件视图右上角单击 {% octicon "pencil" aria-label="The edit icon" %}
![编辑工作流文件按钮](/assets/images/help/repository/actions-edit-workflow-file.png)
1. 在编辑器右侧,使用 {% data variables.product.prodname_marketplace %} 边栏浏览操作。 带有 {% octicon "verified" aria-label="The verified badge" %} 徽章的操作表示 {% data variables.product.prodname_dotcom %} 已验证操作的创建者为合作伙伴组织。
![Marketplace 工作流边栏](/assets/images/help/repository/actions-marketplace-sidebar.png)
## Adding an action to your workflow
## 添加操作到工作流程
You can add an action to your workflow by referencing the action in your workflow file.
您可以通过在工作流程文件中引用操作来向工作流程添加操作。
You can view the actions referenced in your {% data variables.product.prodname_actions %} workflows as dependencies in the dependency graph of the repository containing your workflows. For more information, see “[About the dependency graph](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph).
您可以将 {% data variables.product.prodname_actions %} 工作流程中引用的操作视为包含工作流程的仓库依赖图中的依赖项。 有关详细信息,请参阅“[关于依赖项关系图](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph)”
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
{% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6269 %}
{% note %}
**Note:** To enhance security, {% data variables.product.prodname_actions %} is deprecating redirects for actions. This means that when the owner or name of an action's repository is changed, any workflows using that action with the previous name will fail.
注意:为了增强安全性,{% data variables.product.prodname_actions %} 弃用了操作的重定向。 这意味着,当操作存储库的所有者或名称发生更改时,使用该操作并具有先前名称的任何工作流程都将失败。
{% endnote %}
{% endif %}
### Adding an action from {% data variables.product.prodname_marketplace %}
### {% data variables.product.prodname_marketplace %} 添加操作
An action's listing page includes the action's version and the workflow syntax required to use the action. To keep your workflow stable even when updates are made to an action, you can reference the version of the action to use by specifying the Git or Docker tag number in your workflow file.
操作的列表页包括操作的版本以及使用操作所需的工作流程语法。 为使工作流程在操作有更新时也保持稳定,您可以在工作流程文件中指定 Git Docker 标记号以引用所用操作的版本。
1. Navigate to the action you want to use in your workflow.
1. Under "Installation", click {% octicon "clippy" aria-label="The edit icon" %} to copy the workflow syntax.
![View action listing](/assets/images/help/repository/actions-sidebar-detailed-view.png)
1. Paste the syntax as a new step in your workflow. For more information, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idsteps)."
1. If the action requires you to provide inputs, set them in your workflow. For information on inputs an action might require, see "[Using inputs and outputs with an action](/actions/learn-github-actions/finding-and-customizing-actions#using-inputs-and-outputs-with-an-action)."
1. 导航到要在工作流程中使用的操作。
1. 在“安装”下,单击 {% octicon "clippy" aria-label="The edit icon" %} 复制工作流语法。
![查看操作列表](/assets/images/help/repository/actions-sidebar-detailed-view.png)
1. 将语法粘贴为工作流程中的新步骤。 有关详细信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流语法](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idsteps)”。
1. 如果操作要求您提供输入,请将其设置在工作流程中。 有关操作可能需要的输入的信息,请参阅“[对操作使用输入和输出](/actions/learn-github-actions/finding-and-customizing-actions#using-inputs-and-outputs-with-an-action)”。
{% data reusables.dependabot.version-updates-for-actions %}
{% endif %}
### Adding an action from the same repository
### 从相同仓库添加操作
If an action is defined in the same repository where your workflow file uses the action, you can reference the action with either the `{owner}/{repo}@{ref}` or `./path/to/dir` syntax in your workflow file.
如果操作在工作流文件使用该操作的同一存储库中定义,你可以在工作流文件中通过 `{owner}/{repo}@{ref}` `./path/to/dir` 语法引用操作。
Example repository file structure:
示例仓库文件结构:
```
|-- hello-world (repository)
@@ -91,7 +95,7 @@ Example repository file structure:
| └── action.yml
```
Example workflow file:
示例工作流程文件:
```yaml
jobs:
@@ -104,13 +108,13 @@ jobs:
- uses: ./.github/actions/hello-world-action
```
The `action.yml` file is used to provide metadata for the action. Learn about the content of this file in "[Metadata syntax for GitHub Actions](/actions/creating-actions/metadata-syntax-for-github-actions)."
`action.yml` 文件用于提供操作的元数据。 要了解此文件的内容,请参阅“[GitHub Actions 的元数据语法](/actions/creating-actions/metadata-syntax-for-github-actions)”。
### Adding an action from a different repository
### 从不同仓库添加操作
If an action is defined in a different repository than your workflow file, you can reference the action with the `{owner}/{repo}@{ref}` syntax in your workflow file.
如果操作在与工作流文件不同的存储库中定义,可在工作流文件中通过 `{owner}/{repo}@{ref}` 语法引用该操作。
The action must be stored in a public repository{% ifversion internal-actions %} or an internal repository that is configured to allow access to workflows. For more information, see "[Sharing actions and workflows with your enterprise](/actions/creating-actions/sharing-actions-and-workflows-with-your-enterprise)."{% else %}.{% endif %}
该操作必须存储在公共存储库{% ifversion internal-actions %} 或存储在配置为允许访问工作流的内部存储库中。 有关详细信息,请参阅“[与企业共享操作和工作流](/actions/creating-actions/sharing-actions-and-workflows-with-your-enterprise)”。{% else %}{% endif %}
```yaml
jobs:
@@ -120,9 +124,9 @@ jobs:
uses: {% data reusables.actions.action-setup-node %}
```
### Referencing a container on Docker Hub
### 引用 Docker Hub 上的容器
If an action is defined in a published Docker container image on Docker Hub, you must reference the action with the `docker://{image}:{tag}` syntax in your workflow file. To protect your code and data, we strongly recommend you verify the integrity of the Docker container image from Docker Hub before using it in your workflow.
如果操作在 Docker Hub 上发布的 Docker 容器图像中定义,必须在工作流文件中通过 `docker://{image}:{tag}` 语法引用该操作。 为保护代码和数据,强烈建议先验证 Docker Hub 中 Docker 容器图像的完整性后再将其用于工作流程。
```yaml
jobs:
@@ -132,57 +136,57 @@ jobs:
uses: docker://alpine:3.8
```
For some examples of Docker actions, see the [Docker-image.yml workflow](https://github.com/actions/starter-workflows/blob/main/ci/docker-image.yml) and "[Creating a Docker container action](/articles/creating-a-docker-container-action)."
有关 Docker 操作的一些示例,请参阅 [Docker-image.yml 工作流](https://github.com/actions/starter-workflows/blob/main/ci/docker-image.yml)和“[创建 Docker 容器操作](/articles/creating-a-docker-container-action)”。
## Using release management for your custom actions
## 对自定义操作使用发行版管理
The creators of a community action have the option to use tags, branches, or SHA values to manage releases of the action. Similar to any dependency, you should indicate the version of the action you'd like to use based on your comfort with automatically accepting updates to the action.
社区操作的创建者可以选择使用标记、分支或 SHA 值来管理操作的版本。 与任何依赖项类似,您应该根据自动接受操作更新的舒适程度来指示要使用的操作版本。
You will designate the version of the action in your workflow file. Check the action's documentation for information on their approach to release management, and to see which tag, branch, or SHA value to use.
您将在工作流程文件中指定操作的版本。 检查操作的文档,了解其发行版管理方法的信息,并查看要使用的标记、分支或 SHA 值。
{% note %}
**Note:** We recommend that you use a SHA value when using third-party actions. For more information, see [Security hardening for GitHub Actions](/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions)
注意:建议在使用第三方操作时使用 SHA 值。 有关详细信息,请参阅“[GitHub Actions 的安全强化](/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions)”。
{% endnote %}
### Using tags
### 使用标记
Tags are useful for letting you decide when to switch between major and minor versions, but these are more ephemeral and can be moved or deleted by the maintainer. This example demonstrates how to target an action that's been tagged as `v1.0.1`:
标记可用于让您决定何时在主要版本和次要版本之间切换,但这只是临时的,可能被维护员移动或删除。 此示例演示如何定位已标记为 `v1.0.1` 的操作:
```yaml
steps:
- uses: actions/javascript-action@v1.0.1
```
### Using SHAs
### 使用 SHA
If you need more reliable versioning, you should use the SHA value associated with the version of the action. SHAs are immutable and therefore more reliable than tags or branches. However this approach means you will not automatically receive updates for an action, including important bug fixes and security updates. You must use a commit's full SHA value, and not an abbreviated value. This example targets an action's SHA:
如果需要更可靠的版本控制,应使用与操作版本关联的 SHA 值。 SHA 是不可变的,因此比标记或分支更可靠。 但是,此方法意味着您不会自动接收操作的更新,包括重要的 Bug 修复和安全更新。 必须使用提交的完整 SHA 值,而不是缩写值。 此示例针对操作的 SHA
```yaml
steps:
- uses: actions/javascript-action@172239021f7ba04fe7327647b213799853a9eb89
```
### Using branches
### 使用分支
Specifying a target branch for the action means it will always run the version currently on that branch. This approach can create problems if an update to the branch includes breaking changes. This example targets a branch named `@main`:
为操作指定目标分支意味着它将始终在该分支上运行当前的版本。 如果对分支的更新包含重大更改,此方法可能会造成问题。 此示例针对名为 `@main` 的分支:
```yaml
steps:
- uses: actions/javascript-action@main
```
For more information, see "[Using release management for actions](/actions/creating-actions/about-actions#using-release-management-for-actions)."
有关详细信息,请参阅“[针对操作使用发布管理](/actions/creating-actions/about-actions#using-release-management-for-actions)”。
## Using inputs and outputs with an action
## 对操作使用输入和输出
An action often accepts or requires inputs and generates outputs that you can use. For example, an action might require you to specify a path to a file, the name of a label, or other data it will use as part of the action processing.
操作通常接受或需要输入并生成可以使用的输出。 例如,操作可能要求您指定文件的路径、标签的名称或它将用作操作处理一部分的其他数据。
To see the inputs and outputs of an action, check the `action.yml` or `action.yaml` in the root directory of the repository.
若要查看操作的输入和输出,请检查存储库根目录中的 `action.yml` `action.yaml`
In this example `action.yml`, the `inputs` keyword defines a required input called `file-path`, and includes a default value that will be used if none is specified. The `outputs` keyword defines an output called `results-file`, which tells you where to locate the results.
在示例 `action.yml` 中,`inputs` 关键字定义名为 `file-path` 的必需输入,并且包括在未指定任何输入时使用的默认值。 `outputs` 关键字定义名为 `results-file` 的输出,指示在何处查找结果。
```yaml
name: "Example"
@@ -199,11 +203,11 @@ outputs:
{% ifversion ghae %}
## Using the actions included with {% data variables.product.prodname_ghe_managed %}
## 使用 {% data variables.product.prodname_ghe_managed %} 随附的操作
By default, you can use most of the official {% data variables.product.prodname_dotcom %}-authored actions in {% data variables.product.prodname_ghe_managed %}. For more information, see "[Using actions in {% data variables.product.prodname_ghe_managed %}](/admin/github-actions/using-actions-in-github-ae)."
默认情况下,可以在 {% data variables.product.prodname_ghe_managed %} 中使用大多数官方 {% data variables.product.prodname_dotcom %} 编写的操作。 有关详细信息,请参阅“[使用 {% data variables.product.prodname_ghe_managed %} 中的操作](/admin/github-actions/using-actions-in-github-ae)”。
{% endif %}
## Next steps
## 后续步骤
To continue learning about {% data variables.product.prodname_actions %}, see "[Essential features of {% data variables.product.prodname_actions %}](/actions/learn-github-actions/essential-features-of-github-actions)."
若要继续了解 {% data variables.product.prodname_actions %},请参阅“[{% data variables.product.prodname_actions %} 的基本功能](/actions/learn-github-actions/essential-features-of-github-actions)”。

View File

@@ -1,8 +1,7 @@
---
title: Understanding GitHub Actions
shortTitle: Understand GitHub Actions
intro: 'Learn the basics of {% data variables.product.prodname_actions %}, including core concepts and essential terminology.'
miniTocMaxHeadingLevel: 3
title: 了解 GitHub Actions
shortTitle: Understanding GitHub Actions
intro: '学习 {% data variables.product.prodname_actions %} 的基础知识,包括核心概念和基本术语。'
redirect_from:
- /github/automating-your-workflow-with-github-actions/core-concepts-for-github-actions
- /actions/automating-your-workflow-with-github-actions/core-concepts-for-github-actions
@@ -16,87 +15,96 @@ versions:
type: overview
topics:
- Fundamentals
ms.openlocfilehash: 439aa7fb77fb68c5f66da00a0de666d809b82fde
ms.sourcegitcommit: dc42bb4a4826b414751ffa9eed38962c3e3fea8e
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 07/13/2022
ms.locfileid: '146139447'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## <a name="overview"></a>概述
## Overview
{% data reusables.actions.about-actions %} 您可以创建工作流程来构建和测试存储库的每个拉取请求,或将合并的拉取请求部署到生产环境。
{% data reusables.actions.about-actions %} You can create workflows that build and test every pull request to your repository, or deploy merged pull requests to production.
{% data variables.product.prodname_actions %} goes beyond just DevOps and lets you run workflows when other events happen in your repository. For example, you can run a workflow to automatically add the appropriate labels whenever someone creates a new issue in your repository.
{% data variables.product.prodname_actions %} 不仅仅是 DevOps还允许您在存储库中发生其他事件时运行工作流程。 例如,您可以运行工作流程,以便在有人在您的存储库中创建新问题时自动添加相应的标签。
{% ifversion fpt or ghec %}
{% data variables.product.prodname_dotcom %} provides Linux, Windows, and macOS virtual machines to run your workflows, or you can host your own self-hosted runners in your own data center or cloud infrastructure.
{% data variables.product.prodname_dotcom %} 提供 LinuxWindows macOS 虚拟机来运行工作流程,或者您可以在自己的数据中心或云基础架构中托管自己的自托管运行器。
{% elsif ghes or ghae %}
You must host your own Linux, Windows, or macOS virtual machines to run workflows for {% data variables.location.product_location %}. {% data reusables.actions.self-hosted-runner-locations %}
您必须托管自己的 LinuxWindows macOS 虚拟机才能运行 {% data variables.product.product_location %} 工作流程。 {% data reusables.actions.self-hosted-runner-locations %}
{% endif %}
{% ifversion ghec or ghes or ghae %}
For more information about introducing {% data variables.product.prodname_actions %} to your enterprise, see "[Introducing {% data variables.product.prodname_actions %} to your enterprise](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/introducing-github-actions-to-your-enterprise)."
若要详细了解如何将 {% data variables.product.prodname_actions %} 引入企业,请参阅“[ {% data variables.product.prodname_actions %} 引入企业](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/introducing-github-actions-to-your-enterprise)”。
{% endif %}
## The components of {% data variables.product.prodname_actions %}
## <a name="the-components-of--data-variablesproductprodname_actions-"></a>{% data variables.product.prodname_actions %} 的组件
You can configure a {% data variables.product.prodname_actions %} _workflow_ to be triggered when an _event_ occurs in your repository, such as a pull request being opened or an issue being created. Your workflow contains one or more _jobs_ which can run in sequential order or in parallel. Each job will run inside its own virtual machine _runner_, or inside a container, and has one or more _steps_ that either run a script that you define or run an _action_, which is a reusable extension that can simplify your workflow.
可配置 {% data variables.product.prodname_actions %} 工作流,使其在存储库中发生事件(例如打开拉取请求或创建问题)时触发 。 工作流包含一个或多个可按顺序或并行运行的作业。 每个作业都将在其自己的虚拟机运行器中或在容器中运行,并具有一个或多个步骤,用于运行定义的脚本或运行动作。动作是一个可重用的扩展,可简化工作流 。
![Workflow overview](/assets/images/help/images/overview-actions-simple.png)
![工作流概述](/assets/images/help/images/overview-actions-simple.png)
### Workflows
### <a name="workflows"></a>工作流
{% data reusables.actions.about-workflows-long %}
{% ifversion fpt or ghes > 3.3 or ghae > 3.3 or ghec %}You can reference a workflow within another workflow, see "[Reusing workflows](/actions/learn-github-actions/reusing-workflows)."{% endif %}
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 or ghec %}可在一个工作流中引用另一个工作流,详见“[重用工作流](/actions/learn-github-actions/reusing-workflows)”。{% endif %}
For more information about workflows, see "[Using workflows](/actions/using-workflows)."
有关工作流的详细信息,请参阅“[使用工作流](/actions/using-workflows)”。
### Events
### <a name="events"></a>事件
An event is a specific activity in a repository that triggers a workflow run. For example, activity can originate from {% data variables.product.prodname_dotcom %} when someone creates a pull request, opens an issue, or pushes a commit to a repository. You can also trigger a workflow run on a schedule, by [posting to a REST API](/rest/reference/repos#create-a-repository-dispatch-event), or manually.
事件是存储库中触发工作流程运行的特定活动。 例如,当有人创建拉取请求、打开议题或将提交推送到存储库时,活动可能源自 {% data variables.product.prodname_dotcom %}。 还可通过[发布到 REST API](/rest/reference/repos#create-a-repository-dispatch-event) 触发按计划运行的工作流,或者手动触发。
For a complete list of events that can be used to trigger workflows, see [Events that trigger workflows](/actions/reference/events-that-trigger-workflows).
有关可用于触发工作流的事件的完整列表,请参阅[触发工作流的事件](/actions/reference/events-that-trigger-workflows)
### Jobs
### <a name="jobs"></a>作业
A job is a set of _steps_ in a workflow that execute on the same runner. Each step is either a shell script that will be executed, or an _action_ that will be run. Steps are executed in order and are dependent on each other. Since each step is executed on the same runner, you can share data from one step to another. For example, you can have a step that builds your application followed by a step that tests the application that was built.
作业是工作流中在同一运行器上执行的一组步骤。 每个步骤要么是一个将要执行的 shell 脚本,要么是一个将要运行的动作。 步骤按顺序执行,并且相互依赖。 由于每个步骤都在同一运行器上执行,因此您可以将数据从一个步骤共享到另一个步骤。 例如,可以有一个生成应用程序的步骤,后跟一个测试已生成应用程序的步骤。
You can configure a job's dependencies with other jobs; by default, jobs have no dependencies and run in parallel with each other. When a job takes a dependency on another job, it will wait for the dependent job to complete before it can run. For example, you may have multiple build jobs for different architectures that have no dependencies, and a packaging job that is dependent on those jobs. The build jobs will run in parallel, and when they have all completed successfully, the packaging job will run.
您可以配置作业与其他作业的依赖关系;默认情况下,作业没有依赖关系,并且彼此并行运行。 当一个作业依赖于另一个作业时,它将等待从属作业完成,然后才能运行。 例如,对于没有依赖关系的不同体系结构,您可能有多个生成作业,以及一个依赖于这些作业的打包作业。 生成作业将并行运行,当它们全部成功完成后,打包作业将运行。
For more information about jobs, see "[Using jobs](/actions/using-jobs)."
有关作业的详细信息,请参阅“[使用作业](/actions/using-jobs)”。
### Actions
### <a name="actions"></a>操作
An _action_ is a custom application for the {% data variables.product.prodname_actions %} platform that performs a complex but frequently repeated task. Use an action to help reduce the amount of repetitive code that you write in your workflow files. An action can pull your git repository from {% data variables.product.prodname_dotcom %}, set up the correct toolchain for your build environment, or set up the authentication to your cloud provider.
操作是用于 {% data variables.product.prodname_actions %} 平台的自定义应用程序,它执行复杂但经常重复的任务。 使用操作可帮助减少在工作流程文件中编写的重复代码量。 操作可以从 {% data variables.product.prodname_dotcom %} 拉取 git 存储库,为您的构建环境设置正确的工具链,或设置对云提供商的身份验证。
You can write your own actions, or you can find actions to use in your workflows in the {% data variables.product.prodname_marketplace %}.
您可以编写自己的操作,也可以在 {% data variables.product.prodname_marketplace %} 中找到要在工作流程中使用的操作。
{% data reusables.actions.internal-actions-summary %}
For more information, see "[Creating actions](/actions/creating-actions)."
有关详细信息,请参阅“[创建操作](/actions/creating-actions)”。
### Runners
### <a name="runners"></a>运行程序
{% data reusables.actions.about-runners %} Each runner can run a single job at a time. {% ifversion ghes or ghae %} You must host your own runners for {% data variables.product.product_name %}. {% elsif fpt or ghec %}{% data variables.product.company_short %} provides Ubuntu Linux, Microsoft Windows, and macOS runners to run your workflows; each workflow run executes in a fresh, newly-provisioned virtual machine. {% ifversion actions-hosted-runners %} {% data variables.product.prodname_dotcom %} also offers {% data variables.actions.hosted_runner %}s, which are available in larger configurations. For more information, see "[Using {% data variables.actions.hosted_runner %}s](/actions/using-github-hosted-runners/using-larger-runners)." {% endif %}If you need a different operating system or require a specific hardware configuration, you can host your own runners.{% endif %} For more information{% ifversion fpt or ghec %} about self-hosted runners{% endif %}, see "[Hosting your own runners](/actions/hosting-your-own-runners)."
{% data reusables.actions.about-runners %} 每个运行器一次可以运行一个作业。 {% ifversion ghes or ghae %} 您必须为 {% data variables.product.product_name %} 托管自己的运行器。 {% elsif fpt or ghec %}{% data variables.product.company_short %} 提供 Ubuntu LinuxMicrosoft Windows macOS 运行器来运行您的工作流程;每个工作流程运行都在新预配的全新虚拟机中执行。 如果需要其他操作系统或特定硬件配置,可托管自己的运行器。{% endif %}有关{% ifversion fpt or ghec %}自托管运行器{% endif %}的详细信息,请参阅“[托管自己的运行器](/actions/hosting-your-own-runners)”。
{% data reusables.actions.workflow-basic-example-and-explanation %}
## Next steps
## <a name="more-complex-examples"></a>更复杂的示例
{% data reusables.actions.link-to-example-library %}
{% data reusables.actions.onboarding-next-steps %}
## <a name="next-steps"></a>后续步骤
## Contacting support
- 若要继续了解 {% data variables.product.prodname_actions %},请参阅“[查找和自定义操作](/actions/learn-github-actions/finding-and-customizing-actions)”。
{% ifversion fpt or ghec or ghes %}
- 若要了解 {% data variables.product.prodname_actions %} 的计费工作原理,请参阅“[关于 {% data variables.product.prodname_actions %} 的计费](/actions/reference/usage-limits-billing-and-administration#about-billing-for-github-actions)”。
{% endif %}
## <a name="contacting-support"></a>联系支持部门
{% data reusables.actions.contacting-support %}
{% ifversion ghec or ghes or ghae %}
## Further reading
## <a name="further-reading"></a>延伸阅读
- "[About {% data variables.product.prodname_actions %} for enterprises](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/about-github-actions-for-enterprises)"
{% endif %}
- [关于 {% data variables.product.prodname_actions %} 企业版](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/about-github-actions-for-enterprises)”{% endif %}

View File

@@ -1,6 +1,6 @@
---
title: Moving assigned issues on project boards
intro: 'You can use {% data variables.product.prodname_actions %} to automatically move an issue to a specific column on a project board when the issue is assigned.'
title: 在项目板上移动分配的议题
intro: '您可以使用 {% data variables.product.prodname_actions %} 在议题被分配时自动将议题移到项目板上的特定列。'
redirect_from:
- /actions/guides/moving-assigned-issues-on-project-boards
versions:
@@ -13,23 +13,27 @@ topics:
- Workflows
- Project management
shortTitle: Move assigned issues
ms.openlocfilehash: 88cec7ca6f2e7774fb29407b0b3ee14dc7041067
ms.sourcegitcommit: 5f9527483381cfb1e41f2322f67c80554750a47d
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/11/2022
ms.locfileid: '147410457'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 简介
## Introduction
本教程演示如何在分配问题时使用 [`alex-page/github-project-automation-plus` 操作](https://github.com/marketplace/actions/github-project-automation)自动将问题移至项目板上的特定列。 例如,分配问题后,可以将其移动到项目板的 `In Progress` 列中。
This tutorial demonstrates how to use the [`alex-page/github-project-automation-plus` action](https://github.com/marketplace/actions/github-project-automation) to automatically move an issue to a specific column on a project board when the issue is assigned. For example, when an issue is assigned, you can move it into the `In Progress` column your project board.
在本教程中,你将首先创建一个使用 [`alex-page/github-project-automation-plus` 操作](https://github.com/marketplace/actions/github-project-automation)的工作流文件。 然后,您将自定义工作流以适应您的需要。
In the tutorial, you will first make a workflow file that uses the [`alex-page/github-project-automation-plus` action](https://github.com/marketplace/actions/github-project-automation). Then, you will customize the workflow to suit your needs.
## Creating the workflow
## 创建工作流程
1. {% data reusables.actions.choose-repo %}
2. In your repository, choose a project board. You can use an existing project, or you can create a new project. For more information about creating a project, see "[Creating a project board](/github/managing-your-work-on-github/creating-a-project-board)."
2. 在仓库中,选择项目板。 您可以使用现有项目,也可以创建新项目。 有关如何创建项目的详细信息,请参阅“[创建项目板](/github/managing-your-work-on-github/creating-a-project-board)”。
3. {% data reusables.actions.make-workflow-file %}
4. Copy the following YAML contents into your workflow file.
4. 将以下 YAML 内容复制到工作流程文件中。
```yaml{:copy}
{% indented_data_reference reusables.actions.actions-not-certified-by-github-comment spaces=4 %}
@@ -52,28 +56,28 @@ In the tutorial, you will first make a workflow file that uses the [`alex-page/g
repo-token: {% raw %}${{ secrets.PERSONAL_ACCESS_TOKEN }}{% endraw %}
```
5. Customize the parameters in your workflow file:
- Change the value for `project` to the name of your project board. If you have multiple project boards with the same name, the `alex-page/github-project-automation-plus` action will act on all projects with the specified name.
- Change the value for `column` to the name of the column where you want issues to move when they are assigned.
- Change the value for `repo-token`:
1. Create a {% data variables.product.pat_v1 %} with the `repo` scope. For more information, see "[Creating a {% data variables.product.pat_generic %}](/github/authenticating-to-github/creating-a-personal-access-token)."
1. Store this {% data variables.product.pat_generic %} as a secret in your repository. For more information about storing secrets, see "[Encrypted secrets](/actions/reference/encrypted-secrets)."
1. In your workflow file, replace `PERSONAL_ACCESS_TOKEN` with the name of your secret.
5. 自定义工工作流程文件中的参数:
- `project` 的值更改为项目板的名称。 如果有多个同名项目板,则 `alex-page/github-project-automation-plus` 操作将对具有指定名称的所有项目执行操作。
- `column` 的值更改为要在分配问题时将其移动到的列的名称。
- 更改 `repo-token` 的值:
1. 创建具有 `repo` 作用域的个人访问令牌。 有关详细信息,请参阅“[创建个人访问令牌](/github/authenticating-to-github/creating-a-personal-access-token)”。
1. 将此个人访问令牌作为机密存储在仓库中。 有关如何存储机密的详细信息,请参阅“[已加密的机密](/actions/reference/encrypted-secrets)”。
1. 在工作流文件中,将 `PERSONAL_ACCESS_TOKEN` 替换为机密的名称。
6. {% data reusables.actions.commit-workflow %}
## Testing the workflow
## 测试工作流程
Whenever an issue in your repository is assigned, the issue will be moved to the specified project board column. If the issue is not already on the project board, it will be added to the project board.
每当分配仓库中的议题时,议题将移到指定的项目板列。 如果议题尚未在项目板上,则将添加到项目板中。
If your repository is user-owned, the `alex-page/github-project-automation-plus` action will act on all projects in your repository or personal account that have the specified project name and column. Likewise, if your repository is organization-owned, the action will act on all projects in your repository or organization that have the specified project name and column.
如果存储库是用户拥有的存储库,则 `alex-page/github-project-automation-plus` 操作将对存储库或个人帐户中具有指定项目名称和列的所有项目执行操作。 同样,如果您的仓库归组织所有,则该操作将对仓库或组织中具有指定项目名称和列的所有项目执行。
Test your workflow by assigning an issue in your repository.
通过在仓库中分配议题来测试工作流程。
1. Open an issue in your repository. For more information, see "[Creating an issue](/github/managing-your-work-on-github/creating-an-issue)."
2. Assign the issue. For more information, see "[Assigning issues and pull requests to other GitHub users](/github/managing-your-work-on-github/assigning-issues-and-pull-requests-to-other-github-users)."
3. To see the workflow run that assigning the issue triggered, view the history of your workflow runs. For more information, see "[Viewing workflow run history](/actions/managing-workflow-runs/viewing-workflow-run-history)."
4. When the workflow completes, the issue that you assigned should be added to the specified project board column.
1. 在仓库中打开一个议题。 有关详细信息,请参阅“[创建问题](/github/managing-your-work-on-github/creating-an-issue)”。
2. 分配议题。 有关详细信息,请参阅“[向其他 GitHub 用户分配问题并拉取请求](/github/managing-your-work-on-github/assigning-issues-and-pull-requests-to-other-github-users)”。
3. 要查看分配议题所触发的工作流程运行,请查看工作流程运行的历史记录。 有关详细信息,请参阅“[查看工作流运行历史记录](/actions/managing-workflow-runs/viewing-workflow-run-history)”。
4. 工作流程完成后,分配的议题应会添加到指定的项目板列中。
## Next steps
## 后续步骤
- To learn more about additional things you can do with the `alex-page/github-project-automation-plus` action, like deleting or archiving project cards, visit the [`alex-page/github-project-automation-plus` action documentation](https://github.com/marketplace/actions/github-project-automation).
- 若要详细了解可使用 `alex-page/github-project-automation-plus` 操作执行的其他操作,例如删除或存档项目卡,请访问[`alex-page/github-project-automation-plus`操作文档](https://github.com/marketplace/actions/github-project-automation)

View File

@@ -1,65 +1,50 @@
---
title: Disabling and enabling a workflow
intro: 'You can disable and re-enable a workflow using the {% data variables.product.prodname_dotcom %} UI, the REST API, or {% data variables.product.prodname_cli %}.'
title: 禁用和启用工作流
intro: '您可以使用 {% data variables.product.prodname_dotcom %} UIREST API {% data variables.product.prodname_cli %} 禁用并重新启用工作流程。'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: Disable & enable a workflow
ms.openlocfilehash: 1c0ebc0f56ba8c337648670e0f07d8a56e2fc326
ms.sourcegitcommit: fb047f9450b41b24afc43d9512a5db2a2b750a2a
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/11/2022
ms.locfileid: '145109568'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
禁用工作流程允许您停止触发工作流程,而不必从仓库中删除文件。 您可以轻松地在 {% data variables.product.prodname_dotcom %} 上重新启用工作流程。
Disabling a workflow allows you to stop a workflow from being triggered without having to delete the file from the repo. You can easily re-enable the workflow again on {% data variables.product.prodname_dotcom %}.
在许多情况下,暂时禁用工作流程可能很有用。 以下是禁用工作流程可能有帮助的几个例子:
Temporarily disabling a workflow can be useful in many scenarios. These are a few examples where disabling a workflow might be helpful:
- A workflow error that produces too many or wrong requests, impacting external services negatively.
- A workflow that is not critical and is consuming too many minutes on your account.
- A workflow that sends requests to a service that is down.
- Workflows on a forked repository that aren't needed (for example, scheduled workflows).
- 产生请求过多或错误的工作流程错误,对外部服务产生负面影响。
- 不重要但会耗费您帐户上太多分钟数的工作流程。
- 向已关闭的服务发送请求的工作流程。
- 复刻仓库上不需要的工作流程(例如预定的工作流程)。
{% warning %}
**Warning:** {% data reusables.actions.scheduled-workflows-disabled %}
**警告**{% data reusables.actions.scheduled-workflows-disabled %}
{% endwarning %}
You can also disable and enable a workflow using the REST API. For more information, see the "[Actions REST API](/rest/reference/actions#workflows)."
您也可以使用 REST API 禁用和启用工作流程。 有关详细信息,请参阅“[Actions REST API](/rest/reference/actions#workflows)”。
## Disabling a workflow
## 禁用工作流程
{% webui %}
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.actions-tab %}
1. In the left sidebar, click the workflow you want to disable.
{% ifversion workflow-nav-2022 -%}
![Actions select workflow](/assets/images/help/repository/actions-select-workflow-2022.png)
{%- else -%}
![Actions select workflow](/assets/images/help/repository/actions-select-workflow.png)
{%- endif %}
1. Click {% octicon "kebab-horizontal" aria-label="The horizontal kebab icon" %}.
{% ifversion workflow-nav-2022 -%}
![actions kebab menu](/assets/images/help/repository/actions-workflow-menu-kebab-2022.png)
{%- else -%}
![Actions kebab menu](/assets/images/help/repository/actions-workflow-menu-kebab.png)
{%- endif %}
1. Click **Disable workflow**.
{% ifversion workflow-nav-2022 -%}
![actions disable workflow](/assets/images/help/repository/actions-disable-workflow-2022.png)
{%- else -%}
![actions disable workflow](/assets/images/help/repository/actions-disable-workflow.png)
The disabled workflow is marked {% octicon "stop" aria-label="The stop icon" %} to indicate its status.
![actions list disabled workflow](/assets/images/help/repository/actions-find-disabled-workflow.png)
{%- endif %}
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %}
1. 在左侧边栏中,单击您想要禁用的工作流程。
![操作选择工作流](/assets/images/actions-select-workflow.png)
1. 单击 {% octicon "kebab-horizontal" aria-label="The horizontal kebab icon" %}。
![操作烤肉串菜单](/assets/images/help/repository/actions-workflow-menu-kebab.png)
1. 单击“禁用工作流”。
![操作禁用工作流](/assets/images/help/repository/actions-disable-workflow.png) 禁用的工作流标记为 {% octicon "stop" aria-label="The stop icon" %} 以指示其状态。
![操作列表禁用的工作流](/assets/images/help/repository/actions-find-disabled-workflow.png)
{% endwebui %}
@@ -67,45 +52,34 @@ You can also disable and enable a workflow using the REST API. For more informat
{% data reusables.cli.cli-learn-more %}
To disable a workflow, use the `workflow disable` subcommand. Replace `workflow` with either the name, ID, or file name of the workflow you want to disable. For example, `"Link Checker"`, `1234567`, or `"link-check-test.yml"`. If you don't specify a workflow, {% data variables.product.prodname_cli %} returns an interactive menu for you to choose a workflow.
要禁用工作流,请使用 `workflow disable` 子命令。 将 `workflow` 替换为要禁用的工作流的名称、ID 或文件名。 例如,`"Link Checker"``1234567` `"link-check-test.yml"`。 如果您没有指定工作流程,{% data variables.product.prodname_cli %} 将返回交互式菜单供您选择工作流程。
```shell
gh workflow disable WORKFLOW
gh workflow disable <em>workflow</em>
```
{% endcli %}
## Enabling a workflow
## 启用工作流程
{% webui %}
You can re-enable a workflow that was previously disabled.
您可以重新启用以前禁用过的工作流程。
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.actions-tab %}
1. In the left sidebar, click the workflow you want to enable.
{% ifversion workflow-nav-2022 -%}
![Actions select disabled workflow](/assets/images/help/repository/actions-select-disabled-workflow-2022.png)
{%- else -%}
![Actions select disabled workflow](/assets/images/help/repository/actions-select-disabled-workflow.png)
{%- endif %}
1. Click **Enable workflow**.
{% ifversion workflow-nav-2022 -%}
![Actions enable workflow](/assets/images/help/repository/actions-enable-workflow-2022.png)
{%- else -%}
![Actions enable workflow](/assets/images/help/repository/actions-enable-workflow.png)
{%- endif %}
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %}
1. 在左侧边栏中,单击您想要启用的工作流程。
![操作选择禁用的工作流](/assets/images/help/repository/actions-select-disabled-workflow.png)
1. 单击“启用工作流”。
![操作启用工作流](/assets/images/help/repository/actions-enable-workflow.png)
{% endwebui %}
{% cli %}
To enable a workflow, use the `workflow enable` subcommand. Replace `workflow` with either the name, ID, or file name of the workflow you want to enable. For example, `"Link Checker"`, `1234567`, or `"link-check-test.yml"`. If you don't specify a workflow, {% data variables.product.prodname_cli %} returns an interactive menu for you to choose a workflow.
要启用工作流,请使用 `workflow enable` 子命令。 将 `workflow` 替换为要启用的工作流的名称、ID 或文件名。 例如,`"Link Checker"``1234567` `"link-check-test.yml"`。 如果您没有指定工作流程,{% data variables.product.prodname_cli %} 将返回交互式菜单供您选择工作流程。
```shell
gh workflow enable WORKFLOW
gh workflow enable <em>workflow</em>
```
{% endcli %}

View File

@@ -1,40 +1,38 @@
---
title: Manually running a workflow
intro: 'When a workflow is configured to run on the `workflow_dispatch` event, you can run the workflow using the Actions tab on {% data variables.product.prodname_dotcom %}, {% data variables.product.prodname_cli %}, or the REST API.'
title: 手动运行工作流程
intro: '当工作流配置为在发生 `workflow_dispatch` 事件时运行时,可以使用 {% data variables.product.prodname_dotcom %}{% data variables.product.prodname_cli %} REST API 上的“Actions”选项卡运行工作流。'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: Manually run a workflow
ms.openlocfilehash: 22717c31a6bc2599f066b0e870f0aa652c18cc6f
ms.sourcegitcommit: fcf3546b7cc208155fb8acdf68b81be28afc3d2d
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/10/2022
ms.locfileid: '145099187'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 配置工作流程手动运行
## Configuring a workflow to run manually
To run a workflow manually, the workflow must be configured to run on the `workflow_dispatch` event. To trigger the `workflow_dispatch` event, your workflow must be in the default branch. For more information about configuring the `workflow_dispatch` event, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows#workflow_dispatch)".
要手动运行工作流,必须将工作流配置为在 `workflow_dispatch` 事件上运行。 要触发 `workflow_dispatch` 事件,工作流必须位于默认分支中。 有关配置 `workflow_dispatch` 事件的详细信息,请参阅“[触发工作流的事件](/actions/reference/events-that-trigger-workflows#workflow_dispatch)”。
{% data reusables.repositories.permissions-statement-write %}
## Running a workflow
## 运行工作流程
{% webui %}
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.actions-tab %}
1. In the left sidebar, click the workflow you want to run.
{% ifversion workflow-nav-2022 -%}
![Actions select workflow](/assets/images/help/repository/actions-select-workflow-2022.png)
{%- else -%}
![Actions select workflow](/assets/images/help/repository/actions-select-workflow.png)
{%- endif %}
1. Above the list of workflow runs, select **Run workflow**.
![actions workflow dispatch](/assets/images/actions-workflow-dispatch.png)
1. Use the **Branch** dropdown to select the workflow's branch, and type the input parameters. Click **Run workflow**.
![actions manually run workflow](/assets/images/actions-manually-run-workflow.png)
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %}
1. 在左侧边栏中,单击您想要运行的工作流程。
![操作选择工作流](/assets/images/actions-select-workflow.png)
1. 在工作流运行列表上方,选择“运行工作流”。
![操作工作流调度](/assets/images/actions-workflow-dispatch.png)
1. 使用“分支”下拉菜单,选择工作流的分支,并键入输入参数。 单击“运行工作流”。
![操作手动运行工作流](/assets/images/actions-manually-run-workflow.png)
{% endwebui %}
@@ -42,31 +40,31 @@ To run a workflow manually, the workflow must be configured to run on the `workf
{% data reusables.cli.cli-learn-more %}
To run a workflow, use the `workflow run` subcommand. Replace the `workflow` parameter with either the name, ID, or file name of the workflow you want to run. For example, `"Link Checker"`, `1234567`, or `"link-check-test.yml"`. If you don't specify a workflow, {% data variables.product.prodname_cli %} returns an interactive menu for you to choose a workflow.
要运行工作流,请使用 `workflow run` 子命令。 将 `workflow` 参数替换为要运行的工作流的名称、ID 或文件名。 例如,`"Link Checker"``1234567` `"link-check-test.yml"`。 如果您没有指定工作流程,{% data variables.product.prodname_cli %} 将返回交互式菜单供您选择工作流程。
```shell
gh workflow run WORKFLOW
gh workflow run <em>workflow</em>
```
If your workflow accepts inputs, {% data variables.product.prodname_cli %} will prompt you to enter them. Alternatively, you can use `-f` or `-F` to add an input in `key=value` format. Use `-F` to read from a file.
如果您的工作流程接受输入,{% data variables.product.prodname_cli %} 将提示您输入它们。 或者,可以使用 `-f` `-F` 添加 `key=value` 格式的输入。 使用 `-F` 从文件中读取。
```shell
gh workflow run greet.yml -f name=mona -f greeting=hello -F data=@myfile.txt
```
You can also pass inputs as JSON by using standard input.
您也可以使用标准输入以 JSON 的身份传递输入。
```shell
echo '{"name":"mona", "greeting":"hello"}' | gh workflow run greet.yml --json
```
To run a workflow on a branch other than the repository's default branch, use the `--ref` flag.
要在存储库的默认分支以外的分支上运行工作流,请使用 `--ref` 标记。
```shell
gh workflow run WORKFLOW --ref BRANCH
gh workflow run <em>workflow</em> --ref <em>branch-name</em>
```
To view the progress of the workflow run, use the `run watch` subcommand and select the run from the interactive list.
要查看工作流运行的进度,请使用 `run watch` 子命令,并从交互式列表中选择运行。
```shell
gh run watch
@@ -74,14 +72,14 @@ gh run watch
{% endcli %}
## Running a workflow using the REST API
## 使用 REST API 运行工作流程
When using the REST API, you configure the `inputs` and `ref` as request body parameters. If the inputs are omitted, the default values defined in the workflow file are used.
使用 REST API 时,应将 `inputs` `ref` 配置为请求正文参数。 如果忽略输入,则使用工作流程文件中定义的默认值。
{% note %}
**Note:** You can define up to 10 `inputs` for a `workflow_dispatch` event.
注意:最多可为 `workflow_dispatch` 事件定义 10 个 `inputs`
{% endnote %}
For more information about using the REST API, see the "[Create a workflow dispatch event](/rest/reference/actions/#create-a-workflow-dispatch-event)."
有关使用 REST API 的详细信息,请参阅“[创建工作流调度事件](/rest/reference/actions/#create-a-workflow-dispatch-event)”。

View File

@@ -1,7 +1,6 @@
---
title: Re-running workflows and jobs
shortTitle: Re-run workflows and jobs
intro: 'You can re-run a workflow run{% ifversion re-run-jobs %}, all failed jobs in a workflow run, or specific jobs in a workflow run{% endif %} up to 30 days after its initial run.'
title: 重新运行工作流程和作业
intro: '可以在工作流运行初始运行后最长 30 天内重新运行工作流运行{% ifversion re-run-jobs %}、工作流运行中所有失败的作业或工作流运行中的特定作业{% endif %}。'
permissions: People with write permissions to a repository can re-run workflows in the repository.
miniTocMaxHeadingLevel: 3
redirect_from:
@@ -11,36 +10,30 @@ versions:
ghes: '*'
ghae: '*'
ghec: '*'
ms.openlocfilehash: 086a57b238b4a11e38013997dfcb85418a6961bd
ms.sourcegitcommit: 47bd0e48c7dba1dde49baff60bc1eddc91ab10c5
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/05/2022
ms.locfileid: '147419719'
---
{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
## 关于重新运行工作流程和作业
## About re-running workflows and jobs
重新运行工作流{% ifversion re-run-jobs %}或工作流中的作业{% endif %}使用与触发工作流运行的原始事件相同的 `GITHUB_SHA`(提交 SHA`GITHUB_REF` (Git ref)。 {% ifversion actions-stable-actor-ids %} 工作流将使用最初触发工作流的参与者的权限,而不是启动重新运行的参与者的权限。 {% endif %}在初始运行最多 30 天后,可以重新运行工作流{% ifversion re-run-jobs %}或工作流中的作业{% endif %}。{% ifversion re-run-jobs %}一旦工作流的日志超过其保留限制,就无法重新运行工作流中的作业。 有关详细信息,请参阅“[使用限制、计费和管理](/actions/learn-github-actions/usage-limits-billing-and-administration#artifact-and-log-retention-policy)”。{% endif %}{% ifversion debug-reruns %} 重新运行工作流或工作流中的作业时,可以为重新运行启用调试日志记录。 这将为重新运行启用运行器诊断日志记录和步骤调试日志记录。 有关调试日志记录的详细信息,请参阅“[启用调试日志记录](/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging)”。{% endif %}
Re-running a workflow{% ifversion re-run-jobs %} or jobs in a workflow{% endif %} uses the same `GITHUB_SHA` (commit SHA) and `GITHUB_REF` (Git ref) of the original event that triggered the workflow run. {% ifversion actions-stable-actor-ids %}The workflow will use the privileges of the actor who initially triggered the workflow, not the privileges of the actor who initiated the re-run. {% endif %}You can re-run a workflow{% ifversion re-run-jobs %} or jobs in a workflow{% endif %} for up to 30 days after the initial run.{% ifversion re-run-jobs %} You cannot re-run jobs in a workflow once its logs have passed their retention limits. For more information, see "[Usage limits, billing, and administration](/actions/learn-github-actions/usage-limits-billing-and-administration#artifact-and-log-retention-policy)."{% endif %}{% ifversion debug-reruns %} When you re-run a workflow or jobs in a workflow, you can enable debug logging for the re-run. This will enable runner diagnostic logging and step debug logging for the re-run. For more information about debug logging, see "[Enabling debug logging](/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging)."{% endif %}
## Re-running all the jobs in a workflow
## 重新运行工作流程中的所有作业
{% webui %}
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.actions-tab %}
{% data reusables.repositories.navigate-to-workflow %}
{% data reusables.repositories.view-run %}
{% ifversion fpt or ghes > 3.4 or ghae or ghec -%}
1. In the upper-right corner of the workflow, use the **{% octicon "sync" aria-label="The sync icon" %} Re-run jobs** drop-down menu, and select **Re-run all jobs**.
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} {% data reusables.repositories.view-run %} {% ifversion fpt or ghes > 3.4 or ghae-issue-4721 or ghec %}
1. 在工作流的右上角,使用“重新运行作业”下拉菜单,然后选择“重新运行所有作业” 。
If no jobs failed, you will not see the **{% octicon "sync" aria-label="The sync icon" %} Re-run jobs** drop-down menu. Instead, click **Re-run all jobs**.
![Rerun checks drop-down menu](/assets/images/help/repository/rerun-checks-drop-down.png)
{%- endif %}
{% ifversion ghes < 3.5 or ghae -%}
1. In the upper-right corner of the workflow, use the **Re-run jobs** drop-down menu, and select **Re-run all jobs**.
![Re-run checks drop-down menu](/assets/images/help/repository/rerun-checks-drop-down-updated.png)
{%- endif %}
{% data reusables.actions.enable-debug-logging %}
如果没有作业失败,则看不到“重新运行作业”下拉菜单。 相反,单击“重新运行所有作业”。
![重新运行检查下拉菜单](/assets/images/help/repository/rerun-checks-drop-down.png){% endif %} {% ifversion ghes < 3.5 or ghae %}
1. 在工作流的右上角,使用“重新运行作业”下拉菜单,然后选择“重新运行所有作业” 。
![重新运行检查下拉菜单](/assets/images/help/repository/rerun-checks-drop-down-updated.png) {% endif %} {% data reusables.actions.enable-debug-logging %}
{% endwebui %}
@@ -48,22 +41,21 @@ Re-running a workflow{% ifversion re-run-jobs %} or jobs in a workflow{% endif %
{% data reusables.cli.cli-learn-more %}
To re-run a failed workflow run, use the `run rerun` subcommand. Replace `run-id` with the ID of the failed run that you want to re-run. If you don't specify a `run-id`, {% data variables.product.prodname_cli %} returns an interactive menu for you to choose a recent failed run.
若要重新运行失败的工作流运行,请使用 `run rerun` 子命令。 将 `run-id` 替换为要重新运行的已失败运行的 ID。 如果没有指定 `run-id`{% data variables.product.prodname_cli %} 将返回交互式菜单供你选择最近失败的运行。
```shell
gh run rerun RUN_ID
gh run rerun <em>run-id</em>
```
{% ifversion debug-reruns %}
{% data reusables.actions.enable-debug-logging-cli %}
{% ifversion debug-reruns %} {% data reusables.actions.enable-debug-logging-cli %}
```shell
gh run rerun RUN_ID --debug
gh run rerun <em>run-id</em> --debug
```
{% endif %}
To view the progress of the workflow run, use the `run watch` subcommand and select the run from the interactive list.
要查看工作流运行的进度,请使用 `run watch` 子命令,并从交互式列表中选择运行。
```shell
gh run watch
@@ -72,104 +64,85 @@ gh run watch
{% endcli %}
{% ifversion re-run-jobs %}
## Re-running failed jobs in a workflow
## 重新运行工作流程中失败的作业
If any jobs in a workflow run failed, you can re-run just the jobs that failed. When you re-run failed jobs in a workflow, a new workflow run will start for all failed jobs and their dependents. Any outputs for any successful jobs in the previous workflow run will be used for the re-run. Any artifacts that were created in the initial run will be available in the re-run. Any environment protection rules that passed in the previous run will automatically pass in the re-run.
如果工作流程运行中的任何作业失败,您可以仅重新运行失败的作业。 在重新运行工作流程中失败的作业时,将为所有失败的作业及其依赖项启动新的工作流程运行。 上一个工作流程运行中任何成功作业的任何输出都将用于重新运行。 在初始运行中创建的任何构件都将在重新运行中可用。 在上一次运行中通过的任何环境保护规则都将自动在重新运行中通过。
{% webui %}
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.actions-tab %}
{% data reusables.repositories.navigate-to-workflow %}
{% data reusables.repositories.view-run %}
1. In the upper-right corner of the workflow, use the **{% octicon "sync" aria-label="The sync icon" %} Re-run jobs** drop-down menu, and select **Re-run failed jobs**.
![Rerun checks drop-down menu](/assets/images/help/repository/rerun-checks-drop-down.png)
{% data reusables.actions.enable-debug-logging %}
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} {% data reusables.repositories.view-run %}
1. 在工作流的右上角,使用“重新运行作业”下拉菜单,然后选择“重新运行失败的作业” 。
![“重新运行失败的作业”下拉菜单](/assets/images/help/repository/rerun-failed-jobs-drop-down.png) {% data reusables.actions.enable-debug-logging %}
{% endwebui %}
{% cli %}
To re-run failed jobs in a workflow run, use the `run rerun` subcommand with the `--failed` flag. Replace `run-id` with the ID of the run for which you want to re-run failed jobs. If you don't specify a `run-id`, {% data variables.product.prodname_cli %} returns an interactive menu for you to choose a recent failed run.
若要在工作流运行中重新运行失败的作业,请使用带有 `--failed` 标志的 `run rerun` 子命令。 将 `run-id` 替换为其重新运行失败作业的运行的 ID。 如果没有指定 `run-id`{% data variables.product.prodname_cli %} 将返回交互式菜单供你选择最近失败的运行。
```shell
gh run rerun RUN_ID --failed
gh run rerun <em>run-id</em> --failed
```
{% ifversion debug-reruns %}
{% data reusables.actions.enable-debug-logging-cli %}
{% ifversion debug-reruns %} {% data reusables.actions.enable-debug-logging-cli %}
```shell
gh run rerun RUN_ID --failed --debug
gh run rerun <em>run-id</em> --failed --debug
```
{% endif %}
{% endcli %}
{% endif %} {% endcli %}
## Re-running a specific job in a workflow
## 重新运行工作流程中的特定作业
When you re-run a specific job in a workflow, a new workflow run will start for the job and any dependents. Any outputs for any other jobs in the previous workflow run will be used for the re-run. Any artifacts that were created in the initial run will be available in the re-run. Any environment protection rules that passed in the previous run will automatically pass in the re-run.
重新运行工作流程中的特定作业时,将为该作业和任何依赖项启动新的工作流程运行。 上一个工作流程运行中任何其他作业的任何输出都将用于重新运行。 在初始运行中创建的任何构件都将在重新运行中可用。 在上一次运行中通过的任何环境保护规则都将自动在重新运行中通过。
{% webui %}
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.actions-tab %}
{% data reusables.repositories.navigate-to-workflow %}
{% data reusables.repositories.view-run %}
1. Next to the job that you want to re-run, click {% octicon "sync" aria-label="The re-run icon" %}.
![Re-run selected job](/assets/images/help/repository/re-run-selected-job.png)
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} {% data reusables.repositories.view-run %}
1. 在要重新运行的作业旁边,单击 {% octicon "sync" aria-label="The re-run icon" %}
![重新运行选定的作业](/assets/images/help/repository/re-run-selected-job.png)
Alternatively, click on a job to view the log. In the log, click {% octicon "sync" aria-label="The re-run icon" %}.
![Re-run selected job](/assets/images/help/repository/re-run-single-job-from-log.png)
{% data reusables.actions.enable-debug-logging %}
或者,单击作业以查看日志。 在日志中,单击 {% octicon "sync" aria-label="The re-run icon" %}
![重新运行选定的作业](/assets/images/help/repository/re-run-single-job-from-log.png) {% data reusables.actions.enable-debug-logging %}
{% endwebui %}
{% cli %}
To re-run a specific job in a workflow run, use the `run rerun` subcommand with the `--job` flag. Replace `job-id` with the ID of the job that you want to re-run.
若要在工作流运行中重新运行特定作业,请使用带有 `--job` 标志的 `run rerun` 子命令。 将 `job-id` 替换为要重新运行的作业的 ID。
```shell
gh run rerun --job JOB_ID
gh run rerun --job <em>job-id</em>
```
{% ifversion debug-reruns %}
{% data reusables.actions.enable-debug-logging-cli %}
{% ifversion debug-reruns %} {% data reusables.actions.enable-debug-logging-cli %}
```shell
gh run rerun --job JOB_ID --debug
gh run rerun --job <em>job-id</em> --debug
```
{% endif %}
{% endcli %}
{% endif %} {% endcli %}
{% endif %}
{% ifversion partial-reruns-with-reusable %}
## Re-running workflows and jobs with reusable workflows
## 使用可重用工作流重新运行工作流和作业
{% data reusables.actions.partial-reruns-with-reusable %}
{% endif %}
{% ifversion fpt or ghes > 3.4 or ghae or ghec %}
## Reviewing previous workflow runs
{% ifversion fpt or ghes > 3.4 or ghae-issue-4721 or ghec %}
## 查看以前的工作流程运行
You can view the results from your previous attempts at running a workflow. You can also view previous workflow runs using the API. For more information, see ["Get a workflow run"](/rest/reference/actions#get-a-workflow-run).
您可以查看以前尝试运行工作流程的结果。 您还可以使用 API 查看以前的工作流程运行。 有关详细信息,请参阅“[获取工作流运行](/rest/reference/actions#get-a-workflow-run)”。
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.actions-tab %}
{% data reusables.repositories.navigate-to-workflow %}
{% data reusables.repositories.view-run %}
{%- ifversion re-run-jobs %}
1. Any previous run attempts are shown in the **Latest** drop-down menu.
![Previous run attempts](/assets/images/help/repository/previous-run-attempts.png)
{%- else %}
1. Any previous run attempts are shown in the left pane.
![Rerun workflow](/assets/images/help/settings/actions-review-workflow-rerun.png)
{%- endif %}
1. Click an entry to view its results.
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} {% data reusables.repositories.view-run %} {%- ifversion re-run-jobs %}
1. 任何以前的运行尝试都显示在“最新”下拉菜单中。
![以前的运行尝试](/assets/images/help/repository/previous-run-attempts.png) {%- else %}
1. 任何以前的运行尝试都显示在左窗格中。
![重新运行工作流](/assets/images/help/settings/actions-review-workflow-rerun.png) {%- endif %}
1. 单击某个条目以查看其结果。
{% endif %}

Some files were not shown because too many files have changed in this diff Show More