Skip to content

Commit cfc254d

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

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
@@ -4,6 +4,7 @@
44
from importlib import metadata
55
from pathlib import Path
66
from typing import NamedTuple, TYPE_CHECKING
7+
import os
78

89
from discord import Embed
910
from discord.ext import commands
@@ -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)