-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/ersilia-os/ersilia
- Loading branch information
Showing
61 changed files
with
905 additions
and
475 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ body: | |
- Initiative 🐋 | ||
- Epic 🐅 | ||
- Batch 🐕 | ||
- Task 🐈 | ||
- type: textarea | ||
id: objectives | ||
attributes: | ||
|
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import os | ||
import json | ||
import logging | ||
import boto3 | ||
from botocore.exceptions import ClientError, NoCredentialsError | ||
import requests | ||
|
||
AIRTABLE_MODEL_HUB_BASE_ID = "appgxpCzCDNyGjWc8" | ||
AIRTABLE_TABLE_ID = 'tblZGe2a2XeBxrEHP' | ||
AWS_ACCOUNT_REGION = "eu-central-1" | ||
ERSILIA_MODEL_HUB_S3_BUCKET= 'ersilia-model-hub' | ||
|
||
def convert_airtable_to_json(airtable_api_key, aws_access_key_id, aws_secret_access_key): | ||
|
||
headers = {'Authorization': f'Bearer {airtable_api_key}'} | ||
response= requests.get(f'https://api.airtable.com/v0/{AIRTABLE_MODEL_HUB_BASE_ID}/{AIRTABLE_TABLE_ID}', headers=headers) | ||
|
||
data=response.json() | ||
records_models= [record['fields'] for record in data['records']] | ||
models_json=json.dumps(records_models, indent=4) | ||
|
||
#Load JSON in AWS S3 bucket | ||
s3 = boto3.client('s3',aws_access_key_id=aws_access_key_id,aws_secret_access_key=aws_secret_access_key,region_name=AWS_ACCOUNT_REGION) | ||
try: | ||
s3.put_object(Body=models_json, Bucket=ERSILIA_MODEL_HUB_S3_BUCKET, Key='models.json', ACL='public-read') | ||
print("file models.json uploaded") | ||
except NoCredentialsError: | ||
logging.error("Unable to upload tracking data to AWS: Credentials not found") | ||
except ClientError as e: | ||
logging.error(e) | ||
|
||
if __name__ == "__main__": | ||
|
||
print("Getting environmental variables") | ||
airtable_api_key = os.environ.get('AIRTABLE_API_KEY') | ||
aws_access_key_id = os.environ.get('AWS_ACCESS_KEY_ID') | ||
aws_secret_access_key = os.environ.get('AWS_SECRET_ACCESS_KEY') | ||
|
||
print("Converting AirTable base to JSON file") | ||
convert_airtable_to_json(airtable_api_key, aws_access_key_id, aws_secret_access_key) |
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Convert Back-end Airtable to JSON file | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
schedule: | ||
- cron: '0 2 * * *' | ||
|
||
jobs: | ||
convert-airtable-to-json: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout persist credentials | ||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # pin@v3.5.3 | ||
with: | ||
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | ||
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | ||
|
||
- name: Install dependencies | ||
run: | ||
pip install airtable-python-wrapper | ||
pip install boto3 | ||
|
||
- name: Convert to backend of Airtable to JSON FILE | ||
env: | ||
AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
run: | | ||
python .github/scripts/convert_airtable_to_json.py $AIRTABLE_API_KEY $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY |
This file contains 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
This file contains 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
Oops, something went wrong.