Skip to content

Commit

Permalink
Merge pull request #10612 from ror-community/v2-actions
Browse files Browse the repository at this point in the history
update actions for v2
  • Loading branch information
adambuttrick authored Apr 8, 2024
2 parents 621a192 + 9e4f982 commit dae80f5
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 31 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/generate_relationships.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ name: Create relationships
on:
workflow_dispatch:
inputs:
schema-version:
required: true
description: Schema version
type: choice
options:
- v1
- v2
directory-name:
type: string
description: Name of parent directory containing records to generate relationships for. Needed only if different from branch name.
Expand Down Expand Up @@ -30,8 +37,13 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install requests==2.23.0
curl https://raw.githubusercontent.com/ror-community/curation_ops/main/generate_relationships/generate_relationships.py -o generate_relationships.py
python generate_relationships.py relationships.csv
curl https://raw.githubusercontent.com/ror-community/curation_ops/v2-crosswalk/generate_relationships/generate_relationships.py -o generate_relationships.py
if [[ ${{ github.event.inputs.schema-version }} == 'v1' ]]; then
python generate_relationships.py relationships.csv -v 1
fi
if [[ ${{ github.event.inputs.schema-version }} == 'v2' ]]; then
python generate_relationships.py relationships.csv -v 2
fi
- name: commit error file
if: ${{ steps.genrelshp.outcome != 'success'}}
working-directory: ${{ env.WORKING_DIR }}
Expand Down Expand Up @@ -61,4 +73,4 @@ jobs:
with:
channel: '#ror-curation-releases'
color: 'good'
text: 'Relationship generation status ${env.VALIDATION_STATUS} in ${env.GITHUB_REPOSITORY}. Branch: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/tree/${env.GITHUB_REF_NAME}. Directory: ${{ env.WORKING_DIR }}. Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID} for more details'
text: 'Relationship generation status ${env.VALIDATION_STATUS} in ${env.GITHUB_REPOSITORY}. Using version ${{ github.event.inputs.schema-version }}. Branch: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/tree/${env.GITHUB_REF_NAME}. Directory: ${{ env.WORKING_DIR }}. Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID} for more details'
18 changes: 15 additions & 3 deletions .github/workflows/remove_relationships.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ name: Remove relationships to inactive records
on:
workflow_dispatch:
inputs:
schema-version:
required: true
description: Schema version
type: choice
options:
- v1
- v2
directory-name:
type: string
description: Name of parent directory containing new/updated records with inactive statuses. Needed only if different from branch name.
Expand Down Expand Up @@ -30,8 +37,13 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install requests==2.23.0
curl https://raw.githubusercontent.com/ror-community/curation_ops/main/remove_relationships/remove_relationships.py -o remove_relationships.py
python remove_relationships.py relationships.csv
curl https://raw.githubusercontent.com/ror-community/curation_ops/v2-crosswalk/remove_relationships/remove_relationships.py -o remove_relationships.py
if [[ ${{ github.event.inputs.schema-version }} == 'v1' ]]; then
python remove_relationships.py -v 1
fi
if [[ ${{ github.event.inputs.schema-version }} == 'v2' ]]; then
python remove_relationships.py -v 2
fi
- name: commit error file
if: ${{ steps.remrelshp.outcome != 'success'}}
working-directory: ${{ env.WORKING_DIR }}
Expand Down Expand Up @@ -61,4 +73,4 @@ jobs:
with:
channel: '#ror-curation-releases'
color: 'good'
text: 'Relationship removal status: ${env.VALIDATION_STATUS}. Branch: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/tree/${env.GITHUB_REF_NAME}. Directory: ${{ env.WORKING_DIR }}. Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID} for more details'
text: 'Relationship removal status: ${env.VALIDATION_STATUS}. Using version ${{ github.event.inputs.schema-version }}. Branch: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/tree/${env.GITHUB_REF_NAME}. Directory: ${{ env.WORKING_DIR }}. Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID} for more details'
20 changes: 16 additions & 4 deletions .github/workflows/update_addresses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ name: Update addresses
on:
workflow_dispatch:
inputs:
schema-version:
required: true
description: Schema version
type: choice
options:
- v1
- v2
directory-name:
type: string
description: Name of parent directory containing new/updated records. Needed only if different from branch name.
Expand Down Expand Up @@ -30,9 +37,14 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install requests==2.23.0
pip install git+https://github.com/ror-community/update_address.git@add-caching
curl https://raw.githubusercontent.com/ror-community/curation_ops/separate-address-update/update_address_only/update_addresses.py -o update_addresses.py
python update_addresses.py
pip install git+https://github.com/ror-community/update_address.git@v2-locations
curl https://raw.githubusercontent.com/ror-community/curation_ops/v2-crosswalk/update_address_only/update_addresses.py -o update_addresses.py
if [[ ${{ github.event.inputs.schema-version }} == 'v1' ]]; then
python update_addresses.py -v 1
fi
if [[ ${{ github.event.inputs.schema-version }} == 'v2' ]]; then
python update_addresses.py -v 2
fi
- name: commit error file
if: ${{ steps.updateaddresses.outcome != 'success'}}
working-directory: ${{ env.WORKING_DIR }}
Expand Down Expand Up @@ -62,4 +74,4 @@ jobs:
with:
channel: '#ror-curation-releases'
color: 'good'
text: 'DEV address update status: ${env.VALIDATION_STATUS}. Branch: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/tree/${env.GITHUB_REF_NAME}. Directory: ${{ env.WORKING_DIR }}. Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID} for more details'
text: 'DEV address update status: ${env.VALIDATION_STATUS}. Using version ${{ github.event.inputs.schema-version }}. Branch: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/tree/${env.GITHUB_REF_NAME}. Directory: ${{ env.WORKING_DIR }}. Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID} for more details'
20 changes: 16 additions & 4 deletions .github/workflows/update_labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ name: Update labels in related records
on:
workflow_dispatch:
inputs:
schema-version:
required: true
description: Schema version
type: choice
options:
- v1
- v2
directory-name:
type: string
description: Name of parent directory containing records to generate relationships for. Needed only if different from branch name.
Expand Down Expand Up @@ -29,10 +36,15 @@ jobs:
working-directory: ${{ env.WORKING_DIR }}
run: |
python -m pip install --upgrade pip
curl https://raw.githubusercontent.com/ror-community/curation_ops/main/update_related_records/requirements.txt -o requirements.txt
curl https://raw.githubusercontent.com/ror-community/curation_ops/v2-crosswalk/update_related_records/requirements.txt -o requirements.txt
pip install -r requirements.txt
curl https://raw.githubusercontent.com/ror-community/curation_ops/main/update_related_records/update_related.py -o update_related.py
python update_related.py
curl https://raw.githubusercontent.com/ror-community/curation_ops/v2-crosswalk/update_related_records/update_related.py -o update_related.py
if [[ ${{ github.event.inputs.schema-version }} == 'v1' ]]; then
python update_related.py -v 1
fi
if [[ ${{ github.event.inputs.schema-version }} == 'v2' ]]; then
python update_related.py -v 2
fi
- name: commit changed files
if: ${{ steps.updatelabels.outcome == 'success'}}
uses: stefanzweifel/git-auto-commit-action@v4
Expand All @@ -56,4 +68,4 @@ jobs:
with:
channel: '#ror-curation-releases'
color: 'good'
text: '${env.GITHUB_REPOSITORY}: Update labels in related records status: ${env.VALIDATION_STATUS}. Branch: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/tree/${env.GITHUB_REF_NAME}. Directory: ${{ env.WORKING_DIR }}. Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID} for more details'
text: '${env.GITHUB_REPOSITORY}: Update labels in related records status: ${env.VALIDATION_STATUS}. Using version ${{ github.event.inputs.schema-version }}. Branch: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/tree/${env.GITHUB_REF_NAME}. Directory: ${{ env.WORKING_DIR }}. Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID} for more details'
72 changes: 55 additions & 17 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ name: Validate files
on:
workflow_dispatch:
inputs:
schema-version:
required: true
description: Schema version
type: choice
options:
- v1
- v2
with-relationship:
type: boolean
description: Check box to validate with relationships
Expand Down Expand Up @@ -29,6 +36,7 @@ jobs:
uses: actions/checkout@v2
with:
repository: ror-community/validation-suite
ref: schema-v2
path: validation-suite
- name: Get directory name
if: "${{ github.event.inputs.directory-name != '' }}"
Expand All @@ -39,31 +47,61 @@ jobs:
- name: Validate files
id: validatefiles
run: |
echo ${{ github.event.inputs.schema-version}}
mkdir files
cp ./${{ env.WORKING_DIR }}/*/*.json files/
cd validation-suite
python -m pip install --upgrade pip
pip install -r requirements.txt
curl https://raw.githubusercontent.com/ror-community/ror-schema/master/ror_schema.json -o ror_schema.json
curl https://raw.githubusercontent.com/ror-community/ror-schema/master/ror_schema_v2_0.json -o ror_schema_v2_0.json
ls ../files/
if [[ ${{ github.event.inputs.skip-geonames }} == true ]]; then
if [[ ${{ github.event.inputs.with-relationship }} == true ]]; then
if [[ -f "../${{ env.WORKING_DIR }}/relationships.csv" ]]; then
python run_validations.py -i ../files -f ../${{ env.WORKING_DIR }}/relationships.csv -p ../files/ --no-geonames
else
python run_validations.py -i ../files -p ../files/ --no-geonames
if [[ ${{ github.event.inputs.schema-version }} == 'v1' ]]; then
echo "validating v1"
if [[ ${{ github.event.inputs.skip-geonames }} == true ]]; then
if [[ ${{ github.event.inputs.with-relationship }} == true ]]; then
if [[ -f "../${{ env.WORKING_DIR }}/relationships.csv" ]]; then
python run_validations.py -i ../files -v 1 -s ror_schema.json -f ../${{ env.WORKING_DIR }}/relationships.csv -p ../files/ --no-geonames
else
python run_validations.py -i ../files -v 1 -s ror_schema.json -p ../files/ --no-geonames
fi
elif [[ ${{ github.event.inputs.with-relationship }} == false ]]; then
python run_validations.py -i ../files -v 1 -s ror_schema.json --no-geonames
fi
else
if [[ ${{ github.event.inputs.with-relationship }} == true ]]; then
if [[ -f "../${{ env.WORKING_DIR }}/relationships.csv" ]]; then
python run_validations.py -i ../files -v 1 -s ror_schema.json -f ../${{ env.WORKING_DIR }}/relationships.csv -p ../files/
else
python run_validations.py -i ../files -v 1 -s ror_schema.json -p ../files/
fi
elif [[ ${{ github.event.inputs.with-relationship }} == false ]]; then
python run_validations.py -i ../files -v 1 -s ror_schema.json
fi
elif [[ ${{ github.event.inputs.with-relationship }} == false ]]; then
python run_validations.py -i ../files --no-geonames
fi
else
if [[ ${{ github.event.inputs.with-relationship }} == true ]]; then
if [[ -f "../${{ env.WORKING_DIR }}/relationships.csv" ]]; then
python run_validations.py -i ../files -f ../${{ env.WORKING_DIR }}/relationships.csv -p ../files/
else
python run_validations.py -i ../files -p ../files/
fi
if [[ ${{ github.event.inputs.schema-version }} == 'v2' ]]; then
echo "validating v2"
if [[ ${{ github.event.inputs.skip-geonames }} == true ]]; then
if [[ ${{ github.event.inputs.with-relationship }} == true ]]; then
if [[ -f "../${{ env.WORKING_DIR }}/relationships.csv" ]]; then
python run_validations.py -i ../files -v 2 -s ror_schema_v2_0.json -f ../${{ env.WORKING_DIR }}/relationships.csv -p ../files/ --no-geonames
else
python run_validations.py -i ../files -v 2 -s ror_schema_v2_0.json -p ../files/ --no-geonames
fi
elif [[ ${{ github.event.inputs.with-relationship }} == false ]]; then
python run_validations.py -i ../files -v 2 -s ror_schema_v2_0.json --no-geonames
fi
else
if [[ ${{ github.event.inputs.with-relationship }} == true ]]; then
if [[ -f "../${{ env.WORKING_DIR }}/relationships.csv" ]]; then
python run_validations.py -i ../files -v 2 -s ror_schema_v2_0.json -f ../${{ env.WORKING_DIR }}/relationships.csv -p ../files/
else
python run_validations.py -i ../files -v 2 -s ror_schema_v2_0.json -p ../files/
fi
elif [[ ${{ github.event.inputs.with-relationship }} == false ]]; then
python run_validations.py -i ../files -v 2 -s ror_schema_v2_0.json
fi
elif [[ ${{ github.event.inputs.with-relationship }} == false ]]; then
python run_validations.py -i ../files
fi
fi
- name: Notify Slack
Expand All @@ -74,4 +112,4 @@ jobs:
with:
channel: '#ror-curation-releases'
color: 'good'
text: '${env.GITHUB_REPOSITORY}: Validation status ${{ steps.validatefiles.outcome }} in ${env.GITHUB_REPOSITORY}. On branch: ${{ env.WORKING_DIR }}. Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}'
text: 'Validation status ${{ steps.validatefiles.outcome }} in ${env.GITHUB_REPOSITORY}. Using version ${{ github.event.inputs.schema-version }}. On branch: ${{ env.WORKING_DIR }}. Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}'

0 comments on commit dae80f5

Please sign in to comment.