Skip to content

Commit 605095f

Browse files
authored
refactor: change from summary to job-summary (#10)
1 parent 52b8490 commit 605095f

File tree

5 files changed

+20
-47
lines changed

5 files changed

+20
-47
lines changed

.github/workflows/commit-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
branch: true
1717
author-name: true
1818
author-email: true
19-
summary: true
19+
job-summary: true

LICENSE

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

README.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
author-name: true
3030
author-email: true
3131
dry-run: true
32-
summary: true
32+
job-summary: true
3333
```
3434
3535
## Optional Inputs
@@ -61,24 +61,24 @@ jobs:
6161
- **Description**: run checks without failing. exit code is 0 otherwise is 1.
6262
- Default: 'false'
6363

64-
### `summary`
64+
### `job-summary`
6565

6666
- **Description**: display job summary to a workflow run
6767
- Default: 'true'
6868

6969
Note: the default rule of above inputs is following [this configuration](https://github.com/commit-check/commit-check/blob/main/.commit-check.yml), if you want to customize just add your `.commit-check.yml` config file under your repository root directory.
7070

71-
## GitHub Actions job summary
71+
## GitHub Action job summary
7272

7373
By default, commit-check-action results are shown on the job summary page of the workflow.
7474

75-
### Success summary
75+
### Success job summary
7676

77-
![Success summary](https://github.com/commit-check/.github/blob/main/screenshot/success-summary.png)
77+
![Success job summary](https://github.com/commit-check/.github/blob/main/screenshot/success-summary.png)
7878

79-
### Failure summary
79+
### Failure job summary
8080

81-
![Failure summary](https://github.com/commit-check/.github/blob/main/screenshot/failure-summary.png)
81+
![Failure job summary](https://github.com/commit-check/.github/blob/main/screenshot/failure-summary.png)
8282

8383
## Badging your repository
8484

@@ -108,7 +108,3 @@ Versioning follows [Semantic Versioning](https://semver.org/).
108108
## Have question or feedback?
109109
110110
To provide feedback (requesting a feature or reporting a bug) please post to [issues](https://github.com/commit-check/commit-check/issues).
111-
112-
## License
113-
114-
[MIT License](LICENSE)

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,19 @@ inputs:
2525
description: run checks without failing
2626
required: false
2727
default: false
28-
summary:
28+
job-summary:
2929
description: add a job summary
3030
required: false
3131
default: true
3232
runs:
3333
using: "composite"
3434
steps:
35-
- run: ${{ github.action_path }}/entrypoint
35+
- run: ${{ github.action_path }}/entrypoint.sh
3636
shell: bash
3737
env:
3838
MESSAGE: ${{ inputs.message }}
3939
BRANCH: ${{ inputs.branch }}
4040
AUTHOR_NAME: ${{ inputs.author-name }}
4141
AUTHOR_EMAIL: ${{ inputs.author-email }}
4242
DRY_RUN: ${{ inputs.dry-run }}
43-
SUMMARY: ${{ inputs.summary }}
43+
JOB_SUMMARY: ${{ inputs.job-summary }}

entrypoint renamed to entrypoint.sh

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
ret_code=0
44

5-
install_deps(){
5+
install_dependencies(){
66
if [ "$RUNNER_OS" == "Linux" ]; then
77
# https://github.com/pypa/setuptools/issues/3269
88
export DEB_PYTHON_INSTALL_LAYOUT=deb
@@ -26,32 +26,31 @@ run_commit_check(){
2626
fi
2727

2828
echo "commit-check $args"
29-
commit-check $args > result.txt
29+
commit-check "$args" > result.txt
3030
ret_code=$?
3131
}
3232

3333
add_job_summary(){
34-
if [ "$SUMMARY" == "false" ]; then
34+
if [ "$JOB_SUMMARY" == "false" ]; then
3535
exit
3636
fi
3737

3838
if [ -s result.txt ]; then
3939
# strips ANSI colors
4040
sed -i "s,\x1B\[[0-9;]*[a-zA-Z],,g" result.txt
4141
cat result.txt
42-
echo "### Commit-Check ❌" >> $GITHUB_STEP_SUMMARY
43-
echo '```' >> $GITHUB_STEP_SUMMARY
44-
cat result.txt >> $GITHUB_STEP_SUMMARY
45-
echo '```' >> $GITHUB_STEP_SUMMARY
42+
echo "### Commit-Check ❌" >> "$GITHUB_STEP_SUMMARY"
43+
echo '```' >> "$GITHUB_STEP_SUMMARY"
44+
cat result.txt >> "$GITHUB_STEP_SUMMARY"
45+
echo '```' >> "$GITHUB_STEP_SUMMARY"
4646
ret_code=1
4747
else
48-
echo "### Commit-Check ✔️" >> $GITHUB_STEP_SUMMARY
48+
echo "### Commit-Check ✔️" >> "$GITHUB_STEP_SUMMARY"
4949
ret_code=0
5050
fi
5151
}
5252

53-
# start of main
54-
install_deps
53+
install_dependencies
5554
run_commit_check
5655
add_job_summary
5756

@@ -60,4 +59,3 @@ if [ "$DRY_RUN" == "true" ]; then
6059
fi
6160

6261
exit $ret_code
63-
# end of main

0 commit comments

Comments
 (0)