Skip to content

Commit b64691c

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 b64691c

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,19 @@ jobs:
4848
- rootfs-initrd
4949
- shim-v2
5050
steps:
51+
- name: resolve pr refs
52+
id: refs
53+
uses: eficode/resolve-pr-refs@main
54+
with:
55+
token: ${{ secrets.GITHUB_TOKEN }}
56+
5157
- uses: actions/checkout@v2
58+
with:
59+
ref: ${{ steps.refs.outputs.head_ref }}
5260
- name: Install docker
5361
run: |
5462
curl -fsSL https://test.docker.com -o test-docker.sh
5563
sh test-docker.sh
56-
5764
- name: Build ${{ matrix.asset }}
5865
run: |
5966
make "${KATA_ASSET}-tarball"
@@ -75,7 +82,14 @@ jobs:
7582
runs-on: ubuntu-latest
7683
needs: build-asset
7784
steps:
85+
- name: resolve pr refs
86+
id: rfs
87+
uses: eficode/resolve-pr-refs@main
88+
with:
89+
token: ${{ secrets.GITHUB_TOKEN }}
7890
- uses: actions/checkout@v2
91+
with:
92+
ref: ${{ steps.refs.outputs.head_ref }}
7993
- name: get-artifacts
8094
uses: actions/download-artifact@v2
8195
with:
@@ -94,7 +108,14 @@ jobs:
94108
needs: create-kata-tarball
95109
runs-on: ubuntu-latest
96110
steps:
111+
- name: resolve pr refs
112+
id: rfs
113+
uses: eficode/resolve-pr-refs@main
114+
with:
115+
token: ${{ secrets.GITHUB_TOKEN }}
97116
- uses: actions/checkout@v2
117+
with:
118+
ref: ${{ steps.refs.outputs.head_ref }}
98119
- name: get-kata-tarball
99120
uses: actions/download-artifact@v2
100121
with:

0 commit comments

Comments
 (0)