Skip to content

Instantly share code, notes, and snippets.

@ciiqr
Created November 29, 2021 18:18
Show Gist options
  • Save ciiqr/954d86a31dd90cf4ea6a6e581b13a365 to your computer and use it in GitHub Desktop.
Save ciiqr/954d86a31dd90cf4ea6a6e581b13a365 to your computer and use it in GitHub Desktop.
Github action to update yarn.lock (not fully tested yet)
name: Update yarn.lock
on:
push:
branches:
- main
jobs:
yarn.lock:
runs-on: ubuntu-latest
steps:
# setup
- uses: actions/checkout@v2
- name: Read .nvmrc
run: echo NVMRC="$(cat .nvmrc)" >> $GITHUB_ENV
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NVMRC }}
# make changes
- name: update yarn.lock
run: yarn install
# commit
- name: commit
run: |
# check if there are yarn.lock changes to commit
if ! git diff --quiet yarn.lock; then
# setup the username and email
git config --global user.email "[email protected]"
git config --global user.name "commany-bot"
# Stage the file, commit and push
git add yarn.lock
git commit -m 'chore(yarn): updated yarn.lock'
git push
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment