Skip to content

Commit

Permalink
testing ci connection
Browse files Browse the repository at this point in the history
  • Loading branch information
chelseybeck committed Feb 15, 2024
1 parent 1121b9f commit 10fb916
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/test-aws-access.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: List AWS S3 Buckets

on: [push]

jobs:
list-buckets:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install dependencies
run: |
pip install boto3
- name: List S3 Buckets
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: python list_buckets.py
22 changes: 22 additions & 0 deletions python/list_buckets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import boto3
import os

def list_buckets():
# Create an S3 client using environment variables for credentials
s3 = boto3.client(
's3',
aws_access_key_id=os.getenv('AWS_ACCESS_KEY_ID'),
aws_secret_access_key=os.getenv('AWS_SECRET_ACCESS_KEY')
)

# Call S3 to list current buckets
response = s3.list_buckets()

# Get a list of all bucket names from the response
buckets = [bucket['Name'] for bucket in response['Buckets']]

# Print out the bucket list
print("Bucket List: %s" % buckets)

if __name__ == '__main__':
list_buckets()

0 comments on commit 10fb916

Please sign in to comment.