Skip to content

Use one wasm update workflow #1

Use one wasm update workflow

Use one wasm update workflow #1

# Inspired by bash-language-server under MIT license
# Reference: https://github.com/bash-lsp/bash-language-server/blob/8c42218c77a9451b308839f9a754abde901323d5/.github/workflows/upgrade-tree-sitter.yml
name: Update Tree Sitter WASM File - test
on:
workflow_dispatch:
pull_request:
branches:
- '*'
schedule:
- cron: '0 12 * * 2'
jobs:
update-tree-sitter-wasm:
runs-on: ubuntu-latest
strategy:
matrix:
tree-sitter-name: ['tree-sitter-bitbake', 'tree-sitter-bash']
defaults:
run:
shell: bash
env:
DBUS_SESSION_BUS_ADDRESS: unix:path=/run/user/1001/bus
SHELL: /usr/bin/bash
BASE_BRANCH: staging
node-version: 20
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ env.BASE_BRANCH }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: 'npm'
cache-dependency-path: |
package-lock.json
server/package-lock.json
client/package-lock.json
- name: Install Dependencies
run: npm install
- name: Update tree-sitter wasm
run: bash scripts/update-${{ matrix.tree-sitter-name }}-wasm.sh
- name: Verify file changes
uses: tj-actions/verify-changed-files@v22
id: verify-changed-files
with:
# The script generates a new wasm file and replaces the existing one. Git will treat it as a different file even it is generated with the same commit and CLI
# Hence, we only compare the .info file. It should be enough to tell the difference
files: |
server/${{ matrix.tree-sitter-name }}.info
- name: Create pull request
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: peter-evans/create-pull-request@v6
with:
add-paths: |
server/${{ matrix.tree-sitter-name }}.info
server/${{ matrix.tree-sitter-name }}.wasm
title: Auto update ${{ matrix.tree-sitter-name }} wasm file
commit-message: Auto update ${{ matrix.tree-sitter-name }} wasm file and parser info
branch: update-${{ matrix.tree-sitter-name }}-wasm-file
base: ${{ env.BASE_BRANCH }}
token: ${{ secrets.GITHUB_TOKEN }}