name: Coverage on: push: branches: - devel jobs: coverage: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: go-version: '1.19' - name: install dependencies on Linux if: runner.os == 'Linux' run: sudo apt update && sudo apt install build-essential - name: run coverage run: echo "COVERAGE=$(make coverage)" >> $GITHUB_ENV - name: set badge color shell: bash run: | if [ ${{ env.COVERAGE }} -lt 40 ] then echo "BADGE_COLOR=800000" >> $GITHUB_ENV elif [ ${{ env.COVERAGE }} -lt 75 ] then echo "BADGE_COLOR=696969" >> $GITHUB_ENV else echo "BADGE_COLOR=31c653" >> $GITHUB_ENV fi - name: create badge uses: emibcn/badge-action@d6f51ff11b5c3382b3b88689ae2d6db22d9737d1 with: label: Coverage status: ${{ env.COVERAGE }} color: ${{ env.BADGE_COLOR }} path: badge.svg - name: upload badge to gist if: > github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'devel' || github.event_name != 'workflow_run' && github.ref == 'refs/heads/devel' uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d with: token: ${{ secrets.GIST_TOKEN }} gistURL: https://gist.githubusercontent.com/revitteth/ee38e9beb22353eef6b88f2ad6ed7aa9 file: badge.svg