Skip to content

Commit

Permalink
entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
janssensjelle committed Dec 30, 2024
1 parent dd00ade commit 786e2d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
15 changes: 15 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

cd /opt/hackster

# Pull latest changes
git pull origin develop

# Set GIT_COMMIT env var
export GIT_COMMIT=$(git rev-parse HEAD)

# Update dependencies
poetry install --no-cache

# Run startup script
exec /opt/hackster/startup.sh
10 changes: 1 addition & 9 deletions src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ def __init__(self, mock: bool = False, **kwargs):
logger.debug("Mocking the HTTP session")
self.http_session = None

def get_git_commit():
try:
return subprocess.check_output(['git', 'rev-parse', 'HEAD'],
cwd='/opt/hackster',
text=True).strip()[:7]
except:
return 'unknown'

async def on_ready(self) -> None:
if self.http_session is None:
logger.debug("Starting the HTTP session")
Expand All @@ -74,7 +66,7 @@ async def on_ready(self) -> None:
)

name = f"{self.user} (ID: {self.user.id})"
git_commit = get_git_commit()
git_commit = os.getenv('GIT_COMMIT', 'unknown')
devlog_msg = f"Connected {constants.emojis.partying_face}\nBuild: `{git_commit}`"
self.loop.create_task(self.send_log(devlog_msg, colour=constants.colours.bright_green))

Expand Down

0 comments on commit 786e2d4

Please sign in to comment.