Skip to content

Commit

Permalink
Update GITHUB_REF for GITHUB_HEAD_REF
Browse files Browse the repository at this point in the history
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/<pr_number>/merge

We should use the former to achieve the retrieving
a branch with the same name
  • Loading branch information
vkmc committed Aug 16, 2024
1 parent 2535d0e commit c3e45eb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand Down Expand Up @@ -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: |
Expand All @@ -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
Expand Down Expand Up @@ -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: |
Expand All @@ -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: |
Expand Down

0 comments on commit c3e45eb

Please sign in to comment.