1
0
mirror of synced 2026-01-05 12:07:35 -05:00

Remove fetch-depth: 0 by running git fetch instead (#30953)

This commit is contained in:
Kevin Heis
2022-09-20 13:04:08 -07:00
committed by GitHub
parent 3d45346c34
commit 2e0f7a1133
2 changed files with 28 additions and 14 deletions

View File

@@ -36,7 +36,6 @@ jobs:
strategy:
fail-fast: false
matrix:
# The same array lives in test-windows.yml, so make any updates there too.
test-group:
[
content,
@@ -73,9 +72,9 @@ jobs:
# only for the test groups that we know need the files.
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
# persist-credentials: 'false'
# ->> Do we really need this? actions/checkout doesn't use it for the nested example:
# https://github.com/actions/checkout#checkout-multiple-repos-nested
- name: Figure out which docs-early-access branch to checkout, if internal repo
if: ${{ github.repository == 'github/docs-internal' }}
@@ -135,21 +134,31 @@ jobs:
PR: ${{ github.event.pull_request.number }}
HEAD: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
run: |
# Find the file diff in the pull request or merge group
# If its a pull request, use the faster call to the GitHub API
# For push, workflow_dispatch, and merge_group, use git diff
if [ -n "$PR" ]
then
echo __ running gh pr diff __
DIFF=`gh pr diff $PR --name-only`
elif [ -n "$HEAD" ]
then
echo __ running git fetch main __
git fetch origin main --depth 1
echo __ running git diff __
DIFF=`git diff --name-only origin/main`
else
echo __ no head, empty diff __
DIFF=''
fi
# So we can inspect the output
echo __ DIFF found __
echo $DIFF
# So that becomes a string like `foo.js path/bar.md`
# Must to do this because the list of files can be HUGE. Especially
# in a repo-sync when there are lots of translation files involved.
echo __ format, write to get_diff_files.txt __
echo $DIFF | tr '\n' ' ' > get_diff_files.txt
- name: Setup node