Skip to content

Fail CI when golines reports long lines #21

Fail CI when golines reports long lines

Fail CI when golines reports long lines #21

Workflow file for this run

on:
pull_request:
push:
branches:
- main
name: Test
jobs:
test:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Check mod tidy
run: make mod-tidy-check
- name: Test
run: make test-ci
- name: Determine skip-codecov
uses: actions/github-script@v7
id: skip-codecov
with:
script: |
// Sets `ref` to the SHA of the current pull request's head commit,
// or, if not present, to the SHA of the commit that triggered the
// event.
const ref = '${{ github.event.pull_request.head.sha || github.event.after }}';
const { repo, owner } = context.repo;
const { data: commit } = await github.rest.repos.getCommit({ owner, repo, ref });
const commitMessage = commit.commit.message;
const skip = commitMessage.includes("[skip codecov]") || commitMessage.includes("[skip-codecov]");
core.setOutput("skip", skip);
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: ${{ steps.skip-codecov.outputs.skip != 'true' }}
with:
file: covreport
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}