ci(plugin): Using GitHub Action update plugin packages every Monday #3
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: [push, pull_request] | |
jobs: | |
update-lockfile: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: rhysd/action-setup-vim@v1 | |
with: | |
neovim: true | |
- name: Run lockfile-autoupdate | |
timeout-minutes: 5 | |
run: | | |
git clone https://github.com/kang8/nvim.git ~/.config/nvim | |
nvim --headless "+Lazy! update" +qa | |
cp -pv "${HOME}/.config/nvim/lazy-lock.json" . | |
- name: Commit and Create Pull Request | |
run: | | |
if [[ -n $(git status --porcelain) ]]; then | |
# Commit | |
git config push.autoSetupRemote true | |
git config user.name github-actions | |
git config user.email [email protected] | |
git checkout -b chore/update-lockfile--$RANDOM | |
git commit --all --message="chore(lockfile): auto update lazy-lock.json" | |
git push | |
# Create pull request | |
gh pr create --base master --title 'Auto update lazy-lock.json' --body 'Created by Github Action' | |
else | |
echo "Not plugin update." | |
fi |