Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v4
- name: Cache Docker layers
uses: actions/cache@v4
with:
Expand All @@ -28,12 +28,12 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_RORAPI_USERNAME }}
password: ${{ secrets.DOCKERHUB_RORAPI_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
git add ror/services/api/environments/dev/_ror-api-dev.auto.tfvars
git commit -m "Adding ror-api git variables for commit ${{ steps.extract_variables.outputs.GIT_SHA }}"
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
uses: ad-m/github-push-action@v1.3.0
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
repository: "ror-community/new-deployment"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Checkout ror-api code
uses: actions/checkout@v2
- name: Set up Python environment
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install ruff
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v4
- name: Cache Docker layers
uses: actions/cache@v4
with:
Expand All @@ -22,7 +22,7 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_RORAPI_USERNAME }}
password: ${{ secrets.DOCKERHUB_RORAPI_TOKEN }}
Expand All @@ -31,7 +31,7 @@ jobs:
echo "GIT_TAG=$(git tag --points-at HEAD)" >> $GITHUB_OUTPUT
id: set_git_vars
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
git add ror/services/api/environments/prod/_ror-api.auto.tfvars
git commit -m "Adding ror-api git variables for commit ${{ steps.extract_variables.outputs.GIT_SHA }}"
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
uses: ad-m/github-push-action@v1.3.0
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
repository: 'ror-community/new-deployment'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
with:
path: ror-api
- name: Set up Python environment
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.12"
cache: "pip"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v4
- name: Cache Docker layers
uses: actions/cache@v4
with:
Expand All @@ -24,12 +24,12 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_RORAPI_USERNAME }}
password: ${{ secrets.DOCKERHUB_RORAPI_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
git add ror/services/api/environments/staging/_ror-api-staging.auto.tfvars
git commit -m "Adding ror-api git variables for commit ${{ steps.extract_variables.outputs.GIT_SHA }}"
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
uses: ad-m/github-push-action@v1.3.0
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
repository: 'ror-community/new-deployment'
Expand Down
10 changes: 7 additions & 3 deletions rorapi/common/create_update.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import logging

logger = logging.getLogger(__name__)

import copy
import functools
import json
Expand Down Expand Up @@ -60,10 +64,10 @@ def update_locations(locations):
for location in locations:
if 'geonames_id' in location:
try:
print(location['geonames_id'])
logger.info(location['geonames_id'])
updated_location = ua.new_geonames_v2(str(location['geonames_id']))
updated_locations.append(updated_location['location'])
except:
except Exception:
error = "Error retrieving Geonames data for ID {}. Please check that this is a valid Geonames ID".format(location['geonames_id'])
return error, updated_locations

Expand All @@ -90,7 +94,7 @@ def new_record_from_json(json_input, version):
new_record['locations'] = updated_locations
new_record = add_created_last_mod(new_record)
new_ror_id = check_ror_id()
print("new ror id: " + new_ror_id)
logger.info("new ror id: " + new_ror_id)
new_record['id'] = new_ror_id
error, valid_data = validate_record(sort_list_fields(new_record), get_v2_schema())
return error, valid_data
Expand Down
14 changes: 9 additions & 5 deletions rorapi/common/csv_bulk.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import logging

logger = logging.getLogger(__name__)

import csv
import json
import io
Expand Down Expand Up @@ -43,7 +47,7 @@ def save_report_file(report, report_fields, csv_file, dir_name, validate_only):
f.write(chunk)

def process_csv(csv_file, version, validate_only):
print("Processing CSV")
logger.info("Processing CSV")
dir_name = datetime.now().strftime("%Y-%m-%d_%H_%M_%S") + "-ror-records"
success_msg = None
error = None
Expand All @@ -53,15 +57,15 @@ def process_csv(csv_file, version, validate_only):
updated_count = 0
new_count = 0
read_file = csv_file.read().decode('utf-8')
print(read_file)
logger.info(read_file)
reader = csv.DictReader(io.StringIO(read_file))
row_num = 2
for row in reader:
html_url = None
ror_id = None
updated = False
print("Row data")
print(row)
logger.info("Row data")
logger.info(row)
if row['html_url']:
html_url = row['html_url']
if row['id']:
Expand All @@ -80,7 +84,7 @@ def process_csv(csv_file, version, validate_only):
ror_id = v2_record['id']
serializer = OrganizationSerializerV2(v2_record)
json_obj = json.loads(JSONRenderer().render(serializer.data))
print(json_obj)
logger.info(json_obj)
if not validate_only:
#create file
file = save_record_file(ror_id, updated, json_obj, dir_name)
Expand Down
12 changes: 8 additions & 4 deletions rorapi/common/csv_create.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import logging

logger = logging.getLogger(__name__)

import copy
from rorapi.common.record_utils import *
from rorapi.common.csv_utils import *
Expand Down Expand Up @@ -74,8 +78,8 @@ def new_record_from_csv(csv_data, version):
"lang": lang_code
}
temp_names.append(name_obj)
print("temp names 1:")
print(temp_names)
logger.info("temp names 1:")
logger.info(temp_names)
name_vals = [n['value'] for n in temp_names]
dup_names = []
for n in name_vals:
Expand All @@ -99,8 +103,8 @@ def new_record_from_csv(csv_data, version):
if name_obj not in temp_names:
temp_names = [t for t in temp_names if t not in name_lang_dups]
temp_names.append(name_obj)
print("temp names 2:")
print(temp_names)
logger.info("temp names 2:")
logger.info(temp_names)
v2_data['names'] = temp_names

#status
Expand Down
Loading
Loading