-
Notifications
You must be signed in to change notification settings - Fork 78
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
Enhance sdk-changelog commands #4040
Merged
Merged
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
0252abb
add script to comment to changelog
GuyAfik 3ce6c07
call script on-push
GuyAfik 07473bf
call pr
GuyAfik 84ec72e
fix issues
GuyAfik daed917
poetry github
GuyAfik 7f8c267
add changelog
GuyAfik ad8ef8e
fix bug
GuyAfik 4d7b755
test
GuyAfik 891c588
test
GuyAfik 339adf2
fix bug
GuyAfik d476e77
try to fix 404
GuyAfik 6bfa676
test
GuyAfik 26083df
remove env
GuyAfik 311c67f
echo
GuyAfik 21be113
echo
GuyAfik 0e0a07e
test
GuyAfik d22a74c
prints
GuyAfik 4f3effb
int type
GuyAfik d709b35
create issue comment
GuyAfik 3b0532c
fix
GuyAfik f3ec472
update message
GuyAfik 34a3d74
test
GuyAfik 45507d5
fix
GuyAfik 95a3169
test
GuyAfik 8df7448
fetch before fetching commit
GuyAfik a3351f3
test§
GuyAfik 2ae22f8
git log
GuyAfik d6e6c2e
-n 8
GuyAfik e13b0b3
add previous commit
GuyAfik bee045a
fix on-push
GuyAfik 533bc36
from remote = false
GuyAfik 6be9e4b
test
GuyAfik 4581bfb
test
GuyAfik 8acdd4c
refactor logic
GuyAfik 57396d6
test changes in changelog
GuyAfik f70248a
see what happens without changelog
GuyAfik 17be450
continue on error
GuyAfik c9a363a
add changelog
GuyAfik 40e6776
pre-commit
GuyAfik e36fc59
changelog
GuyAfik b20b8f8
docstring
GuyAfik 2037ba5
get PR number automatically
GuyAfik d02ba65
reverse if statemetns
GuyAfik 7c8bbd0
get pulls
GuyAfik 9002002
handle better exceptions
GuyAfik d45ace7
fix message
GuyAfik 7b8279f
changelog
GuyAfik 115eeec
remove ssl and make const
GuyAfik 8493c57
change the changelog
GuyAfik 9296535
remove dot
GuyAfik dd4d404
cr fixes
GuyAfik 98175c3
code formatting
GuyAfik 9ad2350
add unit-tests for comment method
GuyAfik 538b787
fix comment_changelog_on_pr
GuyAfik d4a5bb8
pre-commit
GuyAfik cbff16e
Merge branch 'master' of github.com:demisto/demisto-sdk into enhance_…
GuyAfik 285b41d
fix tests
GuyAfik 345854c
last changes
GuyAfik 66c0a64
fix
GuyAfik d7504ac
pre-commit
GuyAfik 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
changes: | ||
- description: Added a new step in the **validate-changelog** to comment the changelog description in PR comments. | ||
type: internal | ||
- description: Added support to query the pull request number automatically when running **sdk-changelog --init** command. | ||
type: internal | ||
pr_number: 4040 |
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
50 changes: 50 additions & 0 deletions
50
Utils/github_workflow_scripts/changelog_comment_scripts/comment_changelog.py
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,50 @@ | ||
import argparse | ||
import sys | ||
|
||
from demisto_sdk.commands.common.logger import logger | ||
from demisto_sdk.scripts.changelog.changelog import Changelog | ||
|
||
|
||
def comment_changelog_on_pr(pr_num: int, latest_commit: str, github_token: str): | ||
try: | ||
Changelog(pr_num).comment(latest_commit, github_token) | ||
sys.exit(0) | ||
except Exception: | ||
logger.exception("Couldn't comment on the changelog.") | ||
sys.exit(1) | ||
|
||
|
||
def arguments_handler(): | ||
"""Validates and parses script arguments. | ||
|
||
Returns: | ||
Namespace: Parsed arguments object. | ||
|
||
""" | ||
parser = argparse.ArgumentParser(description="") | ||
parser.add_argument( | ||
"-n", "--pr-number", help="The PR number.", required=True, type=int | ||
) | ||
parser.add_argument( | ||
"-lt", | ||
"--latest_commit", | ||
help="The commit number that triggered the workflow.", | ||
required=True, | ||
) | ||
parser.add_argument( | ||
"-ght", "--github_token", help="The token for Github-Api", required=True | ||
) | ||
|
||
return parser.parse_args() | ||
|
||
|
||
def main(): | ||
options = arguments_handler() | ||
pr_num = options.pr_number | ||
latest_commit = options.latest_commit | ||
github_token = options.github_token | ||
comment_changelog_on_pr(pr_num, latest_commit, github_token) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider making this run only if the changelog validation passed (
needs: validate-changelog
) instead ofcontinue-on-error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdym? it already runs only if validate was successful. (its like the behaivor you described,
needs: validate-changelog
)I didn't see a reason to fail the whole job in case the comment step didn't work, that's why i use
continue_on_error
only on the last step.