DEV index full data dump #23
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
name: DEV index full data dump | |
on: | |
workflow_dispatch: | |
inputs: | |
release-dump: | |
type: string | |
description: Name of existing release dump file to index, without .zip extension (ex v1.41-2024-02-13-ror-data) | |
schema-version: | |
required: true | |
description: Schema version to index | |
type: choice | |
options: | |
- v1 | |
- v2 | |
data-env: | |
required: true | |
description: ROR data env (test uses ror-data-test repo, prod uses ror-data) | |
default: 'test' | |
type: choice | |
options: | |
- test | |
- prod | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} | |
jobs: | |
check_permission: | |
runs-on: ubuntu-latest | |
if: github.event.ref == 'refs/heads/dev' | |
steps: | |
- name: Get Permission | |
uses: octokit/[email protected] | |
id: get_permission | |
with: | |
route: GET /repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: output | |
run: | | |
export role_name=${{ fromJson(steps.get_permission.outputs.data).role_name }} | |
if [[ "$role_name" == "admin" ]]; then | |
exit 0 | |
else | |
exit 1 | |
fi | |
index-dump: | |
runs-on: ubuntu-latest | |
if: github.event.ref == 'refs/heads/dev' | |
needs: check_permission | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
- name: Index dump file | |
id: indexdatadump | |
run: | | |
cd .github/workflows | |
python -m pip install --upgrade pip | |
pip install requests==2.23.0 | |
if [[ ${{ github.event.inputs.schema-version }} == "v1" ]]; then | |
python index_dump.py -u ${{ secrets.INDEX_DUMP_DEV_API_URL }} -f ${{ github.event.inputs.release-dump }} -e ${{ github.event.inputs.data-env }} -he ${{ secrets.INDEX_DEV_API_HEADERS }} | |
else | |
python index_dump.py -u ${{ secrets.INDEX_DUMP_DEV_API_URL_V2 }} -f ${{ github.event.inputs.release-dump }} -e ${{ github.event.inputs.data-env }} -he ${{ secrets.INDEX_DEV_API_HEADERS }} | |
fi | |
- name: Notify Slack | |
if: always() | |
uses: edge/simple-slack-notify@master | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.CURATOR_SLACK_WEBHOOK_URL }} | |
with: | |
channel: '#ror-curation-releases' | |
color: 'good' | |
text: 'DEV full index from dump status: ${{ steps.indexdatadump.outcome }}. From file: ${{ github.event.inputs.release-dump }}. Schema version: ${{ github.event.inputs.schema-version }}. Data env: ${{ github.event.inputs.data-env }}. Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}' | |