Created
November 29, 2021 18:18
-
-
Save ciiqr/954d86a31dd90cf4ea6a6e581b13a365 to your computer and use it in GitHub Desktop.
Github action to update yarn.lock (not fully tested yet)
This file contains hidden or 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 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