File tree Expand file tree Collapse file tree 3 files changed +10
-23
lines changed Expand file tree Collapse file tree 3 files changed +10
-23
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: Commitlint
22
33on :
44 push :
5- branches : [" main" ]
5+ branches : [' main' ]
66 pull_request :
77
88jobs :
1313 - uses : actions/checkout@v4
1414
1515 - name : Run commitlint
16- id : commitlintrun
1716 uses : ./ # Uses an action in the root directory
1817 # or use a released GitHub Action
1918 # uses: opensource-nepal/commitlint@v0.2.1
20- with :
21- fail_on_error : false
22-
23- - name : Check Output
24- run : |
25- echo 'Status - ${{ steps.commitlintrun.outputs.status }}'
26- echo 'Exit Code - ${{ steps.commitlintrun.outputs.exit_code }}'
27-
28- # Check commitlintrun status
29- if [ "${{ steps.commitlintrun.outputs.status }}" = "failure" ]; then
30- echo "Failing the job manually because Commitlint status is failure."
31- exit 1
32- fi
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ commitlint is a tool designed to lint your commit messages according to the [Con
3939If you have any existing workflows, add the following steps:
4040
4141``` yaml
42+ ...
4243steps :
4344 ...
4445 - name : Run commitlint
@@ -71,17 +72,16 @@ jobs:
7172
7273#### GitHub Action Inputs
7374
74- | # | Name | Type | Default | Description |
75- | --- | ----------------- | -----------| -----------| ----------- |
76- | 1 | **fail_on_error** | Boolean | true | Determines whether the GitHub Action should fail when encountering an error. |
77-
75+ | # | Name | Type | Default | Description |
76+ | --- | ----------------- | ------- | ------- | --------------------------------------------------------------------- |
77+ | 1 | **fail_on_error** | Boolean | true | Determines whether the GitHub Action should fail if commitlint fails. |
7878
7979#### GitHub Action Outputs
8080
81- | # | Name | Type | Description |
82- | --- | -------------- | --------------| ------------ |
83- | 1 | **exit_code** | Integer | The exit code indicating the success or failure of the GitHub Actions workflow. |
84- | 2 | **status** |'failure' \| 'success' | The status of the GitHub Actions workflow, indicating success or failure. |
81+ | # | Name | Type | Description |
82+ | --- | ------------- | ------- | ---------------------------------------------------------------- ------------ |
83+ | 1 | **exit_code** | Integer | The exit code of the commitlint step. |
84+ | 2 | **status** | String | The outcome of the commitlint step. Possible values: ' success' or ' failure' . |
8585
8686## Contribution
8787
Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ def _check_commits(from_hash: str, to_hash: str) -> None:
152152 _write_output ("exit_code" , 0 )
153153
154154 except subprocess .CalledProcessError as error :
155+ sys .stderr .write ("::error::Commit validation failed!\n " )
155156 _write_output ("status" , STATUS_FAILURE )
156157 _write_output ("exit_code" , error .returncode )
157158 val = _get_input (INPUT_FAIL_ON_ERROR )
You can’t perform that action at this time.
0 commit comments