-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create postgres-init_trigger.yml (#594)
- Loading branch information
1 parent
fd1924e
commit bf4dd9f
Showing
1 changed file
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
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 |