Skip to content

Commit 7a18c6b

Browse files
authored
Initial commit
0 parents  commit 7a18c6b

File tree

14 files changed

+442
-0
lines changed

14 files changed

+442
-0
lines changed

.github/renovate.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": [
3+
"config:base"
4+
],
5+
"labels": [
6+
"bump:patch"
7+
]
8+
}

.github/workflows/depup.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: depup
2+
on:
3+
schedule:
4+
- cron: "14 14 * * *" # Runs at 14:14 UTC every day
5+
repository_dispatch:
6+
types: [depup]
7+
workflow_dispatch:
8+
9+
jobs:
10+
reviewdog:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: reviewdog/action-depup@v1
15+
id: depup
16+
with:
17+
file: Dockerfile
18+
version_name: REVIEWDOG_VERSION
19+
repo: reviewdog/reviewdog
20+
21+
- name: Create Pull Request
22+
uses: peter-evans/create-pull-request@v6
23+
with:
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
title: "chore(deps): update reviewdog to ${{ steps.depup.outputs.latest }}"
26+
commit-message: "chore(deps): update reviewdog to ${{ steps.depup.outputs.latest }}"
27+
body: |
28+
Update reviewdog to [v${{ steps.depup.outputs.latest }}](https://github.com/reviewdog/reviewdog/releases/tag/v${{ steps.depup.outputs.latest }})
29+
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 }})
30+
31+
This PR is auto generated by [depup workflow](https://github.com/${{ github.repository }}/actions?query=workflow%3Adepup).
32+
branch: depup/reviewdog
33+
base: master
34+
labels: "bump:minor"

.github/workflows/dockerimage.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Docker Image CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Build the Docker image
13+
run: docker build . --file Dockerfile --tag ${{ github.repository }}:$(date +%s)

.github/workflows/release.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: release
2+
on:
3+
push:
4+
branches:
5+
- master
6+
tags:
7+
- "v*.*.*"
8+
pull_request:
9+
types:
10+
- labeled
11+
12+
jobs:
13+
release:
14+
if: github.event.action != 'labeled'
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
# Bump version on merging Pull Requests with specific labels.
20+
# (bump:major,bump:minor,bump:patch)
21+
- id: bumpr
22+
if: "!startsWith(github.ref, 'refs/tags/')"
23+
uses: haya14busa/action-bumpr@v1
24+
25+
# Update corresponding major and minor tag.
26+
# e.g. Update v1 and v1.2 when releasing v1.2.3
27+
- uses: haya14busa/action-update-semver@v1
28+
if: "!steps.bumpr.outputs.skip"
29+
with:
30+
tag: ${{ steps.bumpr.outputs.next_version }}
31+
32+
# Get tag name.
33+
- id: tag
34+
uses: haya14busa/action-cond@v1
35+
with:
36+
cond: "${{ startsWith(github.ref, 'refs/tags/') }}"
37+
if_true: ${{ github.ref }}
38+
if_false: ${{ steps.bumpr.outputs.next_version }}
39+
40+
# Create release
41+
- if: "steps.tag.outputs.value != ''"
42+
env:
43+
TAG_NAME: ${{ steps.tag.outputs.value }}
44+
BODY: ${{ steps.bumpr.outputs.message }}
45+
# This token is provided by Actions, you do not need to create your own token
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
run: |
48+
gh release create "${TAG_NAME}" -t "Release ${TAG_NAME/refs\/tags\//}" --notes "${BODY}"
49+
50+
release-check:
51+
if: github.event.action == 'labeled'
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v4
55+
- name: Post bumpr status comment
56+
uses: haya14busa/action-bumpr@v1

.github/workflows/reviewdog.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: reviewdog
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
jobs:
8+
shellcheck:
9+
name: runner / shellcheck
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: haya14busa/action-cond@v1
14+
id: reporter
15+
with:
16+
cond: ${{ github.event_name == 'pull_request' }}
17+
if_true: "github-pr-review"
18+
if_false: "github-check"
19+
- uses: reviewdog/action-shellcheck@v1
20+
with:
21+
github_token: ${{ secrets.github_token }}
22+
reporter: ${{ steps.reporter.outputs.value }}
23+
level: warning
24+
25+
hadolint:
26+
name: runner / hadolint
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: haya14busa/action-cond@v1
31+
id: reporter
32+
with:
33+
cond: ${{ github.event_name == 'pull_request' }}
34+
if_true: "github-pr-review"
35+
if_false: "github-check"
36+
- uses: reviewdog/action-hadolint@v1
37+
with:
38+
github_token: ${{ secrets.github_token }}
39+
reporter: ${{ steps.reporter.outputs.value }}
40+
level: warning
41+
42+
misspell:
43+
name: runner / misspell
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
- uses: reviewdog/action-misspell@v1
48+
with:
49+
github_token: ${{ secrets.github_token }}
50+
reporter: github-check
51+
level: warning
52+
locale: "US"
53+
54+
alex:
55+
name: runner / alex
56+
runs-on: ubuntu-latest
57+
steps:
58+
- uses: actions/checkout@v4
59+
- uses: reviewdog/action-alex@v1
60+
with:
61+
github_token: ${{ secrets.github_token }}
62+
reporter: github-check
63+
level: warning

.github/workflows/test.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Test
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
jobs:
8+
test-check:
9+
name: runner / <linter-name> (github-check)
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: ./
14+
with:
15+
github_token: ${{ secrets.github_token }}
16+
reporter: github-check
17+
level: info
18+
locale: "US"
19+
20+
test-pr-check:
21+
if: github.event_name == 'pull_request'
22+
name: runner / <linter-name> (github-pr-check)
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: ./
27+
with:
28+
github_token: ${{ secrets.github_token }}
29+
reporter: github-pr-check
30+
level: warning
31+
locale: "US"
32+
workdir: ./testdata/subdir/
33+
34+
test-pr-review:
35+
if: github.event_name == 'pull_request'
36+
name: runner / <linter-name> (github-pr-review)
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
- uses: ./
41+
with:
42+
github_token: ${{ secrets.github_token }}
43+
reporter: github-pr-review
44+
level: error
45+
locale: "US"
46+
reviewdog_flags: -filter-mode=file -fail-on-error

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Folders to ignore
2+
.vscode/

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM alpine:3.20
2+
3+
ENV REVIEWDOG_VERSION=v0.20.2
4+
5+
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
6+
7+
# hadolint ignore=DL3006
8+
RUN apk --no-cache add git
9+
10+
RUN wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b /usr/local/bin/ ${REVIEWDOG_VERSION}
11+
12+
# TODO: Install a linter and/or change docker image as you need.
13+
RUN wget -O - -q https://git.io/misspell | sh -s -- -b /usr/local/bin/
14+
15+
COPY entrypoint.sh /entrypoint.sh
16+
17+
ENTRYPOINT ["/entrypoint.sh"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 reviewdog developers
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# action-template
2+
3+
<!-- TODO: replace reviewdog/action-template with your repo name -->
4+
[![Test](https://github.com/reviewdog/action-template/workflows/Test/badge.svg)](https://github.com/reviewdog/action-template/actions?query=workflow%3ATest)
5+
[![reviewdog](https://github.com/reviewdog/action-template/workflows/reviewdog/badge.svg)](https://github.com/reviewdog/action-template/actions?query=workflow%3Areviewdog)
6+
[![depup](https://github.com/reviewdog/action-template/workflows/depup/badge.svg)](https://github.com/reviewdog/action-template/actions?query=workflow%3Adepup)
7+
[![release](https://github.com/reviewdog/action-template/workflows/release/badge.svg)](https://github.com/reviewdog/action-template/actions?query=workflow%3Arelease)
8+
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/reviewdog/action-template?logo=github&sort=semver)](https://github.com/reviewdog/action-template/releases)
9+
[![action-bumpr supported](https://img.shields.io/badge/bumpr-supported-ff69b4?logo=github&link=https://github.com/haya14busa/action-bumpr)](https://github.com/haya14busa/action-bumpr)
10+
11+
![github-pr-review demo](https://user-images.githubusercontent.com/3797062/73162963-4b8e2b00-4132-11ea-9a3f-f9c6f624c79f.png)
12+
![github-pr-check demo](https://user-images.githubusercontent.com/3797062/73163032-70829e00-4132-11ea-8481-f213a37db354.png)
13+
14+
This is a template repository for [reviewdog](https://github.com/reviewdog/reviewdog) action with release automation.
15+
Click `Use this template` button to create your reviewdog action :dog:!
16+
17+
If you want to create your own reviewdog action from scratch without using this
18+
template, please check and copy release automation flow.
19+
It's important to manage release workflow and sync reviewdog version for all
20+
reviewdog actions.
21+
22+
This repo contains a sample action to run [misspell](https://github.com/client9/misspell).
23+
24+
## Input
25+
26+
<!-- TODO: update -->
27+
```yaml
28+
inputs:
29+
github_token:
30+
description: 'GITHUB_TOKEN'
31+
default: '${{ github.token }}'
32+
workdir:
33+
description: 'Working directory relative to the root directory.'
34+
default: '.'
35+
### Flags for reviewdog ###
36+
level:
37+
description: 'Report level for reviewdog [info,warning,error]'
38+
default: 'error'
39+
reporter:
40+
description: 'Reporter of reviewdog command [github-pr-check,github-check,github-pr-review].'
41+
default: 'github-pr-check'
42+
filter_mode:
43+
description: |
44+
Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
45+
Default is added.
46+
default: 'added'
47+
fail_on_error:
48+
description: |
49+
Exit code for reviewdog when errors are found [true,false]
50+
Default is `false`.
51+
default: 'false'
52+
reviewdog_flags:
53+
description: 'Additional reviewdog flags'
54+
default: ''
55+
### Flags for <linter-name> ###
56+
locale:
57+
description: '-locale flag of misspell. (US/UK)'
58+
default: ''
59+
```
60+
61+
## Usage
62+
<!-- TODO: update. replace `template` with the linter name -->
63+
64+
```yaml
65+
name: reviewdog
66+
on: [pull_request]
67+
jobs:
68+
# TODO: change `linter_name`.
69+
linter_name:
70+
name: runner / <linter-name>
71+
runs-on: ubuntu-latest
72+
steps:
73+
- uses: actions/checkout@v4
74+
- uses: reviewdog/action-template@v1
75+
with:
76+
github_token: ${{ secrets.github_token }}
77+
# Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review].
78+
reporter: github-pr-review
79+
# Change reporter level if you need.
80+
# GitHub Status Check won't become failure with warning.
81+
level: warning
82+
```
83+
84+
## Development
85+
86+
### Release
87+
88+
#### [haya14busa/action-bumpr](https://github.com/haya14busa/action-bumpr)
89+
You can bump version on merging Pull Requests with specific labels (bump:major,bump:minor,bump:patch).
90+
Pushing tag manually by yourself also work.
91+
92+
#### [haya14busa/action-update-semver](https://github.com/haya14busa/action-update-semver)
93+
94+
This action updates major/minor release tags on a tag push. e.g. Update v1 and v1.2 tag when released v1.2.3.
95+
ref: https://help.github.com/en/articles/about-actions#versioning-your-action
96+
97+
### Lint - reviewdog integration
98+
99+
This reviewdog action template itself is integrated with reviewdog to run lints
100+
which is useful for Docker container based actions.
101+
102+
![reviewdog integration](https://user-images.githubusercontent.com/3797062/72735107-7fbb9600-3bde-11ea-8087-12af76e7ee6f.png)
103+
104+
Supported linters:
105+
106+
- [reviewdog/action-shellcheck](https://github.com/reviewdog/action-shellcheck)
107+
- [reviewdog/action-hadolint](https://github.com/reviewdog/action-hadolint)
108+
- [reviewdog/action-misspell](https://github.com/reviewdog/action-misspell)
109+
110+
### Dependencies Update Automation
111+
This repository uses [reviewdog/action-depup](https://github.com/reviewdog/action-depup) to update
112+
reviewdog version.
113+
114+
[![reviewdog depup demo](https://user-images.githubusercontent.com/3797062/73154254-170e7500-411a-11ea-8211-912e9de7c936.png)](https://github.com/reviewdog/action-template/pull/6)

0 commit comments

Comments
 (0)