From e357b8eb2115110458eee53278f9f304fe22aca8 Mon Sep 17 00:00:00 2001 From: Malik Parvez <84777619+malikparvez@users.noreply.github.com> Date: Tue, 2 Apr 2024 20:25:29 +0530 Subject: [PATCH] Update mend_ruby.yml --- .github/workflows/mend_ruby.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/mend_ruby.yml b/.github/workflows/mend_ruby.yml index e8b9382..0e9bc84 100644 --- a/.github/workflows/mend_ruby.yml +++ b/.github/workflows/mend_ruby.yml @@ -8,18 +8,23 @@ on: jobs: mend: - if: github.event.pull_request.head.repo.full_name == github.repository runs-on: "ubuntu-latest" - - env: - BUNDLE_WITHOUT: release_prep - steps: + # If we are on a PR, checkout the PR head sha, else checkout the default branch + - name: "Set the checkout ref" + id: set_ref + run: | + if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then + echo "ref=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT + else + echo "ref=${{ github.ref }}" >> $GITHUB_OUTPUT + fi - name: "checkout" uses: "actions/checkout@v4" with: fetch-depth: 1 + ref: ${{ steps.set_ref.outputs.ref }} - name: "setup ruby" uses: "ruby/setup-ruby@v1"