From 2d96adcf46b0f8574505bd29f0ccb9f7d7d333ff Mon Sep 17 00:00:00 2001 From: Lucy Date: Sat, 12 Jul 2025 16:22:54 -0400 Subject: [PATCH] Add a new lint to ensure `genesis_call.dme` isn't accidentally changed (#92014) ## About The Pull Request Port of https://github.com/Monkestation/Monkestation2.0/pull/7121 > adds a new lint to just verify the sha256sum of `code/genesis_call.dme`, to ensure it's not accidentally mangled from someone using dreammaker as an IDE instead of vscode or something: > > ![image](https://github.com/user-attachments/assets/621ad2b0-ec27-4fe5-b870-e08e726543fa) ## Changelog > no actual in-game changes --- .github/workflows/run_linters.yml | 3 +++ tools/ci/check_genesis.sh | 20 ++++++++++++++++++++ tools/ci/genesis_call.dme.sha256sum | 1 + 3 files changed, 24 insertions(+) create mode 100755 tools/ci/check_genesis.sh create mode 100644 tools/ci/genesis_call.dme.sha256sum diff --git a/.github/workflows/run_linters.yml b/.github/workflows/run_linters.yml index 01359cb1eb4..294286722cd 100644 --- a/.github/workflows/run_linters.yml +++ b/.github/workflows/run_linters.yml @@ -58,6 +58,9 @@ jobs: - name: Give Linters A Go id: linter-setup run: ":" + - name: Ensure genesis_call.dme is unchanged + if: steps.linter-setup.conclusion == 'success' && !cancelled() + run: bash tools/ci/check_genesis.sh - name: Run Grep Checks if: steps.linter-setup.conclusion == 'success' && !cancelled() run: bash tools/ci/check_grep.sh diff --git a/tools/ci/check_genesis.sh b/tools/ci/check_genesis.sh new file mode 100755 index 00000000000..08d064af17a --- /dev/null +++ b/tools/ci/check_genesis.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -euo pipefail + +#ANSI Escape Codes for colors to increase contrast of errors +RED="\033[0;31m" +GREEN="\033[0;32m" +BLUE="\033[0;34m" +NC="\033[0m" # No Color + +if sha256sum -c tools/ci/genesis_call.dme.sha256sum ; then + echo -e "${GREEN}code/genesis_call.dme is unchanged.${NC}" +else + echo -e "${RED}code/genesis_call.dme has been changed!${NC}" + echo -e "${BLUE}This is likely not intentional, please revert any changes made to it.${NC}" + echo -e "${BLUE}On the unlikely occurance that you ARE intentionally modifying that file, replace the contents of tools/ci/genesis_call.dme.sha256sum with the following:${NC}" + + sha256sum tools/ci/genesis_call.dme.sha256sum + + exit 1 +fi diff --git a/tools/ci/genesis_call.dme.sha256sum b/tools/ci/genesis_call.dme.sha256sum new file mode 100644 index 00000000000..7238dacd388 --- /dev/null +++ b/tools/ci/genesis_call.dme.sha256sum @@ -0,0 +1 @@ +393cbb0404a017c61777b178fe5612e033a396550e8633a51fd902cc9912b8b6 code/genesis_call.dme