From b0e321a937f720938d451c689c10a34d91fb93e9 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 31 Dec 2024 15:45:48 +0800 Subject: [PATCH] ci: refactor GitHub Actions workflows for improved efficiency - Add a GitHub Actions workflow for Bearer PR Check - Add Bearer action to Go workflow - Remove macOS from Go workflow operating systems - Remove redundant checkout step from Go workflow Signed-off-by: Bo-Yi Wu --- .github/workflows/bearer.yml | 35 ++++++++++++++++++++++++++++++++ .github/workflows/go.yml | 16 ++++++++++----- .github/workflows/goreleaser.yml | 1 + 3 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/bearer.yml diff --git a/.github/workflows/bearer.yml b/.github/workflows/bearer.yml new file mode 100644 index 0000000..8dd39ab --- /dev/null +++ b/.github/workflows/bearer.yml @@ -0,0 +1,35 @@ +name: Bearer PR Check + +on: + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: read + pull-requests: write + +jobs: + rule_check: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: reviewdog/action-setup@v1 + with: + reviewdog_version: latest + + - name: Run Report + id: report + uses: bearer/bearer-action@v2 + with: + format: rdjson + output: rd.json + diff: true + + - name: Run reviewdog + if: always() + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cat rd.json | reviewdog -f=rdjson -reporter=github-pr-review diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 6c25889..45b698f 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -12,26 +12,32 @@ jobs: lint: runs-on: ubuntu-latest steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup go uses: actions/setup-go@v5 with: go-version: "^1" - - name: Checkout repository - uses: actions/checkout@v4 + - name: Setup golangci-lint uses: golangci/golangci-lint-action@v6 with: args: --verbose + + - name: Bearer + uses: bearer/bearer-action@v2 + with: + diff: true + test: strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest] go: [1.21, 1.22, 1.23] include: - os: ubuntu-latest go-build: ~/.cache/go-build - - os: macos-latest - go-build: ~/Library/Caches/go-build name: ${{ matrix.os }} @ Go ${{ matrix.go }} runs-on: ${{ matrix.os }} env: diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index b00b7a0..ddf1036 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -22,6 +22,7 @@ jobs: with: go-version-file: go.mod check-latest: true + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 with: