Skip to content

Ingest - 📁 Open Data Routine Updates #4

Ingest - 📁 Open Data Routine Updates

Ingest - 📁 Open Data Routine Updates #4

name: Ingest - 📁 Open Data Routine Updates
on:
schedule:
# Weekly Cron job
- cron: "0 0 * * 0"
workflow_dispatch:
inputs:
dev_image:
description: "Use dev image specific to this branch? (If exists)"
type: boolean
required: true
default: false
dev_bucket:
description: "dev bucket to use in place of recipes. If name of bucket is 'de-dev-a' simply put 'a'"
type: string
required: false
jobs:
dataloading:
runs-on: ubuntu-22.04
container:
image: nycplanning/build-base:${{ inputs.dev_image && format('dev-{0}', github.head_ref || github.ref_name) || 'latest' }}
env:
RECIPES_BUCKET: ${{ inputs.dev_bucket && format('de-dev-{0}', inputs.dev_bucket) || 'edm-recipes' }}
PUBLISHING_BUCKET: ${{ inputs.dev_bucket && format('de-dev-{0}', inputs.dev_bucket) || 'edm-publishing' }}
DEV_FLAG: ${{ inputs.dev_bucket && 'true' || 'false' }}
strategy:
fail-fast: false
matrix:
dataset:
- dcp_edesignation_csv
- doitt_buildingfootprints
- doitt_buildingfootprints_historical
- dot_projects_intersections
- dot_projects_streets
- dpr_capitalprojects
- dpr_forever_wild
- dpr_greenthumb
- dpr_park_access_zone
- dpr_parksproperties
- dpr_schoolyard_to_playgrounds
- dsny_frequencies
- dsny_garages
- fdny_firehouses
- lpc_historic_districts
- lpc_historic_district_areas
- lpc_landmarks
- lpc_scenic_landmarks
- nypd_policeprecincts
steps:
- uses: actions/checkout@v4
- name: Load Secrets
uses: 1password/load-secrets-action@v1
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
AWS_S3_ENDPOINT: "op://Data Engineering/DO_keys/AWS_S3_ENDPOINT"
AWS_SECRET_ACCESS_KEY: "op://Data Engineering/DO_keys/AWS_SECRET_ACCESS_KEY"
AWS_ACCESS_KEY_ID: "op://Data Engineering/DO_keys/AWS_ACCESS_KEY_ID"
BUILD_ENGINE_SERVER: "op://Data Engineering/EDM_DATA/server_url"
- name: Finish container setup ...
run: ./bash/docker_container_setup.sh
- name: Ingest
run: python3 -m dcpy.cli lifecycle scripts ingest_or_library_archive ${{ matrix.dataset }} --latest
create_issue_on_failure:
needs: dataloading
runs-on: ubuntu-22.04
if: ${{ failure() && (github.event_name == 'schedule') }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: .github
- name: Create issue on failure
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTION: ${{ github.workflow }}
BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
with:
filename: .github/ISSUE_TEMPLATE/scheduled_action_failure.md