From 50130f8b40b18610cc3270a7acf9d996fb3fb917 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 6 Dec 2023 18:02:15 -0800 Subject: [PATCH] get base sha --- .github/workflows/aviator-targets.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/aviator-targets.yml b/.github/workflows/aviator-targets.yml index 6cc32866..bc8e7a60 100644 --- a/.github/workflows/aviator-targets.yml +++ b/.github/workflows/aviator-targets.yml @@ -16,11 +16,21 @@ jobs: node-version: '18' cache: 'yarn' - run: yarn install + - uses: octokit/request-action@v2.x + id: get_pr + with: + route: GET /repos/${{ github.repository }}/pulls/${{ github.event.number }} + owner: octokit + repo: request-action + env: + GITHUB_TOKEN: ${{ github.token }} + + - run: "echo latest sha: '${{ fromJson(steps.get_pr.outputs.data).base.sha }}'" - run: | set -euo pipefail git fetch origin $GITHUB_BASE_REF PR_NUMBER=${{ github.event.number }} - TARGETS_JSON=$(npx nx show projects --affected --base FETCH_HEAD --head HEAD --json) + TARGETS_JSON=$(npx nx show projects --affected --base FETCH_HEAD --head ${{ github.sha }} --json) echo $TARGETS_JSON curl -X POST -H "Authorization: Bearer ${{ secrets.AVIATOR_API_TOKEN }}" \ -H "Content-Type: application/json" \