Last active
May 20, 2021 21:10
-
-
Save JustDevZero/1c02427031b3a58c2bcd2db715c38c14 to your computer and use it in GitHub Desktop.
autoguess
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
import json | |
from os import getenv | |
try: | |
GITHUB_CONTEXT = json.loads(getenv('GITHUB_CONTEXT', b'{}').decode()) | |
except BaseException: | |
GITHUB_CONTEXT = json.loads(getenv('GITHUB_CONTEXT', '{}')) | |
EVENT = GITHUB_CONTEXT.get('event', {}) | |
COMMITS = EVENT.get('commits', []) | |
LINES = '\n'.join([x.get('message') for x in COMMITS]) | |
result = 'patch' | |
if 'fix' in LINES or 'bug' in LINES: | |
result = 'minor' | |
if 'feat' in LINES or 'refactor' in LINES: | |
result = 'major' | |
print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment