From da51340c4a2c67877949a46c61a3cd53299e4312 Mon Sep 17 00:00:00 2001 From: Beppe Catanese Date: Fri, 29 Nov 2024 11:14:32 +0100 Subject: [PATCH 1/2] Check if any change to commit --- .github/workflows/format.yml | 44 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index bd030b54c..472d6d044 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -1,27 +1,27 @@ name: Go Format on: - push: - branches: - - 'sdk-automation/models' + push: + branches: + - 'sdk-automation/models' jobs: - format: - if: ${{ ! startsWith(github.event.head_commit.message, 'style(fmt)') }} - permissions: - contents: write - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - with: - token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }} - - uses: actions/setup-go@v5 - with: - go-version: 1.18 - - run: make fmt - - run: | - git config user.name AdyenAutomationBot - git config user.email "${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}" - git add . - git commit -m "style(fmt): code formatted" - git push + format: + if: ${{ github.event.commits!= null && github.event.commits.length > 0 &&!startsWith(github.event.head_commit.message, 'style(fmt)') }} + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }} + - uses: actions/setup-go@v5 + with: + go-version: 1.18 + - run: make fmt + - run: | + git config user.name AdyenAutomationBot + git config user.email "${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}" + git add. + git commit -m "style(fmt): code formatted" + git push From 4ac27dab4db1697ffc6585f12d11a9800067dec9 Mon Sep 17 00:00:00 2001 From: Beppe Catanese <1771700+gcatanese@users.noreply.github.com> Date: Wed, 11 Dec 2024 13:57:42 +0100 Subject: [PATCH 2/2] Address PR comments --- .github/workflows/format.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 472d6d044..141d5b24c 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -7,7 +7,7 @@ on: jobs: format: - if: ${{ github.event.commits!= null && github.event.commits.length > 0 &&!startsWith(github.event.head_commit.message, 'style(fmt)') }} + if: ${{ github.event.commits != null && github.event.commits.length > 0 && !startsWith(github.event.head_commit.message, 'style(fmt)') }} permissions: contents: write runs-on: ubuntu-latest @@ -22,6 +22,6 @@ jobs: - run: | git config user.name AdyenAutomationBot git config user.email "${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}" - git add. + git add . git commit -m "style(fmt): code formatted" git push