getGPDFdR #100
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: getGPDFdR | |
on: | |
schedule: | |
- cron: '0 2 * * *' | |
workflow_dispatch: | |
inputs: | |
environment: | |
required: true | |
type: choice | |
options: | |
- prod | |
- uat | |
default: prod | |
flow_date: | |
required: true | |
type: choice | |
options: | |
- all | |
- yesterday | |
default: yesterday | |
notify: | |
description: 'notify report results' | |
required: false | |
type: boolean | |
default: true | |
jobs: | |
run-script: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Install dependencies | |
run: | | |
cd ./python/gpd-get-fdr | |
pip install -r requirements.txt | |
- name: Run Python Script | |
env: | |
FR_NEW_CONN_SUBKEY_PRD: ${{ secrets.FR_NEW_CONN_SUBKEY_PRD }} | |
FR_NEW_CONN_SUBKEY_UAT: ${{ secrets.FR_NEW_CONN_SUBKEY_UAT }} | |
FR_SA_CONN_STRING_PRD: ${{ secrets.FR_SA_CONN_STRING_PRD }} | |
FR_SA_CONN_STRING_UAT: ${{ secrets.FR_SA_CONN_STRING_UAT }} | |
FR_DATE: ${{inputs.flow_date || 'yesterday'}} | |
FR_ENV: ${{inputs.environment || 'prod'}} | |
FR_CSV_NAME: "ec-list_updated_prod.csv" | |
PYTHONUNBUFFERED: "1" | |
run: | | |
cd ./python/gpd-get-fdr | |
python get-flows.py | |
- name: Create failure payload | |
if: ${{ failure() && inputs.notify }} | |
run: | | |
echo '{ | |
"text": "❌ *Errore* Il workflow è fallito.", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "❌ *Si è verificato un errore durante l'esecuzione del job*" | |
} | |
} | |
] | |
}' > ./python/gpd-get-fdr/payload.json | |
- name: Send notification to Slack | |
id: slack | |
if: ${{ (success() || failure()) && (inputs.notify != 'false' || github.event_name == 'schedule') }} | |
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 #v1.24.0 | |
with: | |
payload-file-path: "./python/gpd-get-fdr/payload.json" | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |