1
1
name : CI
2
2
3
3
on :
4
- push :
5
- branches : # only run on branch push, tag push will be ignored
6
- - ' **'
4
+ pull_request :
5
+ types : [opened, reopened, synchronize, closed]
7
6
paths-ignore : # ignore docs only changes since they use a dedicated workflows: docs.yml
8
7
- ' docs/**'
9
8
- ' mithril-explorer/**'
@@ -249,12 +248,11 @@ jobs:
249
248
packages : write
250
249
251
250
env :
252
- PUSH_PACKAGES : ${{ github.ref == 'refs/heads/main' || startsWith('refs/heads/hotfix', github.ref ) }}
251
+ PUSH_PACKAGES : ${{ github.event.action == 'closed' && github.event.pull_request.merged == true && (github.base_ref == ' refs/heads/main' || startsWith('refs/heads/hotfix', github.base_ref) ) }}
253
252
REGISTRY : ghcr.io
254
253
IMAGE_NAME : ${{ github.repository_owner }}/${{ matrix.project }}
255
254
DOCKER_FILE : ./${{ matrix.project }}/Dockerfile.ci
256
255
CONTEXT : .
257
- GITHUB_REF : ${{ github.ref}}
258
256
259
257
steps :
260
258
- name : Checkout
@@ -274,7 +272,7 @@ jobs:
274
272
images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
275
273
tags : |
276
274
unstable
277
- type=raw,value={{branch }}-{{sha}}
275
+ type=raw,value={{base_ref }}-{{sha}}
278
276
279
277
- name : Download built artifacts
280
278
uses : actions/download-artifact@v3
@@ -291,7 +289,7 @@ jobs:
291
289
tags : ${{ steps.meta.outputs.tags }}
292
290
293
291
unstable-release :
294
- if : github.ref == 'refs/heads/main' || startsWith('refs/heads/hotfix', github.ref )
292
+ if : github.event.action == 'closed' && github.event.pull_request.merged == true && (github.base_ref == ' refs/heads/main' || startsWith('refs/heads/hotfix', github.base_ref) )
295
293
runs-on : ubuntu-22.04
296
294
needs :
297
295
- build
@@ -460,7 +458,7 @@ jobs:
460
458
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform plan --var-file=./env.variables.tfvars
461
459
462
460
- name : Terraform Apply
463
- if : github.ref == 'refs/heads/main'
461
+ if : github.event.action == 'closed' && github.event.pull_request.merged == true && github.base_ref == ' refs/heads/main'
464
462
run : |
465
463
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform apply -auto-approve --var-file=./env.variables.tfvars
466
464
0 commit comments