Skip to content

Commit

Permalink
fix: Skip package if the last commit is after the comment (#3184)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanguoyu authored Jun 18, 2024
1 parent aa100d7 commit 681f0b5
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/package_for_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,37 @@ jobs:
with:
ref: refs/pull/${{ github.event.issue.number }}/merge

- name: Ensure no more commits after the triggering 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:
Expand Down

1 comment on commit 681f0b5

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Packaging for test is done in 9560004699

Please sign in to comment.