From 52b84905cd0f6d253d28e920b7f170a7146650fc Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Thu, 2 Feb 2023 22:56:28 -0500 Subject: [PATCH 1/2] docs: add screenshot to README.md (#9) --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 0eb34c8..f8018fb 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,18 @@ jobs: 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 + +By default, commit-check-action results are shown on the job summary page of the workflow. + +### Success summary + +![Success summary](https://github.com/commit-check/.github/blob/main/screenshot/success-summary.png) + +### Failure summary + +![Failure summary](https://github.com/commit-check/.github/blob/main/screenshot/failure-summary.png) + ## Badging your repository You can add a badge to your repository to show your contributors / users that you use commit-check! From 605095fb41530558f6e2ee7591bfead4c167b27f Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Mon, 6 Feb 2023 18:55:45 -0700 Subject: [PATCH 2/2] refactor: change from summary to job-summary (#10) --- .github/workflows/commit-check.yml | 2 +- LICENSE | 21 --------------------- README.md | 18 +++++++----------- action.yml | 6 +++--- entrypoint => entrypoint.sh | 20 +++++++++----------- 5 files changed, 20 insertions(+), 47 deletions(-) delete mode 100644 LICENSE rename entrypoint => entrypoint.sh (71%) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 3c421da..fad54eb 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -16,4 +16,4 @@ jobs: branch: true author-name: true author-email: true - summary: true + job-summary: true diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 075dbce..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2022 Commit Check - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index f8018fb..c51c662 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ jobs: author-name: true author-email: true dry-run: true - summary: true + job-summary: true ``` ## Optional Inputs @@ -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 @@ -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) diff --git a/action.yml b/action.yml index ef16335..aa58901 100644 --- a/action.yml +++ b/action.yml @@ -25,14 +25,14 @@ 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 }} @@ -40,4 +40,4 @@ runs: AUTHOR_NAME: ${{ inputs.author-name }} AUTHOR_EMAIL: ${{ inputs.author-email }} DRY_RUN: ${{ inputs.dry-run }} - SUMMARY: ${{ inputs.summary }} + JOB_SUMMARY: ${{ inputs.job-summary }} diff --git a/entrypoint b/entrypoint.sh similarity index 71% rename from entrypoint rename to entrypoint.sh index 697b594..9c5451a 100755 --- a/entrypoint +++ b/entrypoint.sh @@ -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 @@ -26,12 +26,12 @@ 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 @@ -39,19 +39,18 @@ add_job_summary(){ # 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 @@ -60,4 +59,3 @@ if [ "$DRY_RUN" == "true" ]; then fi exit $ret_code -# end of main