Skip to content

Sync remote main

Sync remote main #1

Workflow file for this run

name: Register PR In Database
on:
pull_request_target:
branches: [main]
types: [opened, reopened, synchronize, closed]
jobs:
register-pr:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout Pull Request
id: checkout
env:
PR_REPO_URL: ${{ github.event.pull_request.head.repo.clone_url }}
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
run: |
bash scripts/checkout-pr.sh src docs
if [ -n "$(git status --porcelain src | grep '^A')" ]; then
echo '::set-output name=has_new_func::true'
else
echo '::set-output name=has_new_func::false'
fi
- name: Wait for other checks to finish
if: steps.checkout.outputs.has_new_func == 'true'
uses: lewagon/[email protected]
with:
ref: ${{ github.event.pull_request.head.sha }}
running-workflow-name: 'register-pr'
repo-token: ${{ secrets.GITHUB_TOKEN }}
allowed-conclusions: success,skipped,failure,timed_out,cancelled
- name: Install pnpm
if: steps.checkout.outputs.has_new_func == 'true'
uses: pnpm/action-setup@v4
- name: Install Node.js
if: steps.checkout.outputs.has_new_func == 'true'
uses: actions/setup-node@v4
with:
cache: pnpm
- name: Install Dependencies
if: steps.checkout.outputs.has_new_func == 'true'
run: |
pnpm install -C scripts/functions
pnpm install -C scripts/radashi-db
- name: Register PR
if: steps.checkout.outputs.has_new_func == 'true'
uses: actions/github-script@v7
env:
ALGOLIA_KEY: ${{ secrets.ALGOLIA_KEY }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const root = '${{ github.workspace }}/scripts/functions'
const { tsImport } = await import(root + '/node_modules/tsx/dist/esm/api/index.cjs')
const script = await tsImport(root + '/ci-register-pr.ts', root)
await script.run(context.payload.pull_request, github.rest)