[学校信息变更]:前郭二中 #176
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 学校信息审核通过回复 | |
| on: | |
| issues: | |
| types: [labeled] | |
| jobs: | |
| reply-when-approved: | |
| runs-on: ubuntu-latest | |
| if: github.event.label.name == '审核通过' && contains(github.event.issue.labels.*.name, '学校信息填报') | |
| steps: | |
| - name: 添加审核通过回复 | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| // 检查是否已经回复过 | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.issue.number | |
| }); | |
| const hasReplied = comments.some(comment => | |
| comment.body.includes('✅ 审核成功') && | |
| comment.user.type === 'Bot' | |
| ); | |
| if (!hasReplied) { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.issue.number, | |
| body: `✅ 审核通过\n\n您的学校信息审核成功,请等待维护人员将信息上传至网站。若14日内未上线,请联系\`wujingbo12@qq.com\`` | |
| }); | |
| console.log('自动回复已添加'); | |
| } else { | |
| console.log('已回复过,跳过'); | |
| } |