Script cleanup / prepare for PR

This commit is contained in:
zandercymatics 2023-11-27 12:41:26 -07:00
parent a188137988
commit f40e71ca8b
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
4 changed files with 11 additions and 49 deletions

View file

@ -7,7 +7,7 @@ on:
inputs:
environment:
type: choice
description: Which environment load reports for?
description: Which environment do you wish to load reports for?
options:
- stable
- staging
@ -24,9 +24,10 @@ on:
- bl
- rjm
- dk
schedule:
# TODO - uncomment after #1403 is finished
#schedule:
# Runs every day at 5 AM UTC.
- cron: "0 5 * * *"
# - cron: "0 5 * * *"
jobs:
variables:
@ -42,31 +43,13 @@ jobs:
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, wait-for-deploy]
needs: [variables]
env:
CF_USERNAME: CF_ZA_USERNAME
CF_PASSWORD: CF_ZA_PASSWORD
CF_USERNAME: CF_{{ needs.variables.outputs.environment }}_USERNAME
CF_PASSWORD: CF_{{ needs.variables.outputs.environment }}_PASSWORD
steps:
- name: Wait for a few seconds
run: sleep 20
- name: Generate current-federal.csv
uses: 18f/cg-deploy-action@main
with:
@ -84,20 +67,4 @@ jobs:
cf_org: cisa-dotgov
cf_space: ${{ needs.variables.outputs.environment }}
full_command: "cf run-task getgov-${{ needs.variables.outputs.environment }} --command 'python manage.py generate_current_full_report' --name full"
comment:
runs-on: ubuntu-latest
needs: [variables, upload-reports]
steps:
- uses: actions/github-script@v6
env:
ENVIRONMENT: ${{ needs.variables.outputs.environment }}
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🥳 Successfully uploaded current-full.csv and current-federal.csv to **[${{ env.ENVIRONMENT }}](https://getgov-${{ env.ENVIRONMENT }}.app.cloud.gov/)**.'
})