diff --git a/.github/workflows/link-check-all.yml b/.github/workflows/link-check-all.yml index 9f9124ecc9..0a5e1cea58 100644 --- a/.github/workflows/link-check-all.yml +++ b/.github/workflows/link-check-all.yml @@ -28,6 +28,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 + # Get the branches so merge_group can make the comparison with git diff + with: + fetch-depth: 0 - name: Setup node uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 @@ -43,7 +46,6 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR: ${{ github.event.pull_request.number }} - BASE: ${{ github.event.pull_request.base.ref || github.event.merge_group.base_ref }} HEAD: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }} run: | # If its a pull request, use the faster call to the GitHub API @@ -51,9 +53,9 @@ jobs: if [ -n "$PR" ] then DIFF=`gh pr diff $PR --name-only` - elif [ -n "$BASE" ] && [ -n "$HEAD" ] + elif [ -n "$HEAD" ] then - DIFF=`git diff --name-only $BASE $HEAD` + DIFF=`git diff --name-only origin/main` else DIFF='' fi diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dc88bd5035..c8e0be7623 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -74,6 +74,8 @@ jobs: lfs: ${{ matrix.test-group == 'content' }} # Enables cloning the Early Access repo later with the relevant PAT persist-credentials: 'false' + # Get the branches so merge_group can make the comparison with git diff + fetch-depth: 0 - name: Figure out which docs-early-access branch to checkout, if internal repo if: ${{ github.repository == 'github/docs-internal' }} @@ -131,7 +133,6 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR: ${{ github.event.pull_request.number }} - BASE: ${{ github.event.pull_request.base.ref || github.event.merge_group.base_ref }} HEAD: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }} run: | # If its a pull request, use the faster call to the GitHub API @@ -139,9 +140,9 @@ jobs: if [ -n "$PR" ] then DIFF=`gh pr diff $PR --name-only` - elif [ -n "$BASE" ] && [ -n "$HEAD" ] + elif [ -n "$HEAD" ] then - DIFF=`git diff --name-only $BASE $HEAD` + DIFF=`git diff --name-only origin/main` else DIFF='' fi