Skip to content

Check changes and sync #710

Check changes and sync

Check changes and sync #710

Workflow file for this run

name: "Check changes and sync"
on:
workflow_dispatch:
schedule:
- cron: 0 5 * * *
jobs:
check-and-sync:
runs-on: ubuntu-latest
if: github.repository == 'tree-sitter/tree-sitter-scala'
outputs:
all: ${{ steps.changes.outputs.all}}
c: ${{ steps.changes.outputs.c }}
steps:
- name: checkout tree-sitter-scala
uses: actions/checkout@v4
with:
fetch-depth: 10
- name: Set up tree-sitter
uses: tree-sitter/setup-action/cli@v1
- name: Generate parser from scratch
shell: bash
run: tree-sitter generate
- name: Format Javascipt
run: |
npm install
export PATH=./node_modules/.bin:$PATH
prettier --write --ignore-unknown grammar.js
- name: Check for changes
uses: tj-actions/verify-changed-files@v19
id: verify-changed-files
with:
files: |
bindings/c/tree-sitter-scala.h
bindings/c/tree-sitter-scala.pc.in
grammar.js
src/grammar.json
src/node-types.json
src/parser.c
src/tree_sitter/alloc.h
src/tree_sitter/array.h
src/tree_sitter/parser.h
- name: Commit changes if necessary
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config user.name "GitHub"
git config user.email "[email protected]"
git add .
LAST_COMMIT=$(git log --format="%H" -n 1)
git commit -m "chore: generate and sync from $LAST_COMMIT"
git clean -xf
- name: Create Pull Request
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: peter-evans/create-pull-request@v4
with:
title: "chore: generate and sync latest changes"
branch: generation
base: ${{ github.head_ref }}
- name: No changes detected
if: steps.verify-changed-files.outputs.files_changed == 'false'
run: echo "No changes detected"