-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51affc4
commit c86c679
Showing
1 changed file
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# 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 }} |