这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
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
19 changes: 19 additions & 0 deletions .github/depup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

CURRENT=$(cd "$(dirname "$0")" && pwd)

set -eu

# cleanup temporary directory
unset tmpdir
atexit() {
[[ -n ${tmpdir-} ]] && rm -f "$tmpdir"
}
trap atexit EXIT
trap 'rc=$?; trap - EXIT; atexit; exit $?' INT PIPE TERM

tempdir=$(mktemp -d)

# sync install.sh with https://github.com/reviewdog/action-setup
curl -sSL https://raw.githubusercontent.com/reviewdog/action-setup/master/install.sh -o "$tempdir/install.sh"
install -m 755 "$tempdir/install.sh" "$CURRENT/../install.sh"
12 changes: 10 additions & 2 deletions .github/workflows/depup.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: depup
on:
schedule:
- cron: '14 14 * * *' # Runs at 14:14 UTC every day
- cron: "14 14 * * *" # Runs at 14:14 UTC every day
repository_dispatch:
types: [depup]
workflow_dispatch:
Expand All @@ -14,6 +14,14 @@ jobs:
- uses: reviewdog/action-depup/with-pr@v1
with:
file: action.yml
version_name: reviewdog_version
version_name: REVIEWDOG_VERSION
repo: reviewdog/reviewdog
labels: "bump:minor"

setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: ./.github/depup.sh
- name: commit and create a pull request
uses: shogo82148/actions-commit-and-create-pr@v1
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
sudo cp "shellcheck-${scversion}/shellcheck" /usr/local/bin/
rm -rf "shellcheck-${scversion}/shellcheck"
- run: shellcheck -f diff $(shfmt -f .) | patch -p1
- run: shellcheck -f diff "$(shfmt -f .)" | patch -p1
- name: suggester / shellcheck
uses: ./
with:
Expand Down
54 changes: 32 additions & 22 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,58 @@
name: 'reviewdog-suggester: Suggest any code changes based on diff with reviewdog'
description: '🐶 Suggest any code changes based on diff through GitHub Multi-line code suggestions'
author: 'haya14busa'
name: "reviewdog-suggester: Suggest any code changes based on diff with reviewdog"
description: "🐶 Suggest any code changes based on diff through GitHub Multi-line code suggestions"
author: "haya14busa"
inputs:
github_token:
description: 'GITHUB_TOKEN'
default: '${{ 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'
description: "Tool name to use for reviewdog reporter"
default: "reviewdog-suggester"
required: false
level:
description: 'Report level for reviewdog [info,warning,error]'
default: 'warning'
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'
default: "diff_context"
required: false
fail_on_error:
description: |
Exit code for reviewdog when errors are found [true,false]
Default is `false`.
default: 'false'
default: "false"
required: false
reviewdog_flags:
description: 'Additional reviewdog flags'
default: ''
description: "Additional reviewdog flags"
default: ""
required: false
### Flags for reviewdog suggester ###
cleanup:
description: 'Clean up non-committed changes after the action'
default: 'true'
description: "Clean up non-committed changes after the action"
default: "true"
required: false
runs:
using: 'composite'
using: "composite"
steps:
- uses: reviewdog/action-setup@v1
with:
reviewdog_version: v0.14.2
- run: $GITHUB_ACTION_PATH/script.sh
- run: |
set -euo pipefail
"$GITHUB_ACTION_PATH/install.sh"
shell: bash
env:
REVIEWDOG_VERSION: v0.14.2
REVIEWDOG_TEMPDIR: ${{ runner.temp }}
- run: |
set -euo pipefail
"$GITHUB_ACTION_PATH/check-installed.sh"
shell: bash
- run: |
set -euo pipefail
"$GITHUB_ACTION_PATH/script.sh"
shell: bash
env:
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
Expand All @@ -57,5 +67,5 @@ runs:

# Ref: https://haya14busa.github.io/github-action-brandings/
branding:
icon: 'edit'
color: 'red'
icon: "edit"
color: "red"
9 changes: 9 additions & 0 deletions check-installed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

if ! command -v reviewdog >/dev/null 2>&1; then
echo "reviewdog was not installed"
exit 1
fi
echo "::group::📖 reviewdog -h"
reviewdog -h 2>&1 || true
echo "::endgroup::"
28 changes: 28 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

set -euo pipefail

VERSION="${REVIEWDOG_VERSION:-latest}"

TEMP="${REVIEWDOG_TEMPDIR}"
if [ -z "${TEMP}" ]; then
if [ -n "${RUNNER_TEMP}" ]; then
TEMP="${RUNNER_TEMP}"
else
TEMP="$(mktemp -d)"
fi
fi

INSTALL_SCRIPT='https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh'
if [ "${VERSION}" == 'nightly' ] ; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shfmt] reported by reviewdog 🐶

Suggested change
if [ "${VERSION}" == 'nightly' ] ; then
if [ "${VERSION}" == 'nightly' ]; then

INSTALL_SCRIPT='https://raw.githubusercontent.com/reviewdog/nightly/master/install.sh'
VERSION='latest'
fi

mkdir -p "${TEMP}/reviewdog/bin"

echo '::group::🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog'
curl -sfL "${INSTALL_SCRIPT}" | sh -s -- -b "${TEMP}/reviewdog/bin" "${VERSION}" 2>&1
echo '::endgroup::'

echo "${TEMP}/reviewdog/bin" >>"${GITHUB_PATH}"