Create daily S3 snapshots #405
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Create daily S3 snapshots | |
| # yamllint disable-line rule:truthy | |
| on: | |
| schedule: | |
| - cron: '0 15 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| cf_space: | |
| description: deployed cloud.gov space | |
| required: true | |
| default: prod | |
| jobs: | |
| snapshot: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: run create-daily-snapshot cli job in chosen space | |
| uses: cloud-gov/cg-cli-tools@bafcd2b3d36984482c01b1dd2c3750b4f355b8a2 # main | |
| with: | |
| cf_api: https://api.fr.cloud.gov | |
| cf_username: ${{ secrets.CF_USERNAME }} | |
| cf_password: ${{ secrets.CF_PASSWORD }} | |
| cf_org: gsatts-sitescan | |
| cf_space: ${{ github.event.inputs.cf_space || 'prod' }} | |
| cf_command: | | |
| run-task site-scanner-consumer | |
| -c "node dist/apps/cli/main.js create-daily-snapshot" | |
| -k 4G -m 4G | |
| --name github-action-create-daily-snapshots-${{ github.run_id }} | |
| - name: Create issue on failure | |
| if: failure() | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 | |
| with: | |
| github-token: ${{ secrets.SITE_SCANNING_ISSUE_REPO_TOKEN }} | |
| script: | | |
| await github.rest.issues.create({ | |
| owner: 'gsatts-sitescan', | |
| repo: 'site-scanning', | |
| title: `Workflow failed: ${context.workflow}`, | |
| body: `Workflow **${context.workflow}** failed in [${context.repo.owner}/${context.repo.repo}](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}).\n\nRef: \`${context.ref}\`\nSHA: \`${context.sha}\`` | |
| }); |