Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding an action-script for an automated update of yarn.lock #206

Merged
merged 10 commits into from
Apr 15, 2023
51 changes: 51 additions & 0 deletions .github/workflows/kjs-yarn-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Update yarn.lock generated by Kotlin Gradle Plugin

on:
pull_request:
paths:
- 'gradle/libs.versions.toml'
- 'ktoml-core/build.gradle.kts'
push:
paths:
- 'gradle/libs.versions.toml'
- 'ktoml-core/build.gradle.kts'

jobs:
update_kjs_yarn_lock:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
if: github.event_name == 'pull_request'
with:
# Checkout source branch directly, without merging base into it
ref: ${{ github.event.pull_request.head.ref }}
- uses: actions/checkout@v3
if: github.event_name == 'push'
with:
# Checkout source branch directly, without merging base into it
ref: ${{ github.event.push.ref }}
- name: Generate yarn.lock
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
arguments: |
kotlinStoreYarnLock
--build-cache
-PgprUser=${{ github.actor }}
-PgprKey=${{ secrets.GITHUB_TOKEN }}
- name: Dedupe generated yarn.lock
run: |
npm install -g yarn-deduplicate
yarn-deduplicate
- name: Commit and push if yarn.lock is changed
run: |
git add yarn.lock
if git diff --staged --quiet; then
echo Everything is UP-TO-DATE
else
echo Pushing updated yarn.lock
git config user.name akuleshov7
git config user.email 'andrewkuleshov7@gmail.com'
git commit -m "Update yarn.lock"
git push
fi
File renamed without changes.