From b0abdb60a75150de2093bfef43bf8329f17045cd Mon Sep 17 00:00:00 2001 From: wakai hajime Date: Thu, 19 Feb 2026 23:18:00 +0900 Subject: [PATCH 1/4] ci: add go-fmt workflow and test triggers --- .github/workflows/go-fmt.yml | 39 ++++++++++++++++++++++++++++ .github/workflows/verify-openapi.yml | 3 +++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/go-fmt.yml diff --git a/.github/workflows/go-fmt.yml b/.github/workflows/go-fmt.yml new file mode 100644 index 0000000..0b5f149 --- /dev/null +++ b/.github/workflows/go-fmt.yml @@ -0,0 +1,39 @@ +name: Go Format + +on: + push: + branches: + - main + - test/ci # テスト用(確認後削除) + paths: + - "backend/**/*.go" + - ".github/workflows/go-fmt.yml" # テスト用(確認後削除) + +permissions: + contents: write + +jobs: + go-fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - uses: actions/setup-go@v5 + with: + go-version-file: backend/go.mod + + - name: Run go fmt + working-directory: ./backend + run: go fmt ./... + + - name: Commit and push if changed + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add -A + if git diff --cached --quiet; then + echo "No formatting changes needed." + else + git commit -m "style: apply go fmt" + git push + fi diff --git a/.github/workflows/verify-openapi.yml b/.github/workflows/verify-openapi.yml index 080e630..1ba78df 100644 --- a/.github/workflows/verify-openapi.yml +++ b/.github/workflows/verify-openapi.yml @@ -3,6 +3,9 @@ on: pull_request: branches: - main + push: # テスト用(確認後削除) + branches: + - test/ci jobs: generate: runs-on: ubuntu-latest From 59a801111dda8bf7609f304e0fca68290430d94f Mon Sep 17 00:00:00 2001 From: wakai hajime Date: Thu, 19 Feb 2026 23:23:21 +0900 Subject: [PATCH 2/4] ci: go fmt on every push, revert verify-openapi trigger --- .github/workflows/go-fmt.yml | 4 ---- .github/workflows/verify-openapi.yml | 3 --- 2 files changed, 7 deletions(-) diff --git a/.github/workflows/go-fmt.yml b/.github/workflows/go-fmt.yml index 0b5f149..761492d 100644 --- a/.github/workflows/go-fmt.yml +++ b/.github/workflows/go-fmt.yml @@ -2,12 +2,8 @@ name: Go Format on: push: - branches: - - main - - test/ci # テスト用(確認後削除) paths: - "backend/**/*.go" - - ".github/workflows/go-fmt.yml" # テスト用(確認後削除) permissions: contents: write diff --git a/.github/workflows/verify-openapi.yml b/.github/workflows/verify-openapi.yml index 1ba78df..080e630 100644 --- a/.github/workflows/verify-openapi.yml +++ b/.github/workflows/verify-openapi.yml @@ -3,9 +3,6 @@ on: pull_request: branches: - main - push: # テスト用(確認後削除) - branches: - - test/ci jobs: generate: runs-on: ubuntu-latest From 580fdb774040fd2509b13bda152349145def796a Mon Sep 17 00:00:00 2001 From: wakai hajime Date: Thu, 19 Feb 2026 23:38:10 +0900 Subject: [PATCH 3/4] ci: go-fmt check with git diff --exit-code on PR --- .github/workflows/go-fmt.yml | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/.github/workflows/go-fmt.yml b/.github/workflows/go-fmt.yml index 761492d..38415dd 100644 --- a/.github/workflows/go-fmt.yml +++ b/.github/workflows/go-fmt.yml @@ -1,13 +1,11 @@ name: Go Format - on: - push: + pull_request: + branches: + - main paths: - "backend/**/*.go" -permissions: - contents: write - jobs: go-fmt: runs-on: ubuntu-latest @@ -20,16 +18,6 @@ jobs: - name: Run go fmt working-directory: ./backend - run: go fmt ./... - - - name: Commit and push if changed run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git add -A - if git diff --cached --quiet; then - echo "No formatting changes needed." - else - git commit -m "style: apply go fmt" - git push - fi + go fmt ./... + git diff --exit-code From e3e996ff583a90e057d6e485e45b622dd8f84dc5 Mon Sep 17 00:00:00 2001 From: wakai hajime Date: Tue, 3 Mar 2026 22:32:56 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=E3=83=97=E3=83=83=E3=82=B7=E3=83=A5?= =?UTF-8?q?=E6=99=82=E3=81=AE=E5=AF=BE=E8=B1=A1=E3=81=AB=E3=83=A1=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=83=96=E3=83=A9=E3=83=B3=E3=83=81=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/go-fmt.yml | 5 +++++ .github/workflows/verify-openapi.yml | 3 +++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/go-fmt.yml b/.github/workflows/go-fmt.yml index 38415dd..0c702ef 100644 --- a/.github/workflows/go-fmt.yml +++ b/.github/workflows/go-fmt.yml @@ -5,6 +5,11 @@ on: - main paths: - "backend/**/*.go" + push: + branches: + - main + paths: + - "backend/**/*.go" jobs: go-fmt: diff --git a/.github/workflows/verify-openapi.yml b/.github/workflows/verify-openapi.yml index 080e630..1bf4b41 100644 --- a/.github/workflows/verify-openapi.yml +++ b/.github/workflows/verify-openapi.yml @@ -3,6 +3,9 @@ on: pull_request: branches: - main + push: + branches: + - main jobs: generate: runs-on: ubuntu-latest