@@ -45,23 +45,22 @@ jobs:
4545
4646 validate-source :
4747 name : Validate source code changes
48- # TODO: currently only works on a PR checkout, enable parts of this later to also work on pushes.
49- if : ${{ github.event_name == 'pull_request' }}
5048 runs-on : cncf-ubuntu-8-32-x86
5149 env :
5250 # Base commit of this PR; used by the Makefile and the helper scripts to
53- # compute the commit range (git merge-base $DEST_BRANCH HEAD..HEAD ).
54- DEST_BRANCH : ${{ github.event.pull_request.base.sha }}
55- PR_NUMBER : ${{ github.event.pull_request.number }}
56- PR_HEAD : ${{ github.event.pull_request.head.sha }}
57- PR_BODY : ${{ github.event.pull_request.body }}
51+ # compute the commit range (git merge-base $DEST_BRANCH HEAD).
52+ DEST_BRANCH : ${{ github.event.pull_request.base.sha || github.ref_name }}
53+ PR_NUMBER : ${{ github.event.pull_request.number || '' }}
54+ PR_HEAD : ${{ github.event.pull_request.head.sha || '' }}
55+ PR_BODY : ${{ github.event.pull_request.body || '' }}
5856 steps :
5957 - name : Checkout PR head
6058 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6159 with :
6260 # Check out the actual PR head (not the synthetic merge commit) so
6361 # the commit-range checks validate the contributor's commits.
64- ref : refs/pull/${{ github.event.pull_request.number }}/head
62+ # Unless on branch push then checkout the normal ref that triggered the job
63+ ref : ${{ github.event.pull_request.head.sha || github.ref }}
6564 # Full history (all branches) is required for git merge-base to find
6665 # the fork point against the base branch.
6766 fetch-depth : 0
@@ -128,7 +127,7 @@ jobs:
128127
129128 - name : Check that the PR includes tests
130129 # The 'No New Tests' label lets maintainers override this check.
131- if : ${{ !contains(github.event.pull_request.labels.*.name, 'No New Tests') }}
130+ if : ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'No New Tests') }}
132131 run : make tests-included
133132
134133 - name : Validate renovate config
0 commit comments