11name : Integration Tests
22
33on :
4+ push :
5+ branches : [main]
6+ tags :
7+ - " v*"
8+ pull_request :
9+ branches : [main]
10+ schedule :
11+ - cron : " 0 7 * * *"
412 workflow_dispatch :
513 inputs :
614 pr_number :
715 type : number
8- required : true
16+ required : false
17+ description : ' PR number (optional, for manual PR testing)'
918 sha :
1019 type : string
11- required : true
20+ required : false
21+ description : ' SHA to test (optional, for manual PR testing)'
1222
1323permissions :
1424 contents : read
@@ -25,18 +35,19 @@ jobs:
2535 steps :
2636 - uses : actions/checkout@v5
2737 with :
28- ref : ' refs/pull/${{ github.event.inputs.pr_number }}/merge '
38+ ref : ${{ github.event.inputs.pr_number && format( 'refs/pull/{0}/merge', github.event.inputs.pr_number) || github.ref }}
2939 fetch-depth : 0
3040
3141 - name : Check SHA
42+ if : github.event.inputs.pr_number && github.event.inputs.sha
3243 run : |
3344 git fetch origin refs/pull/${{ github.event.inputs.pr_number }}/head:pr-head
3445 prsha=`git rev-parse pr-head | awk '{ print $1 }'`
3546
3647 echo "PR SHA: $prsha"
37- echo "expected SHA: ${{ github.event.inputs.SHA }}"
48+ echo "expected SHA: ${{ github.event.inputs.sha }}"
3849
39- if [ "$prsha" != "${{ github.event.inputs.SHA }}" ]; then
50+ if [ "$prsha" != "${{ github.event.inputs.sha }}" ]; then
4051 echo "SHA must match" >&2
4152 exit 1
4253 fi
@@ -124,11 +135,11 @@ jobs:
124135 steps :
125136 - uses : actions/checkout@v5
126137 with :
127- ref : ' refs/pull/${{ github.event.inputs.pr_number }}/merge '
138+ ref : ${{ github.event.inputs.pr_number && format( 'refs/pull/{0}/merge', github.event.inputs.pr_number) || github.ref }}
128139 fetch-depth : 0
129140
130141 - name : Get PR Commit
131- if : always() && matrix.runner-os == 'ubuntu-latest'
142+ if : always() && matrix.runner-os == 'ubuntu-latest' && github.event.inputs.pr_number
132143 run : |
133144 prsha=`git ls-remote origin refs/pull/${{ github.event.inputs.pr_number }}/head | awk '{ print $1 }'`
134145 echo "SHA: $prsha"
0 commit comments