Update lockfile #840
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
name: Update lockfile | |
on: | |
schedule: | |
- cron: '30 6 * * *' | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
update-lockfile: | |
name: Update lockfile | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: master | |
- name: Prepare | |
env: | |
NVIM_TAG: stable | |
run: | | |
wget https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 | |
mv ./jq-linux64 /tmp/jq | |
chmod +x /tmp/jq | |
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 | |
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: | |
SKIP_LOCKFILE_UPDATE_FOR_LANGS: verilog,gleam,nix | |
run: | | |
cp lockfile.json /tmp/old_lockfile.json | |
./nvim.appimage --headless -c "luafile ./scripts/write-lockfile.lua" -c "q" | |
# Pretty print | |
cp lockfile.json /tmp/lockfile.json | |
cat /tmp/lockfile.json | /tmp/jq --sort-keys > lockfile.json | |
- name: Commit changes | |
run: | | |
git config user.name "GitHub" | |
git config user.email "[email protected]" | |
git add lockfile.json | |
UPDATED_PARSERS=$(echo $(/tmp/jd -set /tmp/old_lockfile.json lockfile.json | grep @ | sed 's/","revision"\]//' | sed 's/@ \["//') | sed 's/ /, /g') | |
echo "UPDATED_PARSERS=$UPDATED_PARSERS" >> $GITHUB_ENV | |
git commit -m "Update parsers: $UPDATED_PARSERS" || echo 'No commit necessary!' | |
git clean -xf | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
title: "Update lockfile.json: ${{ env.UPDATED_PARSERS }}" | |
branch: update-lockfile-pr | |
base: ${{ github.head_ref }} | |
draft: true |