Skip to content

Commit

Permalink
Minor updates (#52)
Browse files Browse the repository at this point in the history
* use reviewdog/action-setup in action steps

* add tool_name input, del unused default env value

* add shfmt + actionlint checks, simplify ci

* add declarative label management

* better action testing

* fix linters errors

* disable automatic check of failing tests
  • Loading branch information
EPMatt authored Mar 1, 2022
1 parent 95346c9 commit 935b711
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 39 deletions.
26 changes: 26 additions & 0 deletions .github/labels.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"name": "bump:major",
"color": "ef6bb4",
"description": "Attach to PR to automatically bump major version on merge"
},
{
"name": "bump:minor",
"color": "ef6bb4",
"description": "Attach to PR to automatically bump minor version on merge"
},
{
"name": "bump:patch",
"color": "ef6bb4",
"description": "Attach to PR to automatically bump patch version on merge"
},
{
"name": "status - waiting for feedback",
"color": "fbca04",
"description": "Waiting for additional feedback from people involved in the issue / pull request"
},
{
"name": "stale",
"color": "ededed"
}
]
4 changes: 2 additions & 2 deletions .github/workflows/depup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
- uses: reviewdog/action-depup@v1
id: depup
with:
file: script.sh
version_name: REVIEWDOG_VERSION
file: action.yml
version_name: reviewdog_version
repo: reviewdog/reviewdog

- name: Create Pull Request
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# yamllint disable rule:document-start
# yamllint disable rule:line-length
# Workflows which handle labels in repository issues and PRs
name: Issues & PRs label management
# Workflows which handle labels for repository issues and PRs
name: Issues & PRs labeler

'on':
issues:
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# yamllint disable rule:document-start
# yamllint disable rule:line-length
# Workflow handling available labels in the repository. The list of labels is declared in .github/labels.json
name: Label management
on:
push:
paths:
- .github/labels.json
- .github/workflows/labels.yml
branches:
- main
workflow_dispatch:
jobs:
label:
name: Manage GitHub labels
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Manage labels
uses: lannonbr/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
if_false: ${{ steps.bumpr.outputs.next_version }}

- id: stripped-tag
run: echo ::set-output name=value::$(echo ${TAG} | sed 's/refs\/tags\///')
run: echo "::set-output name=value::$(echo "${TAG}" | sed 's/refs\/tags\///')"
env:
TAG: ${{ steps.tag.outputs.value }}

Expand Down
46 changes: 22 additions & 24 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,38 @@ jobs:
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-shellcheck@v1
with:
github_token: ${{ secrets.github_token }}
reporter: ${{ steps.reporter.outputs.value }}
reporter: github-check
level: error

shfmt:
name: runner / shfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: reviewdog/action-shfmt@v1
with:
level: error

actionlint:
name: runner / actionlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: reviewdog/action-actionlint@v1
with:
reporter: github-check
level: error

misspell:
name: runner / misspell
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-misspell@v1
with:
github_token: ${{ secrets.github_token }}
reporter: ${{ steps.reporter.outputs.value }}
reporter: github-check
level: error
locale: "US"

Expand All @@ -45,14 +50,7 @@ jobs:
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-alex@v1
with:
github_token: ${{ secrets.github_token }}
reporter: ${{ steps.reporter.outputs.value }}
reporter: github-check
level: error
21 changes: 19 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,21 @@ jobs:
github_token: ${{ secrets.github_token }}
reporter: github-check
level: error
filter_mode: nofilter
workdir: ./testdata
tool_name: tsc-github-check
fail_on_error: true
tsc_flags: --project passing
- id: action_failing_test
uses: ./
with:
github_token: ${{ secrets.github_token }}
reporter: github-check
level: info
filter_mode: nofilter
workdir: ./testdata
tool_name: tsc-github-check
fail_on_error: true
tsc_flags: --project failing

test-pr-check:
Expand All @@ -37,15 +43,21 @@ jobs:
github_token: ${{ secrets.github_token }}
reporter: github-pr-check
level: error
filter_mode: nofilter
workdir: ./testdata
tool_name: tsc-github-pr-check
fail_on_error: true
tsc_flags: --project passing
- id: action_failing_test
uses: ./
with:
github_token: ${{ secrets.github_token }}
reporter: github-check
reporter: github-pr-check
level: info
filter_mode: nofilter
workdir: ./testdata
tool_name: tsc-github-pr-check
fail_on_error: true
tsc_flags: --project failing

test-pr-review:
Expand All @@ -59,13 +71,18 @@ jobs:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
level: error
filter_mode: nofilter
workdir: ./testdata
tool_name: tsc-github-pr-review
fail_on_error: true
tsc_flags: --project passing
- id: action_failing_test
uses: ./
with:
github_token: ${{ secrets.github_token }}
reporter: github-check
reporter: github-pr-review
level: info
filter_mode: nofilter
workdir: ./testdata
tool_name: tsc-github-pr-review
tsc_flags: --project failing
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ This reviewdog action template itself is integrated with reviewdog to run lint c
Supported linters:

- [reviewdog/action-shellcheck](https://github.com/reviewdog/action-shellcheck)
- [reviewdog/action-shfmt](https://github.com/reviewdog/action-shfmt)
- [reviewdog/action-actionlint](https://github.com/reviewdog/action-actionlint)
- [reviewdog/action-misspell](https://github.com/reviewdog/action-misspell)
- [reviewdog/action-alex](https://github.com/reviewdog/action-alex)

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ inputs:
Default is ``.
default: ''
required: false
tool_name:
description: 'Tool name to use for reviewdog reporter'
default: 'tsc'
required: false
### Flags for tsc ###
tsc_flags:
description: |
Expand Down
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ inputs:
Default is ``.
default: ''
required: false
tool_name:
description: 'Tool name to use for reviewdog reporter'
default: 'tsc'
required: false
### Flags for tsc ###
tsc_flags:
description: |
Expand All @@ -55,6 +59,9 @@ inputs:
runs:
using: 'composite'
steps:
- uses: reviewdog/action-setup@v1
with:
reviewdog_version: v0.14.0
- run: $GITHUB_ACTION_PATH/script.sh
shell: bash
env:
Expand All @@ -65,6 +72,7 @@ runs:
INPUT_FILTER_MODE: ${{ inputs.filter_mode }}
INPUT_FAIL_ON_ERROR: ${{ inputs.fail_on_error }}
INPUT_REVIEWDOG_FLAGS: ${{ inputs.reviewdog_flags }}
INPUT_TOOL_NAME: ${{ inputs.tool_name }}
INPUT_TSC_FLAGS: ${{ inputs.tsc_flags }}


Expand Down
9 changes: 1 addition & 8 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,8 @@

cd "${GITHUB_WORKSPACE}/${INPUT_WORKDIR}" || exit 1

REVIEWDOG_VERSION=v0.14.0
TEMP_PATH="$(mktemp -d)"
PATH="${TEMP_PATH}:$PATH"
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

echo "::group::🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog"
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b "${TEMP_PATH}" "${REVIEWDOG_VERSION}" 2>&1
echo "::endgroup::"

if [ ! -f "$(npm bin)"/tsc ]; then
echo "::group::🔄 Running npm install to install tsc ..."
npm install
Expand All @@ -30,7 +23,7 @@ else
"$(npm bin)"/tsc ${INPUT_TSC_FLAGS} \
| reviewdog -f=tsc \
-name="${INPUT_TOOL_NAME}" \
-reporter="${INPUT_REPORTER:-github-pr-review}" \
-reporter="${INPUT_REPORTER}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
-level="${INPUT_LEVEL}" \
Expand Down

0 comments on commit 935b711

Please sign in to comment.