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

Linter testing new action location #181

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
18 changes: 18 additions & 0 deletions .github/actions/retext-style-guide/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:current-alpine

ENV REVIEWDOG_VERSION=v0.17.2

SHELL ["/bin/ash", "-eo", "pipefail", "-c"]

RUN apk --no-cache add git findutils

RUN wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b /usr/local/bin/ ${REVIEWDOG_VERSION}
# TODO: try pretty-reporter - RUN npm install -g markcmurphy/quality-docs-fork#pretty-reporter --save
RUN npm install -g bigcommerce/dev-docs-style-guide-linter#updated-messages --save

COPY entrypoint.sh /entrypoint.sh

# Set execute permissions for the entrypoint script
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
36 changes: 36 additions & 0 deletions .github/actions/retext-style-guide/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'check styleguide'
description: 'checks styleguide'
author: 'Mark Murphy'
inputs:
github_token:
description: 'GITHUB_TOKEN'
default: '${{ github.token }}'
workdir:
description: 'Working directory relative to the root directory.'
default: '.'
### Flags for reviewdog ###
level:
description: 'Report level for reviewdog [info,warning,error]'
default: 'warning'
reporter:
description: 'Reporter of reviewdog command [github-pr-check,github-pr-review].'
default: 'github-pr-check'
filter_mode:
description: |
Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
Default is added.
default: 'added'
fail_on_error:
description: |
Exit code for reviewdog when errors are found [true,false]
Default is `false`.
default: 'false'
reviewdog_flags:
description: 'Additional reviewdog flags'
default: ''
runs:
using: 'docker'
image: 'Dockerfile'
branding:
icon: 'check'
color: 'blue'
20 changes: 20 additions & 0 deletions .github/actions/retext-style-guide/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
set -e

if [ -n "${GITHUB_WORKSPACE}" ] ; then
cd "${GITHUB_WORKSPACE}/${INPUT_WORKDIR}" || exit
fi

git config --global --add safe.directory $GITHUB_WORKSPACE || exit 1

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

find ${GITHUB_WORKSPACE} -type f -name '*.mdx' -exec quality-docs {} + \
| reviewdog -f=remark-lint \
-name="remark-lint" \
-reporter="${INPUT_REPORTER:-github-pr-check}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
-level="${INPUT_LEVEL}" \
${INPUT_REVIEWDOG_FLAGS} \
-tee
4 changes: 1 addition & 3 deletions .github/workflows/retext-style-guide.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: quality-docs-github-check
uses: bigcommerce/dev-docs-style-guide-action@master
- uses: ./.github/actions/retext-style-guide
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
level: warning
filter_mode: added
Loading
Loading