-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: drawable images + workflows #41
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""Script to calculate the next version.""" | ||
import subprocess | ||
import sys | ||
|
||
from git import Repo | ||
from git_conventional_version.api import Api | ||
import semantic_version | ||
import semver | ||
|
||
|
||
def get_last_beta_tag(): | ||
"""Get the last beta tag from GIT.""" | ||
command = ["git", "describe", "--tags", "--abbrev=0", "--match", "*beta*"] | ||
output = subprocess.check_output(command).decode().strip() | ||
Check notice Code scanning / Bandit subprocess call - check for execution of untrusted input.
subprocess call - check for execution of untrusted input.
|
||
return output | ||
|
||
|
||
def get_version_without_prerelease(version): | ||
"""Get SemVer version without prerelease suffix.""" | ||
semver = semantic_version.Version(version) | ||
return str(semver.major) + "." + str(semver.minor) + "." + str(semver.patch) | ||
|
||
|
||
api = Api(repo=Repo(search_parent_directories=True)) | ||
last_beta_tag = get_last_beta_tag() | ||
new_tag = api.get_new_version(type="final") | ||
last_beta_tag_without_prerelease = get_version_without_prerelease(last_beta_tag) | ||
ver = semver.Version.parse(last_beta_tag) | ||
if new_tag != last_beta_tag_without_prerelease: | ||
new_version = f"{new_tag}-beta.1" | ||
else: | ||
new_version = ver.bump_prerelease() | ||
print(new_version) | ||
sys.exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"""Script to extract the labels for a PR.""" | ||
import os | ||
import re | ||
import sys | ||
|
||
|
||
def extract_semver_types(commit_messages): | ||
"""Extract SemVer types.""" | ||
types = [] | ||
for message in commit_messages: | ||
pattern = r"^(feat|fix|chore|docs|style|refactor|perf|test)(?:\(.+?\))?:\s(.+)$" | ||
match = re.match(pattern, message) | ||
if match and match.group(1) not in types: | ||
types.append(match.group(1)) | ||
return types | ||
|
||
|
||
def get_semver_level(commit_messages): | ||
"""Extract SemVer level.""" | ||
major_keywords = ["breaking change", "major"] | ||
minor_keywords = ["feat", "minor"] | ||
for message in commit_messages: | ||
if any(keyword in message for keyword in major_keywords): | ||
return "major" | ||
for message in commit_messages: | ||
if any(keyword in message for keyword in minor_keywords): | ||
return "minor" | ||
return "patch" | ||
|
||
|
||
file_path = "COMMIT_MESSAGES" | ||
if os.path.exists(file_path): | ||
with open(file_path) as file: | ||
messages = [] | ||
for line in file: | ||
messages.append(line.strip()) | ||
semver_level = get_semver_level(messages) | ||
types = extract_semver_types(messages) | ||
types.append(semver_level) | ||
print(types) | ||
sys.exit(0) | ||
else: | ||
sys.exit(f"ERROR: {file_path} does not exist") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,39 @@ | ||
exclude: CHANGELOG.md | ||
minimum_pre_commit_version: 2.11.0 | ||
default_stages: [commit, push, manual] | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.3.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: local | ||
- repo: https://github.com/psf/black | ||
rev: 23.1.0 | ||
hooks: | ||
- id: black | ||
name: black | ||
entry: black | ||
language: system | ||
types: [python] | ||
require_serial: true | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 6.0.0 | ||
hooks: | ||
- id: flake8 | ||
name: flake8 | ||
entry: flake8 | ||
language: system | ||
types: [python] | ||
args: ["-j8", "--ignore=E501,W503"] | ||
require_serial: true | ||
- id: reorder-python-imports | ||
name: Reorder python imports | ||
entry: reorder-python-imports | ||
language: system | ||
types: [python] | ||
args: [--application-directories=custom_components] | ||
args: [--max-line-length=88, "-j8", "--ignore=E501,W503"] | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
args: [--filter-files] | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.3.0 | ||
hooks: | ||
- id: mypy | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v2.7.1 | ||
hooks: | ||
- id: prettier | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-added-large-files | ||
args: [--maxkb=800] | ||
- id: debug-statements | ||
- id: detect-aws-credentials | ||
args: [--allow-missing-credentials] | ||
- id: detect-private-key | ||
- id: end-of-file-fixer | ||
- id: forbid-new-submodules | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check notice
Code scanning / Bandit
Consider possible security implications associated with the subprocess module.