Skip to content

Merge pull request #49 from vercel-labs/docs #327

Merge pull request #49 from vercel-labs/docs

Merge pull request #49 from vercel-labs/docs #327

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm lint
- name: Knip
run: pnpm knip
typecheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Typecheck
run: pnpm typecheck
build-and-test:
runs-on: ubuntu-latest
env:
SLACK_BOT_TOKEN: xoxb-mock
SLACK_SIGNING_SECRET: mock
TEAMS_APP_ID: mock
TEAMS_APP_PASSWORD: mock
TEAMS_APP_TENANT_ID: mock
GOOGLE_CHAT_CREDENTIALS: '{"type":"service_account","project_id":"mock","private_key":"-----BEGIN RSA PRIVATE KEY-----\nMOCK\n-----END RSA PRIVATE KEY-----","client_email":"mock@mock.iam.gserviceaccount.com"}'
REDIS_URL: redis://localhost:6379
RECORDING_ENABLED: "false"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Test
run: pnpm test
preview-comment:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Post preview testing instructions
uses: actions/github-script@v7
with:
script: |
const body = `## Preview Branch Testing
To test this PR with real webhook traffic:
1. Go to [/settings](https://the-real-chat-sdk-nextjs-chat.labs.vercel.dev/settings) on the production deployment
2. Enter this PR's Vercel preview URL
3. Save - all webhook requests will now be proxied to this preview
**To disable:** Clear the URL on the settings page.`;
// Check if we already commented
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const botComment = comments.find(comment =>
comment.user.type === 'Bot' &&
comment.body.includes('## Preview Branch Testing')
);
if (!botComment) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: body
});
}