diff --git a/.github/workflows/reusable-issue-help-wanted.yml b/.github/workflows/reusable-issue-help-wanted.yml new file mode 100644 index 0000000..6a8b7ec --- /dev/null +++ b/.github/workflows/reusable-issue-help-wanted.yml @@ -0,0 +1,26 @@ +# 当打上 "help wanted" 标签时,自动留言引导社区贡献 +name: reusable-issue-help-wanted + +on: + workflow_call: + inputs: + issue-number: + required: false + type: number + default: ${{ github.event.issue.number }} + +jobs: + add-comment: + if: github.event.label.name == 'help wanted' + runs-on: ubuntu-latest + steps: + - uses: TDesignOteam/workflows/actions/issues-helper@main + with: + actions: create-comment + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ inputs.issue-number }} + body: | + 任何人都可以处理此问题。 + **请务必在您的 `pull request` 中引用此问题。** :sparkles: + 感谢你的贡献! :sparkles: + emoji: heart diff --git a/.github/workflows/reusable-issue-mark-duplicate.yml b/.github/workflows/reusable-issue-mark-duplicate.yml new file mode 100644 index 0000000..9754a8c --- /dev/null +++ b/.github/workflows/reusable-issue-mark-duplicate.yml @@ -0,0 +1,25 @@ +# 当 comment 中回复类似 "Duplicate of #111" 时,自动打标签并关闭 issue +name: reusable-issue-mark-duplicate + +on: + workflow_call: + inputs: + duplicate-labels: + required: false + type: string + default: duplicate + close-issue: + required: false + type: boolean + default: true + +jobs: + mark-duplicate: + runs-on: ubuntu-latest + steps: + - uses: TDesignOteam/workflows/actions/issues-helper@main + with: + actions: mark-duplicate + token: ${{ secrets.GITHUB_TOKEN }} + duplicate-labels: ${{ inputs.duplicate-labels }} + close-issue: ${{ inputs.close-issue }} diff --git a/.github/workflows/reusable-issue-need-reproduce.yml b/.github/workflows/reusable-issue-need-reproduce.yml new file mode 100644 index 0000000..9de3bbe --- /dev/null +++ b/.github/workflows/reusable-issue-need-reproduce.yml @@ -0,0 +1,27 @@ +# 当打上 "Need Reproduce" 标签时,自动提示提供重现实例 +name: reusable-issue-need-reproduce + +on: + workflow_call: + inputs: + issue-number: + required: false + type: number + default: ${{ github.event.issue.number }} + login: + required: false + type: string + default: ${{ github.event.issue.user.login }} + +jobs: + issue-reply: + if: github.event.label.name == 'Need Reproduce' + runs-on: ubuntu-latest + steps: + - uses: TDesignOteam/workflows/actions/issues-helper@main + with: + actions: create-comment + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ inputs.issue-number }} + body: | + 你好 @${{ inputs.login }}, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 [此处](https://codesandbox.io/) 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。请确保选择准确的版本。 diff --git a/.github/workflows/reusable-issue-shoot.yml b/.github/workflows/reusable-issue-shoot.yml new file mode 100644 index 0000000..a80a0a4 --- /dev/null +++ b/.github/workflows/reusable-issue-shoot.yml @@ -0,0 +1,60 @@ +# 当打上 easy/middle/hard 标签时,追加难度分级模板 +name: reusable-issue-shoot + +on: + workflow_call: + inputs: + issue-number: + required: false + type: number + default: ${{ github.event.issue.number }} + template-path: + required: false + type: string + default: .github/issue-shoot.md + +jobs: + add-template: + if: contains(fromJSON('["easy", "middle", "hard"]'), github.event.label.name) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Get level config + id: config + run: | + label=${{ github.event.label.name }} + if [[ $label = "easy" ]] + then + echo "level=低" >> $GITHUB_OUTPUT + echo "duration=1" >> $GITHUB_OUTPUT + echo "deadline=$(date -d '+3 days' +'%Y-%m-%d')" >> $GITHUB_OUTPUT + elif [[ $label = "middle" ]] + then + echo "level=中" >> $GITHUB_OUTPUT + echo "duration=3" >> $GITHUB_OUTPUT + echo "deadline=$(date -d '+7 days' +'%Y-%m-%d')" >> $GITHUB_OUTPUT + else + echo "level=高" >> $GITHUB_OUTPUT + echo "duration=5" >> $GITHUB_OUTPUT + echo "deadline=$(date -d '+10 days' +'%Y-%m-%d')" >> $GITHUB_OUTPUT + fi + + - name: Render template + id: template + uses: chuhlomin/render-template@v1.4 + with: + template: ${{ inputs.template-path }} + vars: | + level: ${{ steps.config.outputs.level }} + duration: ${{ steps.config.outputs.duration }} + deadline: ${{ steps.config.outputs.deadline }} + + - name: Update issue + uses: TDesignOteam/workflows/actions/issues-helper@main + with: + actions: update-issue + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ inputs.issue-number }} + body: ${{ steps.template.outputs.result }} + update-mode: append diff --git a/.github/workflows/reusable-issue-welcome.yml b/.github/workflows/reusable-issue-welcome.yml new file mode 100644 index 0000000..0f7492b --- /dev/null +++ b/.github/workflows/reusable-issue-welcome.yml @@ -0,0 +1,27 @@ +# 当 issue 被创建时,自动回复引导完善信息 +name: reusable-issue-welcome + +on: + workflow_call: + inputs: + issue-number: + required: false + type: number + default: ${{ github.event.issue.number }} + login: + required: false + type: string + default: ${{ github.event.issue.user.login }} + +jobs: + add-comment: + runs-on: ubuntu-latest + steps: + - uses: TDesignOteam/workflows/actions/issues-helper@main + with: + actions: create-comment + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ inputs.issue-number }} + body: | + 👋 @${{ inputs.login }},感谢给 TDesign 提出了 issue。 + 请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。