diff --git a/.github/workflows/on-code-change.yml b/.github/workflows/on-code-change.yml index 3a1b66b03dc..c97874c6b0d 100644 --- a/.github/workflows/on-code-change.yml +++ b/.github/workflows/on-code-change.yml @@ -291,12 +291,28 @@ jobs: runs-on: ubuntu-latest needs: [integration-tests, sonar-analysis, security-scan, vulnerability-scan, build] steps: + - name: Get branch name + id: branch-name + uses: tj-actions/branch-names@v5.4 + - name: Preparing variables for remote branch + id: exports + shell: bash + run: | + # If we are in a PR, we use master for the remote branch + # If we are not in a PR, we use the current branch for the remote branch + if [[ "${{ github.event.pull_request.head.ref }}" == "" ]]; then + echo "Currently NOT in a PR: ${{ github.event.pull_request.head.ref }}, using ${{ steps.branch-name.outputs.current_branch }} as remote branch" + echo "remote_branch=${{ steps.branch-name.outputs.current_branch }}" >> $GITHUB_OUTPUT + else + echo "Currently in a PR with head: ${{ github.event.pull_request.head.ref }}, using master as remote branch" + echo "remote_branch=master" >> $GITHUB_OUTPUT + fi - name: Call Jahia-pack-private id: trigger-step uses: jonas-schievink/workflow-proxy@v1 with: workflow: do-it-all.yml - ref: master + ref: ${{ steps.exports.outputs.remote_branch }} repo: Jahia/jahia-pack-private wait-for-completion-timeout: 2h inputs: '{ "parent_image_tag": "${{needs.build.outputs.image_tag}}" }'