diff --git a/.github/workflows/cicd-1-pull-request.yaml b/.github/workflows/cicd-1-pull-request.yaml index 4493bad2..2244a702 100644 --- a/.github/workflows/cicd-1-pull-request.yaml +++ b/.github/workflows/cicd-1-pull-request.yaml @@ -25,11 +25,14 @@ jobs: terraform_version: ${{ steps.variables.outputs.terraform_version }} version: ${{ steps.variables.outputs.version }} does_pull_request_exist: ${{ steps.pr_exists.outputs.does_pull_request_exist }} + branch_name: ${{ steps.variables.outputs.branch_name }} steps: - name: "Checkout code" uses: actions/checkout@v5 - name: "Set CI/CD variables" id: variables + env: + BRANCH_NAME: ${{ github.head_ref }} run: | datetime=$(date -u +'%Y-%m-%dT%H:%M:%S%z') BUILD_DATETIME=$datetime make version-create-effective-file @@ -41,6 +44,7 @@ jobs: echo "python_version=$(grep "^python\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT echo "terraform_version=$(grep "^terraform\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT echo "version=$(head -n 1 .version 2> /dev/null || echo unknown)" >> $GITHUB_OUTPUT + echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT - name: "Check if pull request exists for this branch" id: pr_exists env: @@ -66,7 +70,7 @@ jobs: export TERRAFORM_VERSION="${{ steps.variables.outputs.terraform_version }}" export VERSION="${{ steps.variables.outputs.version }}" export DOES_PULL_REQUEST_EXIST="${{ steps.pr_exists.outputs.does_pull_request_exist }}" - export BRANCH_NAME="${{ github.head_ref }}" + export BRANCH_NAME="${{ steps.variables.outputs.branch_name }}" make list-variables commit-stage: # Recommended maximum execution time is 2 minutes name: "Commit stage" diff --git a/.github/workflows/cicd-2-main-branch.yaml b/.github/workflows/cicd-2-main-branch.yaml index 07641d68..275ee0c6 100644 --- a/.github/workflows/cicd-2-main-branch.yaml +++ b/.github/workflows/cicd-2-main-branch.yaml @@ -21,6 +21,7 @@ jobs: python_version: ${{ steps.variables.outputs.python_version }} terraform_version: ${{ steps.variables.outputs.terraform_version }} version: ${{ steps.variables.outputs.version }} + branch_name: ${{ steps.variables.outputs.branch_name }} steps: - name: "Checkout code" uses: actions/checkout@v5 @@ -37,6 +38,7 @@ jobs: echo "python_version=$(grep "^python\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT echo "terraform_version=$(grep "^terraform\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT echo "version=$(head -n 1 .version 2> /dev/null || echo unknown)" >> $GITHUB_OUTPUT + echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT - name: "List variables" run: | export BUILD_DATETIME_LONDON="${{ steps.variables.outputs.build_datetime_london }}" @@ -47,7 +49,7 @@ jobs: export PYTHON_VERSION="${{ steps.variables.outputs.python_version }}" export TERRAFORM_VERSION="${{ steps.variables.outputs.terraform_version }}" export VERSION="${{ steps.variables.outputs.version }}" - export BRANCH_NAME="${{ github.head_ref }}" + export BRANCH_NAME="${{ steps.variables.outputs.branch_name }}" make list-variables commit-stage: # Recommended maximum execution time is 2 minutes name: "Commit stage"