Skip to content

docs(ci): Fix permission issues raised by the docs ci workflow #56

docs(ci): Fix permission issues raised by the docs ci workflow

docs(ci): Fix permission issues raised by the docs ci workflow #56

Workflow file for this run

name: Sync schema.json to LSP repo
on:
push:
branches: [main]
paths:
- "src/makim/schema.json"
pull_request:
branches: [main]
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
jobs:
sync-schema:
runs-on: ubuntu-latest
steps:
- name: Checkout Makim repo
uses: actions/checkout@v4
- name: Set up Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: GitHub Login
if: ${{ github.event_name == 'push' }}
run: |
gh auth setup-git
- name: Clone target repo
run: git clone https://github.com/makim-org/makim-lsp.git
- name: Create a new branch
run: |
cd makim-lsp
git checkout -b sync-schema-$(date +%s)
cp ../src/makim/schema.json ./packages/language-server/src/schema/makim.schema.json
- name: Push LSP branch and open a PR
if: ${{ github.event_name == 'push' }}
run: |
cd makim-lsp
git add .
git commit -m "chore(schema): Sync schema.json from Makim"
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
git push origin "$CURRENT_BRANCH"
gh pr create \
--title "Sync schema.json from Makim" \
--body "Auto-generated by GitHub Actions" \
--head "$CURRENT_BRANCH" \
--base main