diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76bbeb999..94aad3938 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,12 +34,6 @@ jobs: - uses: actions/checkout@v6 with: fetch-depth: 0 - - uses: nrwl/nx-set-shas@afb73a62d26e41464e9254689e1fd6122ee683c1 # v5.0.1 - id: last_successful_commit_push - if: ${{ inputs.plugins == '' }} - with: - main-branch-name: ${{ github.ref_name }} - workflow-id: 'ci.yml' - name: Install Go uses: actions/setup-go@v6 with: @@ -47,8 +41,11 @@ jobs: check-latest: true - name: Calculate changed plugins and set PLUGINS env var from last successful commit push if: ${{ inputs.plugins == '' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - val=`go run ./internal/cmd/changed-plugins --base-ref '${{ steps.last_successful_commit_push.outputs.base }}'` + base_ref=$(gh api "repos/${{ github.repository }}/actions/workflows/ci.yml/runs?branch=${{ github.ref_name }}&status=success&per_page=1" --jq '.workflow_runs[0].head_sha') + val=$(go run ./internal/cmd/changed-plugins --base-ref "${base_ref}") if [[ -n "${val}" && -z "${PLUGINS}" ]]; then echo "PLUGINS=${val}" >> $GITHUB_ENV fi