Skip to content

Commit

Permalink
Merge pull request #306 from idea2app/optimize-Issue-PR
Browse files Browse the repository at this point in the history
[refactor] replace Markdown with YAML for GitHub Issue templates
  • Loading branch information
Yuyz0112 authored May 26, 2024
2 parents 2445b94 + d32bbc6 commit 8868d35
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 44 deletions.
10 changes: 0 additions & 10 deletions .github/ISSUE_TEMPLATE/react-ui-gen-template.md

This file was deleted.

36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/react-ui-gen-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: React UI generation
description: will trigger a React UI generation workflow
labels:
- ui-gen
body:
- type: input
attributes:
label: Content language / 内容语言
description: such as English, Chinese, etc. / 如英文、中文等
value: English
validations:
required: true
- type: textarea
attributes:
label: Major content / 主要内容
value: |-
1. content, function & component / 内容、功能和组件
2. content, function & component / 内容、功能和组件
3. content, function & component / 内容、功能和组件
validations:
required: true
- type: input
attributes:
label: Style theme / 样式主题
description: such as Technical, Cute, Natural etc. / 如科技风、可爱风、自然风等
- type: textarea
attributes:
label: Referred image / 参考图片
description: >-
upload or paste Prototype, UI design or Screenshot images / 上传或粘贴 原型图、UI
设计图 或 屏幕截图
- type: markdown
attributes:
value: >-
This template was generated with [Issue Forms
Creator](https://issue-forms-creator.netlify.app)
10 changes: 0 additions & 10 deletions .github/ISSUE_TEMPLATE/svelte-ui-gen-template.md

This file was deleted.

36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/svelte-ui-gen-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Svelte UI generation
description: will trigger a Svelte UI generation workflow
labels:
- svelte-ui-gen
body:
- type: input
attributes:
label: Content language / 内容语言
description: such as English, Chinese, etc. / 如英文、中文等
value: English
validations:
required: true
- type: textarea
attributes:
label: Major content / 主要内容
value: |-
1. content, function & component / 内容、功能和组件
2. content, function & component / 内容、功能和组件
3. content, function & component / 内容、功能和组件
validations:
required: true
- type: input
attributes:
label: Style theme / 样式主题
description: such as Technical, Cute, Natural etc. / 如科技风、可爱风、自然风等
- type: textarea
attributes:
label: Referred image / 参考图片
description: >-
upload or paste Prototype, UI design or Screenshot images / 上传或粘贴 原型图、UI
设计图 或 屏幕截图
- type: markdown
attributes:
value: >-
This template was generated with [Issue Forms
Creator](https://issue-forms-creator.netlify.app)
10 changes: 0 additions & 10 deletions .github/ISSUE_TEMPLATE/vue-ui-gen-template.md

This file was deleted.

36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/vue-ui-gen-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Vue UI generation
description: will trigger a Vue UI generation workflow
labels:
- vue-ui-gen
body:
- type: input
attributes:
label: Content language / 内容语言
description: such as English, Chinese, etc. / 如英文、中文等
value: English
validations:
required: true
- type: textarea
attributes:
label: Major content / 主要内容
value: |-
1. content, function & component / 内容、功能和组件
2. content, function & component / 内容、功能和组件
3. content, function & component / 内容、功能和组件
validations:
required: true
- type: input
attributes:
label: Style theme / 样式主题
description: such as Technical, Cute, Natural etc. / 如科技风、可爱风、自然风等
- type: textarea
attributes:
label: Referred image / 参考图片
description: >-
upload or paste Prototype, UI design or Screenshot images / 上传或粘贴 原型图、UI
设计图 或 屏幕截图
- type: markdown
attributes:
value: >-
This template was generated with [Issue Forms
Creator](https://issue-forms-creator.netlify.app)
17 changes: 17 additions & 0 deletions .github/pr-badge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- icon: visualstudio
label: "GitHub.dev"
message: "PR-$prNumber"
color: "blue"
url: "https://github.dev/$owner/$repo/pull/$prNumber"

- icon: github
label: "GitHub codespaces"
message: "PR-$prNumber"
color: "black"
url: "https://codespaces.new/$owner/$repo/pull/$prNumber"

- icon: git
label: "GitPod.io"
message: "PR-$prNumber"
color: "orange"
url: "https://gitpod.io/?autostart=true#https://github.com/$owner/$repo/pull/$prNumber"
16 changes: 10 additions & 6 deletions docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

## Create Repository with Template

1. Install **[Settings][1] GitHub app** in your account or organization for labels auto-creating.
2. Click the **[Use this template][2] button** on the top of this GitHub repository's home page, then create your own repository in the app-installed namespace above.
1. Install **GitHub apps** in your account or organization for labels & badges auto-creating:

1. [Probot settings][1]
2. [PR badge][2]

2. Click the **[Use this template][3] button** on the top of this GitHub repository's home page, then create your own repository in the app-installed namespace above.

## Setup Repository Secrets

Users can start by creating their own Dewhale repository based on the current template repo. In the repository's [`settings -> secrets and variables -> actions`][3] section, the following repository secrets need to be set up:
Users can start by creating their own Dewhale repository based on the current template repo. In the repository's [`settings -> secrets and variables -> actions`][4] section, the following repository secrets need to be set up:

- `OPENAI_API_KEY`: This is an OpenAI API key. [How to create one?][5]
- `WHITELIST`: A list of GitHub usernames allowed to use Dewhale, separated by commas. Only issues and comments created by users in the WHITELIST will be responded to by Dewhale, ensuring API usage safety.
Expand All @@ -27,7 +31,7 @@ Dewhale includes a preview UI feature. In the template repository, we continuous
[How to configure continuously deploy](./CD.md).

[1]: https://github.com/apps/settings
[2]: https://github.com/new?template_name=dewhale&template_owner=Yuyz0112
[3]: https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository
[4]: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic
[2]: https://pullrequestbadge.com/
[3]: https://github.com/new?template_name=dewhale&template_owner=Yuyz0112
[4]: https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository
[5]: https://platform.openai.com/docs/quickstart/account-setup
16 changes: 10 additions & 6 deletions docs/quick-start.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

## 用模板创建仓库

1. 为了自动创建专用 label,要在你的 GitHub 账号或组织中安装 **[Settings][1] GitHub 应用**
2. 在本 GitHub 仓库主页顶部点击 **[Use this template][2] 按钮**,然后在安装了上述 GitHub 应用的命名空间中创建你自己的仓库。
1. 为了自动创建专用 label 和 badge,要在你的 GitHub 账号或组织中安装 **GitHub 应用**

1. [Probot settings][1]
2. [PR badge][2]

2. 在本 GitHub 仓库主页顶部点击 **[Use this template][3] 按钮**,然后在安装了上述 GitHub 应用的命名空间中创建你自己的仓库。

## 设置仓库 secret

用户可以基于当前的模板仓库创建自己的 Dewhale 仓库。在仓库的[settings -> secrets and variables -> actions][3]部分,需要设置以下仓库 secret:
用户可以基于当前的模板仓库创建自己的 Dewhale 仓库。在仓库的[settings -> secrets and variables -> actions][4]部分,需要设置以下仓库 secret:

- `OPENAI_API_KEY`:这是一个 OpenAI API 密钥。[如何创建?][5]
- `WHITELIST`:允许使用 Dewhale 的 GitHub 用户名列表,用逗号分隔。仅由 WHITELIST 中的用户创建的 issue 和评论才会受到 Dewhale 的响应,确保 API 使用安全。
Expand All @@ -27,7 +31,7 @@ Dewhale 包含预览 UI 功能。在模板仓库中,我们通过 Cloudflare Pa
[如何配置持续部署](./CD.zh_CN.md)

[1]: https://github.com/apps/settings
[2]: https://github.com/new?template_name=dewhale&template_owner=Yuyz0112
[3]: https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository
[4]: https://docs.github.com/zh/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
[2]: https://pullrequestbadge.com/
[3]: https://github.com/new?template_name=dewhale&template_owner=Yuyz0112
[4]: https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository
[5]: https://platform.openai.com/docs/quickstart/account-setup
4 changes: 2 additions & 2 deletions prompts/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ async function getConnectedPr(

async function getConnectedIssue(owner: string, repo: string, prBody: string) {
const issueNumber = parseInt(
prBody.match(/\[Dewhale\] This PR implements #(\d+),/)?.[1] || ""
prBody.match(/\[Dewhale\] This PR implements & closes #(\d+),/)?.[1] || ""
);
if (!issueNumber) {
throw new Error("failed to get connected issue");
Expand Down Expand Up @@ -217,7 +217,7 @@ export async function applyPR(
head: newBranch,
base: baseBranch,
title: `${dewhalePrefix} implements #${issueNumber}`,
body: `${dewhalePrefix} This PR implements #${issueNumber}, created by Dewhale.`,
body: `${dewhalePrefix} This PR implements & closes #${issueNumber}, created by Dewhale.`,
})
).data as any;
}
Expand Down

0 comments on commit 8868d35

Please sign in to comment.