Skip to content

chore: test pkg.pr.new #3

chore: test pkg.pr.new

chore: test pkg.pr.new #3

name: Publish Any Commit
on:
push:
branches:
- main
tags:
- '!**'
issue_comment:
types: [created]
jobs:
build:
if: github.repository == 'userquin/vuetify-nuxt-module' && (github.event_name == 'push' || github.event.issue.pull_request && startsWith(github.event.comment.body, '/pkg-pr-new'))
runs-on: ubuntu-latest
steps:
- if: github.event.issue.pull_request
uses: actions/github-script@v7
with:
script: |
const user = context.payload.sender.login
console.log(`Validate user: ${user}`)
let hasPermission = false
try {
const { data } = await github.rest.repos.getCollaboratorPermissionLevel({
owner: context.repo.owner,
repo: context.repo.repo,
username: user,
});
hasPermission = data.user.permissions.write
} catch (e) {
console.warn(e)
}
if (hasPermission) {
console.log('Allowed')
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: '+1',
})
} else {
console.log('Not allowed')
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: '-1',
})
throw new Error('not allowed')
}
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4.0.0
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm prepack
- run: pnpm dlx pkg-pr-new publish --compact --pnpm