manage.get.gov/.github/workflows/daily-csv-upload.yaml
Workflow config file is invalid. Please check your config file: yaml: line 66: did not find expected key
2023-12-01 09:42:28 -07:00

94 lines
3 KiB
YAML

name: Upload current-full.csv and current-federal.csv
run-name: Upload current-full.csv and current-federal.csv for branch ${{ github.head_ref }}
on:
pull_request:
workflow_dispatch:
inputs:
environment:
type: choice
description: Which environment do you wish to load reports for?
options:
- stable
- staging
- development
- ky
- es
- nl
- rh
- za
- gd
- rb
- ko
- ab
- bl
- rjm
- dk
schedule:
# Runs every day at 5 AM UTC.
- cron: "0 5 * * *"
jobs:
variables:
outputs:
environment: ${{ steps.var.outputs.environment}}
runs-on: "ubuntu-latest"
steps:
- name: Setting global variables
uses: actions/github-script@v6
id: var
with:
script: |
const environment = (github && github.event && github.event.inputs) ? github.event.inputs.environment : 'za';
core.setOutput('environment', environment);
wait-for-deploy:
runs-on: ubuntu-latest
steps:
- name: Wait for deploy to complete
uses: fountainhead/action-wait-for-check@v1.0.0
id: wait-for-deploy
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: "deploy"
ref: ${{ github.event.pull_request.head.sha }}
# the maximum time to wait for the check to complete, in seconds
timeoutSeconds: 600
# the time to wait between checks, in seconds
intervalSeconds: 10
upload-reports:
runs-on: ubuntu-latest
needs: [variables]
env:
CF_USERNAME: CF_{{ needs.variables.outputs.environment }}_USERNAME
CF_PASSWORD: CF_{{ needs.variables.outputs.environment }}_PASSWORD
steps:
- name: Check secrets
run: |
if [[ -z "${{ secrets.CF_ZA_USERNAME }}" ]]; then
echo "CF_ZA_USERNAME is not set"
exit 1
fi
if [[ -z "${{ secrets.CF_ZA_PASSWORD }}" ]]; then
echo "CF_ZA_PASSWORD is not set"
exit 1
fi
- name: Generate current-federal.csv
uses: cloud-gov/cg-cli-tools@main
with:
cf_username: ${{ secrets[env.CF_USERNAME] }}
cf_password: ${{ secrets[env.CF_PASSWORD] }}
cf_org: cisa-dotgov
cf_space: ${{ needs.variables.outputs.environment }}
cf_command: "run-task getgov-${{ needs.variables.outputs.environment }} --command 'python manage.py generate_current_federal_report' --name federal"
- name: Generate current-full.csv
uses: cloud-gov/cg-cli-tools@main
with:
cf_username: ${{ secrets[env.CF_USERNAME] }}
cf_password: ${{ secrets[env.CF_PASSWORD] }}
cf_org: cisa-dotgov
cf_space: ${{ needs.variables.outputs.environment }}
cf_command: "run-task getgov-${{ needs.variables.outputs.environment }} --command 'python manage.py generate_current_full_report' --name full"