Skip to content

Commit

Permalink
wip: pr-comment-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
liweijie0812 committed Jun 25, 2024
1 parent ec4d7bd commit 299f88b
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/pr-comment-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@ jobs:
let next_action = ''
const fs = require('fs')
const CODEOWNERS = fs.readFileSync('.github/CODEOWNERS', 'utf8')
if (CODEOWNERS.includes(`@${context.payload.comment.user.login}`)) {
const isReviewer = false;
CODEOWNERS.match(/@\w+/g).forEach((owner) => {
if (owner === `@${context.payload.comment.user.login}`) {
isReviewer = true
}
})
if (isReviewer) {
console.log('Allowed')
const body = context.payload.comment.body
if (body.startsWith('/update-build')) {
next_action='update-build'
}
if (body.startsWith('/update-dist')) {
next_action='update-dist'
}
} else {
core.warning('You are not collaborator');
}
Expand All @@ -36,11 +42,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: echo ${{ needs.check.outputs.next_action }}
update-build:

update-dist:
needs: check
runs-on: ubuntu-latest
if: ${{ needs.check.outputs.next_action == 'update-build' }}
if: ${{ needs.check.outputs.next_action == 'update-dist' }}
steps:
- uses: actions/checkout@v4
- name: gh checkout pr
Expand All @@ -63,4 +69,4 @@ jobs:
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "chore: build"
git push
git push

0 comments on commit 299f88b

Please sign in to comment.