Skip to content

Commit 1bd5c5e

Browse files
committed
Init for docker-build-check
1 parent 7a18c6b commit 1bd5c5e

File tree

12 files changed

+124
-248
lines changed

12 files changed

+124
-248
lines changed

.github/workflows/dockerimage.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.github/workflows/reviewdog.yml

Lines changed: 11 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,60 +4,23 @@ on:
44
branches:
55
- master
66
pull_request:
7+
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
712
jobs:
813
shellcheck:
914
name: runner / shellcheck
1015
runs-on: ubuntu-latest
1116
steps:
1217
- 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
18+
- name: shellcheck
19+
uses: reviewdog/action-shellcheck@v1
2020
with:
2121
github_token: ${{ secrets.github_token }}
22-
reporter: ${{ steps.reporter.outputs.value }}
23-
level: warning
22+
reporter: github-pr-review
23+
path: "."
24+
pattern: "*.sh"
25+
exclude: "./.git/*"
2426

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: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,17 @@
11
name: Test
22
on:
3-
push:
4-
branches:
5-
- master
63
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"
194

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/
5+
permissions:
6+
pull-requests: write
7+
contents: read
338

34-
test-pr-review:
35-
if: github.event_name == 'pull_request'
36-
name: runner / <linter-name> (github-pr-review)
9+
jobs:
10+
test-docker-build-check:
11+
name: test-docker-build-check
3712
runs-on: ubuntu-latest
3813
steps:
3914
- uses: actions/checkout@v4
4015
- uses: ./
4116
with:
4217
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

Dockerfile

Lines changed: 0 additions & 17 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,26 @@
1-
# action-template
1+
# GitHub Action: Run `docker build --check` with action-docker-build-check
22

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)
3+
This action runs `docker build --check` with reviewdog on pull requests to improve code review experience.
104

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)
5+
## Examples
136

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-
```
7+
![image](https://github.com/user-attachments/assets/07d0fbac-72b5-4136-8649-b24176da580f)
608

619
## Usage
62-
<!-- TODO: update. replace `template` with the linter name -->
6310

6411
```yaml
6512
name: reviewdog
6613
on: [pull_request]
6714
jobs:
68-
# TODO: change `linter_name`.
69-
linter_name:
70-
name: runner / <linter-name>
15+
docker-build-check:
16+
name: docker-build-check
7117
runs-on: ubuntu-latest
7218
steps:
7319
- uses: actions/checkout@v4
74-
- uses: reviewdog/action-template@v1
20+
- uses: shmokmt/action-docker-build-check@master
7521
with:
7622
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
8223
```
8324
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)
25+
## See Also
26+
* https://docs.docker.com/reference/build-checks/

action.yml

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: 'TODO: Run <linter-name> with reviewdog'
2-
description: 'TODO: 🐶 Run <linter-name> with reviewdog on pull requests to improve code review experience.'
3-
author: 'TODO: <your-name>'
1+
name: 'Run docker build --check with reviewdog'
2+
description: 'Run docker build --check with reviewdog on pull requests to improve code review experience.'
3+
author: 'shmokmt(reviwedog)'
44
inputs:
55
github_token:
66
description: 'GITHUB_TOKEN'
@@ -11,10 +11,10 @@ inputs:
1111
### Flags for reviewdog ###
1212
level:
1313
description: 'Report level for reviewdog [info,warning,error]'
14-
default: 'error'
14+
default: 'warning'
1515
reporter:
1616
description: 'Reporter of reviewdog command [github-pr-check,github-pr-review].'
17-
default: 'github-pr-check'
17+
default: 'github-pr-review'
1818
filter_mode:
1919
description: |
2020
Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
@@ -28,16 +28,26 @@ inputs:
2828
reviewdog_flags:
2929
description: 'Additional reviewdog flags'
3030
default: ''
31-
### Flags for <linter-name> ###
32-
locale:
33-
description: '-locale flag of misspell. (US/UK)'
34-
default: ''
31+
3532
runs:
36-
using: 'docker'
37-
image: 'Dockerfile'
33+
using: 'composite'
34+
steps:
35+
- run: $GITHUB_ACTION_PATH/script.sh
36+
id: docker-build-check
37+
shell: bash
38+
env:
39+
REVIEWDOG_VERSION: v0.20.2
40+
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
41+
# https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611
42+
INPUT_GITHUB_TOKEN: ${{ inputs.github_token }}
43+
INPUT_WORKING_DIRECTORY: ${{ inputs.working_directory }}
44+
INPUT_LEVEL: ${{ inputs.level }}
45+
INPUT_REPORTER: ${{ inputs.reporter }}
46+
INPUT_FILTER_MODE: ${{ inputs.filter_mode }}
47+
INPUT_FAIL_ON_ERROR: ${{ inputs.fail_on_error }}
48+
INPUT_FLAGS: ${{ inputs.flags }}
3849

3950
# Ref: https://haya14busa.github.io/github-action-brandings/
40-
# TODO: update branding if you want.
4151
branding:
42-
icon: 'check'
52+
icon: 'box'
4353
color: 'blue'

entrypoint.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)