Skip to content

Commit 2df61f1

Browse files
committed
Support GITHUB_SHA for creating permalinks
1 parent 304fe53 commit 2df61f1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pydis_core/exts/source.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Pre-built cog to display source code links for commands and cogs."""
22
import enum
33
import inspect
4+
import os
45
from importlib import metadata
56
from pathlib import Path
67
from typing import NamedTuple, TYPE_CHECKING
@@ -160,6 +161,8 @@ def _get_source_link(self, source_item: object, source_type: _SourceType) -> tup
160161

161162
if source_type == _SourceType.core_command or source_type == _SourceType.core_cog:
162163
version = f"v{metadata.version('pydis_core')}"
164+
elif sha := os.getenv("GITHUB_SHA"):
165+
version = sha
163166
else:
164167
version = "main"
165168

0 commit comments

Comments
 (0)