Skip to content

Commit 84c8fa3

Browse files
committed
workflows: Use the correct branch ref on test kata-deploy
The action used for testing kata-deploy is entirely based on the action used to build the kata-deploy tarball, but while the latter is able to use the correct branch, the former always uses `main`. This happens as the `issue_comment`, from GitHub actions, passed the "default branch" as the GITHUB_REF. As we're not the first ones to face such a issue, I've decided to take one of the approaches suggested at one of the checkout's issues, actions/checkout#331, and take advantage of a new action provided by the community, which will get the PR where the comment was made, give us that ref, and that then can be used with the checkout action, resulting on what we originally wanted. Fixes: kata-containers#3443 Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
1 parent d370604 commit 84c8fa3

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/kata-deploy-test.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,18 @@ jobs:
4848
- rootfs-initrd
4949
- shim-v2
5050
steps:
51+
# As Github action event `issue_comment` does not provide the right ref
52+
# (commit/branch) to be tested, let's use this third part action to work
53+
# this limitation around.
54+
- name: resolve pr refs
55+
id: refs
56+
uses: kata-containers/resolve-pr-refs@0.0.3
57+
with:
58+
token: ${{ secrets.GITHUB_TOKEN }}
59+
5160
- uses: actions/checkout@v2
61+
with:
62+
ref: ${{ steps.refs.outputs.head_ref }}
5263
- name: Install docker
5364
run: |
5465
curl -fsSL https://test.docker.com -o test-docker.sh
@@ -75,7 +86,17 @@ jobs:
7586
runs-on: ubuntu-latest
7687
needs: build-asset
7788
steps:
89+
# As Github action event `issue_comment` does not provide the right ref
90+
# (commit/branch) to be tested, let's use this third part action to work
91+
# this limitation around.
92+
- name: resolve pr refs
93+
id: refs
94+
uses: kata-containers/resolve-pr-refs@0.0.3
95+
with:
96+
token: ${{ secrets.GITHUB_TOKEN }}
7897
- uses: actions/checkout@v2
98+
with:
99+
ref: ${{ steps.refs.outputs.head_ref }}
79100
- name: get-artifacts
80101
uses: actions/download-artifact@v2
81102
with:
@@ -94,7 +115,17 @@ jobs:
94115
needs: create-kata-tarball
95116
runs-on: ubuntu-latest
96117
steps:
118+
# As Github action event `issue_comment` does not provide the right ref
119+
# (commit/branch) to be tested, let's use this third part action to work
120+
# this limitation around.
121+
- name: resolve pr refs
122+
id: refs
123+
uses: kata-containers/resolve-pr-refs@0.0.3
124+
with:
125+
token: ${{ secrets.GITHUB_TOKEN }}
97126
- uses: actions/checkout@v2
127+
with:
128+
ref: ${{ steps.refs.outputs.head_ref }}
98129
- name: get-kata-tarball
99130
uses: actions/download-artifact@v2
100131
with:

0 commit comments

Comments
 (0)