Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove path filter and allow seed delete workflow to be triggered manually #1130

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions .github/workflows/delete-test-seed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,28 @@ name: Delete Test Seed
on:
pull_request_target:
types: [closed]
paths:
- 'seed/seed.json'
- 'studies/**'
workflow_dispatch:
inputs:
pull_request_number:
description: 'Pull Request Number'
required: true
type: number

jobs:
build:
runs-on: ubuntu-latest
env:
REMOTE_SEED_PATH: 'pull/${{ github.event.pull_request.number }}/seed'
REMOTE_SEED_PATH: 'pull/${{ github.event.pull_request.number || github.event.inputs.pull_request_number }}/seed'

steps:
- name: Delete seed
- name: Delete test seed
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PRODUCTION_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PRODUCTION_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
run: |
aws s3 rm "s3://brave-production-griffin-origin/$REMOTE_SEED_PATH"
aws cloudfront create-invalidation --distribution-id "$CLOUDFRONT_DISTRIBUTION_ID" --paths "/$REMOTE_SEED_PATH"
if aws s3 ls "s3://brave-production-griffin-origin/$REMOTE_SEED_PATH" > /dev/null 2>&1; then
aws s3 rm "s3://brave-production-griffin-origin/$REMOTE_SEED_PATH"
aws cloudfront create-invalidation --distribution-id "$CLOUDFRONT_DISTRIBUTION_ID" --paths "/$REMOTE_SEED_PATH"
fi