Merge pull request #186 from dmego/gitconfig

option `COMMIT_BY_ME` flag can be set to `True` to commit the code using your name and email
This commit is contained in:
Anmol Pratap Singh
2021-04-14 13:50:37 +05:30
committed by GitHub
3 changed files with 13 additions and 2 deletions

View File

@@ -119,6 +119,7 @@ jobs:
`LOCALE` This Flag can be used to show stats in your language default is english uses Locale [Short Hand](https://saimana.com/list-of-country-locale-code/) to be passed in the flag variable example of the final result can be found [here](https://github.com/anmol098/anmol098/blob/master/Readme-fr.md)
`COMMIT_BY_ME` flag can be set to `True` to commit the code using your name and email
`SHOW_LINES_OF_CODE` flag can be set to `True` to show the Lines of code writen till date

View File

@@ -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'

View File

@@ -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)
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: