11name : CI
22
3- on : [push, pull_request_target]
3+ on :
4+ push :
5+ branches :
6+ - ' spark-*'
7+ tags :
8+ - ' *'
9+ pull_request :
410
511jobs :
612 build :
713 name : Build
814 runs-on : ubuntu-latest
9- if : >
10- github.event_name == 'push' ||
11- github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository
1215
1316 steps :
1417 - name : Checkout
4346 name : Unit Tests (Dgraph ${{ matrix.dgraph-version }} and Python ${{ matrix.python-version }})
4447 runs-on : ubuntu-latest
4548 needs : build
46- if : >
47- github.event_name == 'push' ||
48- github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository
4949
5050 strategy :
5151 fail-fast : false
@@ -128,7 +128,11 @@ jobs:
128128 needs : test
129129
130130 runs-on : ubuntu-latest
131- if : success() || failure()
131+ # the workflow is useless on pull_request events from fork repositories
132+ # as it can not create check runs or pull request comments
133+ if : >
134+ ( success() || failure() ) &&
135+ ( github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository )
132136
133137 steps :
134138 - name : Download Artifacts
@@ -137,20 +141,17 @@ jobs:
137141 path : artifacts
138142
139143 - name : Publish Unit Test Results
140- uses : docker://ghcr.io/enricomi/publish-unit-test-result-action:latest
144+ uses : docker://ghcr.io/enricomi/publish-unit-test-result-action:v1
141145 with :
142- check_name : Unit Test Results
143- github_token : ${{ secrets.GITHUB_TOKEN }}
146+ github_token : ${{ github.token }}
144147 files : " artifacts/Unit Test Results*/**/*.xml"
148+ comment_on_pr : ${{ github.event_name != 'push' }}
145149 log_level : DEBUG
146150
147151 integration :
148152 name : Integration Tests (Dgraph ${{ matrix.dgraph-version }})
149153 runs-on : ubuntu-latest
150154 needs : build
151- if : >
152- github.event_name == 'push' ||
153- github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository
154155
155156 strategy :
156157 fail-fast : false
0 commit comments