Migrate all records of an event from v1 to v2 #19
This file contains hidden or 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: Migrate all records of an event from v1 to v2 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| event: | |
| description: 'The event to process (birth or death)' | |
| required: true | |
| type: string | |
| domain: | |
| description: 'The environment domain (without protocol or subdomains)' | |
| required: true | |
| type: string | |
| default: 'farajaland-qa.opencrvs.org' | |
| client_id: | |
| description: 'System Client ID' | |
| required: false | |
| type: string | |
| client_secret: | |
| description: 'System Client Secret' | |
| required: false | |
| type: string | |
| jobs: | |
| fetch-and-transform: | |
| name: Migrate ${{ github.event.inputs.event }} in ${{ github.event.inputs.domain }} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| script_output: ${{ steps.deno-script.outputs.script_output }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref }} | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y jq | |
| curl -fsSL https://deno.land/install.sh | sh | |
| echo "$HOME/.deno/bin" >> $GITHUB_PATH | |
| - name: Convert notebook to TypeScript | |
| run: | | |
| mkdir -p tmp | |
| bash ./scripts/deno-notebook-to-deno.sh ./v1-to-v2-data-migration/migrate.ipynb ./tmp/migrate.ts | |
| - name: Run the script with Deno | |
| id: deno-script | |
| env: | |
| OPENCRVS_EVENT: ${{ github.event.inputs.event }} | |
| OPENCRVS_DOMAIN: ${{ github.event.inputs.domain }} | |
| OPENCRVS_CLIENT_ID: ${{ github.event.inputs.client_id }} | |
| OPENCRVS_CLIENT_SECRET: ${{ github.event.inputs.client_secret }} | |
| run: | | |
| set -o pipefail | |
| echo "script_output<<EOF" >> $GITHUB_OUTPUT | |
| deno run --allow-net --allow-env ./tmp/migrate.ts | tee /dev/stderr >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Generate summary | |
| run: | | |
| echo "## Notebook result" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "${{ steps.deno-script.outputs.script_output }}" >> $GITHUB_STEP_SUMMARY |