From b6313a8f7317b7d185366ebeee048601db456425 Mon Sep 17 00:00:00 2001 From: Hannah Pho Date: Tue, 5 Nov 2024 14:04:06 -0500 Subject: [PATCH] Properly reference master branch on central repo As well as the the repo and branch of the PR --- .github/workflows/all-commits-in-master.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/all-commits-in-master.yml b/.github/workflows/all-commits-in-master.yml index f4ec02ee4d..b94f5e1437 100644 --- a/.github/workflows/all-commits-in-master.yml +++ b/.github/workflows/all-commits-in-master.yml @@ -10,17 +10,20 @@ jobs: steps: - uses: actions/checkout@v3 with: - fetch-depth: 0 # Fetch all history for accurate comparison + # Fetch all history for accurate comparison + fetch-depth: 0 + # Check out the PR branch + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} - name: Check if commits exist in master run: | git remote add dc https://github.com/datacommonsorg/website.git git fetch dc - MASTER_BRANCH="remotes/dc/master" - SOURCE_BRANCH=$(echo ${{ github.head_ref }}) + MASTER_BRANCH="dc/master" # Get the list of commits in the source branch that are not in the master branch - MISSING_COMMITS=$(git log --pretty="%H - %s" $MASTER_BRANCH..$SOURCE_BRANCH --) + MISSING_COMMITS=$(git log --no-merges --pretty="%H - %s" $MASTER_BRANCH..HEAD --) if [[ -n "$MISSING_COMMITS" ]]; then echo "ERROR: The following commits are not present in $MASTER_BRANCH:"