From 89277054335f4f3f8955dc023487c2e1296ebb88 Mon Sep 17 00:00:00 2001 From: QuentinN42 Date: Mon, 23 Mar 2026 16:11:15 +0100 Subject: [PATCH 1/6] feat: py ci Signed-off-by: QuentinN42 --- .github/workflows/pr.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 2a56f0af..2c5983a0 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -4,6 +4,7 @@ on: branches: - main pull_request: + workflow_dispatch: env: GO_VERSION: "1.23.0" @@ -12,7 +13,10 @@ jobs: go-fmt: runs-on: ubuntu-latest permissions: + actions: write contents: write + outputs: + reformatted: ${{ steps.auto-commit.outputs.changes_detected || 'false' }} steps: - uses: actions/checkout@v4 if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} @@ -38,13 +42,27 @@ jobs: } - name: Commit and push changes + id: auto-commit if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} uses: stefanzweifel/git-auto-commit-action@v7 with: commit_message: "style: auto-format go code" + - name: Trigger checks on formatted head + if: ${{ github.event_name != 'workflow_dispatch' && steps.auto-commit.outputs.changes_detected == 'true' }} + uses: actions/github-script@v7 + with: + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: "pr.yaml", + ref: "${{ github.head_ref || github.ref_name }}", + }) + go-mod: needs: go-fmt + if: ${{ needs.go-fmt.outputs.reformatted != 'true' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -64,6 +82,7 @@ jobs: golangci-lint: needs: go-fmt + if: ${{ needs.go-fmt.outputs.reformatted != 'true' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -82,6 +101,7 @@ jobs: tests: needs: go-fmt + if: ${{ needs.go-fmt.outputs.reformatted != 'true' }} strategy: matrix: os: From f56b48081566e0e089f80d64a1e7f296278d8425 Mon Sep 17 00:00:00 2001 From: QuentinN42 Date: Mon, 23 Mar 2026 16:11:55 +0100 Subject: [PATCH 2/6] feat: test ci autofix Signed-off-by: QuentinN42 --- cmd/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/main.go b/cmd/main.go index 2cfe1829..3b6cca04 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -12,7 +12,7 @@ import ( func main() { err := cli.Run(context.Background()) if err != nil { - out.PrintError(err) + out.PrintError(err) os.Exit(1) } } From fbc3745c676406e1310c083d7a6de5528c701373 Mon Sep 17 00:00:00 2001 From: QuentinN42 <32516498+QuentinN42@users.noreply.github.com> Date: Mon, 23 Mar 2026 15:12:23 +0000 Subject: [PATCH 3/6] style: auto-format go code --- cmd/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/main.go b/cmd/main.go index 3b6cca04..2cfe1829 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -12,7 +12,7 @@ import ( func main() { err := cli.Run(context.Background()) if err != nil { - out.PrintError(err) + out.PrintError(err) os.Exit(1) } } From 8d5498f70bd29b6ee5f1af2acd7acf1bbefdbc83 Mon Sep 17 00:00:00 2001 From: QuentinN42 Date: Mon, 23 Mar 2026 16:20:27 +0100 Subject: [PATCH 4/6] fix: use PAT for auto-commit to trigger PR checks on autofix --- .github/workflows/pr.yaml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 2c5983a0..ac7194f4 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -13,7 +13,6 @@ jobs: go-fmt: runs-on: ubuntu-latest permissions: - actions: write contents: write outputs: reformatted: ${{ steps.auto-commit.outputs.changes_detected || 'false' }} @@ -22,6 +21,7 @@ jobs: if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} with: ref: ${{ github.head_ref || github.ref }} + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - uses: actions/checkout@v4 if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }} @@ -48,18 +48,6 @@ jobs: with: commit_message: "style: auto-format go code" - - name: Trigger checks on formatted head - if: ${{ github.event_name != 'workflow_dispatch' && steps.auto-commit.outputs.changes_detected == 'true' }} - uses: actions/github-script@v7 - with: - script: | - await github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: "pr.yaml", - ref: "${{ github.head_ref || github.ref_name }}", - }) - go-mod: needs: go-fmt if: ${{ needs.go-fmt.outputs.reformatted != 'true' }} From 7c41ba3bc340fbea8a0b2d1fe991c23fd47d00de Mon Sep 17 00:00:00 2001 From: QuentinN42 Date: Mon, 23 Mar 2026 16:21:29 +0100 Subject: [PATCH 5/6] feat: test ci autofix Signed-off-by: QuentinN42 --- cmd/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/main.go b/cmd/main.go index 2cfe1829..3b6cca04 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -12,7 +12,7 @@ import ( func main() { err := cli.Run(context.Background()) if err != nil { - out.PrintError(err) + out.PrintError(err) os.Exit(1) } } From 2220b0b0969096fe001378b38bb3fbe1535e478c Mon Sep 17 00:00:00 2001 From: QuentinN42 <32516498+QuentinN42@users.noreply.github.com> Date: Mon, 23 Mar 2026 15:21:58 +0000 Subject: [PATCH 6/6] style: auto-format go code --- cmd/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/main.go b/cmd/main.go index 3b6cca04..2cfe1829 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -12,7 +12,7 @@ import ( func main() { err := cli.Run(context.Background()) if err != nil { - out.PrintError(err) + out.PrintError(err) os.Exit(1) } }