diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7af6886..b66f75d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,6 +42,7 @@ jobs: path-to-profile: /tmp/coverage/combined.txt flag-name: Go-${{ matrix.go }} parallel: true + if: ${{ github.event.repository.fork == false }} # 仅在非 fork 时上传覆盖率 check-coverage: name: Check coverage @@ -51,14 +52,15 @@ jobs: - uses: shogo82148/actions-goveralls@v1 with: parallel-finished: true + if: ${{ github.event.repository.fork == false }} # 仅在非 fork 时检查覆盖率 # 发布 Release release: name: Release a new version needs: [ lint, test ] runs-on: ubuntu-latest - # 仅在推送标签时执行 - if: ${{ success() && startsWith(github.ref, 'refs/tags/v') }} + # 仅在推送标签时执行 - && - 仅在非 fork 时执行发布 + if: ${{ github.event.repository.fork == false && success() && startsWith(github.ref, 'refs/tags/v') }} steps: # 1. 检出代码 - name: Checkout code diff --git a/must.go b/must.go index 4c38046..8bfaa2e 100644 --- a/must.go +++ b/must.go @@ -74,6 +74,14 @@ func Full[V *any](v any) { } } +// Equal expects the values to be equal. Panics if they are not equal. +// Equal 期望值相等。如果值不相等,则触发 panic。 +func Equal[V comparable](a, b V) { + if a != b { + zaplog.ZAPS.P1.LOG.Panic("A AND B ARE NOT EQUAL", zap.Any("a", a), zap.Any("b", b)) + } +} + // Equals expects the values to be equal. Panics if they are not equal. // Equals 期望值相等。如果值不相等,则触发 panic。 func Equals[V comparable](a, b V) {