Skip to content

lines-changed-only: true -> always analyses +1 line #388

@mkmer

Description

@mkmer

What events trigger your workflow?

name: "Pre-commit checks"

on:
   pull_request:
      types: [opened, synchronize, reopened]

permissions:
  contents: write
  actions: write
  pull-requests: write

jobs:
   codespell:
    name: "Check for spelling errors"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false
      - uses: codespell-project/actions-codespell@v2
        with:
          check_filenames: true
          ignore_words_file: ./.dev/.codespellignore
          # When using this Action in other repos, the --skip option below can be removed
          # and the .codespellignore file can be used to ignore files or words.          
   lint:
    name: "C-lint tools"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: cpp-linter/cpp-linter-action@v2
        id: linter
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          version: '19'
          lines-changed-only: true
          format-review: true
          style: 'file:./.dev/.clang-format'  # Use .clang-format config file
          tidy-checks: '-*' # Use .clang-tidy config file
          # only 'update' a single comment in a pull request thread.
          thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}
      - name: Fail fast?!
        if: steps.linter.outputs.checks-failed > 0
        run: exit 1

What OS does your workflow use?

Github action container.
Linux

If you need more info, see the action run:(https://github.com/AllStarLink/app_rpt/actions/runs/20413702845/job/58654206133)

How is cpp-linter-action configured?

lint:
    name: "C-lint tools"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: cpp-linter/cpp-linter-action@v2
        id: linter
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          version: '19'
          lines-changed-only: true
          format-review: true
          style: 'file:./.dev/.clang-format'  # Use .clang-format config file
          tidy-checks: '-*' # Use .clang-tidy config file
          # only 'update' a single comment in a pull request thread.
          thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}
      - name: Fail fast?!
        if: steps.linter.outputs.checks-failed > 0
        run: exit 1

What was the unexpected behavior?

Github action container.

INFO:CPP Linter:Running "/usr/bin/clang-format-19 -style=file:./.dev/.clang-format --output-replacements-xml --lines=758:761 --lines=829:838 --lines=893:894 --lines=925:926 --lines=937:939 --lines=958:960 --lines=985:989 --lines=1022:1024 --lines=1032:1039 --lines=1087:1088 --lines=1089:1090 apps/app_rpt/app_rpt.h"

All of the above "lines=" are +1 line more than what is actually changed.
ex: --lines=758:761 should be --lines=758-760

Only look at the changed lines as the "docs" explain.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions