From 0bb2739f1275e45a893336361abe7d8a32fefef0 Mon Sep 17 00:00:00 2001 From: Donian960 Date: Wed, 5 Feb 2025 23:41:31 +0000 Subject: [PATCH 1/9] Adds the everest command --- cogs/__init__.py | 3 ++ cogs/everest.py | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 cogs/everest.py diff --git a/cogs/__init__.py b/cogs/__init__.py index ec67465c0..80a77fba2 100644 --- a/cogs/__init__.py +++ b/cogs/__init__.py @@ -39,6 +39,7 @@ from .stats import StatsCommandsCog from .strike import ManualModerationCog, StrikeCommandCog, StrikeContextCommandsCog from .write_roles import WriteRolesCommandCog +from .everest import EverestCommandCog if TYPE_CHECKING: from collections.abc import Iterable, Sequence @@ -76,6 +77,7 @@ "StrikeCommandCog", "StrikeUserCommandCog", "WriteRolesCommandCog", + "EverestCommandCog" "setup", ) @@ -113,6 +115,7 @@ def setup(bot: "TeXBot") -> None: StrikeCommandCog, StrikeContextCommandsCog, WriteRolesCommandCog, + EverestCommandCog ) Cog: type[TeXBotBaseCog] for Cog in cogs: diff --git a/cogs/everest.py b/cogs/everest.py new file mode 100644 index 000000000..e13b9ea36 --- /dev/null +++ b/cogs/everest.py @@ -0,0 +1,72 @@ +"""Contains cog classes for any everest interactions.""" + +import random +from typing import TYPE_CHECKING + +import discord + +from config import settings +from utils import TeXBotBaseCog + +if TYPE_CHECKING: + from collections.abc import Sequence + + from utils import TeXBotApplicationContext + +__all__: "Sequence[str]" = ("EverestCommandCog",) + + +class EverestCommandCog(TeXBotBaseCog): + """Cog class that defines the "/everest" command and its call-back method.""" + + @client.tree.command(description="How many steps of everest is your assignment worth?") # The description of the command + @app_commands.describe( + course="What course are you on (bsc or msci)", + year="Current year of the course (1 to 4)", + value="What % of a module is the assignment worth" + ) # The descriptions of the attributes of the command + async def everest(interaction: discord.Interaction, course: str, year: int, value: float): # defining function + message_start = "Course: " + str(course) + ", Year: " + str(year) + ", Value: " +str(value) + "%\n" # message data + + course = course.lower() # allowing capital courses + + if course != "bsc" and course != "msci": # weeding out fake courses + message = message_start + "That's not a real course :(" # preparing to tell the user to go away + await interaction.response.send_message(message) # telling the user to go away + else: # if the course is real + failure = False # it hasn't failed yet + + try: # seeing if it will fail in a safe way + year = int(year) # checking the year is an int + value = float(value) # checking the % is valid + except: # if they aren't + failure = True # it's failed + message = message_start + "Invalid data type :(" # preparing to tell the user to go away + await interaction.response.send_message(message) # telling the user to go away + + if failure == False: # if it didn't fail + if year < 1 or (year > 3 and course == "bsc") or (year > 4 and course == "msci"): # checking they are on a real year + message = message_start + "Invalid year :(" # preparing to tell the user to go away + await interaction.response.send_message(message) # telling the user to go away + + else: # if they're on a real year + if course == "bsc": # this + if year == 1: # is + year_value = 0 # just + elif year == 2: # a + year_value = 0.25 # longer + else: # way + year_value = 0.75 # to + if course == "msci": # do + if year == 1: # a + year_value = 0 # dictionary + elif year == 2: # but + year_value = 0.2 # too + else: # bad + year_value = 0.4 # how much is each year worth + + steps = (value / 100) * 1 / 6 * year_value * 44250 # actually calculating the steps of everest (assumes modules are worth 20 / 120 credits) + + message = message_start + "This assignment is worth " + str(int(steps)) + " steps of Mt. Everest!" # preparing to tell the user how much they walked + await interaction.response.send_message(message) # telling the user how much they walked + From 78ac34b4ce41e612326d5676f5d1de2cff8c1aa2 Mon Sep 17 00:00:00 2001 From: Matt Norton Date: Sun, 9 Feb 2025 02:00:00 +0000 Subject: [PATCH 2/9] Fix import ordering & missing commas --- cogs/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cogs/__init__.py b/cogs/__init__.py index 80a77fba2..aa5e67516 100644 --- a/cogs/__init__.py +++ b/cogs/__init__.py @@ -20,6 +20,7 @@ ) from .delete_all import DeleteAllCommandsCog from .edit_message import EditMessageCommandCog +from .everest import EverestCommandCog from .get_token_authorisation import GetTokenAuthorisationCommandCog from .induct import ( EnsureMembersInductedCommandCog, @@ -39,7 +40,6 @@ from .stats import StatsCommandsCog from .strike import ManualModerationCog, StrikeCommandCog, StrikeContextCommandsCog from .write_roles import WriteRolesCommandCog -from .everest import EverestCommandCog if TYPE_CHECKING: from collections.abc import Iterable, Sequence @@ -58,6 +58,7 @@ "DeleteAllCommandsCog", "EditMessageCommandCog", "EnsureMembersInductedCommandCog", + "EverestCommandCog", "GetTokenAuthorisationCommandCog", "InductContextCommandsCog", "InductSendMessageCog", @@ -77,7 +78,6 @@ "StrikeCommandCog", "StrikeUserCommandCog", "WriteRolesCommandCog", - "EverestCommandCog" "setup", ) @@ -96,6 +96,7 @@ def setup(bot: "TeXBot") -> None: DeleteAllCommandsCog, EditMessageCommandCog, EnsureMembersInductedCommandCog, + EverestCommandCog, GetTokenAuthorisationCommandCog, InductContextCommandsCog, InductSendMessageCog, @@ -115,7 +116,6 @@ def setup(bot: "TeXBot") -> None: StrikeCommandCog, StrikeContextCommandsCog, WriteRolesCommandCog, - EverestCommandCog ) Cog: type[TeXBotBaseCog] for Cog in cogs: From 40c4eeb162d770374761cfd390524eef5adddba9 Mon Sep 17 00:00:00 2001 From: Matt Norton Date: Sun, 9 Feb 2025 02:13:51 +0000 Subject: [PATCH 3/9] Add function definition fixes --- cogs/everest.py | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/cogs/everest.py b/cogs/everest.py index e13b9ea36..84ff74f4e 100644 --- a/cogs/everest.py +++ b/cogs/everest.py @@ -19,23 +19,50 @@ class EverestCommandCog(TeXBotBaseCog): """Cog class that defines the "/everest" command and its call-back method.""" - @client.tree.command(description="How many steps of everest is your assignment worth?") # The description of the command + @staticmethod + async def autocomplete_get_course_types( + ctx: "TeXBotAutocompleteContext", + ) -> "AbstractSet[discord.OptionChoice] | AbstractSet[str]": + raise NotImplementedError # TODO(Donian960) + + @discord.slash_command(description="How many steps of everest is your assignment worth?") @app_commands.describe( course="What course are you on (bsc or msci)", year="Current year of the course (1 to 4)", value="What % of a module is the assignment worth" - ) # The descriptions of the attributes of the command - async def everest(interaction: discord.Interaction, course: str, year: int, value: float): # defining function + ) + @discord.option( # type: ignore[no-untyped-call, misc] + name="course", + description="Your type of university course: B.Sc. or M.Sci.", + input_type=..., # TODO(Donian960): Make type into a limited set of choices + autocomplete=discord.utils.basic_autocomplete(autocomplete_get_course_types), # type: ignore[arg-type] + required=True, + parameter_name="course_type", + ) + @discord.option( # type: ignore[no-untyped-call, misc] + name="year", + description="Current year of the course (1 to 4).", + input_type=..., # TODO(Donian960): Make type into a limited set of choices + required=True, + parameter_name="current_course_year", + ) + @discord.option( # type: ignore[no-untyped-call, misc] + name="module_percentage", + description="The percentage of a module that the assignment worth.", + input_type=float, # TODO(Donian960): limit values to between 0% & 100% + required=True, + ) + async def everest(self, ctx: "TeXBotApplicationContext", course_type: ..., current_course_year: int, module_percentage: float): # TODO(Donian960): Choose correct type for 'course_type' variable message_start = "Course: " + str(course) + ", Year: " + str(year) + ", Value: " +str(value) + "%\n" # message data course = course.lower() # allowing capital courses - + if course != "bsc" and course != "msci": # weeding out fake courses message = message_start + "That's not a real course :(" # preparing to tell the user to go away await interaction.response.send_message(message) # telling the user to go away else: # if the course is real failure = False # it hasn't failed yet - + try: # seeing if it will fail in a safe way year = int(year) # checking the year is an int value = float(value) # checking the % is valid @@ -58,15 +85,14 @@ async def everest(interaction: discord.Interaction, course: str, year: int, valu else: # way year_value = 0.75 # to if course == "msci": # do - if year == 1: # a + if year == 1: # a year_value = 0 # dictionary elif year == 2: # but - year_value = 0.2 # too + year_value = 0.2 # too else: # bad year_value = 0.4 # how much is each year worth - + steps = (value / 100) * 1 / 6 * year_value * 44250 # actually calculating the steps of everest (assumes modules are worth 20 / 120 credits) message = message_start + "This assignment is worth " + str(int(steps)) + " steps of Mt. Everest!" # preparing to tell the user how much they walked await interaction.response.send_message(message) # telling the user how much they walked - From be52e0dc828817f21f18483ae24479cc63af4690 Mon Sep 17 00:00:00 2001 From: MattyTheHacker <18513864+MattyTheHacker@users.noreply.github.com> Date: Sat, 1 Mar 2025 13:09:52 +0000 Subject: [PATCH 4/9] Add fork check --- .github/workflows/update-dev-container-image.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-dev-container-image.yaml b/.github/workflows/update-dev-container-image.yaml index 152d4007d..1481182a2 100644 --- a/.github/workflows/update-dev-container-image.yaml +++ b/.github/workflows/update-dev-container-image.yaml @@ -12,6 +12,7 @@ jobs: packages: write if: ${{ ! startsWith(github.head_ref, 'dependabot/') }} + if: ${{ github.event.pull_request.head.repo.full_name == 'CSSUoB/TeX-Bot-Py-V2' }} steps: - uses: docker/setup-buildx-action@v3 From 89b49ed43d012dc510a68b089548c7eb816255e8 Mon Sep 17 00:00:00 2001 From: MattyTheHacker <18513864+MattyTheHacker@users.noreply.github.com> Date: Sat, 1 Mar 2025 14:29:11 +0000 Subject: [PATCH 5/9] Fix errors and cleanup --- cogs/everest.py | 153 +++++++++++++++++++++++++++++------------------- 1 file changed, 92 insertions(+), 61 deletions(-) diff --git a/cogs/everest.py b/cogs/everest.py index 84ff74f4e..336696193 100644 --- a/cogs/everest.py +++ b/cogs/everest.py @@ -1,40 +1,49 @@ """Contains cog classes for any everest interactions.""" -import random from typing import TYPE_CHECKING import discord -from config import settings from utils import TeXBotBaseCog if TYPE_CHECKING: from collections.abc import Sequence + from collections.abc import Set as AbstractSet + from typing import Final - from utils import TeXBotApplicationContext + from utils import TeXBotApplicationContext, TeXBotAutocompleteContext __all__: "Sequence[str]" = ("EverestCommandCog",) +POSSIBLE_COURSE_TYPES: "Final[AbstractSet[str]]" = {"B.Sc.", "M.Sci."} +POSSIBLE_YEARS: "Final[AbstractSet[int]]" = {1, 2, 3, 4} + +BSC_WEIGHTINGS: "Final[list[float]]" = [0, 0.25, 0.75] +MSCI_WEIGHTINGS: "Final[list[float]]" = [0, 0.2, 0.4, 0.4] + + class EverestCommandCog(TeXBotBaseCog): """Cog class that defines the "/everest" command and its call-back method.""" @staticmethod - async def autocomplete_get_course_types( - ctx: "TeXBotAutocompleteContext", - ) -> "AbstractSet[discord.OptionChoice] | AbstractSet[str]": - raise NotImplementedError # TODO(Donian960) - - @discord.slash_command(description="How many steps of everest is your assignment worth?") - @app_commands.describe( - course="What course are you on (bsc or msci)", - year="Current year of the course (1 to 4)", - value="What % of a module is the assignment worth" + async def autocomplete_get_course_types(ctx: "TeXBotAutocompleteContext",) -> "AbstractSet[discord.OptionChoice] | AbstractSet[str]": # noqa: E501, ARG004 + """Autocomplete for the course type option.""" + return POSSIBLE_COURSE_TYPES + + @staticmethod + async def autocomplete_get_course_years(ctx: "TeXBotAutocompleteContext",) -> "AbstractSet[discord.OptionChoice] | AbstractSet[int]": # noqa: E501, ARG004 + """Autocomplete for the course year option.""" + return POSSIBLE_YEARS + + @discord.slash_command( # type: ignore[no-untyped-call, misc] + name="everest", + description="How many steps of everest is your assignment worth?" ) @discord.option( # type: ignore[no-untyped-call, misc] - name="course", + name="course-type", description="Your type of university course: B.Sc. or M.Sci.", - input_type=..., # TODO(Donian960): Make type into a limited set of choices + input_type=str, autocomplete=discord.utils.basic_autocomplete(autocomplete_get_course_types), # type: ignore[arg-type] required=True, parameter_name="course_type", @@ -42,57 +51,79 @@ async def autocomplete_get_course_types( @discord.option( # type: ignore[no-untyped-call, misc] name="year", description="Current year of the course (1 to 4).", - input_type=..., # TODO(Donian960): Make type into a limited set of choices + input_type=int, + autocomplete=discord.utils.basic_autocomplete(autocomplete_get_course_years), # type: ignore[arg-type] required=True, parameter_name="current_course_year", ) @discord.option( # type: ignore[no-untyped-call, misc] name="module_percentage", description="The percentage of a module that the assignment worth.", - input_type=float, # TODO(Donian960): limit values to between 0% & 100% + input_type=float, required=True, ) - async def everest(self, ctx: "TeXBotApplicationContext", course_type: ..., current_course_year: int, module_percentage: float): # TODO(Donian960): Choose correct type for 'course_type' variable - message_start = "Course: " + str(course) + ", Year: " + str(year) + ", Value: " +str(value) + "%\n" # message data - - course = course.lower() # allowing capital courses - - if course != "bsc" and course != "msci": # weeding out fake courses - message = message_start + "That's not a real course :(" # preparing to tell the user to go away - await interaction.response.send_message(message) # telling the user to go away - else: # if the course is real - failure = False # it hasn't failed yet - - try: # seeing if it will fail in a safe way - year = int(year) # checking the year is an int - value = float(value) # checking the % is valid - except: # if they aren't - failure = True # it's failed - message = message_start + "Invalid data type :(" # preparing to tell the user to go away - await interaction.response.send_message(message) # telling the user to go away - - if failure == False: # if it didn't fail - if year < 1 or (year > 3 and course == "bsc") or (year > 4 and course == "msci"): # checking they are on a real year - message = message_start + "Invalid year :(" # preparing to tell the user to go away - await interaction.response.send_message(message) # telling the user to go away - - else: # if they're on a real year - if course == "bsc": # this - if year == 1: # is - year_value = 0 # just - elif year == 2: # a - year_value = 0.25 # longer - else: # way - year_value = 0.75 # to - if course == "msci": # do - if year == 1: # a - year_value = 0 # dictionary - elif year == 2: # but - year_value = 0.2 # too - else: # bad - year_value = 0.4 # how much is each year worth - - steps = (value / 100) * 1 / 6 * year_value * 44250 # actually calculating the steps of everest (assumes modules are worth 20 / 120 credits) - - message = message_start + "This assignment is worth " + str(int(steps)) + " steps of Mt. Everest!" # preparing to tell the user how much they walked - await interaction.response.send_message(message) # telling the user how much they walked + async def everest(self, ctx: "TeXBotApplicationContext", course_type: str, current_course_year: int, module_percentage: float) -> None: + """Calculate how many steps of Mount Everest an assignment is worth.""" + if course_type not in POSSIBLE_COURSE_TYPES: + await ctx.respond( + content=( + f"{course_type} is not a valid course type. Please use the autocomplete." + ) + ) + return + + INVALID_COURSE_YEAR_MESSAGE: Final[str] = ( + f"Course year: {current_course_year} is not valid. Please use the autocomplete." + ) + + try: + current_course_year = int(current_course_year) + except ValueError: + await ctx.respond(content=INVALID_COURSE_YEAR_MESSAGE) + return + + if current_course_year not in POSSIBLE_YEARS: + await ctx.respond(content=INVALID_COURSE_YEAR_MESSAGE) + return + + INVALID_MODULE_WEIGHT_MESSAGE: Final[str] = ( + f"Module weight: {module_percentage} is not valid." + "Please enter a positive number less than or equal to 100." + ) + try: + module_weight = float(module_percentage) + except ValueError: + await ctx.respond(content=INVALID_MODULE_WEIGHT_MESSAGE) + return + + if module_weight < 0 or module_weight > 100: + await ctx.respond(content=INVALID_MODULE_WEIGHT_MESSAGE) + return + + + if current_course_year == 4 and course_type == "B.Sc.": + await ctx.respond( + content=( + "You have selected 4th year of a B.Sc. course, which is not valid." + "If you are in final year, please select 3rd year." + ) + ) + return + + year_value: float = 0 + + if course_type == "B.Sc.": + year_value = BSC_WEIGHTINGS[current_course_year - 1] + if course_type == "msci": + year_value = MSCI_WEIGHTINGS[current_course_year - 1] + + steps = (module_weight / 100) * 1 / 6 * year_value * 44250 # NOTE: Assumes all modules are 20 credits + + await ctx.respond( + content=( + f"Course: {course_type}, " + f"Year: {current_course_year}, " + f"Weight: {module_percentage}%\n" + f"This assignment is worth {int(steps)} steps of Mt. Everest!" + ) + ) From bf6589834a812775a1b4c01132509580491f58d1 Mon Sep 17 00:00:00 2001 From: MattyTheHacker <18513864+MattyTheHacker@users.noreply.github.com> Date: Sun, 13 Apr 2025 13:35:43 +0100 Subject: [PATCH 6/9] Refactor for new checks --- cogs/everest.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/cogs/everest.py b/cogs/everest.py index 336696193..59a746b76 100644 --- a/cogs/everest.py +++ b/cogs/everest.py @@ -27,18 +27,21 @@ class EverestCommandCog(TeXBotBaseCog): """Cog class that defines the "/everest" command and its call-back method.""" @staticmethod - async def autocomplete_get_course_types(ctx: "TeXBotAutocompleteContext",) -> "AbstractSet[discord.OptionChoice] | AbstractSet[str]": # noqa: E501, ARG004 + async def autocomplete_get_course_types( + ctx: "TeXBotAutocompleteContext", # noqa: ARG004 + ) -> "AbstractSet[discord.OptionChoice] | AbstractSet[str]": """Autocomplete for the course type option.""" return POSSIBLE_COURSE_TYPES @staticmethod - async def autocomplete_get_course_years(ctx: "TeXBotAutocompleteContext",) -> "AbstractSet[discord.OptionChoice] | AbstractSet[int]": # noqa: E501, ARG004 + async def autocomplete_get_course_years( + ctx: "TeXBotAutocompleteContext", # noqa: ARG004 + ) -> "AbstractSet[discord.OptionChoice] | AbstractSet[int]": """Autocomplete for the course year option.""" return POSSIBLE_YEARS @discord.slash_command( # type: ignore[no-untyped-call, misc] - name="everest", - description="How many steps of everest is your assignment worth?" + name="everest", description="How many steps of everest is your assignment worth?" ) @discord.option( # type: ignore[no-untyped-call, misc] name="course-type", @@ -62,7 +65,13 @@ async def autocomplete_get_course_years(ctx: "TeXBotAutocompleteContext",) -> "A input_type=float, required=True, ) - async def everest(self, ctx: "TeXBotApplicationContext", course_type: str, current_course_year: int, module_percentage: float) -> None: + async def everest( # type: ignore[misc] + self, + ctx: "TeXBotApplicationContext", + course_type: str, + current_course_year: int, + module_percentage: float, + ) -> None: """Calculate how many steps of Mount Everest an assignment is worth.""" if course_type not in POSSIBLE_COURSE_TYPES: await ctx.respond( @@ -83,8 +92,8 @@ async def everest(self, ctx: "TeXBotApplicationContext", course_type: str, curre return if current_course_year not in POSSIBLE_YEARS: - await ctx.respond(content=INVALID_COURSE_YEAR_MESSAGE) - return + await ctx.respond(content=INVALID_COURSE_YEAR_MESSAGE) + return INVALID_MODULE_WEIGHT_MESSAGE: Final[str] = ( f"Module weight: {module_percentage} is not valid." @@ -100,7 +109,6 @@ async def everest(self, ctx: "TeXBotApplicationContext", course_type: str, curre await ctx.respond(content=INVALID_MODULE_WEIGHT_MESSAGE) return - if current_course_year == 4 and course_type == "B.Sc.": await ctx.respond( content=( @@ -117,7 +125,9 @@ async def everest(self, ctx: "TeXBotApplicationContext", course_type: str, curre if course_type == "msci": year_value = MSCI_WEIGHTINGS[current_course_year - 1] - steps = (module_weight / 100) * 1 / 6 * year_value * 44250 # NOTE: Assumes all modules are 20 credits + steps = ( + (module_weight / 100) * 1 / 6 * year_value * 44250 + ) # NOTE: Assumes all modules are 20 credits await ctx.respond( content=( From 8ef1d078128c41cc508562d2a5ce7bfe468fb307 Mon Sep 17 00:00:00 2001 From: MattyTheHacker <18513864+MattyTheHacker@users.noreply.github.com> Date: Sun, 13 Apr 2025 20:39:55 +0100 Subject: [PATCH 7/9] Add fork check --- .github/workflows/check-build-deploy.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-build-deploy.yaml b/.github/workflows/check-build-deploy.yaml index 9b964ac65..2b66d3a18 100644 --- a/.github/workflows/check-build-deploy.yaml +++ b/.github/workflows/check-build-deploy.yaml @@ -275,7 +275,9 @@ jobs: contents: write id-token: write - if: github.ref_type == 'tag' + if: github.ref_type == 'tag' && ( (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name + == 'CSSUoB/TeX-Bot-Py-V2') || (github.event_name == 'push' && github.repository == 'CSSUoB/TeX-Bot-Py-V2') + ) steps: - name: Create GitHub Release From 308ab8b2911b7e448e9b842b1d1d9027cc02198f Mon Sep 17 00:00:00 2001 From: MattyTheHacker <18513864+MattyTheHacker@users.noreply.github.com> Date: Sun, 13 Apr 2025 20:43:27 +0100 Subject: [PATCH 8/9] move check --- .github/workflows/check-build-deploy.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-build-deploy.yaml b/.github/workflows/check-build-deploy.yaml index 2b66d3a18..b9a60cb18 100644 --- a/.github/workflows/check-build-deploy.yaml +++ b/.github/workflows/check-build-deploy.yaml @@ -217,6 +217,9 @@ jobs: run: uv run -- ruff check --no-fix --output-format=github build-and-publish: + if: | + (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name== 'CSSUoB/TeX-Bot-Py-V2') || + (github.event_name == 'push' && github.repository == 'CSSUoB/TeX-Bot-Py-V2') runs-on: ubuntu-latest environment: publish needs: [mypy, pre-commit, prevent-migrations-deletion, pymarkdown, pytest, ruff-lint, uv-check] @@ -275,9 +278,7 @@ jobs: contents: write id-token: write - if: github.ref_type == 'tag' && ( (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name - == 'CSSUoB/TeX-Bot-Py-V2') || (github.event_name == 'push' && github.repository == 'CSSUoB/TeX-Bot-Py-V2') - ) + if: github.ref_type == 'tag' steps: - name: Create GitHub Release From cd238782f913f692cba0b2b8ecde6fab10010084 Mon Sep 17 00:00:00 2001 From: MattyTheHacker <18513864+MattyTheHacker@users.noreply.github.com> Date: Mon, 14 Apr 2025 11:31:12 +0100 Subject: [PATCH 9/9] fix check --- .github/workflows/check-build-deploy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-build-deploy.yaml b/.github/workflows/check-build-deploy.yaml index b9a60cb18..ba285b129 100644 --- a/.github/workflows/check-build-deploy.yaml +++ b/.github/workflows/check-build-deploy.yaml @@ -218,8 +218,8 @@ jobs: build-and-publish: if: | - (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name== 'CSSUoB/TeX-Bot-Py-V2') || - (github.event_name == 'push' && github.repository == 'CSSUoB/TeX-Bot-Py-V2') + github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name== 'CSSUoB/TeX-Bot-Py-V2' runs-on: ubuntu-latest environment: publish needs: [mypy, pre-commit, prevent-migrations-deletion, pymarkdown, pytest, ruff-lint, uv-check]