Skip to content

Commit

Permalink
Merge pull request #11 from ror-community/staging
Browse files Browse the repository at this point in the history
Merge v1.0.1 to production
  • Loading branch information
adambuttrick authored Apr 28, 2022
2 parents 825e6e8 + 90bb872 commit 0e2774c
Show file tree
Hide file tree
Showing 171 changed files with 14,142 additions and 81 deletions.
33 changes: 19 additions & 14 deletions .github/workflows/generate_relationships.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: Create relationships
on:
workflow_dispatch
workflow_dispatch:
inputs:
directory-name:
type: string
description: Name of parent directory containing records to generate relationships for. Needed only if different from branch name.

jobs:
generate-relationships:
runs-on: ubuntu-latest
if: github.event.ref != 'refs/heads/main'
steps:
- name: checkout
uses: actions/checkout@v2
Expand All @@ -15,37 +18,39 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Extract branch name
id: extract_branch
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
- name: Get directory name
if: "${{ github.event.inputs.directory-name != '' }}"
run: echo "WORKING_DIR=${{ github.event.inputs.directory-name }}" >> $GITHUB_ENV
- name: Get branch name
if: "${{ github.event.inputs.directory-name == '' }}"
run: echo "WORKING_DIR=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Generate relationships
id: genrelshp
working-directory: ${{ steps.extract_branch.outputs.branch }}
working-directory: ${{ env.WORKING_DIR }}
run: |
python -m pip install --upgrade pip
pip install requests==2.23.0
pip install git+https://github.com/ror-community/update_address.git
curl https://raw.githubusercontent.com/ror-community/ror-api/staging/rorapi/management/commands/generaterelationships.py -o generaterelationships.py
curl https://raw.githubusercontent.com/ror-community/ror-api/dev/rorapi/management/commands/generaterelationships.py -o generaterelationships.py
python generaterelationships.py relationships.csv
continue-on-error: true
- name: commit error file
if: ${{ steps.genrelshp.outcome != 'success'}}
working-directory: ${{ steps.extract_branch.outputs.branch }}
working-directory: ${{ env.WORKING_DIR }}
run: |
echo "ERRORS found:"
echo "ERRORS found for some records:"
cat relationship_errors.log
- name: commit changed files
if: ${{ steps.genrelshp.outcome == 'success'}}
uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: ${{ steps.extract_branch.outputs.branch }}/*.json
file_pattern: ${{ env.WORKING_DIR }}/**.json
commit_message: Apply relationship changes to files
- name: Set env variable for notification
if: always()
run: |
if [[ ${{ steps.genrelshp.outcome }} == 'success' ]]; then
echo "relationship_status=SUCCESS" >> $GITHUB_ENV
elif [[ ${{ steps.genrelshp.outcome }} == 'failure' ]]; then
else
echo "relationship_status=FAILED" >> $GITHUB_ENV
fi
- name: Notify Slack
Expand All @@ -57,4 +62,4 @@ jobs:
with:
channel: '#ror-curation-releases'
color: 'good'
text: 'Relationship generation status: ${env.VALIDATION_STATUS}. Branch: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/tree/${env.GITHUB_REF_NAME}. Directory: ${{ steps.extract_branch.outputs.branch }}. 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}. 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'
2 changes: 1 addition & 1 deletion .github/workflows/staging_manual_index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
if [[ -f "../${{ github.event.inputs.directory-name }}/relationships.csv" ]]; then
python run_validations.py -i ../files -f ../${{ github.event.inputs.directory-name }}/relationships.csv -p ../files/
else
python run_validations.py -i ../files -p ../files/
python run_validations.py -i ../files
fi
- name: Notify Slack
if: always()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/staging_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
if [[ -f "../${{github.event.pull_request.head.ref}}/relationships.csv" ]]; then
python run_validations.py -i ../files -f ../${{github.event.pull_request.head.ref}}/relationships.csv -p ../files/
else
python run_validations.py -i ../files -p ../files/
python run_validations.py -i ../files
fi
- name: Notify Slack
if: always()
Expand Down
21 changes: 13 additions & 8 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
with-relationship:
type: boolean
description: Check box to validate with relationships
directory-name:
type: string
description: Name of parent directory containing records to validate. Needed only if different from branch name.

jobs:
validate-files:
Expand All @@ -24,21 +27,23 @@ jobs:
with:
repository: ror-community/validation-suite
path: validation-suite
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Get directory name
if: "${{ github.event.inputs.directory-name != '' }}"
run: echo "WORKING_DIR=${{ github.event.inputs.directory-name }}" >> $GITHUB_ENV
- name: Get branch name
if: "${{ github.event.inputs.directory-name == '' }}"
run: echo "WORKING_DIR=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Validate files
id: validatefiles
run: |
mkdir files
cp ./${{ steps.extract_branch.outputs.branch }}/*.json files/
cp ./${{ env.WORKING_DIR }}/**.json files/
cd validation-suite
python -m pip install --upgrade pip
pip install -r requirements.txt
if [[ ${{ github.event.inputs.with-relationship }} == "true" ]]; then
if [[ -f "../${{ steps.extract_branch.outputs.branch }}/relationships.csv" ]]; then
python run_validations.py -i ../files -f ../${{ steps.extract_branch.outputs.branch }}/relationships.csv -p ../files/
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
Expand All @@ -53,4 +58,4 @@ jobs:
with:
channel: '#ror-curation-releases'
color: 'good'
text: 'Validation status: ${{ steps.validatefiles.outcome }}. On branch: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/tree/${env.GITHUB_REF_NAME} in directory ${{ steps.extract_branch.outputs.branch }}. 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}. On branch: ${{ env.WORKING_DIR }}. Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}'
Loading

0 comments on commit 0e2774c

Please sign in to comment.