diff --git a/.github/workflows/dependabot-auto-merge.yaml b/.github/workflows/dependabot-auto-merge.yaml index 9256f58..6ae9da0 100644 --- a/.github/workflows/dependabot-auto-merge.yaml +++ b/.github/workflows/dependabot-auto-merge.yaml @@ -1,5 +1,8 @@ name: Dependabot auto-merge -on: pull_request +on: + check_suite: + types: + - completed permissions: contents: write diff --git a/.github/workflows/golang.yaml b/.github/workflows/golang.yaml index 632f485..5c59eef 100644 --- a/.github/workflows/golang.yaml +++ b/.github/workflows/golang.yaml @@ -15,10 +15,8 @@ name: Go on: - push: - branches: [ main, develop ] pull_request: - branches: [ main, develop ] + branches: [ main ] env: GO_MODULE: github.com/finleap-connect/backup-operator @@ -45,22 +43,52 @@ jobs: needs: lint runs-on: ubuntu-latest steps: - - name: Install Go + - name: Checkout Project + uses: actions/checkout@v3 + with: + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + + - name: Setup Go uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} - - name: Checkout Project - uses: actions/checkout@v3 - - name: test + + - uses: actions/cache@v2 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Run Test run: | make test make coverage - - name: Convert coverage to lcov - uses: jandelgado/gcov2lcov-action@v1.0.9 + + - name: Go Coverage Badge + uses: tj-actions/coverage-badge-go@v1.2 + with: + filename: .coverprofile + + - name: Verify Changed files + uses: tj-actions/verify-changed-files@v9.1 + id: verify-changed-files with: - infile: .coverprofile - - name: Coveralls GitHub Action - uses: coverallsapp/github-action@1.1.3 + files: README.md + + - name: Commit changes + if: steps.verify-changed-files.outputs.files_changed == 'true' + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add README.md + git commit -m "chore: Updated coverage badge." + + - name: Push changes + if: steps.verify-changed-files.outputs.files_changed == 'true' + uses: ad-m/github-push-action@master with: - github-token: ${{ secrets.github_token }} - path-to-lcov: coverage.lcov + github_token: ${{ github.token }} + branch: ${{ github.head_ref }} \ No newline at end of file diff --git a/.github/workflows/greetings.yaml b/.github/workflows/greetings.yaml new file mode 100644 index 0000000..a5508d3 --- /dev/null +++ b/.github/workflows/greetings.yaml @@ -0,0 +1,13 @@ +name: Greetings + +on: [pull_request_target, issues] + +jobs: + greeting: + runs-on: ubuntu-latest + steps: + - uses: actions/first-interaction@v1.1.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: "Thanks for reporting this issue, don't forget to star this project to help us reach a wider audience." + pr-message: "Thanks for implementing a fix, could you ensure that the test covers your changes." \ No newline at end of file diff --git a/README.md b/README.md index 9215cf2..b976c20 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Backup Operator +![Coverage](https://img.shields.io/badge/Coverage-1-red) [![Build status](https://github.com/finleap-connect/backup-operator/actions/workflows/golang.yaml/badge.svg)](https://github.com/finleap-connect/backup-operator/actions/workflows/golang.yaml) -[![Coverage Status](https://coveralls.io/repos/github/finleap-connect/backup-operator/badge.svg?branch=main)](https://coveralls.io/github/finleap-connect/backup-operator?branch=main) [![Go Report Card](https://goreportcard.com/badge/github.com/finleap-connect/backup-operator)](https://goreportcard.com/report/github.com/finleap-connect/backup-operator) [![Go Reference](https://pkg.go.dev/badge/github.com/finleap-connect/backup-operator.svg)](https://pkg.go.dev/github.com/finleap-connect/backup-operator) [![GitHub release](https://img.shields.io/github/release/finleap-connect/backup-operator.svg)](https://github.com/finleap-connect/backup-operator/releases)