From 4e76a7ace4a48ec75dfc26ffc4a45ba7292e3d3a Mon Sep 17 00:00:00 2001 From: Qinyang Liu <93815242+willow-god@users.noreply.github.com> Date: Thu, 4 Jul 2024 21:18:14 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=AE=E5=B0=9D=E8=AF=95issue=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=A4=84=E7=90=86action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..425a970 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,46 @@ +name: Handle Email Issues + +on: + issues: + types: [opened] + +jobs: + handle_email_issues: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Add label + if: startsWith(github.event.issue.title, '[e-mail]') + uses: actions-ecosystem/action-add-labels@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + labels: 'subscribe' + + - name: Comment on issue + if: startsWith(github.event.issue.title, '[e-mail]') + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.PAT_TOKEN }} + script: | + github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '您已订阅本站更新,若有新文章将通过邮箱推送给您,谢谢!' + }) + + - name: Close issue + if: startsWith(github.event.issue.title, '[e-mail]') + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.PAT_TOKEN }} + script: | + github.issues.update({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + state: 'closed' + })