-
Notifications
You must be signed in to change notification settings - Fork 21
Allow custom commit message and pull request title #12
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
Changes from 5 commits
cffc878
dd0c254
bfe1d2f
dc424e4
0d6a9aa
c47c62f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,10 +15,12 @@ class GitHubActionsVersionUpdater: | |
| github_url = 'https://github.com/' | ||
| action_label = 'uses' | ||
|
|
||
| def __init__(self, repository, base_branch, token, ignore_actions=None): | ||
| def __init__(self, repository, base_branch, token, commit_message=None, pr_title=None, ignore_actions=None): | ||
| self.repository = repository | ||
| self.base_branch = base_branch | ||
| self.token = token | ||
| self.commit_message = commit_message or 'Update GitHub Action Versions' | ||
| self.pr_title = pr_title or 'Update GitHub Action Versions' | ||
| self.ignore_actions = self.get_ignored_actions(ignore_actions) | ||
| self.workflow_updated = False | ||
|
|
||
|
|
@@ -183,7 +185,7 @@ def create_new_branch(self): | |
| ) | ||
| subprocess.run(['git', 'add', '.']) | ||
| subprocess.run( | ||
| ['git', 'commit', '-m', 'Update GitHub Action Versions'] | ||
| ['git', 'commit', '-m', commit_message] | ||
| ) | ||
|
|
||
| subprocess.run(['git', 'push', '-u', 'origin', new_branch]) | ||
|
|
@@ -196,7 +198,7 @@ def create_pull_request(self, branch_name, body): | |
| """Create pull request on GitHub""" | ||
| url = f'{self.github_api_url}/repos/{self.repository}/pulls' | ||
| payload = { | ||
| 'title': 'Update GitHub Action Versions', | ||
| 'title': pr_title, | ||
|
itsMaxC marked this conversation as resolved.
Outdated
|
||
| 'head': branch_name, | ||
| 'base': self.base_branch, | ||
| 'body': body, | ||
|
|
@@ -312,6 +314,10 @@ def print_message(message, message_type=None): | |
| email = os.environ['INPUT_COMMITTER_EMAIL'] | ||
| # Actions that should not be updated | ||
| ignore = os.environ['INPUT_IGNORE'] | ||
| # Commit message | ||
| commit_message = os.environ['INPUT_COMMIT_MESSAGE'] | ||
| # Pull Request Title | ||
| pr_title = os.environ['INPUT_PULL_REQUEST_TITLE'] | ||
|
Comment on lines
+318
to
+320
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should pass these to the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am very much a newbie with Python, I will look into this and figure it out :)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @saadmk11 - added it but I am not sure it was in the spirit of your suggestion. Let me know and thank you! |
||
|
|
||
| # Group: Configure Git | ||
| print_message('Configure Git', message_type='group') | ||
|
|
@@ -326,7 +332,7 @@ def print_message(message, message_type=None): | |
|
|
||
| # Initialize GitHubActionsVersionUpdater | ||
| actions_version_updater = GitHubActionsVersionUpdater( | ||
| repository, base_branch, token, ignore_actions=ignore | ||
| repository, base_branch, token, commit_message=commit_message, pr_title=pr_title, ignore_actions=ignore | ||
| ) | ||
| actions_version_updater.run() | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.