Skip to content

Commit

Permalink
Merge pull request #613 from input-output-hk/djo/597/run-ci-from-forks
Browse files Browse the repository at this point in the history
Doc & Build CI: Switch to pull_request trigger
  • Loading branch information
Alenar committed Nov 29, 2022
2 parents aa31261 + 97816e2 commit f5b5d9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/ci.yml
@@ -1,9 +1,8 @@
name: CI

on:
push:
branches: # only run on branch push, tag push will be ignored
- '**'
pull_request:
types: [opened, reopened, synchronize, closed]
paths-ignore: # ignore docs only changes since they use a dedicated workflows: docs.yml
- 'docs/**'
- 'mithril-explorer/**'
Expand Down Expand Up @@ -249,12 +248,11 @@ jobs:
packages: write

env:
PUSH_PACKAGES: ${{ github.ref == 'refs/heads/main' || startsWith('refs/heads/hotfix', github.ref) }}
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)) }}
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/${{ matrix.project }}
DOCKER_FILE: ./${{ matrix.project }}/Dockerfile.ci
CONTEXT: .
GITHUB_REF: ${{ github.ref}}

steps:
- name: Checkout
Expand All @@ -274,7 +272,7 @@ jobs:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
unstable
type=raw,value={{branch}}-{{sha}}
type=raw,value={{base_ref}}-{{sha}}
- name: Download built artifacts
uses: actions/download-artifact@v3
Expand All @@ -291,7 +289,7 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}

unstable-release:
if: github.ref == 'refs/heads/main' || startsWith('refs/heads/hotfix', github.ref)
if: github.event.action == 'closed' && github.event.pull_request.merged == true && (github.base_ref == 'refs/heads/main' || startsWith('refs/heads/hotfix', github.base_ref))
runs-on: ubuntu-22.04
needs:
- build
Expand Down Expand Up @@ -460,7 +458,7 @@ jobs:
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform plan --var-file=./env.variables.tfvars
- name: Terraform Apply
if: github.ref == 'refs/heads/main'
if: github.event.action == 'closed' && github.event.pull_request.merged == true && github.base_ref == 'refs/heads/main'
run: |
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform apply -auto-approve --var-file=./env.variables.tfvars
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/docs.yml
@@ -1,9 +1,8 @@
name: Documentations & Explorer

on:
push:
branches: # only run on branch push, tag push will be ignored
- '**'
pull_request:
types: [opened, reopened, synchronize, closed]

concurrency:
group: ci-docs-${{ github.ref }}
Expand Down Expand Up @@ -117,7 +116,7 @@ jobs:
out/*
publish-docs:
if: github.ref == 'refs/heads/main'
if: github.event.action == 'closed' && github.event.pull_request.merged == true && github.base_ref == 'refs/heads/main'
runs-on: ubuntu-22.04
needs:
- cargo-doc
Expand Down

0 comments on commit f5b5d9f

Please sign in to comment.