Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use action-suggester instead of a patched reviewdog #433

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 6 additions & 40 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,6 @@ on:
workflow_call: # reusable workflow - the same jobs in submodules

jobs:
clang-format:
if: github.event_name == 'push'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed only job run on push, You can adjust the global on properties and remove if in the jobs.

name: clang-format
runs-on: ubuntu-latest
steps:
- name: Checkout current repo
uses: actions/checkout@v2
with:
fetch-depth: 3 # current PR merge commit + 1 back

- uses: reviewdog/action-setup@v1
if: false

# upstream reviewdog doesn't work for now, sideload our static binary
- name: Install reviewdog
run: |
wget http:https://misc.nalajcie.org/reviewdog -O /tmp/reviewdog 2>/dev/null
chmod +x /tmp/reviewdog

- name: clang-format
if: true
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git diff -U0 HEAD^ | clang-format-diff-10 -p1 | /tmp/reviewdog -f=diff -f.diff.strip=0 -name=clang-format -reporter=github-check

# reviewdog: use clang-format for PR review
clang-format-pr:
if: github.event_name == 'pull_request'
Expand All @@ -52,20 +26,12 @@ jobs:
with:
fetch-depth: 2 # current PR merge commit + 1 back

- uses: reviewdog/action-setup@v1
if: false

# upstream reviewdog doesn't work for now, sideload our static binary
- name: Install reviewdog
run: |
wget http:https://misc.nalajcie.org/reviewdog -O /tmp/reviewdog 2>/dev/null
chmod +x /tmp/reviewdog

- name: clang-format
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git diff -U0 HEAD^ | clang-format-diff-10 -p1 | /tmp/reviewdog -f=diff -f.diff.strip=0 -name=clang-format-pr -reporter=github-pr-review -fail-on-error
- run: git diff -U0 HEAD^ | clang-format-diff-10 -p1 | patch -p0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • please name this step
  • IMHO using clang-format-diff -i would be more straightforward instead of pipe'ing it to patch
  • maybe comment how it works (we won't be parsing the tool output, the changes are applied to the code and analyzed in the next step)

- name: clang-format-diff
uses: reviewdog/action-suggester@v1
with:
tool_name: clang-format-diff
fail_on_error: true


# reviewdog: codespell for PRs only
Expand Down