diff options
| author | 2025-11-09 23:50:40 +0000 | |
|---|---|---|
| committer | 2025-11-10 23:19:27 +0000 | |
| commit | 250d7e429025a036e7fb4dcff473b6f97de828f7 (patch) | |
| tree | a047cf93cc9df7acf3048125b7967e2508624c6f | |
| parent | Move comment about tag handling (diff) | |
Support GITHUB_SHA for creating permalinks
| -rw-r--r-- | pydis_core/exts/source.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pydis_core/exts/source.py b/pydis_core/exts/source.py index c26be248..e54fcc98 100644 --- a/pydis_core/exts/source.py +++ b/pydis_core/exts/source.py @@ -1,6 +1,7 @@ """Pre-built cog to display source code links for commands and cogs.""" import enum import inspect +import os from importlib import metadata from pathlib import Path from typing import NamedTuple, TYPE_CHECKING @@ -160,6 +161,8 @@ class SourceCode(commands.Cog, description="Displays information about the bot's if source_type == _SourceType.core_command or source_type == _SourceType.core_cog: version = f"v{metadata.version('pydis_core')}" + elif sha := os.getenv("GITHUB_SHA"): + version = sha else: version = "main" |