You've already forked wakapi-readme-stats
add commit with own name and email config
This commit is contained in:
@@ -77,6 +77,10 @@ inputs:
|
||||
description: "Show stats in your own language"
|
||||
default: "en"
|
||||
|
||||
COMMIT_BY_ME:
|
||||
required: false
|
||||
description: "Git commit with your own name and email"
|
||||
default: "False"
|
||||
|
||||
runs:
|
||||
using: 'docker'
|
||||
|
||||
8
main.py
8
main.py
@@ -41,12 +41,14 @@ showLocChart = os.getenv('INPUT_SHOW_LOC_CHART')
|
||||
show_profile_view = os.getenv('INPUT_SHOW_PROFILE_VIEWS')
|
||||
show_short_info = os.getenv('INPUT_SHOW_SHORT_INFO')
|
||||
locale = os.getenv('INPUT_LOCALE')
|
||||
commit_by_me = os.getenv('INPUT_COMMIT_BY_ME')
|
||||
show_waka_stats = 'y'
|
||||
# The GraphQL query to get commit data.
|
||||
userInfoQuery = """
|
||||
{
|
||||
viewer {
|
||||
login
|
||||
email
|
||||
id
|
||||
}
|
||||
}
|
||||
@@ -484,8 +486,9 @@ if __name__ == '__main__':
|
||||
headers = {"Authorization": "Bearer " + ghtoken}
|
||||
user_data = run_query(userInfoQuery) # Execute the query
|
||||
username = user_data["data"]["viewer"]["login"]
|
||||
email = user_data["data"]["viewer"]["email"]
|
||||
id = user_data["data"]["viewer"]["id"]
|
||||
print(username)
|
||||
print("Username " + username + ", Email " + email)
|
||||
repo = g.get_repo(f"{username}/{username}")
|
||||
contents = repo.get_readme()
|
||||
try:
|
||||
@@ -499,6 +502,9 @@ if __name__ == '__main__':
|
||||
# star_me()
|
||||
rdmd = decode_readme(contents.content)
|
||||
new_readme = generate_new_readme(stats=waka_stats, readme=rdmd)
|
||||
if commit_by_me.lower() in truthy:
|
||||
committer = InputGitAuthor(username, email)
|
||||
else:
|
||||
committer = InputGitAuthor('readme-bot', '41898282+github-actions[bot]@users.noreply.github.com')
|
||||
if new_readme != rdmd:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user