@@ -13,27 +13,30 @@ jobs:
1313 steps :
1414 - uses : actions/checkout@v4
1515 with :
16- fetch-depth : 1
16+ repository : Tencent/tdesign
17+ sparse-checkout : |
18+ .github/.pr-comment-ci-whitelist
19+ sparse-checkout-cone-mode : false
20+
1721 - uses : actions/github-script@v7
1822 id : get-action
1923 with :
2024 script : |
2125 const user = context.payload.comment.user.login
22- core.debug (`user: ${user}`)
26+ core.info (`user: ${user}`)
2327
24- const fs = require('fs')
25- const CODEOWNERS = fs.readFileSync('.github/CODEOWNERS', 'utf8')
26- core.debug(`CODEOWNERS: ${CODEOWNERS}`)
28+ const fs = require('fs');
29+ const whitelist = fs.readFileSync('.github/.pr-comment-ci-whitelist', 'utf8');
2730
28- let isReviewer = false;
29- CODEOWNERS.match(/@\w+/g ).forEach((owner) => {
30- if (owner === `@${ user}` ) {
31- isReviewer = true
31+ let isWhitelist = false;
32+ whitelist.split('\n' ).forEach((owner) => {
33+ if (owner === user) {
34+ isWhitelist = true;
3235 }
33- })
36+ });
3437
3538 let next_action = ''
36- if (isReviewer ) {
39+ if (isWhitelist ) {
3740 const body = context.payload.comment.body
3841 core.info(`body: ${body}`)
3942 if (body.startsWith('/update-common')) {
4245 if (body.startsWith('/update-snapshot')) {
4346 next_action='update-snapshot'
4447 }
48+
49+ if(next_action){
50+ await github.rest.reactions.createForIssueComment({
51+ owner: context.repo.owner,
52+ repo: context.repo.repo,
53+ comment_id: context.payload.comment.id,
54+ content: 'rocket',
55+ })
56+ }
4557 } else {
4658 core.warning('You are not collaborator');
4759 }
@@ -77,15 +89,34 @@ jobs:
7789 - uses : actions/checkout@v4
7890 with :
7991 token : ${{ secrets.PERSONAL_TOKEN }}
92+
8093 - name : gh checkout pr
8194 env :
8295 GH_TOKEN : ${{ secrets.PERSONAL_TOKEN }}
8396 run : gh pr checkout ${{ github.event.issue.number }} --recurse-submodules
97+
98+ - name : bot commtent
99+ id : bot-comment
100+ uses : actions/github-script@v7
101+ with :
102+ script : |
103+ const url = `${context.serverUrl}//${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
104+ const urlLink = `[Open](${url})`
105+ const { data: comment } = await github.rest.issues.createComment({
106+ issue_number: context.issue.number,
107+ owner: context.repo.owner,
108+ repo: context.repo.repo,
109+ body: `⏳ 正在运行快照更新。。。 CI: ${urlLink}`
110+ })
111+ return comment.id
112+
84113 - uses : actions/setup-node@v4
85114 with :
86115 node-version : 18
116+
87117 - uses : ./.github/actions/install-dep
88118 - run : npm run test:snap-update
119+
89120 - name : Commit Snapshot
90121 run : |
91122 git add .
0 commit comments