From 5ecc5ef1127138ae0ccb0559d45e48975bac9a3f Mon Sep 17 00:00:00 2001 From: "vimartin@redhat.com" Date: Fri, 16 Aug 2024 17:09:39 +0200 Subject: [PATCH] Update GITHUB_REF for GITHUB_HEAD_REF GITHUB_HEAD_REF points to the head ref or source branch of the pull request in a workflow run. GITHUB_REF points to the pull request merge branch. The ref given is fully-formed, meaning that for pull requests it is refs/pull//merge We should use the former to achieve the retrieving a branch with the same name --- .github/workflows/integration.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 602cf6dd..0234b15b 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -62,8 +62,8 @@ jobs: id: bridge_branch continue-on-error: true run: | - echo "${refs/heads/GITHUB_REF}" - git ls-remote --exit-code --heads https://github.com/infrawatch/sg-bridge.git "$(echo ${refs/heads/GITHUB_REF})" + echo "${refs/heads/GITHUB_HEAD_REF}" + git ls-remote --exit-code --heads https://github.com/infrawatch/sg-bridge.git "$(echo ${refs/heads/GITHUB_HEAD_REF})" - name: Start sg-bridge from container image if: steps.bridge_branch.outcome != 'success' run: | @@ -74,7 +74,7 @@ jobs: if: steps.bridge_branch.outcome == 'success' run: | docker run --name=sgbridge --network host $BRIDGE_VOLUME -d -uroot \ - -e GITHUB_REF -e BRIDGE_SOCKET -e QDR_CHANNEL -e OPSTOOLS_REPO \ + -e GITHUB_HEAD_REF -e BRIDGE_SOCKET -e QDR_CHANNEL -e OPSTOOLS_REPO \ --workdir=$(dirname $BRIDGE_SOCKET) --volume ${{ github.workspace }}:$PROJECT_ROOT:z \ $TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/run_bridge.sh - name: Install collectd @@ -158,8 +158,8 @@ jobs: id: bridge_branch continue-on-error: true run: | - echo "${refs/heads/GITHUB_REF}" - git ls-remote --exit-code --heads https://github.com/infrawatch/sg-bridge.git "$(echo ${refs/heads/GITHUB_REF})" + echo "${refs/heads/GITHUB_HEAD_REF}" + git ls-remote --exit-code --heads https://github.com/infrawatch/sg-bridge.git "$(echo ${refs/heads/GITHUB_HEAD_REF})" - name: Start sg-bridge from container image if: steps.bridge_branch.outcome != 'success' run: | @@ -170,7 +170,7 @@ jobs: if: steps.bridge_branch.outcome == 'success' run: | docker run --name=sgbridge --network host $BRIDGE_VOLUME -d -uroot \ - -e GITHUB_REF -e BRIDGE_SOCKET -e QDR_CHANNEL -e OPSTOOLS_REPO \ + -e GITHUB_HEAD_REF -e BRIDGE_SOCKET -e QDR_CHANNEL -e OPSTOOLS_REPO \ --workdir=$(dirname $BRIDGE_SOCKET) --volume ${{ github.workspace }}:$PROJECT_ROOT:z \ $TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/run_bridge.sh - name: Set Ceilometer pipelines to QDR output and restart notification agent @@ -323,8 +323,8 @@ jobs: id: bridge_branch continue-on-error: true run: | - echo "${refs/heads/GITHUB_REF}" - git ls-remote --exit-code --heads https://github.com/infrawatch/sg-bridge.git "$(echo ${refs/heads/GITHUB_REF})" + echo "${refs/heads/GITHUB_HEAD_REF}" + git ls-remote --exit-code --heads https://github.com/infrawatch/sg-bridge.git "$(echo ${refs/heads/GITHUB_HEAD_REF})" - name: Start sg-bridge from container image if: steps.bridge_branch.outcome != 'success' run: | @@ -334,7 +334,7 @@ jobs: if: steps.bridge_branch.outcome == 'success' run: | docker run --name=sgbridge $BRIDGE_VOLUME -d -uroot --network host -e OPSTOOLS_REPO \ - -e GITHUB_REF -e BRIDGE_SOCKET --workdir=$(dirname $BRIDGE_SOCKET) --volume ${{ github.workspace }}:$PROJECT_ROOT:z \ + -e GITHUB_HEAD_REF -e BRIDGE_SOCKET --workdir=$(dirname $BRIDGE_SOCKET) --volume ${{ github.workspace }}:$PROJECT_ROOT:z \ $TEST_IMAGE bash $PROJECT_ROOT/ci/integration/logging/run_bridge.sh - name: Run rsyslog to produce log messages run: |