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
2 changes: 1 addition & 1 deletion .github/workflows/commit-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
branch: true
author-name: true
author-email: true
summary: true
job-summary: true
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
author-name: true
author-email: true
dry-run: true
summary: true
job-summary: true
```

## Optional Inputs
Expand Down Expand Up @@ -61,24 +61,24 @@ jobs:
- **Description**: run checks without failing. exit code is 0 otherwise is 1.
- Default: 'false'

### `summary`
### `job-summary`

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

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.

## GitHub Actions job summary
## GitHub Action job summary

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

### Success summary
### Success job summary

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

### Failure summary
### Failure job summary

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

## Badging your repository

Expand Down Expand Up @@ -108,7 +108,3 @@ Versioning follows [Semantic Versioning](https://semver.org/).
## Have question or feedback?

To provide feedback (requesting a feature or reporting a bug) please post to [issues](https://github.com/commit-check/commit-check/issues).

## License

[MIT License](LICENSE)
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ inputs:
description: run checks without failing
required: false
default: false
summary:
job-summary:
description: add a job summary
required: false
default: true
runs:
using: "composite"
steps:
- run: ${{ github.action_path }}/entrypoint
- run: ${{ github.action_path }}/entrypoint.sh
shell: bash
env:
MESSAGE: ${{ inputs.message }}
BRANCH: ${{ inputs.branch }}
AUTHOR_NAME: ${{ inputs.author-name }}
AUTHOR_EMAIL: ${{ inputs.author-email }}
DRY_RUN: ${{ inputs.dry-run }}
SUMMARY: ${{ inputs.summary }}
JOB_SUMMARY: ${{ inputs.job-summary }}
20 changes: 9 additions & 11 deletions entrypoint → entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ret_code=0

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

echo "commit-check $args"
commit-check $args > result.txt
commit-check "$args" > result.txt
ret_code=$?
}

add_job_summary(){
if [ "$SUMMARY" == "false" ]; then
if [ "$JOB_SUMMARY" == "false" ]; then
exit
fi

if [ -s result.txt ]; then
# strips ANSI colors
sed -i "s,\x1B\[[0-9;]*[a-zA-Z],,g" result.txt
cat result.txt
echo "### Commit-Check ❌" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat result.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "### Commit-Check ❌" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
cat result.txt >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
ret_code=1
else
echo "### Commit-Check ✔️" >> $GITHUB_STEP_SUMMARY
echo "### Commit-Check ✔️" >> "$GITHUB_STEP_SUMMARY"
ret_code=0
fi
}

# start of main
install_deps
install_dependencies
run_commit_check
add_job_summary

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

exit $ret_code
# end of main