From 66c6e9640650622d3b7d157cccc4e66dde3689f3 Mon Sep 17 00:00:00 2001 From: Katerina Koukiou Date: Wed, 24 Feb 2021 10:48:36 +0100 Subject: [PATCH] livetest: fix cloning of repo Previously it was checking out origin/master not the PR's branch. --- .github/workflows/livetest.yml.disabled | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/livetest.yml.disabled b/.github/workflows/livetest.yml.disabled index 42a1f80..3130783 100644 --- a/.github/workflows/livetest.yml.disabled +++ b/.github/workflows/livetest.yml.disabled @@ -46,11 +46,28 @@ jobs: sudo apt update sudo apt install -y cockpit-system cockpit-ws nodejs npm sassc make - - name: Clone repository - uses: actions/checkout@v2 + - uses: actions/github-script@v3 + id: get-pr with: - # need this to also fetch tags + script: | + const request = { + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number + } + core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`) + try { + const result = await github.pulls.get(request) + return result.data + } catch (err) { + core.setFailed(`Request failed with error ${err}`) + } + + - uses: actions/checkout@v2 + with: + repository: ${{ fromJSON(steps.get-pr.outputs.result).head.repo.full_name }} fetch-depth: 0 + ref: ${{ fromJSON(steps.get-pr.outputs.result).head.ref }} - name: Compile and install the project run: make && sudo make install