Skip to content

Commit

Permalink
[skip ci]
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
yanguoyu committed Jun 12, 2024
1 parent 13e6afd commit a1300e4
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion .github/workflows/package_for_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,44 @@ on:
push:

jobs:
check_issue_comment:
if: ${{ (github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/package') && contains(fromJSON('["OWNER", "COLLABORATOR"]'), github.event.comment.author_association)) }}

run-on: ubuntu-20.04

setps:
- name: Check without commit after comment
uses: actions/github-script@v7
env:
COMMENT_ID: ${{github.event.comment.id}}
with:
script: |
const { COMMENT_ID } = process.env
let page = 1
let findComment = false
let endOfData = false
while(!endOfData) {
const { data: timelines } = await github.rest.issues.listEventsForTimeline({
owner: context.repo.owner,
repo: context.repo.repo,
page,
per_page: 100,
})
if (timelines.find(v => {
findComment = findComment || (v.event === 'commented' && `${v.id}` === `${COMMENT_ID}`)
return findComment && v.event === 'committed'
})) {
throw new Error('The commits comes after the comment.')
}
if (timelines.length === 0) {
return
}
page += 1
}
packaging:
if: ${{ (github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/package') && contains(fromJSON('["OWNER", "COLLABORATOR"]'), github.event.comment.author_association)) || github.event_name == 'push' }}
needs: [check_issue_comment]
if: ${{ (always() && needs.check_issue_comment.result == 'skipped' && github.event_name == 'push') || success() }}

strategy:
matrix:
Expand Down

0 comments on commit a1300e4

Please sign in to comment.