Skip to content

Commit

Permalink
Migrates to using a composite action like reviewdog/action-flake8 (#43)
Browse files Browse the repository at this point in the history
* composite action like reviewdog/action-flake8

* ci(gh-actions): updates gh-actions such that they work for the composite action

Co-authored-by: rickstaa <[email protected]>
  • Loading branch information
weargoggles and rickstaa authored Sep 16, 2021
1 parent 7b65863 commit 2de44fd
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/depup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: reviewdog/action-depup@v1
id: depup
with:
file: Dockerfile
file: entrypoint.sh
version_name: REVIEWDOG_VERSION
repo: reviewdog/reviewdog

Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/dockerimage.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,6 @@ jobs:
reporter: ${{ steps.reporter.outputs.value }}
level: warning

hadolint:
name: runner / hadolint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: haya14busa/action-cond@v1
id: reporter
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: "github-pr-review"
if_false: "github-check"
- uses: reviewdog/action-hadolint@v1
with:
github_token: ${{ secrets.github_token }}
reporter: ${{ steps.reporter.outputs.value }}
level: warning

misspell:
name: runner / misspell
runs-on: ubuntu-latest
Expand Down
13 changes: 0 additions & 13 deletions Dockerfile

This file was deleted.

16 changes: 14 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,20 @@ inputs:
required: false
default: ""
runs:
using: "docker"
image: "Dockerfile"
using: "composite"
steps:
- run: $GITHUB_ACTION_PATH/entrypoint.sh
shell: bash
env:
INPUT_WORKDIR: ${{ inputs.workdir }}
INPUT_BLACK_ARGS: ${{ inputs.black_args }}
INPUT_GITHUB_TOKEN: ${{ inputs.github_token }}
INPUT_TOOL_NAME: ${{ inputs.tool_name }}
INPUT_LEVEL: ${{ inputs.level }}
INPUT_REPORTER: ${{ inputs.reporter }}
INPUT_FILTER_MODE: ${{ inputs.filter_mode }}
INPUT_FAIL_ON_ERROR: ${{ inputs.fail_on_error }}
INPUT_REVIEWDOG_FLAGS: ${{ inputs.reviewdog_flags }}

# Ref: https://haya14busa.github.io/github-action-brandings/
branding:
Expand Down
17 changes: 15 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ fi

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

export REVIEWDOG_VERSION=v0.13.0

echo "[action-black] Installing reviewdog..."
wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b /tmp "${REVIEWDOG_VERSION}"

if [[ "$(which black)" == "" ]]; then
echo "[action-black] Installing black package..."
python -m pip install --upgrade black
fi

# Run black with reviewdog
black_exit_val="0"
reviewdog_exit_val="0"
Expand All @@ -19,7 +29,7 @@ if [[ "${INPUT_REPORTER}" = 'github-pr-review' ]]; then
black_exit_val="$?"

# Intput black formatter output to reviewdog
echo "${black_check_output}" | reviewdog -f="diff" \
echo "${black_check_output}" | /tmp/reviewdog -f="diff" \
-f.diff.strip=0 \
-name="${INPUT_TOOL_NAME}" \
-reporter="github-pr-review" \
Expand All @@ -34,7 +44,7 @@ else
black_exit_val="$?"

# Intput black formatter output to reviewdog
echo "${black_check_output}" | reviewdog -f="black" \
echo "${black_check_output}" | /tmp/reviewdog -f="black" \
-name="${INPUT_TOOL_NAME}" \
-reporter="${INPUT_REPORTER}" \
-filter-mode="${INPUT_FILTER_MODE}" \
Expand All @@ -58,3 +68,6 @@ if [[ "${INPUT_FAIL_ON_ERROR}" = 'true' && ("${black_exit_val}" -ne '0' || \
exit 1
fi
fi

echo "[action-black] Clean up reviewdog..."
rm /tmp/reviewdog

0 comments on commit 2de44fd

Please sign in to comment.