From d52359d1c58ea1f37efaf7b4425296b5a9c9831e Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Tue, 21 Nov 2023 14:45:23 -0700 Subject: [PATCH] Yaml stub --- .github/workflows/daily-csv-upload.yaml | 39 ++++++------------------- src/api/views.py | 1 + 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/.github/workflows/daily-csv-upload.yaml b/.github/workflows/daily-csv-upload.yaml index 729b5bd16..3863c36c4 100644 --- a/.github/workflows/daily-csv-upload.yaml +++ b/.github/workflows/daily-csv-upload.yaml @@ -1,28 +1,17 @@ name: Upload current-full.csv and current-federal.csv on: - push: - paths-ignore: - - 'docs/**' - - '**.md' - - '.gitignore' - branches: - - rjm - pull_request: - paths-ignore: - - 'docs/**' - - '**.md' - - '.gitignore' - branches: - - rjm schedule: # Runs every day at 5 AM UTC - cron: '0 5 * * *' + jobs: upload_reports: runs-on: ubuntu-latest - if: github.event_name == 'schedule' + env: + CF_USERNAME: CF_${{ github.event.inputs.environment }}_USERNAME + CF_PASSWORD: CF_${{ github.event.inputs.environment }}_PASSWORD steps: - uses: actions/checkout@v3 @@ -31,19 +20,9 @@ jobs: curl -L "https://packages.cloudfoundry.org/stable?release=linux64-binary&source=github" | tar -zx sudo mv cf /usr/local/bin - - name: Login to cloud.gov - run: | - cf api https://api.fr.cloud.gov - cf auth ${{ secrets.CF_USERNAME }} ${{ secrets.CF_PASSWORD }} - cf target -o ${{ secrets.CF_ORG }} -s ${{ secrets.CF_SPACE }} - - - name: Run task - run: cf run-task my-app "/tmp/lifecycle/shell -c './manage.py generate_current_full_and_federal_reports.py'" + - name: Generate current-federal.csv + run: cf run-task getgov-za "/tmp/lifecycle/shell -c './manage.py generate_current_full_report.py'" + - - name: Commit and push CSV files - run: | - git config --global user.name 'GitHub Actions' - git config --global user.email 'actions@github.com' - git add current-full.csv current-federal.csv - git commit -m "Update CSV files" - git push \ No newline at end of file + - name: Generate current-full.csv + run: cf run-task getgov-za "/tmp/lifecycle/shell -c './manage.py generate_current_federal_report.py'" diff --git a/src/api/views.py b/src/api/views.py index 1ed8a0888..9653a906e 100644 --- a/src/api/views.py +++ b/src/api/views.py @@ -1,4 +1,5 @@ """Internal API views""" +import os from django.apps import apps from django.views.decorators.http import require_http_methods from django.http import FileResponse, HttpResponse, JsonResponse