From 4a35997cd15b5875151a043a8e5e716f165a5eab Mon Sep 17 00:00:00 2001 From: Nhu Viet Nguyen Date: Tue, 14 Nov 2023 18:28:59 +0100 Subject: [PATCH] fix: protect from repoonwer+reponame as an input.packageName --- .github/workflows/reusable_dockerfile_pipeline.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/reusable_dockerfile_pipeline.yml b/.github/workflows/reusable_dockerfile_pipeline.yml index ffa9858..a14fdd1 100644 --- a/.github/workflows/reusable_dockerfile_pipeline.yml +++ b/.github/workflows/reusable_dockerfile_pipeline.yml @@ -55,6 +55,17 @@ jobs: # Set the default package name to the repository name PACKAGE_NAME=$REPO_NAME + # If a user submitted package name that has the naming containing + # both the repository owner and repository name, we fail + # e.g: inputs.packageName = "celestiaorg/celestiaorg" is not allowed + if [[ ! "${{ inputs.packageName }}" == "${{ github.repository }}" ]]; then + echo "------------------------------------------------------------" + echo "ERROR: Package name not valid! => [ $PACKAGE_NAME} ]" + echo "Don't use the repository owner and repository name in the package name." + echo "------------------------------------------------------------" + exit 1 + fi + # If there is a user submitted package name, use it if [[ ! "${{ inputs.packageName }}" != "" ]]; then PACKAGE_NAME=$(echo "${{ inputs.packageName }}" | tr '[:upper:]' '[:lower:]')