2022-04-14 12:01:23 +08:00
|
|
|
name: Update lockfile
|
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
2023-06-18 14:17:38 +08:00
|
|
|
- cron: "30 6 * * *"
|
|
|
|
workflow_dispatch:
|
2022-04-14 12:01:23 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
update-lockfile:
|
|
|
|
name: Update lockfile
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-06-18 14:17:38 +08:00
|
|
|
- uses: actions/checkout@v3
|
2022-04-14 12:01:23 +08:00
|
|
|
with:
|
|
|
|
ref: master
|
|
|
|
|
|
|
|
- name: Prepare
|
|
|
|
env:
|
|
|
|
NVIM_TAG: stable
|
|
|
|
run: |
|
2023-06-18 14:17:38 +08:00
|
|
|
wget https://github.com/josephburnett/jd/releases/download/v1.6.1/jd-amd64-linux
|
|
|
|
mv ./jd-amd64-linux /tmp/jd
|
|
|
|
chmod +x /tmp/jd
|
|
|
|
sudo apt install libfuse2
|
2022-04-14 12:01:23 +08:00
|
|
|
wget https://github.com/neovim/neovim/releases/download/${NVIM_TAG}/nvim.appimage
|
|
|
|
chmod u+x nvim.appimage
|
|
|
|
mkdir -p ~/.local/share/nvim/site/pack/nvim-treesitter/start
|
|
|
|
ln -s $(pwd) ~/.local/share/nvim/site/pack/nvim-treesitter/start
|
|
|
|
|
|
|
|
- name: Update parsers
|
|
|
|
env:
|
2023-06-18 14:17:38 +08:00
|
|
|
SKIP_LOCKFILE_UPDATE_FOR_LANGS: ""
|
2022-04-14 12:01:23 +08:00
|
|
|
run: |
|
2023-06-18 14:17:38 +08:00
|
|
|
cp lockfile.json /tmp/old_lockfile.json
|
2022-04-14 12:01:23 +08:00
|
|
|
./nvim.appimage --headless -c "luafile ./scripts/write-lockfile.lua" -c "q"
|
|
|
|
# Pretty print
|
|
|
|
cp lockfile.json /tmp/lockfile.json
|
2023-06-18 14:17:38 +08:00
|
|
|
cat /tmp/lockfile.json | jq --sort-keys > lockfile.json
|
2022-04-14 12:01:23 +08:00
|
|
|
|
|
|
|
- name: Commit changes
|
|
|
|
run: |
|
|
|
|
git config user.name "GitHub"
|
|
|
|
git config user.email "noreply@github.com"
|
|
|
|
git add lockfile.json
|
2023-06-18 14:17:38 +08:00
|
|
|
UPDATED_PARSERS=$(/tmp/jd -f merge /tmp/old_lockfile.json lockfile.json | jq -r 'keys | join(", ")')
|
|
|
|
echo "UPDATED_PARSERS=$UPDATED_PARSERS" >> $GITHUB_ENV
|
|
|
|
git commit -m "Update parsers: $UPDATED_PARSERS" || echo 'No commit necessary!'
|
2022-04-14 12:01:23 +08:00
|
|
|
git clean -xf
|
|
|
|
|
|
|
|
- name: Create Pull Request
|
2023-06-18 14:17:38 +08:00
|
|
|
uses: peter-evans/create-pull-request@v4
|
2022-04-14 12:01:23 +08:00
|
|
|
with:
|
2023-06-18 14:17:38 +08:00
|
|
|
title: "Update lockfile.json: ${{ env.UPDATED_PARSERS }}"
|
2022-04-14 12:01:23 +08:00
|
|
|
branch: update-lockfile-pr
|
|
|
|
base: ${{ github.head_ref }}
|
|
|
|
draft: true
|