Skip to content

[MOSIP-29315]

[MOSIP-29315] #13

name: Trigger postgres-init repo upon db scripts updates
on:
push:
branches:
- master
- 1.*
- develop
- release*
paths:
- db_release_scripts/**
- db_scripts/**
jobs:
paths-filter:
runs-on: ubuntu-latest
outputs:
db_release_scripts: ${{ steps.filter.outputs.db_release_scripts }}
db_scripts: ${{ steps.filter.outputs.db_scripts }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
base: ${{ github.ref }}
filters: |
db_release_scripts:
- 'db_release_scripts/**'
db_scripts:
- 'db_scripts/**'
# run only if 'db_release_scripts' files were changed
db_release_scripts_updates:
needs: paths-filter
if: needs.paths-filter.outputs.db_release_scripts == 'true'
runs-on: ubuntu-latest
steps:
- name: Check for updates
run: echo "Updates are present in db_release_scripts directory, Triggering postgres-init repo"
- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,commit,author,job,took,ref # selectable (default: repo,message)
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DEVOPS }} # required
if: success() # Pick up events when the job is successful.
# run only if not 'db_release_scripts' files were changed
- name: Check for no updates
if: needs.paths-filter.outputs.db_release_scripts != 'true'
run: echo "Updates are not present in db_release_scripts directory"
# run only if 'db_scripts' files were changed
db_scripts_updates:
needs: paths-filter
if: needs.paths-filter.outputs.db_scripts == 'true'
runs-on: ubuntu-latest
steps:
- name: Check for updates
run: echo "Updates are present in db_scripts directory, Triggering postgres-init repo"
- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,commit,author,job,took,ref # selectable (default: repo,message)
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DEVOPS }} # required
if: success() # Pick up events when the job is successful.
# run only if not 'db_scripts' files were changed
- name: Check for no updates
if: needs.paths-filter.outputs.db_scripts != 'true'
run: echo "Updates are not present in db_scripts directory"
# This job is to trigger postgres-init repo.
trigger-postgres_init_repo:
runs-on: ubuntu-latest
steps:
- uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.ACTION_PAT }}
repository: mosip/postgres-init
base: ${{ github.ref }}
event-type: db-event