Skip to content

Commit 4bf779e

Browse files
committed
ci: Github Action workflow define : nvcheck
1 parent 4aeaf45 commit 4bf779e

File tree

5 files changed

+158
-0
lines changed

5 files changed

+158
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM golang:1.15.6-alpine
2+
3+
ENV REVIEWDOG_VERSION=v0.11.0
4+
5+
# hadolint ignore=DL3006
6+
RUN apk --no-cache add git
7+
8+
RUN wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b /usr/local/bin/ ${REVIEWDOG_VERSION}
9+
10+
RUN go get github.com/koron/nvcheck
11+
12+
COPY entrypoint.sh /entrypoint.sh
13+
14+
ENTRYPOINT ["/entrypoint.sh"]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: 'Run nvcheck with reviewdog'
2+
description: '🐶Run nvcheck with reviewdog on pull requests to improve document writing experience.'
3+
author: 'Tsuyoshi CHO <Tsuyoshi.CHO+develop@Gmail.com>'
4+
inputs:
5+
github_token:
6+
description: 'GITHUB_TOKEN.'
7+
required: true
8+
default: ${{ github.token }}
9+
level:
10+
description: 'Report level for reviewdog [info,warning,error]'
11+
default: 'error'
12+
reporter:
13+
description: |
14+
Reporter of reviewdog command [github-check,github-pr-review].
15+
Default is github-pr-review.
16+
github-pr-review can use Markdown and add a link to rule page in reviewdog reports.
17+
default: 'github-pr-review'
18+
filter_mode:
19+
description: |
20+
Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
21+
Default is added.
22+
default: 'added'
23+
fail_on_error:
24+
description: |
25+
Exit code for reviewdog when errors are found [true,false]
26+
Default is `false`.
27+
default: 'false'
28+
reviewdog_flags:
29+
description: 'Additional reviewdog flags'
30+
default: ''
31+
tool_name:
32+
description: 'Tool name to use for reviewdog reporter'
33+
default: 'nvcheck'
34+
runs:
35+
using: 'docker'
36+
image: 'Dockerfile'
37+
branding:
38+
icon: 'chevron-down'
39+
color: 'green'
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/sh
2+
3+
cd "$GITHUB_WORKSPACE" || true
4+
5+
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
6+
7+
# find doc -name \*.jax -print0 | xargs -0 nvcheck \
8+
# | reviewdog -f=checkstyle \
9+
# -name="${INPUT_TOOL_NAME}" \
10+
# -reporter="${INPUT_REPORTER:-github-pr-review}" \
11+
# -filter-mode="${INPUT_FILTER_MODE}" \
12+
# -fail-on-error="${INPUT_FAIL_ON_ERROR}" \
13+
# -level="${INPUT_LEVEL}" \
14+
# ${INPUT_REVIEWDOG_FLAGS}
15+
16+
# github-pr-review only diff adding
17+
if [ "${INPUT_REPORTER}" = "github-pr-review" ]; then
18+
# fix
19+
find doc -name \*.jax -print0 | xargs -0 nvcheck -i
20+
21+
TMPFILE=$(mktemp)
22+
git diff >"${TMPFILE}"
23+
24+
reviewdog \
25+
-name="nvcheck-fix" \
26+
-f=diff \
27+
-f.diff.strip=1 \
28+
-name="${INPUT_TOOL_NAME}-fix" \
29+
-reporter="github-pr-review" \
30+
-filter-mode="diff_context" \
31+
-level="${INPUT_LEVEL}" \
32+
${INPUT_REVIEWDOG_FLAGS} < "${TMPFILE}"
33+
34+
git restore . || true
35+
rm -f "${TMPFILE}"
36+
fi
37+
38+
# EOF

.github/workflows/depup.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: depup
2+
on:
3+
schedule:
4+
- cron: '35 9 * * *' # Runs at 9:35 UTC every day
5+
repository_dispatch:
6+
types: [depup]
7+
8+
jobs:
9+
reviewdog:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
submodules: true
16+
17+
- name: Check depup
18+
uses: haya14busa/action-depup@v1
19+
id: depup
20+
with:
21+
file: .github/actions/vimhelp-nvcheck/Dockerfile
22+
version_name: REVIEWDOG_VERSION
23+
repo: reviewdog/reviewdog
24+
25+
- name: Create Pull Request
26+
uses: peter-evans/create-pull-request@v3
27+
with:
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
title: "chore(deps): update reviewdog to ${{ steps.depup.outputs.latest }}"
30+
commit-message: "chore(deps): update reviewdog to ${{ steps.depup.outputs.latest }}"
31+
body: |
32+
Update reviewdog to [v${{ steps.depup.outputs.latest }}](https://github.com/reviewdog/reviewdog/releases/tag/v${{ steps.depup.outputs.latest }})
33+
Compare [v${{ steps.depup.outputs.current }}...v${{ steps.depup.outputs.latest }}](https://github.com/reviewdog/reviewdog/compare/v${{ steps.depup.outputs.current }}...v${{ steps.depup.outputs.latest }})
34+
35+
This PR is auto generated by [depup workflow](https://github.com/${{ github.repository }}/actions?query=workflow%3Adepup).
36+
branch: depup/reviewdog
37+
delete-branch: true
38+
base: master

.github/workflows/reviewdog.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: reviewdog
2+
on: [push, pull_request]
3+
jobs:
4+
nvcheck:
5+
name: runner / nvcheck
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout
9+
uses: actions/checkout@v2
10+
with:
11+
submodules: true
12+
# - name: nvcheck-github-pr-check
13+
# uses: ./.github/actions/vimhelp-nvcheck/
14+
# if: github.event_name == 'pull_request'
15+
# with:
16+
# github_token: ${{ secrets.github_token }}
17+
# reporter: github-pr-check
18+
# - name: nvcheck-github-check
19+
# uses: ./.github/actions/vimhelp-nvcheck/
20+
# if: github.event_name != 'pull_request'
21+
# with:
22+
# github_token: ${{ secrets.github_token }}
23+
# reporter: github-check
24+
- name: nvcheck-github-pr-review
25+
if: github.event_name == 'pull_request'
26+
uses: ./.github/actions/vimhelp-nvcheck/
27+
with:
28+
github_token: ${{ secrets.github_token }}
29+
reporter: github-pr-review

0 commit comments

Comments
 (0)