Skip to content

Commit

Permalink
Merge branch 'opensource-nepal:main' into updatereadme
Browse files Browse the repository at this point in the history
  • Loading branch information
martincarapia authored Apr 5, 2024
2 parents b348d77 + 8761e42 commit d076957
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 23 deletions.
16 changes: 1 addition & 15 deletions .github/workflows/test_action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Commitlint

on:
push:
branches: ["main"]
branches: ['main']
pull_request:

jobs:
Expand All @@ -13,20 +13,6 @@ jobs:
- uses: actions/checkout@v4

- name: Run commitlint
id: commitlintrun
uses: ./ # Uses an action in the root directory
# or use a released GitHub Action
# uses: opensource-nepal/[email protected]
with:
fail_on_error: false

- name: Check Output
run: |
echo 'Status - ${{ steps.commitlintrun.outputs.status }}'
echo 'Exit Code - ${{ steps.commitlintrun.outputs.exit_code }}'
# Check commitlintrun status
if [ "${{ steps.commitlintrun.outputs.status }}" = "failure" ]; then
echo "Failing the job manually because Commitlint status is failure."
exit 1
fi
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ commitlint is a tool designed to lint your commit messages according to the [Con
If you have any existing workflows, add the following steps:

```yaml
...
steps:
...
- name: Run commitlint
Expand Down Expand Up @@ -71,17 +72,16 @@ jobs:
#### GitHub Action Inputs
| # | Name | Type | Default | Description |
| --- | ----------------- | -----------| -----------| ----------- |
| 1 | **fail_on_error** | Boolean | true | Determines whether the GitHub Action should fail when encountering an error. |
| # | Name | Type | Default | Description |
| --- | ----------------- | ------- | ------- | --------------------------------------------------------------------- |
| 1 | **fail_on_error** | Boolean | true | Determines whether the GitHub Action should fail if commitlint fails. |
#### GitHub Action Outputs
| # | Name | Type | Description |
| --- | -------------- | --------------| ------------ |
| 1 | **exit_code** | Integer | The exit code indicating the success or failure of the GitHub Actions workflow. |
| 2 | **status** |'failure' \| 'success'| The status of the GitHub Actions workflow, indicating success or failure. |
| # | Name | Type | Description |
| --- | ------------- | ------- | ---------------------------------------------------------------------------- |
| 1 | **exit_code** | Integer | The exit code of the commitlint step. |
| 2 | **status** | String | The outcome of the commitlint step. Possible values: 'success' or 'failure'. |
## CLI (Command Line Interface)
Expand Down
1 change: 1 addition & 0 deletions github_actions/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def _check_commits(from_hash: str, to_hash: str) -> None:
_write_output("exit_code", 0)

except subprocess.CalledProcessError as error:
sys.stderr.write("::error::Commit validation failed!\n")
_write_output("status", STATUS_FAILURE)
_write_output("exit_code", error.returncode)
val = _get_input(INPUT_FAIL_ON_ERROR)
Expand Down

0 comments on commit d076957

Please sign in to comment.