|
| 1 | +name: Download File from DEV S3 Bucket and Commit to Repo |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: # Allow manual trigger of the workflow remove the push comment to test |
| 5 | + # push: |
| 6 | + # branches: |
| 7 | + # - feat/53_auto_postwarnings |
| 8 | + |
| 9 | +jobs: |
| 10 | + download_file: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + # Step 1: Checkout the code from the repository |
| 15 | + - name: Checkout repository |
| 16 | + uses: actions/checkout@v2 |
| 17 | + |
| 18 | + # Step 2: Set up Python |
| 19 | + - name: Set up Python |
| 20 | + uses: actions/setup-python@v2 |
| 21 | + with: |
| 22 | + python-version: '3.x' # You can specify the Python version here |
| 23 | + |
| 24 | + # Step 3: Install the dependencies (e.g., boto3) |
| 25 | + - name: Install dependencies |
| 26 | + run: | |
| 27 | + python -m pip install --upgrade pip |
| 28 | + pip install boto3 |
| 29 | +
|
| 30 | + # Step 4: Run the Python script to download the file from Dell ECS |
| 31 | + - name: Download file from Dell ECS |
| 32 | + run: | |
| 33 | + python frontend/import_dev.py |
| 34 | + env: |
| 35 | + S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID_DEV }} |
| 36 | + S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY_DEV }} |
| 37 | + S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }} |
| 38 | + S3_BUCKET: ${{ secrets.S3_BUCKET_DEV }} |
| 39 | + |
| 40 | + # Step 5: Add, commit, and push the downloaded file to the repository |
| 41 | + - name: Commit and push downloaded file to repository |
| 42 | + run: | |
| 43 | + git config --global user.name "AmanBhathal" |
| 44 | + git config --global user.email "amandeep.bhathal@gov.bc.ca" |
| 45 | + git add . # Add the downloaded file (path relative to the repo root) |
| 46 | + git commit -m "Add downloaded file from BCBOX" || echo "No changes to commit" |
| 47 | +
|
| 48 | + # Push back to the same branch that triggered the workflow |
| 49 | + git push origin HEAD:${{ github.ref_name }} || echo "No changes to push" |
0 commit comments