Skip to content

Commit

Permalink
ci: lint: use action-suggester
Browse files Browse the repository at this point in the history
Remove clang-format from the "push" event. Annotations
do not support suggestions, so there is no sense to apply
clang-format directly to commits.

Use action-suggester instead of a patched reviewdog.

JIRA: CI-123
  • Loading branch information
Jakub Sarzyński committed Jun 22, 2022
1 parent 1820307 commit dd09174
Showing 1 changed file with 8 additions and 42 deletions.
50 changes: 8 additions & 42 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,57 +15,23 @@ on:
workflow_call: # reusable workflow - the same jobs in submodules

jobs:
clang-format:
if: github.event_name == 'push'
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:
clang-format:
if: github.event_name == 'pull_request'
name: clang-format-pr
name: clang-format
runs-on: ubuntu-latest
steps:
- name: Checkout current repo
uses: actions/checkout@v2
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
- 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

0 comments on commit dd09174

Please sign in to comment.