Skip to content

Commit

Permalink
Add last commit badges (#1566)
Browse files Browse the repository at this point in the history
* Add last commit badges

* Add last commit badges

* Remove print

* Fix lint errors

* WIP
  • Loading branch information
bdovaz committed Jun 26, 2022
1 parent f8f39ff commit 7eef5b8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .automation/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2208,6 +2208,7 @@ def generate_documentation_all_users():
file.write("\n".join(linter_doc_md) + "\n")
logging.info(f"Generated {REPO_HOME}/docs/all_users.md")


# https://shields.io/category/activity
def get_repository_badge_url(linter):
repo_url = None
Expand All @@ -2224,12 +2225,14 @@ def get_repository_badge_url(linter):
badge = ""

if repo_url is not None:
match = re.search('https:\/\/github\.com\/(.*)\/(.*)', repo_url)
match = re.search(r'https://github\.com/(.*)/(.*)', repo_url)

badge = f"[![GitHub last commit](https://img.shields.io/github/last-commit/{match.group(1)}/{match.group(2)})]({repo_url}/commits)"
badge_url = f"https://img.shields.io/github/last-commit/{match.group(1)}/{match.group(2)}"
badge = f"[![GitHub last commit]({badge_url})]({repo_url}/commits)"

return badge


# get github repo info using api
def get_github_repo_info(repo):
api_github_url = f"https://api.github.com/repos/{repo}"
Expand Down

0 comments on commit 7eef5b8

Please sign in to comment.