You've already forked wakapi-readme-stats
Merge pull request #234 from oHTGo/master
add options: commit message & show updated date FIX #228
This commit is contained in:
@@ -121,6 +121,10 @@ jobs:
|
|||||||
|
|
||||||
`COMMIT_BY_ME` flag can be set to `True` to commit the code using your name and email
|
`COMMIT_BY_ME` flag can be set to `True` to commit the code using your name and email
|
||||||
|
|
||||||
|
`COMMIT_MESSAGE` flag can be to set message commit, default is "Updated with Dev Metrics"
|
||||||
|
|
||||||
|
`SHOW_UPDATED_DATE` flag can be set to `True` to show updated date in end of paragraph
|
||||||
|
|
||||||
`SHOW_LINES_OF_CODE` flag can be set to `True` to show the Lines of code writen till date
|
`SHOW_LINES_OF_CODE` flag can be set to `True` to show the Lines of code writen till date
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
10
action.yml
10
action.yml
@@ -87,6 +87,16 @@ inputs:
|
|||||||
description: "Repos you don't want to be counted"
|
description: "Repos you don't want to be counted"
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
|
COMMIT_MESSAGE:
|
||||||
|
required: false
|
||||||
|
description: "Git commit message"
|
||||||
|
default: "Updated with Dev Metrics"
|
||||||
|
|
||||||
|
SHOW_UPDATED_DATE:
|
||||||
|
required: false
|
||||||
|
description: "Show updated date"
|
||||||
|
default: "True"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
image: 'Dockerfile'
|
image: 'Dockerfile'
|
||||||
|
|||||||
8
main.py
8
main.py
@@ -44,6 +44,8 @@ show_short_info = os.getenv('INPUT_SHOW_SHORT_INFO')
|
|||||||
locale = os.getenv('INPUT_LOCALE')
|
locale = os.getenv('INPUT_LOCALE')
|
||||||
commit_by_me = os.getenv('INPUT_COMMIT_BY_ME')
|
commit_by_me = os.getenv('INPUT_COMMIT_BY_ME')
|
||||||
ignored_repos_name = str(os.getenv('INPUT_IGNORED_REPOS') or '').replace(' ', '').split(',')
|
ignored_repos_name = str(os.getenv('INPUT_IGNORED_REPOS') or '').replace(' ', '').split(',')
|
||||||
|
show_updated_date = os.getenv('INPUT_SHOW_UPDATED_DATE')
|
||||||
|
commit_message = os.getenv('INPUT_COMMIT_MESSAGE')
|
||||||
show_waka_stats = 'y'
|
show_waka_stats = 'y'
|
||||||
# The GraphQL query to get commit data.
|
# The GraphQL query to get commit data.
|
||||||
userInfoQuery = """
|
userInfoQuery = """
|
||||||
@@ -465,6 +467,8 @@ def get_stats(github):
|
|||||||
stats += '**' + translate['Timeline'] + '**\n\n'
|
stats += '**' + translate['Timeline'] + '**\n\n'
|
||||||
branch_name = github.get_repo(f'{username}/{username}').default_branch
|
branch_name = github.get_repo(f'{username}/{username}').default_branch
|
||||||
stats = stats + ' \n\n'
|
stats = stats + ' \n\n'
|
||||||
|
|
||||||
|
if show_updated_date.lower() in truthy:
|
||||||
today = date.today()
|
today = date.today()
|
||||||
d1 = today.strftime("%d/%m/%Y")
|
d1 = today.strftime("%d/%m/%Y")
|
||||||
stats = stats + "\n Last Updated on " + d1
|
stats = stats + "\n Last Updated on " + d1
|
||||||
@@ -518,11 +522,11 @@ if __name__ == '__main__':
|
|||||||
committer = InputGitAuthor('readme-bot', '41898282+github-actions[bot]@users.noreply.github.com')
|
committer = InputGitAuthor('readme-bot', '41898282+github-actions[bot]@users.noreply.github.com')
|
||||||
if new_readme != rdmd:
|
if new_readme != rdmd:
|
||||||
try:
|
try:
|
||||||
repo.update_file(path=contents.path, message='Updated with Dev Metrics',
|
repo.update_file(path=contents.path, message=commit_message,
|
||||||
content=new_readme, sha=contents.sha, branch='master',
|
content=new_readme, sha=contents.sha, branch='master',
|
||||||
committer=committer)
|
committer=committer)
|
||||||
except:
|
except:
|
||||||
repo.update_file(path=contents.path, message='Updated with Dev Metrics',
|
repo.update_file(path=contents.path, message=commit_message,
|
||||||
content=new_readme, sha=contents.sha, branch='main',
|
content=new_readme, sha=contents.sha, branch='main',
|
||||||
committer=committer)
|
committer=committer)
|
||||||
print("Readme updated")
|
print("Readme updated")
|
||||||
|
|||||||
Reference in New Issue
Block a user