-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from fastapi import APIRouter | ||
import subprocess | ||
|
||
router = APIRouter() | ||
|
||
@router.get("/info") | ||
async def get_build_number(): | ||
try: | ||
# Run the "git rev-parse HEAD" command to get the latest commit hash | ||
commit_hash = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode().strip() | ||
return {"build_number": commit_hash} | ||
except Exception as e: | ||
return {"error": str(e)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters