Skip to content

Actualiza_productos_de_Registro_Civil #10877

Actualiza_productos_de_Registro_Civil

Actualiza_productos_de_Registro_Civil #10877

Workflow file for this run

name: Actualiza_productos_de_Registro_Civil
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
#push
# github runners are on GMT
schedule:
- cron: '45 12-23 * * *'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
Actualiza_productos_del_Registro_Civil:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Sets up python
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
# Runs a set of commands using the runners shell
- name: Install dependencies
run: |
date
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: querying API to update our products
run: |
cd src
python registroCivil.py
for i in *.tmp;do
if [ -f ${i} ]; then
echo "Processing ${i}"
export SLACK_MESSAGE="${SLACK_MESSAGE}\n$i"
fi
done
if [ -z SLACK_MESSAGE ] ;then
echo '{
"text": "'${SLACK_MESSAGE}'"
}' > slack_message.json
fi
if [[ -f slack_message.json ]]; then
cat slack_message.json
curl -X POST -H 'Content-type: application/json' --data @slack_message.json ${{ secrets.SLACK_WEBHOOK_URL }}
fi
- name: Uploads changes to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --exclude '*' --include '*.tmp'
env:
AWS_S3_BUCKET: ${{ secrets.AWS_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.COVID_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.COVID_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1' # optional: defaults to us-east-1
SOURCE_DIR: 'src' # optional: defaults to entire repository
DEST_DIR: 'logsRegistroCivil'
- name: add_remove_changes
# only remove files from input/RegistroCivil
# then add the new ones
run: |
for i in $(git status input/RegistroCivil | grep deleted | awk '{print $2}'); do
if [ ! -z "$i" ]
then
echo git rm $i;
git rm $i;
fi
done
for i in $(git status input/RegistroCivil | grep input | egrep -v deleted ); do
if [ ! -z "$i" ]
then
echo git add $i;
git add $i;
fi
done
- uses: stefanzweifel/[email protected]
with:
commit_message: "Added data from registro civil to repo"
# Optional glob pattern of files which should be added to the commit
file_pattern: output/*/*.csv
# Optional local file path to the repository
repository: .
# Optional commit user and author settings
commit_user_name: MinCiencia GitHub Actions Bot
commit_user_email: [email protected]
commit_author: minciencia github bot <[email protected]>
- name: update_API
run: |
curl -u "${{ secrets.DO_INT_USER }}:${{ secrets.DO_INT_PASS }}" \
-H 'Accept: application/vnd.github.everest-preview+json' "https://api.github.com/repos/Data-Observatory/covid19-API/dispatches" \
-d '{"event_type": "update_please_from_Registro_Civil"}'