diff --git a/.github/ISSUE_TEMPLATE/react-ui-gen-template.md b/.github/ISSUE_TEMPLATE/react-ui-gen-template.md deleted file mode 100644 index 45da7f7..0000000 --- a/.github/ISSUE_TEMPLATE/react-ui-gen-template.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: react ui-gen template -about: will trigger a react ui-gen workflow -title: '' -labels: ui-gen -assignees: '' - ---- - -Describe your code generation needs, including images or text. diff --git a/.github/ISSUE_TEMPLATE/react-ui-gen-template.yml b/.github/ISSUE_TEMPLATE/react-ui-gen-template.yml new file mode 100644 index 0000000..c52e61c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/react-ui-gen-template.yml @@ -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) diff --git a/.github/ISSUE_TEMPLATE/svelte-ui-gen-template.md b/.github/ISSUE_TEMPLATE/svelte-ui-gen-template.md deleted file mode 100644 index 033cad5..0000000 --- a/.github/ISSUE_TEMPLATE/svelte-ui-gen-template.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: svelte ui-gen template -about: will trigger a svelte ui-gen workflow -title: '' -labels: svelte-ui-gen -assignees: '' - ---- - -Describe your code generation needs, including images or text. diff --git a/.github/ISSUE_TEMPLATE/svelte-ui-gen-template.yml b/.github/ISSUE_TEMPLATE/svelte-ui-gen-template.yml new file mode 100644 index 0000000..ec1e90c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/svelte-ui-gen-template.yml @@ -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) diff --git a/.github/ISSUE_TEMPLATE/vue-ui-gen-template.md b/.github/ISSUE_TEMPLATE/vue-ui-gen-template.md deleted file mode 100644 index 8312378..0000000 --- a/.github/ISSUE_TEMPLATE/vue-ui-gen-template.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: vue ui-gen template -about: will trigger a vue ui-gen workflow -title: '' -labels: vue-ui-gen -assignees: '' - ---- - -Describe your code generation needs, including images or text. diff --git a/.github/ISSUE_TEMPLATE/vue-ui-gen-template.yml b/.github/ISSUE_TEMPLATE/vue-ui-gen-template.yml new file mode 100644 index 0000000..497c4e7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/vue-ui-gen-template.yml @@ -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) diff --git a/.github/pr-badge.yml b/.github/pr-badge.yml new file mode 100644 index 0000000..96b10e5 --- /dev/null +++ b/.github/pr-badge.yml @@ -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" diff --git a/docs/quick-start.md b/docs/quick-start.md index c12f553..500d7c7 100644 --- a/docs/quick-start.md +++ b/docs/quick-start.md @@ -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. @@ -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 diff --git a/docs/quick-start.zh_CN.md b/docs/quick-start.zh_CN.md index 70a242c..2419651 100644 --- a/docs/quick-start.zh_CN.md +++ b/docs/quick-start.zh_CN.md @@ -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 使用安全。 @@ -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 diff --git a/prompts/common.ts b/prompts/common.ts index f456217..45ceef8 100644 --- a/prompts/common.ts +++ b/prompts/common.ts @@ -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"); @@ -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; }