Skip to content

Commit

Permalink
debug ci
Browse files Browse the repository at this point in the history
  • Loading branch information
aburkut committed Oct 20, 2023
1 parent 981d669 commit 0596e68
Showing 1 changed file with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,31 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
with:
# During a pre-merge check, Github creates and checks out an temporary merge commit. That
# commit won't work as the HEAD for jest --changedSince
ref: ${{ github.event.pull_request.head.sha }}
- name: Fetch merge base commits
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Fetch commits to a depth so that head and base reach their merge base.
comparison=$(gh api\
repos/paraswap/parapswap-dex-lib/compare/${{ github.event.pull_request.base.sha }}...${{github.event.pull_request.head.sha }})
behind_by=$(echo -E $comparison | jq -r '.behind_by')
ahead_by=$(echo -E $comparison | jq -r '.ahead_by')
echo "ahead_by: $ahead_by; behind by: $behind_by"
# +1 because fetch depth=1 is the commit itself.
if [[ $behind_by -gt 0 ]]; then
base_depth=$((behind_by+1))
echo Fetching base to depth $base_depth
git -c protocol.version=2 fetch --no-tags --no-recurse-submodules\
--depth=$base_depth origin ${{github.event.pull_request.base.sha }}
fi
if [[ $ahead_by -gt 0 ]]; then
head_depth=$((ahead_by+1))
echo Fetching head to depth $head_depth
git -c protocol.version=2 fetch --no-tags --no-recurse-submodules\
--depth=$head_depth origin ${{github.event.pull_request.head.sha }}
fi

- name: Fetch merge base commits
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Fetch commits to a depth so that head and base reach their merge base.
comparison=$(gh api\
repos/paraswap/parapswap-dex-lib/compare/${{ github.event.pull_request.base.sha }}...${{github.event.pull_request.head.sha }})
behind_by=$(echo -E $comparison | jq -r '.behind_by')
ahead_by=$(echo -E $comparison | jq -r '.ahead_by')
echo "ahead_by: $ahead_by; behind by: $behind_by"
# +1 because fetch depth=1 is the commit itself.
if [[ $behind_by -gt 0 ]]; then
base_depth=$((behind_by+1))
echo Fetching base to depth $base_depth
git -c protocol.version=2 fetch --no-tags --no-recurse-submodules\
--depth=$base_depth origin ${{github.event.pull_request.base.sha }}
fi
if [[ $ahead_by -gt 0 ]]; then
head_depth=$((ahead_by+1))
echo Fetching head to depth $head_depth
git -c protocol.version=2 fetch --no-tags --no-recurse-submodules\
--depth=$head_depth origin ${{github.event.pull_request.head.sha }}
fi
- uses: actions/checkout@v2

Expand Down

0 comments on commit 0596e68

Please sign in to comment.