Ability to include code from the _files
in the markdown of the lesson
#76
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PRs can be published by commenting `/pkg-pr-new` in the PR | |
name: Publish Any Commit | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
build: | |
if: github.repository == 'stackblitz/tutorialkit' && (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 hasTriagePermission = false | |
try { | |
const { data } = await github.rest.repos.getCollaboratorPermissionLevel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
username: user, | |
}); | |
hasTriagePermission = data.user.permissions.triage | |
} catch (e) { | |
console.warn(e) | |
} | |
if (hasTriagePermission) { | |
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 | |
uses: actions/checkout@v4 | |
with: | |
ref: refs/pull/${{ github.event.issue.number }}/head | |
- uses: ./.github/actions/setup-and-build | |
- name: Publish to pkg.pr.new | |
run: > | |
pnpm dlx pkg-pr-new@0.0 publish --compact --pnpm | |
./packages/astro | |
./packages/react | |
./packages/runtime | |
./packages/theme | |
./packages/types |