From 68adfdbcb5bfa7a855fe09d976781cd970da736a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E9=93=AD=E6=9D=B0?= Date: Tue, 21 Nov 2023 08:06:06 +0800 Subject: [PATCH 1/7] feat:Format the code style automatically for PR --- .github/workflows/code_style.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/code_style.yml b/.github/workflows/code_style.yml index edaff914..16bacfc9 100644 --- a/.github/workflows/code_style.yml +++ b/.github/workflows/code_style.yml @@ -5,6 +5,10 @@ on: - main - feature/ci_setup pull_request: + paths: + - '.github/workflows/code_style.yml' + - '**/*.kt' + - '**/*.kts' jobs: check-code-style: @@ -15,6 +19,23 @@ jobs: with: distribution: 'corretto' java-version: '17' + + - name: Format code style + run: | + ./gradlew ktlintFormat + + - name: Commit files changed by ktlintFormat + run: | + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + git add . + git diff --quiet && git diff --staged --quiet || git commit -m "Apply ktlint formatting" + - name: Check code style shell: bash - run: ./gradlew ktlintCheck \ No newline at end of file + run: ./gradlew ktlintCheck + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 8456e7ba124a32dd777d1a13b6838528e0b30f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E9=93=AD=E6=9D=B0?= Date: Tue, 21 Nov 2023 10:24:47 +0800 Subject: [PATCH 2/7] feat:Format the code style automatically for PR --- .github/workflows/code_style.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/code_style.yml b/.github/workflows/code_style.yml index 16bacfc9..8d11846c 100644 --- a/.github/workflows/code_style.yml +++ b/.github/workflows/code_style.yml @@ -38,4 +38,5 @@ jobs: - name: Push changes uses: ad-m/github-push-action@master with: - github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} \ No newline at end of file From fb756d69a61fbd7810ea75efaac6885f5a34971e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E9=93=AD=E6=9D=B0?= Date: Wed, 22 Nov 2023 08:22:01 +0800 Subject: [PATCH 3/7] feat:Format the code style automatically for PR --- .github/workflows/code_style.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/code_style.yml b/.github/workflows/code_style.yml index 8d11846c..4a3b2bf6 100644 --- a/.github/workflows/code_style.yml +++ b/.github/workflows/code_style.yml @@ -39,4 +39,5 @@ jobs: uses: ad-m/github-push-action@master with: github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} \ No newline at end of file + branch: + ${{ github.event_name == 'push' ? github.ref : github.event.pull_request.head.ref }} \ No newline at end of file From 38ab00b7e47638cfb52987663156ebb91c3c39e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E9=93=AD=E6=9D=B0?= Date: Wed, 22 Nov 2023 08:36:41 +0800 Subject: [PATCH 4/7] feat:Format the code style automatically for PR --- .github/workflows/code_style.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/code_style.yml b/.github/workflows/code_style.yml index 4a3b2bf6..a0705a8c 100644 --- a/.github/workflows/code_style.yml +++ b/.github/workflows/code_style.yml @@ -39,5 +39,4 @@ jobs: uses: ad-m/github-push-action@master with: github_token: ${{ secrets.GITHUB_TOKEN }} - branch: - ${{ github.event_name == 'push' ? github.ref : github.event.pull_request.head.ref }} \ No newline at end of file + branch: ${{ github.event_name == 'push' && github.ref || github.event.pull_request.head.ref }} \ No newline at end of file From 601520b834a9c8b5fd63713126612e21de3c01bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E9=93=AD=E6=9D=B0?= Date: Wed, 22 Nov 2023 08:49:09 +0800 Subject: [PATCH 5/7] feat:Format the code style automatically for PR --- .github/workflows/code_style.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/code_style.yml b/.github/workflows/code_style.yml index a0705a8c..613c7a7b 100644 --- a/.github/workflows/code_style.yml +++ b/.github/workflows/code_style.yml @@ -13,6 +13,8 @@ on: jobs: check-code-style: runs-on: ubuntu-latest + env: + BRANCH_REF: ${{ github.event_name == 'push' && github.ref || github.event.pull_request.head.ref }} steps: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 @@ -35,6 +37,9 @@ jobs: shell: bash run: ./gradlew ktlintCheck + - name: Pull latest changes + run: git pull origin ${BRANCH_REF} + - name: Push changes uses: ad-m/github-push-action@master with: From 620fcf3d6b72b015663105cea1769b6c21c95076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E9=93=AD=E6=9D=B0?= Date: Wed, 22 Nov 2023 09:22:31 +0800 Subject: [PATCH 6/7] feat:Format the code style automatically for PR --- .github/workflows/code_style.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code_style.yml b/.github/workflows/code_style.yml index 613c7a7b..73a33e06 100644 --- a/.github/workflows/code_style.yml +++ b/.github/workflows/code_style.yml @@ -38,7 +38,7 @@ jobs: run: ./gradlew ktlintCheck - name: Pull latest changes - run: git pull origin ${BRANCH_REF} + run: git pull --rebase origin ${BRANCH_REF} - name: Push changes uses: ad-m/github-push-action@master From fa11f5ec009a547fdeb324369a1512642b50c8ab Mon Sep 17 00:00:00 2001 From: Kevin Zou <43654611+KevinnZou@users.noreply.github.com> Date: Mon, 20 Nov 2023 07:56:38 +0800 Subject: [PATCH 7/7] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2350c9f4..07215dfc 100644 --- a/README.md +++ b/README.md @@ -423,6 +423,8 @@ To add to a multiplatform project, add the dependency to the common source-set: ```kotlin repositories { mavenCentral() + // Desktop target has to add this repo + maven("https://jogamp.org/deployment/maven") } kotlin {