From e6d1ac38254bd49eb039e6072c752c8e2f7bde4c Mon Sep 17 00:00:00 2001 From: Qinyang Liu <93815242+willow-god@users.noreply.github.com> Date: Thu, 4 Jul 2024 21:37:22 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=AE=E7=BB=A7=E7=BB=AD=E5=B0=9D?= =?UTF-8?q?=E8=AF=95=E6=96=B0=E7=9A=84=E6=96=B9=E6=B3=95=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deal_subscribe_issue.yml | 48 +++++++++++----------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/.github/workflows/deal_subscribe_issue.yml b/.github/workflows/deal_subscribe_issue.yml index 425a970..bb03c40 100644 --- a/.github/workflows/deal_subscribe_issue.yml +++ b/.github/workflows/deal_subscribe_issue.yml @@ -7,40 +7,38 @@ on: jobs: handle_email_issues: runs-on: ubuntu-latest + permissions: + issues: write steps: - name: Checkout repository uses: actions/checkout@v2 - - name: Add label + - name: Add subscribed label if: startsWith(github.event.issue.title, '[e-mail]') - uses: actions-ecosystem/action-add-labels@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - labels: 'subscribe' + run: | + gh issue edit $NUMBER --add-label subscribed + env: + GH_TOKEN: ${{ secrets.PAT_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.issue.number }} - 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: '您已订阅本站更新,若有新文章将通过邮箱推送给您,谢谢!' - }) + run: | + gh issue comment $NUMBER --body "$BODY" + env: + GH_TOKEN: ${{ secrets.PAT_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.issue.number }} + 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' - }) + run: | + gh issue edit $NUMBER --state closed + env: + GH_TOKEN: ${{ secrets.PAT_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.issue.number }}