diff options
| author | 2025-11-09 23:50:40 +0000 | |
|---|---|---|
| committer | 2025-11-10 00:01:22 +0000 | |
| commit | 2df61f1bf0ae65b4247f5dbddb348199ad12f940 (patch) | |
| tree | 1699dfc2cee8853217646931c1ba092ac41099cb | |
| 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 32c0f0a5..5fe29306 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" |