Skip to content

Relaxa Py req. - Fix #1684 #1031

Relaxa Py req. - Fix #1684

Relaxa Py req. - Fix #1684 #1031

Workflow file for this run

name: data-check
on:
pull_request_target:
types:
- labeled
jobs:
guard:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check if workflow files were modified
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
workflows:
- '.github/**'
- name: Exit if workflow files were modified and it's a fork
if: |
steps.changes.outputs.workflows == 'true' &&
github.event.pull_request.head.repo.full_name != github.repository
run: exit 1
get-changes:
needs: guard
runs-on: ubuntu-latest
if: github.event.label.name == 'data-check-trigger'
steps:
- name: Check file changes
id: file_changes
uses: trilom/[email protected]
- name: Copy file changes
run: cp $HOME/files.json files.json
- name: Upload file changes
uses: actions/upload-artifact@v2
with:
name: push-changes
path: files.json
data-check:
needs: get-changes
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Download changes
uses: actions/download-artifact@v2
with:
name: push-changes
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install basedosdados==1.6.11 pyarrow pytest toml
- name: Set up base dos dados environment
shell: bash
env:
BUCKET_NAME: basedosdados
PROJECT_NAME_PROD: basedosdados
PROJECT_NAME_STAGING: basedosdados-staging
GCP_BD_PROD: ${{ secrets.GCP_BD_DEV_PROD }}
GCP_BD_STAGING: ${{ secrets.GCP_BD_DEV_STAGING }}
CKAN_URL: "https://basedosdados.org"
CKAN_API_KEY: ${{ secrets.CKAN_PROD }}
run: python .github/workflows/env-setup/env_setup.py
- name: Test data and fill report
run: pytest -v .github/workflows/data-check
shell: bash
- name: Format report
if: ${{ always() }}
id: get-comment-body
run: |
echo -e "\n\n[Action Output](${{ env.GITHUB_WORKFLOW_URL }})" >> report.md
body=$(cat report.md)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::"$body"
shell: bash
env:
GITHUB_WORKFLOW_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Create comment
if: ${{ always() && github.event_name == 'pull_request_target' }}
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.get-comment-body.outputs.body }}