Skip to content

Commit

Permalink
Merge pull request #26 from reviewdog/composite-run
Browse files Browse the repository at this point in the history
Migrate to composite run action
  • Loading branch information
haya14busa authored Sep 25, 2021
2 parents fcb7835 + 5e4822c commit d948214
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 44 deletions.
28 changes: 12 additions & 16 deletions .github/workflows/depup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: haya14busa/action-depup@v1
id: depup
- uses: reviewdog/action-depup/with-pr@v1
with:
file: Dockerfile
version_name: REVIEWDOG_VERSION
file: action.yml
version_name: reviewdog_version
repo: reviewdog/reviewdog
labels: "bump:minor"

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: reviewdog/action-depup/with-pr@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "chore(deps): update reviewdog to ${{ steps.depup.outputs.latest }}"
commit-message: "chore(deps): update reviewdog to ${{ steps.depup.outputs.latest }}"
body: |
Update reviewdog to [v${{ steps.depup.outputs.latest }}](https://github.com/reviewdog/reviewdog/releases/tag/v${{ steps.depup.outputs.latest }})
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 }})
This PR is auto generated by [depup workflow](https://github.com/${{ github.repository }}/actions?query=workflow%3Adepup).
branch: depup/reviewdog
base: master
file: action.yml
version_name: SHELLCHECK_VERSION
repo: koalaman/shellcheck
labels: "bump:minor"
14 changes: 0 additions & 14 deletions .github/workflows/dockerimage.yml

This file was deleted.

12 changes: 0 additions & 12 deletions Dockerfile

This file was deleted.

33 changes: 31 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,71 @@ inputs:
github_token:
description: 'GITHUB_TOKEN.'
default: '${{ github.token }}'
required: false
level:
description: 'Report level for reviewdog [info,warning,error]'
default: 'error'
required: false
reporter:
description: |
Reporter of reviewdog command [github-pr-check,github-pr-review,github-check].
Default is github-pr-check.
github-pr-review can use Markdown and add a link to rule page in reviewdog reports.
default: 'github-pr-check'
required: false
filter_mode:
description: |
Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
Default is added.
default: 'added'
required: false
fail_on_error:
description: |
Exit code for reviewdog when errors are found [true,false]
Default is `false`.
default: 'false'
required: false
reviewdog_flags:
description: 'Additional reviewdog flags'
default: ''
required: false
path:
description: "Base directory to run shellcheck. Same as `[path]` of `find` command."
default: '.'
required: false
pattern:
description: "File patterns of target files. Same as `-name [pattern]` of `find` command."
default: '*.sh'
required: false
exclude:
description: "Exclude patterns of target files. Same as `-not -path [exclude]` of `find` command."
shellcheck_flags:
description: "Flags of shellcheck command."
default: '--external-sources'
required: false
runs:
using: 'docker'
image: 'Dockerfile'
using: "composite"
steps:
- uses: reviewdog/action-setup@v1
with:
reviewdog_version: v0.13.0
- run: $GITHUB_ACTION_PATH/script.sh
shell: bash
env:
SHELLCHECK_VERSION: 0.7.2
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
# https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611
INPUT_GITHUB_TOKEN: ${{ inputs.github_token }}
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 }}
INPUT_PATH: ${{ inputs.path }}
INPUT_PATTERN: ${{ inputs.pattern }}
INPUT_EXCLUDE: ${{ inputs.exclude }}
INPUT_SHELLCHECK_FLAGS: ${{ inputs.shellcheck_flags }}

branding:
icon: 'zoom-in'
color: 'purple'
9 changes: 9 additions & 0 deletions entrypoint.sh → script.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#!/bin/sh

echo '::group:: Installing shellcheck ... https://github.com/koalaman/shellcheck'
TEMP_PATH="$(mktemp -d)"
cd "${TEMP_PATH}" t ad || exit
wget -qO- "https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | tar -xJf -
mkdir bin
cp "shellcheck-v$SHELLCHECK_VERSION/shellcheck" ./bin
PATH="${TEMP_PATH}/bin:$PATH"
echo '::endgroup::'

cd "${GITHUB_WORKSPACE}" || exit

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
Expand Down

0 comments on commit d948214

Please sign in to comment.