Prime UDI Mat Refresh (data-only) #1171
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
name: Prime UDI Mat Refresh (data-only) | |
on: | |
schedule: | |
# Run every 2 hours | |
- cron: "0 */2 * * *" | |
jobs: | |
build: | |
runs-on: techbd-sql | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Create .pgpass file | |
run: | | |
# Write the metadata comment to the .pgpass file | |
echo "# { id: \"PROD_TECHBD_UDI_DS_PRIME\", description: \"UDI Prime database \", boundary: \"Production\" }" > ~/.pgpass | |
# Append the database connection details to the .pgpass file | |
echo "${{ secrets.PROD_TECHBD_UDI_DS_PRIME_HOST }}:${{ secrets.PROD_TECHBD_UDI_DS_PRIME_PORT }}:${{ secrets.PROD_TECHBD_UDI_DS_PRIME_NAME }}:${{ secrets.PROD_TECHBD_UDI_DS_PRIME_USER }}:${{ secrets.PROD_TECHBD_UDI_DS_PRIME_PASSWORD }}" >> ~/.pgpass | |
# Set the .pgpass file permissions to 600 (read and write for owner only) | |
chmod 600 ~/.pgpass | |
- name: Refresh Materialized views | |
run: | | |
psql -h ${{ secrets.PROD_TECHBD_UDI_DS_PRIME_HOST }} \ | |
-p ${{ secrets.PROD_TECHBD_UDI_DS_PRIME_PORT }} \ | |
-U ${{ secrets.PROD_TECHBD_UDI_DS_PRIME_USER }} \ | |
-d ${{ secrets.PROD_TECHBD_UDI_DS_PRIME_NAME }} \ | |
-c "select techbd_udi_ingress.refresh_materialized_view();" |