From 0af6d188e330b48043ab60813b733a1d5bfec368 Mon Sep 17 00:00:00 2001 From: Adrian Baumgart Date: Sun, 31 Mar 2024 21:29:41 +0200 Subject: [PATCH 1/6] Create fix-formatting-and-license.yml --- .../workflows/fix-formatting-and-license.yml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/fix-formatting-and-license.yml diff --git a/.github/workflows/fix-formatting-and-license.yml b/.github/workflows/fix-formatting-and-license.yml new file mode 100644 index 0000000..affaabc --- /dev/null +++ b/.github/workflows/fix-formatting-and-license.yml @@ -0,0 +1,31 @@ +name: Fix formatting and license file + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: dart-lang/setup-dart@v1 + + - name: Install dependencies + run: dart pub get + + - name: Verify formatting + run: dart format --output=none --set-exit-if-changed . + + - name: Update license file + run: flutter packages pub run license_generator generat + + - name: Commit and push + run: | + git config --global user.name 'Github Actions' + git config --global user.email 'adrian@abmgrt.dev' + git commit -am "Auto-corrected formatting and license file" + git push From 9a31ea73df7c5a909aa65b32925b38228649988e Mon Sep 17 00:00:00 2001 From: Adrian Baumgart Date: Sun, 31 Mar 2024 21:35:48 +0200 Subject: [PATCH 2/6] Update fix-formatting-and-license.yml --- .github/workflows/fix-formatting-and-license.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/fix-formatting-and-license.yml b/.github/workflows/fix-formatting-and-license.yml index affaabc..aba64be 100644 --- a/.github/workflows/fix-formatting-and-license.yml +++ b/.github/workflows/fix-formatting-and-license.yml @@ -12,7 +12,20 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: dart-lang/setup-dart@v1 + + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Setup Android SDK + uses: android-actions/setup-android@v2 + + - name: Setup Flutter SDK + uses: flutter-actions/setup-flutter@v2 + with: + channel: stable + version: 3.13.7 - name: Install dependencies run: dart pub get From cfa47371e75eab3c7a950c76ea842e8e6cc52f56 Mon Sep 17 00:00:00 2001 From: Adrian Baumgart Date: Sun, 31 Mar 2024 21:38:12 +0200 Subject: [PATCH 3/6] Update fix-formatting-and-license.yml --- .github/workflows/fix-formatting-and-license.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/fix-formatting-and-license.yml b/.github/workflows/fix-formatting-and-license.yml index aba64be..5595ffa 100644 --- a/.github/workflows/fix-formatting-and-license.yml +++ b/.github/workflows/fix-formatting-and-license.yml @@ -13,10 +13,11 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + - name: Set up JDK + uses: actions/setup-java@v4 with: - java-version: 1.8 + distribution: 'oracle' + java-version: '21' - name: Setup Android SDK uses: android-actions/setup-android@v2 From 3849ae09ed5f787b626aac671fe3cf003e6e3e1b Mon Sep 17 00:00:00 2001 From: Adrian Baumgart Date: Sun, 31 Mar 2024 21:41:11 +0200 Subject: [PATCH 4/6] Update fix-formatting-and-license.yml --- .github/workflows/fix-formatting-and-license.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fix-formatting-and-license.yml b/.github/workflows/fix-formatting-and-license.yml index 5595ffa..fd89193 100644 --- a/.github/workflows/fix-formatting-and-license.yml +++ b/.github/workflows/fix-formatting-and-license.yml @@ -32,7 +32,7 @@ jobs: run: dart pub get - name: Verify formatting - run: dart format --output=none --set-exit-if-changed . + run: dart format --output=none . - name: Update license file run: flutter packages pub run license_generator generat From 508a392a94ff2d70c0594a5da4a079f47d946213 Mon Sep 17 00:00:00 2001 From: Adrian Baumgart Date: Sun, 31 Mar 2024 21:46:07 +0200 Subject: [PATCH 5/6] Update fix-formatting-and-license.yml --- .github/workflows/fix-formatting-and-license.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/fix-formatting-and-license.yml b/.github/workflows/fix-formatting-and-license.yml index fd89193..3859239 100644 --- a/.github/workflows/fix-formatting-and-license.yml +++ b/.github/workflows/fix-formatting-and-license.yml @@ -41,5 +41,8 @@ jobs: run: | git config --global user.name 'Github Actions' git config --global user.email 'adrian@abmgrt.dev' - git commit -am "Auto-corrected formatting and license file" - git push + git add -A + if ! git diff-index --quiet HEAD; then + git commit -m "Auto-corrected formatting and license file" + git push + fi From 0cb9debd88e61f42762a9482ae914b1c8c9110d1 Mon Sep 17 00:00:00 2001 From: Adrian Baumgart Date: Sun, 31 Mar 2024 21:52:13 +0200 Subject: [PATCH 6/6] Update fix-formatting-and-license.yml --- .github/workflows/fix-formatting-and-license.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/fix-formatting-and-license.yml b/.github/workflows/fix-formatting-and-license.yml index 3859239..7aeec68 100644 --- a/.github/workflows/fix-formatting-and-license.yml +++ b/.github/workflows/fix-formatting-and-license.yml @@ -3,8 +3,6 @@ name: Fix formatting and license file on: push: branches: [ "main" ] - pull_request: - branches: [ "main" ] jobs: build: @@ -35,14 +33,7 @@ jobs: run: dart format --output=none . - name: Update license file - run: flutter packages pub run license_generator generat + run: flutter packages pub run license_generator generate - name: Commit and push - run: | - git config --global user.name 'Github Actions' - git config --global user.email 'adrian@abmgrt.dev' - git add -A - if ! git diff-index --quiet HEAD; then - git commit -m "Auto-corrected formatting and license file" - git push - fi + uses: stefanzweifel/git-auto-commit-action@v5