Skip to content

Commit

Permalink
chore(workflow): add issue helper action
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed May 22, 2021
1 parent f28f76a commit e2d7c0a
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
blank_issues_enabled: true
contact_links:
- name: Create new issue
url: http://v2.formilyjs.org/guide/issue-helper
about: The issue which is not created via http://v2.formilyjs.org/guide/issue-helper will be closed immediately.
url: https://v2.formilyjs.org/guide/issue-helper
about: The issue which is not created via https://v2.formilyjs.org/guide/issue-helper will be closed immediately.
- name: ✨ Question Answer / Idea
url: https://github.com/alibaba/formily/discussions/new
about: All questions can be solved here. At the same time you can provide all your ideas here.
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/issue-open-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Issue Open Check

on:
issues:
types: [opened]

jobs:
check-issue:
runs-on: ubuntu-latest
steps:
- uses: actions-cool/check-user-permission@v1.0.0
id: checkUser
with:
require: 'write'

- name: check invalid
if: (contains(github.event.issue.body, 'formily-issue-helper') == false) && (steps.checkUser.outputs.result == 'false')
uses: actions-cool/issues-helper@v1.2
with:
actions: 'create-comment,add-labels,close-issue'
issue-number: ${{ github.event.issue.number }}
labels: 'Invalid'
body: |
Hello @${{ github.event.issue.user.login }}, your issue has been closed because it does not conform to our issue requirements. Please use the [Issue Helper](https://v2.formilyjs.org/guide/issue-helper) to create an issue, thank you!
你好 @${{ github.event.issue.user.login }},为了能够进行高效沟通,我们对 issue 有一定的格式要求,你的 issue 因为不符合要求而被自动关闭。你可以通过 [issue 助手](https://v2.formilyjs.org/guide/issue-helper) 来创建 issue 以方便我们定位错误。谢谢配合!
69 changes: 67 additions & 2 deletions docs/guide/issue-helper.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For usage questions, please use the following resources:
- Make sure you have search your question in FAQ and changelog
- Look for / ask questions on [Discussions](https://github.com/alibaba/formily/discussions)

Also try to search for your issue
Also try to search for your issue

it may have already been answered or even fixed in the development branch. However, if you find that an old, closed issue still persists in the latest version, you should open a new issue using the form below instead of commenting on the old issue.

Expand Down Expand Up @@ -100,6 +100,64 @@ const form = createForm({
},
})

const createIssueURL = ({
type,
title,
version,
package,
reproduceLink,
reproduceStep,
expected,
actually,
comment,
feature,
api,
}) => {
const url = new URL('https://github.com/alibaba/formily/issues/new')

const bugInfo = `
- [ ] I have searched the [issues](https://github.com/alibaba/formily/issues) of this repository and believe that this is not a duplicate.
### Reproduction link
[![Edit on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](${
reproduceLink || ''
})
### Steps to reproduce
${reproduceStep || ''}
### What is expected?
${expected || ''}
### What is actually happening?
${actually || ''}
---
${comment || ''}
<!-- generated by formily-issue-helper. DO NOT REMOVE -->
`

const prInfo = `
- [ ] I have searched the [issues](https://github.com/alibaba/formily/issues) of this repository and believe that this is not a duplicate.
### What problem does this feature solve?
${feature || ''}
### What does the proposed API look like?
${api || ''}
<!-- generated by formily-issue-helper. DO NOT REMOVE -->
`

url.searchParams.set('title', `[${type}] ${title}`)
url.searchParams.set('body', type === 'Bug Report' ? bugInfo : prInfo)

return url.href
}

export default () => {
return (
<Form form={form} layout="vertical" size="large">
Expand Down Expand Up @@ -219,7 +277,14 @@ export default () => {
/>
</VoidField>
<FormButtonGroup.Sticky align="center">
<Submit size="large">Submit</Submit>
<Submit
size="large"
onSubmit={(values) => {
window.open(createIssueURL(values))
}}
>
Submit
</Submit>
</FormButtonGroup.Sticky>
</Form>
)
Expand Down

0 comments on commit e2d7c0a

Please sign in to comment.