-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (31 loc) · 1.03 KB
/
pr-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: PR Test
on:
pull_request:
type:
- opened
- synchronize
- reopened
jobs:
ref-depth:
runs-on: ubuntu-latest
outputs:
depth: ${{ steps.depth.outputs.depth }}
steps:
- uses: actions/checkout@v3
# Fetch history up to base
- run: |
git fetch origin ${{ github.event.pull_request.base.sha }}
COMMITTER_DATE=`git show ${{ github.event.pull_request.base.sha }} --format="%cD" -s`
git fetch --shallow-since="${COMMITTER_DATE}" origin
# Determine required depth by comparing base to head, then adding 1
- id: depth
run: |
COUNT=`git rev-list ${{ github.event.pull_request.base.sha }}..HEAD --count`
echo "::set-output name=depth::$(($COUNT + 1))"
build-and-test:
needs: ref-depth
uses: ./.github/workflows/build-and-test.yaml
with:
depth: ${{ fromJSON(needs.ref-depth.outputs.depth) }}
base-ref: ${{ github.event.pull_request.base.sha }}
head-ref: ${{ github.event.pull_request.head.sha }}