From 613954184a42d6ada0973edd377b1b59df717f67 Mon Sep 17 00:00:00 2001 From: Bart Thomee <11445373+bthomee@users.noreply.github.com> Date: Thu, 23 Oct 2025 10:39:42 -0400 Subject: [PATCH] Add CI step to enforce renaming --- {bin => .github/scripts}/rename/README.md | 9 ++-- .../scripts}/rename/definitions.sh | 2 +- .github/workflows/on-pr.yml | 5 +++ .github/workflows/reusable-check-rename.yml | 42 +++++++++++++++++++ 4 files changed, 53 insertions(+), 5 deletions(-) rename {bin => .github/scripts}/rename/README.md (72%) rename {bin => .github/scripts}/rename/definitions.sh (94%) create mode 100644 .github/workflows/reusable-check-rename.yml diff --git a/bin/rename/README.md b/.github/scripts/rename/README.md similarity index 72% rename from bin/rename/README.md rename to .github/scripts/rename/README.md index 76710bc80e..d7f52fc791 100644 --- a/bin/rename/README.md +++ b/.github/scripts/rename/README.md @@ -7,8 +7,8 @@ developers located around the world. The XRPL community is larger than ever. In light of the decentralized and diversified nature of XRPL, we will rename any references to `ripple` and `rippled` to `xrpl` and `xrpld`, when appropriate. -See [here](https://github.com/XRPLF/XRPL-Standards/discussions/384) for more -information. +See [here](https://xls.xrpl.org/xls/XLS-0095-rename-rippled-to-xrpld.html) for +more information. ### Scripts @@ -16,5 +16,6 @@ To facilitate this transition, there will be multiple scripts that developers can run on their own PRs and forks to minimize conflicts. Each script should be run from the repository root. -1. `bin/rename/definitions.sh`: This script will rename all definitions, such - as include guards, from `RIPPLE_XXX` and `RIPPLED_XXX` to `XRPL_XXX`. +1. `.github/scripts/rename/definitions.sh`: This script will rename all + definitions, such as include guards, from `RIPPLE_XXX` and `RIPPLED_XXX` to + `XRPL_XXX`. diff --git a/bin/rename/definitions.sh b/.github/scripts/rename/definitions.sh similarity index 94% rename from bin/rename/definitions.sh rename to .github/scripts/rename/definitions.sh index b1fb172d98..d9f04b91e6 100755 --- a/bin/rename/definitions.sh +++ b/.github/scripts/rename/definitions.sh @@ -4,7 +4,7 @@ # Specifically, it renames "RIPPLED_XXX" and "RIPPLE_XXX" to "XRPL_XXX" by # scanning all cmake, header, and source files in the specified directory and # its subdirectories. -# Usage: bin/rename/definitions.sh +# Usage: .github/scripts/rename/definitions.sh if [ "$#" -ne 1 ]; then echo "Usage: $0 " diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index 6d74486e96..a5bc717873 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -98,6 +98,11 @@ jobs: if: ${{ needs.should-run.outputs.go == 'true' }} uses: ./.github/workflows/reusable-check-levelization.yml + check-rename: + needs: should-run + if: ${{ needs.should-run.outputs.go == 'true' }} + uses: ./.github/workflows/reusable-check-rename.yml + build-test: needs: should-run if: ${{ needs.should-run.outputs.go == 'true' }} diff --git a/.github/workflows/reusable-check-rename.yml b/.github/workflows/reusable-check-rename.yml new file mode 100644 index 0000000000..353aca0c86 --- /dev/null +++ b/.github/workflows/reusable-check-rename.yml @@ -0,0 +1,42 @@ +# This workflow checks if the codebase is properly renamed, see more info in +# .github/scripts/rename/README.md. +name: Check rename + +# This workflow can only be triggered by other workflows. +on: workflow_call + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-rename + cancel-in-progress: true + +defaults: + run: + shell: bash + +jobs: + levelization: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + - name: Check definitions + run: .github/scripts/rename/definitions.sh + - name: Check for differences + env: + MESSAGE: | + + One or more files contain changes that do not adhere to new naming + conventions. + + Run the scripts in '.github/scripts/rename/' in your repo, commit + and push the changes. See .github/scripts/rename/README.md for + more info. + run: | + DIFF=$(git status --porcelain) + if [ -n "${DIFF}" ]; then + # Print the differences to give the contributor a hint about what to + # expect when running the renaming scripts on their own machine. + git diff + echo "${MESSAGE}" + exit 1 + fi