-
Notifications
You must be signed in to change notification settings - Fork 55
60 lines (53 loc) · 1.65 KB
/
sync.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: "Check changes and sync"
on:
workflow_dispatch:
schedule:
- cron: 0 5 * * *
jobs:
check-and-sync:
runs-on: ubuntu-20.04
outputs:
all: ${{ steps.changes.outputs.all}}
c: ${{ steps.changes.outputs.c }}
steps:
- name: checkout tree-sitter-scala
uses: actions/checkout@v3
with:
fetch-depth: 10
- name: Generate parser from scratch
run: |
npm install
npm run build
- name: Format Javascipt
run: |
npm install
npm run format
- name: Check for changes
uses: tj-actions/verify-changed-files@v13
id: verify-changed-files
with:
files: |
grammar.js
src/grammar.json
src/node-types.json
src/parser.c
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"