From 37d20a5765ebbd3181a932c827ba70db7071dee0 Mon Sep 17 00:00:00 2001 From: Karthikeyan Chinnakonda Date: Mon, 2 Sep 2024 17:12:09 +0530 Subject: [PATCH] Fix bug in registry update automation (#275) This PR modifies the check out logic a bit for PRs opened on forked repositories. If the PR opened is from a forked repository, the code will be checked out to that repo's `ref` commit to access the files present in that branch, in the case the PR is opened directly in this repo, the behaviour will be the same as it was earlier. --- .github/workflows/registry-updates.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/registry-updates.yaml b/.github/workflows/registry-updates.yaml index f3b39177..fd0a6afe 100644 --- a/.github/workflows/registry-updates.yaml +++ b/.github/workflows/registry-updates.yaml @@ -17,7 +17,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 with: - fetch_depth: 1 + # In the case of forked PRs, the forked repository will + # be checked out. + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + fetch-depth: 1 - name: Check for PR approvals id: check-approval