1212 strategy :
1313 matrix :
1414 node :
15- - 18.12.0
15+ - 20.15.1
1616 os :
1717 - macos-latest
1818 - ubuntu-20.04
@@ -46,14 +46,45 @@ jobs:
4646 with :
4747 ref : refs/pull/${{ github.event.issue.number }}/merge
4848
49+ - name : Ensure no more commits after the triggering comment
50+ uses : actions/github-script@v7
51+ if : ${{ github.event_name == 'issue_comment' }}
52+ env :
53+ ISSUE_NUMBER : ${{github.event.issue.number}}
54+ COMMENT_ID : ${{ github.event.comment.id }}
55+ with :
56+ script : |
57+ const { ISSUE_NUMBER, COMMENT_ID } = process.env
58+ let page = 1
59+ let hasFoundComment = false
60+ while(true) {
61+ const { data: timelines } = await github.rest.issues.listEventsForTimeline({
62+ owner: context.repo.owner,
63+ repo: context.repo.repo,
64+ issue_number: ISSUE_NUMBER,
65+ page,
66+ per_page: 100,
67+ })
68+ if (timelines.some(v => {
69+ hasFoundComment = hasFoundComment || (v.event === 'commented' && `${v.id}` === `${COMMENT_ID}`)
70+ return hasFoundComment && v.event === 'committed'
71+ })) {
72+ throw new Error('The last commit comes after the comment, please comment and package after last commit')
73+ }
74+ if (timelines.length === 0) {
75+ return
76+ }
77+ page += 1
78+ }
79+
4980 - name : Setup Node
5081 uses : actions/setup-node@v4
5182 with :
5283 node-version : ${{ matrix.node }}
5384 cache : " yarn"
5485
5586 - name : Restore
56- uses : actions/cache@v3
87+ uses : actions/cache@v4
5788 with :
5889 path : |
5990 node_modules
6293
6394 - name : Add msbuild to PATH
6495 if : matrix.os == 'windows-2019'
65- uses : microsoft/setup-msbuild@v1.3.1
96+ uses : microsoft/setup-msbuild@v2
6697 env :
6798 ACTIONS_ALLOW_UNSECURE_COMMANDS : " true"
6899
@@ -225,7 +256,7 @@ jobs:
225256
226257 - name : Comment by pull request comment event
227258 if : ${{ github.event_name == 'issue_comment' }}
228- uses : peter-evans/create-or-update-comment@v3
259+ uses : peter-evans/create-or-update-comment@v4
229260 with :
230261 comment-id : ${{ github.event.comment.id }}
231262 body : |
@@ -242,7 +273,7 @@ jobs:
242273 steps :
243274 - name : Comment by pull request comment event when package failed
244275 if : ${{ github.event_name == 'issue_comment' }}
245- uses : peter-evans/create-or-update-comment@v3
276+ uses : peter-evans/create-or-update-comment@v4
246277 with :
247278 comment-id : ${{ github.event.comment.id }}
248279 body : Packageing failed in [${{ github.run_id }}](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}). @${{ github.event.comment.user.login }}
0 commit comments