From 04c625d76a7566050aee7f94c60702e7c1b00812 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Sat, 25 Sep 2021 06:26:02 +0000 Subject: [PATCH 1/4] Migrate to composite action --- .github/workflows/dockerimage.yml | 13 ------------- Dockerfile | 14 -------------- action.yml | 26 ++++++++++++++++++++++++-- entrypoint.sh => script.sh | 0 4 files changed, 24 insertions(+), 29 deletions(-) delete mode 100644 .github/workflows/dockerimage.yml delete mode 100644 Dockerfile rename entrypoint.sh => script.sh (100%) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml deleted file mode 100644 index a9822c5..0000000 --- a/.github/workflows/dockerimage.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Docker Image CI -on: - push: - branches: - - master - pull_request: -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag ${{ github.repository }}:$(date +%s) diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index ca3997a..0000000 --- a/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM alpine:3.14 - -ENV REVIEWDOG_VERSION=v0.13.0 - -SHELL ["/bin/ash", "-eo", "pipefail", "-c"] - -# hadolint ignore=DL3006 -RUN apk --no-cache add git - -RUN wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b /usr/local/bin/ ${REVIEWDOG_VERSION} - -COPY entrypoint.sh /entrypoint.sh - -ENTRYPOINT ["/entrypoint.sh"] diff --git a/action.yml b/action.yml index 486c816..2965d70 100644 --- a/action.yml +++ b/action.yml @@ -5,33 +5,55 @@ inputs: github_token: description: 'GITHUB_TOKEN' default: '${{ github.token }}' + required: true ### Flags for reviewdog ### tool_name: description: 'Tool name to use for reviewdog reporter' default: 'reviewdog-suggester' + required: false level: description: 'Report level for reviewdog [info,warning,error]' default: 'warning' + required: false filter_mode: description: | Filtering mode for the reviewdog command [added,diff_context,file,nofilter]. Default is diff_context. GitHub suggestions only support added and diff_context. default: 'diff_context' + 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 ### Flags for reviewdog suggester ### cleanup: description: 'Clean up non-committed changes after the action' default: 'true' + 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: + # INPUT_ 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_TOOL_NAME: ${{ inputs.tool_name }} + INPUT_LEVEL: ${{ inputs.level }} + INPUT_FILTER_MODE: ${{ inputs.filter_mode }} + INPUT_FAIL_ON_ERROR: ${{ inputs.fail_on_error }} + INPUT_REVIEWDOG_FLAGS: ${{ inputs.reviewdog_flags }} + INPUT_WORKDIR: ${{ inputs.workdir }} # Ref: https://haya14busa.github.io/github-action-brandings/ branding: diff --git a/entrypoint.sh b/script.sh similarity index 100% rename from entrypoint.sh rename to script.sh From bbf8f59692e4adb484ac9b488acfbecbe3bc87cb Mon Sep 17 00:00:00 2001 From: haya14busa Date: Sat, 25 Sep 2021 06:28:52 +0000 Subject: [PATCH 2/4] Update depup workflow --- .github/workflows/depup.yml | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/.github/workflows/depup.yml b/.github/workflows/depup.yml index 7df772f..e4f0507 100644 --- a/.github/workflows/depup.yml +++ b/.github/workflows/depup.yml @@ -4,30 +4,16 @@ on: - cron: '14 14 * * *' # Runs at 14:14 UTC every day repository_dispatch: types: [depup] + workflow_dispatch: jobs: reviewdog: 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 - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 - 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 labels: "bump:minor" From 86dafa3a40591713ff4033e167a92b73e6c36970 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Sat, 25 Sep 2021 06:30:22 +0000 Subject: [PATCH 3/4] Introduce shfmt and actionlint Also removed hadolint --- .github/workflows/reviewdog.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index fea6584..780e4fe 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -22,21 +22,21 @@ jobs: reporter: ${{ steps.reporter.outputs.value }} level: warning - hadolint: - name: runner / hadolint + shfmt: + name: runner / shfmt 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 + - uses: reviewdog/action-shfmt@v1 + + actionlint: + name: runner / actionlint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: reviewdog/action-actionlint@v1 with: - github_token: ${{ secrets.github_token }} - reporter: ${{ steps.reporter.outputs.value }} + reporter: github-check level: warning misspell: From 99d93404c35f93fbdc0a4c311e655a6c54074906 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Sat, 25 Sep 2021 06:40:42 +0000 Subject: [PATCH 4/4] use filter_mode=nofilter in gofmt suggestion test --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2089c23..e530fa1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,6 +11,7 @@ jobs: - uses: ./ with: tool_name: gofmt + filter_mode: nofilter test-shell: name: runner / suggester / shell