From 280a2cff8efefafec034f7131adb2cb636fccbc3 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Mon, 2 Oct 2023 19:34:11 +0800 Subject: [PATCH] feat(actions): add issue actions --- .github/workflows/issue-check-inactive.yml | 16 +++++++++ .github/workflows/issue-close-require.yml | 20 ++++++++++++ .github/workflows/issue-comment.yml | 38 ++++++++++++++++++++++ .github/workflows/issue-open.yml | 16 +++++++++ .github/workflows/issues.yml | 23 ------------- 5 files changed, 90 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/issue-check-inactive.yml create mode 100644 .github/workflows/issue-close-require.yml create mode 100644 .github/workflows/issue-comment.yml create mode 100644 .github/workflows/issue-open.yml delete mode 100644 .github/workflows/issues.yml diff --git a/.github/workflows/issue-check-inactive.yml b/.github/workflows/issue-check-inactive.yml new file mode 100644 index 0000000000..805170c988 --- /dev/null +++ b/.github/workflows/issue-check-inactive.yml @@ -0,0 +1,16 @@ +name: Issue Check Inactive + +on: + schedule: + - cron: "0 0 * * *" + +jobs: + issue-check-inactive: + runs-on: ubuntu-latest + steps: + - name: check-inactive + uses: actions-cool/issues-helper@v2 + with: + actions: 'check-inactive' + inactive-label: 'stale' + inactive-day: 30 diff --git a/.github/workflows/issue-close-require.yml b/.github/workflows/issue-close-require.yml new file mode 100644 index 0000000000..f5506e4f97 --- /dev/null +++ b/.github/workflows/issue-close-require.yml @@ -0,0 +1,20 @@ +name: Issue Close Require + +on: + schedule: + - cron: "0 1 * * *" + +jobs: + issue-close-require: + runs-on: ubuntu-latest + steps: + - name: need reproduce + uses: actions-cool/issues-helper@v2 + with: + actions: 'close-issues' + labels: 'state/awaiting user feedback' + inactive-day: 37 + body: | + If you do not provide feedback for more than 37 days, we will close the issue and you can either reopen it or submit a new issue. + + 您超过 37 天未反馈信息,我们将关闭该 issue,如有需求您可以重新打开或者提交新的 issue。 diff --git a/.github/workflows/issue-comment.yml b/.github/workflows/issue-comment.yml new file mode 100644 index 0000000000..f35d33f1c8 --- /dev/null +++ b/.github/workflows/issue-comment.yml @@ -0,0 +1,38 @@ +on: + issue_comment: + types: [created] + +name: Add issues workflow labels + +jobs: + add-label-if-is-author: + runs-on: ubuntu-latest + if: (github.event.issue.user.id == github.event.comment.user.id) && !github.event.issue.pull_request && (github.event.issue.state == 'open') + steps: + - name: Add require handle label + uses: actions-cool/issues-helper@v2 + with: + actions: 'add-labels' + labels: 'state/awaiting processing' + + - name: Remove require reply label + uses: actions-cool/issues-helper@v2 + with: + actions: 'remove-labels' + labels: 'state/awaiting user feedback' + + add-label-if-not-author: + runs-on: ubuntu-latest + if: (github.event.issue.user.id != github.event.comment.user.id) && !github.event.issue.pull_request && (github.event.issue.state == 'open') + steps: + - name: Add require replay label + uses: actions-cool/issues-helper@v2 + with: + actions: 'add-labels' + labels: 'state/awaiting user feedback' + + - name: Remove require handle label + uses: actions-cool/issues-helper@v2 + with: + actions: 'remove-labels' + labels: 'state/awaiting processing' diff --git a/.github/workflows/issue-open.yml b/.github/workflows/issue-open.yml new file mode 100644 index 0000000000..7e47bc4429 --- /dev/null +++ b/.github/workflows/issue-open.yml @@ -0,0 +1,16 @@ +name: Issue Open Check + +on: + issues: + types: [opened] + +jobs: + issue-open-add-labels: + runs-on: ubuntu-latest + steps: + - name: Add labels + uses: actions-cool/issues-helper@v2 + if: ${{ !github.event.comment.pull_request.pull_request }} + with: + actions: 'add-labels' + labels: 'state/awaiting processing' diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml deleted file mode 100644 index fde053f942..0000000000 --- a/.github/workflows/issues.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Close inactive issues -on: - schedule: - - cron: "00 10 * * *" - -jobs: - close-issues: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - steps: - - uses: actions/stale@v5 - with: - days-before-issue-stale: 30 - days-before-issue-close: 7 - stale-issue-label: "stale" - stale-issue-message: "This issue is stale because it has been open for 30 days with no activity." - close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." - days-before-pr-stale: -1 - days-before-pr-close: -1 - repo-token: ${{ secrets.GITHUB_TOKEN }} -