fix: handling http response headers (#106) #161
This file contains 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
# This workflow is based on https://github.com/vitejs/vite/tree/main/.github/workflows | |
name: Publish Any Commit 🚀 | |
env: | |
# install playwright binary manually (because pnpm only runs install script once) | |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "!**" | |
issue_comment: | |
types: [created] | |
jobs: | |
changed: | |
name: Get changed files 📂 | |
runs-on: ubuntu-latest | |
outputs: | |
all_changed_files: ${{ steps.changed-files.outputs.all_changed_files }} | |
should_skip: ${{ steps.changed-files.outputs.any_changed != 'true' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# Assume PRs are less than 50 commits | |
fetch-depth: 50 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v45 | |
with: | |
files: | | |
packages/** | |
build: | |
name: Build 🚀 | |
needs: changed | |
if: github.repository == 'lazarv/react-server' && needs.changed.outputs.should_skip != 'true' && (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 code | |
uses: actions/checkout@v4 | |
- run: corepack enable | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Publish @lazarv/react-server | |
if: contains(needs.changed.outputs.all_changed_files, 'packages/react-server/') | |
run: pnpm dlx pkg-pr-new@0.0 publish --compact --pnpm ./packages/react-server --comment=update | |
- name: Publish @lazarv/react-server-adapter-core | |
if: contains(needs.changed.outputs.all_changed_files, 'packages/react-server-adapter-core/') | |
run: pnpm dlx pkg-pr-new@0.0 publish --compact --pnpm ./packages/react-server-adapter-core --comment=update | |
- name: Publish @lazarv/react-server-adapter-vercel | |
if: contains(needs.changed.outputs.all_changed_files, 'packages/react-server-adapter-vercel/') | |
run: pnpm dlx pkg-pr-new@0.0 publish --compact --pnpm ./packages/react-server-adapter-vercel --comment=update |