diff --git a/.github/workflows/cleanup_caches.yml b/.github/workflows/cleanup_caches.yml index 02ad22c3e..66ac060eb 100644 --- a/.github/workflows/cleanup_caches.yml +++ b/.github/workflows/cleanup_caches.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Cleanup run: | diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 23e129ceb..67ab4143f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -39,7 +39,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | diff --git a/.github/workflows/docker-push.yml b/.github/workflows/docker-push.yml index 17c14d644..66fd160e6 100644 --- a/.github/workflows/docker-push.yml +++ b/.github/workflows/docker-push.yml @@ -14,7 +14,7 @@ jobs: contents: read steps: - name: Check out the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v2 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint_golang.yml similarity index 56% rename from .github/workflows/lint.yml rename to .github/workflows/lint_golang.yml index d909b241d..27f7bc839 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint_golang.yml @@ -1,4 +1,4 @@ -name: Lint +name: Lint Golang on: push: @@ -7,6 +7,10 @@ on: branches: - main pull_request: + paths: + - '**.go' + - 'go.md' + - 'go.sum' permissions: contents: read @@ -16,23 +20,10 @@ concurrency: cancel-in-progress: true jobs: - golangci: - name: golangci-lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 - with: - go-version: 1.21 - - uses: golangci/golangci-lint-action@v3 - with: - version: v1.54.2 - args: --timeout 10m - shellcheck: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run shellcheck run: make lint-shell - name: Run shfmt diff --git a/.github/workflows/lint_pr.yml b/.github/workflows/lint_pr.yml new file mode 100644 index 000000000..18027164f --- /dev/null +++ b/.github/workflows/lint_pr.yml @@ -0,0 +1,47 @@ +name: "Lint PR" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +permissions: + contents: read + +jobs: + main: + permissions: + pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs + statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5.4.0 + id: lint_pr_title + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: marocchino/sticky-pull-request-comment@v2 + # When the previous steps fails, the workflow would stop. By adding this + # condition you can continue the execution with the populated error message. + if: always() && (steps.lint_pr_title.outputs.error_message != null) + with: + header: pr-title-lint-error + message: | + Hey there and thank you for opening this pull request! 👋🏼 + + We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. + + Details: + + ``` + ${{ steps.lint_pr_title.outputs.error_message }} + ``` + + # Delete a previous comment when the issue has been resolved + - if: ${{ steps.lint_pr_title.outputs.error_message == null }} + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: pr-title-lint-error + delete: true diff --git a/.github/workflows/lint_shell.yml b/.github/workflows/lint_shell.yml new file mode 100644 index 000000000..718e6edc8 --- /dev/null +++ b/.github/workflows/lint_shell.yml @@ -0,0 +1,28 @@ +name: Lint Shell + +on: + push: + tags: + - v* + branches: + - main + pull_request: + paths: + - '**.sh' + +permissions: + contents: read + +concurrency: + group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}' + cancel-in-progress: true + +jobs: + shellcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run shellcheck + run: make lint-shell + - name: Run shfmt + run: docker run --rm -v $(pwd):/mnt -w /mnt mvdan/shfmt:v3.6.0 -l -d -i 2 . diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 215a657b7..25cb3a32e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest environment: release steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - name: Set up Go diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index c0541dd72..7951718a1 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -15,7 +15,7 @@ jobs: GO111MODULE: on steps: - name: Checkout Source - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get Diff uses: technote-space/get-diff-action@v6.1.2 with: diff --git a/.github/workflows/solhint.yml b/.github/workflows/solhint.yml index b4af0df78..0203ebf7a 100644 --- a/.github/workflows/solhint.yml +++ b/.github/workflows/solhint.yml @@ -20,7 +20,7 @@ jobs: name: runner solhint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: node-version: 16 diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index 3f06fe7ac..90e8cd0e3 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -15,7 +15,7 @@ jobs: test-integration: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: go-version: 1.21 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index daa8c26ad..39b4c5f5c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,10 @@ on: branches: - main pull_request: + paths: + - '**.go' + - 'go.md' + - 'go.sum' permissions: contents: read @@ -19,7 +23,7 @@ jobs: tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: go-version: 1.21