diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index 58a52eddb5..9975627520 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -152,7 +152,7 @@ jobs: - name: prepare variables id: ev run: | - python ./scripts/gh_do_set_branch.py + python ./scripts/gh_env.py - name: checkout current code run: | set -x @@ -290,7 +290,7 @@ jobs: env: DOCKER_USERNAME: ${{ secrets.HARBOR_USERNAME }} run: | - python ./scripts/gh_do_set_branch.py + python ./scripts/gh_env.py - name: Login to Container Registry uses: docker/login-action@v1 if: ${{ steps.ev.outputs.shouldBuild == 'true' }} diff --git a/.github/workflows/ci-outpost.yml b/.github/workflows/ci-outpost.yml index eee2349240..16b1026c15 100644 --- a/.github/workflows/ci-outpost.yml +++ b/.github/workflows/ci-outpost.yml @@ -48,7 +48,7 @@ jobs: env: DOCKER_USERNAME: ${{ secrets.HARBOR_USERNAME }} run: | - python ./scripts/gh_do_set_branch.py + python ./scripts/gh_env.py - name: Login to Container Registry uses: docker/login-action@v1 if: ${{ steps.ev.outputs.shouldBuild == 'true' }} diff --git a/scripts/gh_do_set_branch.py b/scripts/gh_env.py similarity index 90% rename from scripts/gh_do_set_branch.py rename to scripts/gh_env.py index e0adbcaebe..c121c85381 100644 --- a/scripts/gh_do_set_branch.py +++ b/scripts/gh_env.py @@ -9,12 +9,11 @@ sha = "GITHUB_SHA" branch_name = os.environ[default_branch] if os.environ.get(env_pr_branch, "") != "": branch_name = os.environ[env_pr_branch] -branch_name = branch_name.replace("refs/heads/", "") should_build = str(os.environ.get("DOCKER_USERNAME", "") != "").lower() print("##[set-output name=branchName]%s" % branch_name) -print("##[set-output name=branchNameContainer]%s" % branch_name.replace("/", "-")) +print("##[set-output name=branchNameContainer]%s" % branch_name.replace("refs/heads/", "").replace("/", "-")) print("##[set-output name=timestamp]%s" % int(time())) print("##[set-output name=sha]%s" % os.environ[sha]) print("##[set-output name=shouldBuild]%s" % should_build)