Skip to content

Commit

Permalink
chore: add pkg.pr.new (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin authored Aug 15, 2024
1 parent b6d4c87 commit 0a9e9c0
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/publish-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
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/[email protected]

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build

- run: pnpm dlx pkg-pr-new publish --compact --pnpm

0 comments on commit 0a9e9c0

Please sign in to comment.