From 1a9673980afed843c5cf137d93e82ea776aa8067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20=C5=BDivkovi=C4=87?= Date: Fri, 20 Dec 2024 14:55:10 +0100 Subject: [PATCH] chore: fix `examples` workflow (#3385) ## Description This PR fixes the `examples` workflow that attempted to use the `gnofmt_template.yml` for running `gno fmt` on the examples folder. The issue was that `gnofmt_template.yml` is a reusable workflow, not an action, and the way the `fmt` job was structured in the `examples` workflow was calling it like an action. --- .github/workflows/codeql.yml | 4 ++++ .github/workflows/examples.yml | 14 ++++---------- .github/workflows/fossa.yml | 2 +- .github/workflows/gnofmt_template.yml | 8 +++++++- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 270c422b3de..4745788714d 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -16,6 +16,10 @@ on: branches: [ "master", "chain/*" ] pull_request: branches: [ "master", "chain/*" ] + paths: + - '**/*.go' + - 'go.mod' + - 'go.sum' schedule: - cron: '22 17 * * 3' diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index e441d9c1dad..e933db9ea19 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -71,16 +71,10 @@ jobs: # TODO: consider running lint on every other directories, maybe in "warning" mode? # TODO: track coverage fmt: - name: Run gno fmt - runs-on: ubuntu-latest - steps: - - name: gno fmt - uses: ./.github/workflows/gnofmt_template.yml - with: - path: "examples/..." - - name: Check for unformatted gno files - run: | - git diff --exit-code || (echo "Some gno files are not formatted, please run 'make fmt'." && exit 1) + name: Run gno fmt on examples + uses: ./.github/workflows/gnofmt_template.yml + with: + path: "examples/..." mod-tidy: strategy: diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml index e8defd00f7c..0a94211cb90 100644 --- a/.github/workflows/fossa.yml +++ b/.github/workflows/fossa.yml @@ -8,7 +8,7 @@ on: - '**/*.go' - 'go.mod' - 'go.sum' - pull_request: + pull_request_target: paths: - '**/*.go' - 'go.mod' diff --git a/.github/workflows/gnofmt_template.yml b/.github/workflows/gnofmt_template.yml index aa85d52097e..096dbaa1b5d 100644 --- a/.github/workflows/gnofmt_template.yml +++ b/.github/workflows/gnofmt_template.yml @@ -19,9 +19,15 @@ jobs: uses: actions/setup-go@v5 with: go-version: ${{ inputs.go-version }} + - name: Checkout code uses: actions/checkout@v4 - - name: fmt + + - name: Format code with gno fmt env: GNOFMT_PATH: ${{ inputs.path }} run: go run ./gnovm/cmd/gno fmt -v -diff $GNOFMT_PATH + + - name: Check for unformatted code + run: | + git diff --exit-code || (echo "Some gno files are not formatted, please run 'make fmt'." && exit 1) \ No newline at end of file