From 82c97d1bdce222b53b5d79be173d6b701ba33316 Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Wed, 12 Jun 2024 16:50:10 +0800 Subject: [PATCH 1/3] fix: Skip package if the last commit is after the comment --- .github/workflows/package_for_test.yml | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/package_for_test.yml b/.github/workflows/package_for_test.yml index a475701b0c..4f7d8aac2a 100644 --- a/.github/workflows/package_for_test.yml +++ b/.github/workflows/package_for_test.yml @@ -46,6 +46,37 @@ jobs: with: ref: refs/pull/${{ github.event.issue.number }}/merge + - name: Check without commit after comment + uses: actions/github-script@v7 + if: ${{ github.event_name == 'issue_comment' }} + env: + ISSUE_NUMBER: ${{github.event.issue.number}} + COMMENT_ID: ${{ github.event.comment.id }} + with: + script: | + const { ISSUE_NUMBER, COMMENT_ID } = process.env + let page = 1 + let hasFoundComment = false + while(true) { + const { data: timelines } = await github.rest.issues.listEventsForTimeline({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: ISSUE_NUMBER, + page, + per_page: 100, + }) + if (timelines.some(v => { + hasFoundComment = hasFoundComment || (v.event === 'commented' && `${v.id}` === `${COMMENT_ID}`) + return hasFoundComment && v.event === 'committed' + })) { + throw new Error('The last commit comes after the comment, please comment and package after last commit') + } + if (timelines.length === 0) { + return + } + page += 1 + } + - name: Setup Node uses: actions/setup-node@v4 with: From 00daf60b142562ebc07a426f5c35f4f1b5826037 Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Wed, 12 Jun 2024 22:39:40 +0800 Subject: [PATCH 2/3] [skip ci] [skip ci] --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8732315577..08b8a001b6 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ You will need `node >= 18.12.0` and `yarn >= 1.14` to build and run Neuron. #### Lerna + This project uses [lerna](https://github.com/lerna/lerna/) for package management. ```shell From 34a121fab013a885228e3470c8e1fd669f05a136 Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Wed, 12 Jun 2024 22:40:29 +0800 Subject: [PATCH 3/3] [skip ci] [skip ci] --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 08b8a001b6..dd60e363ea 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ You will need `node >= 18.12.0` and `yarn >= 1.14` to build and run Neuron. #### Lerna + This project uses [lerna](https://github.com/lerna/lerna/) for package management. ```shell