Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/91-Placeholder-number
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpojer committed Oct 16, 2024
2 parents 4f2ccb2 + f3bcb34 commit f8f9eb3
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 35 deletions.
5 changes: 5 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ unsafe-load-any-extension=no
#verbose=


[MASTER]

ignore-paths=tests


[BASIC]

# Naming style matching correct argument names.
Expand Down
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ Generate Release Notes action is dedicated to enhance the quality and organizati
- **Required**: No
- **Default**: true (Empty chapters are printed.)

### `chapters-to-pr-without-issue`
- **Description**: Set it to false to avoid the application of custom chapters for PRs without linked issues.
- **Required**: No
- **Default**: true (Custom chapters are applied to PRs without linked issues.)


## Outputs
The output of the action is a markdown string containing the release notes for the specified tag. This string can be used in subsequent steps to publish the release notes to a file, create a GitHub release, or send notifications.

Expand Down Expand Up @@ -165,7 +159,6 @@ Add the following step to your GitHub workflow (in example are used non-default

warnings: false
print-empty-chapters: false
chapters-to-pr-without-issue: false
```
## Features
Expand Down Expand Up @@ -380,7 +373,6 @@ export INPUT_WARNINGS="true"
export INPUT_PUBLISHED_AT="true"
export INPUT_SKIP_RELEASE_NOTES_LABEL="ignore-in-release"
export INPUT_PRINT_EMPTY_CHAPTERS="true"
export INPUT_CHAPTERS_TO_PR_WITHOUT_ISSUE="true"
export INPUT_VERBOSE="true"

# CI in-build variables
Expand Down
9 changes: 4 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ inputs:
description: 'Print chapters even if they are empty.'
required: false
default: 'true'
chapters-to-pr-without-issue:
description: 'Apply custom chapters for PRs without linked issues.'
required: false
default: 'true'
verbose:
description: 'Print verbose logs.'
required: false
Expand Down Expand Up @@ -97,6 +93,9 @@ runs:
else
echo "Python version meets the minimum requirement of $minimal_required_version"
fi
python -m venv .venv
source .venv/bin/activate
pip install -r ${{ github.action_path }}/requirements.txt
shell: bash

Expand All @@ -118,12 +117,12 @@ runs:
INPUT_PUBLISHED_AT: ${{ inputs.published-at }}
INPUT_SKIP_RELEASE_NOTES_LABEL: ${{ inputs.skip-release-notes-label }}
INPUT_PRINT_EMPTY_CHAPTERS: ${{ inputs.print-empty-chapters }}
INPUT_CHAPTERS_TO_PR_WITHOUT_ISSUE: ${{ inputs.chapters-to-pr-without-issue }}
INPUT_VERBOSE: ${{ inputs.verbose }}
INPUT_GITHUB_REPOSITORY: ${{ github.repository }}
INPUT_ROW_FORMAT_ISSUE: ${{ inputs.row-format-issue }}
INPUT_ROW_FORMAT_PR: ${{ inputs.row-format-pr }}
INPUT_ROW_FORMAT_LINK_PR: ${{ inputs.row-format-link-pr }}
run: |
source .venv/bin/activate
python ${{ github.action_path }}/main.py
shell: bash
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[tool.black]
line-length = 120
target-version = ['py311']
force-exclude = '''test'''

[tool.coverage.run]
omit = ["tests/*"]
14 changes: 0 additions & 14 deletions release_notes_generator/action_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
WARNINGS,
RUNNER_DEBUG,
PRINT_EMPTY_CHAPTERS,
CHAPTERS_TO_PR_WITHOUT_ISSUE,
DUPLICITY_SCOPE,
DUPLICITY_ICON,
ROW_FORMAT_LINK_PR,
Expand Down Expand Up @@ -138,13 +137,6 @@ def get_print_empty_chapters() -> bool:
"""
return get_action_input(PRINT_EMPTY_CHAPTERS, "true").lower() == "true"

@staticmethod
def get_chapters_to_pr_without_issue() -> bool:
"""
Get the chapters to PR without issue parameter value from the action inputs.
"""
return get_action_input(CHAPTERS_TO_PR_WITHOUT_ISSUE, "true").lower() == "true"

@staticmethod
def validate_input(input_value, expected_type: type, error_message: str, error_buffer: list) -> bool:
"""
Expand Down Expand Up @@ -246,11 +238,6 @@ def validate_inputs():
print_empty_chapters = ActionInputs.get_print_empty_chapters()
ActionInputs.validate_input(print_empty_chapters, bool, "Print empty chapters must be a boolean.", errors)

chapters_to_pr_without_issue = ActionInputs.get_chapters_to_pr_without_issue()
ActionInputs.validate_input(
chapters_to_pr_without_issue, bool, "Chapters to PR without issue must be a boolean.", errors
)

# Log errors if any
if errors:
for error in errors:
Expand All @@ -265,4 +252,3 @@ def validate_inputs():
logger.debug("Verbose logging: %s", verbose)
logger.debug("Warnings: %s", warnings)
logger.debug("Print empty chapters: %s", print_empty_chapters)
logger.debug("Chapters to PR without issue: %s", chapters_to_pr_without_issue)
1 change: 0 additions & 1 deletion release_notes_generator/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
# Features
WARNINGS = "warnings"
PRINT_EMPTY_CHAPTERS = "print-empty-chapters"
CHAPTERS_TO_PR_WITHOUT_ISSUE = "chapters-to-pr-without-issue"

# Pull Request states
PR_STATE_CLOSED = "closed"
Expand Down
7 changes: 0 additions & 7 deletions tests/test_action_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"get_published_at": False,
"get_skip_release_notes_label": "skip",
"get_print_empty_chapters": True,
"get_chapters_to_pr_without_issue": False,
"get_verbose": True,
}

Expand All @@ -42,7 +41,6 @@
("get_published_at", "not_bool", "Published at must be a boolean."),
("get_skip_release_notes_label", "", "Skip release notes label must be a non-empty string."),
("get_print_empty_chapters", "not_bool", "Print empty chapters must be a boolean."),
("get_chapters_to_pr_without_issue", "not_bool", "Chapters to PR without issue must be a boolean."),
("get_verbose", "not_bool", "Verbose logging must be a boolean."),
("get_duplicity_icon", "", "Duplicity icon must be a non-empty string and have a length of 1."),
("get_duplicity_icon", "Oj", "Duplicity icon must be a non-empty string and have a length of 1."),
Expand Down Expand Up @@ -129,11 +127,6 @@ def test_get_print_empty_chapters(mocker):
assert ActionInputs.get_print_empty_chapters() is True


def test_get_chapters_to_pr_without_issue(mocker):
mocker.patch("release_notes_generator.action_inputs.get_action_input", return_value="false")
assert ActionInputs.get_chapters_to_pr_without_issue() is False


def test_get_verbose_verbose_by_action_input(mocker):
mocker.patch("release_notes_generator.action_inputs.get_action_input", return_value="true")
mocker.patch("os.getenv", return_value=0)
Expand Down

0 comments on commit f8f9eb3

Please sign in to comment.