Add document registry resolver #3
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: Validate DataOps Content | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "content/**" | |
| - ".github/workflows/validate-dataops-content.yml" | |
| pull_request: | |
| paths: | |
| - "content/**" | |
| - ".github/workflows/validate-dataops-content.yml" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| env: | |
| AWS_REGION: eu-west-1 | |
| AWS_DEFAULT_REGION: eu-west-1 | |
| AWS_ROLE_ARN: arn:aws:iam::817685572750:role/dataops-github-actions-deploy | |
| FULL_DOCS_STACK_NAME: dataops-v1 | |
| jobs: | |
| validate-content: | |
| name: Validate operation docs content | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: lambda-functions | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| - name: Install Python | |
| run: uv python install | |
| - name: Build search index | |
| run: uv run --extra search python -m lambda_functions.build_search_index --docs-dir ../content --output /tmp/dataops-content-search.index | |
| - name: Smoke test built index | |
| run: | | |
| SEARCH_INDEX_PATH=/tmp/dataops-content-search.index uv run --extra search python - <<'PY' | |
| import json | |
| from lambda_functions.search_handler import handler | |
| result = handler({"queryStringParameters": {"q": "invoice", "limit": "1"}}, None) | |
| assert result["statusCode"] == 200, result | |
| body = json.loads(result["body"]) | |
| assert "results" in body, body | |
| PY | |
| - name: Check whether content changed | |
| if: github.event_name == 'push' | |
| id: content-changes | |
| working-directory: . | |
| run: | | |
| if git diff --name-only "${{ github.event.before }}" "${{ github.sha }}" | grep -q '^content/'; then | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| echo "No content files changed; skipping deployed cache refresh." | |
| fi | |
| - name: Configure AWS credentials | |
| if: github.event_name == 'push' && steps.content-changes.outputs.changed == 'true' | |
| uses: aws-actions/configure-aws-credentials@v6.1.0 | |
| with: | |
| role-to-assume: ${{ env.AWS_ROLE_ARN }} | |
| role-session-name: dataops-content-refresh | |
| aws-region: ${{ env.AWS_REGION }} | |
| - name: Refresh deployed docs cache | |
| if: github.event_name == 'push' && steps.content-changes.outputs.changed == 'true' | |
| run: | | |
| function_name="$( | |
| aws cloudformation describe-stack-resource \ | |
| --stack-name "$FULL_DOCS_STACK_NAME" \ | |
| --logical-resource-id DocsFullAppFunction \ | |
| --region "$AWS_REGION" \ | |
| --query 'StackResourceDetail.PhysicalResourceId' \ | |
| --output text | |
| )" | |
| printf '%s' '{"source":"dataops.github-actions","rawPath":"/admin/refresh","requestContext":{"http":{"method":"POST"}}}' > /tmp/dataops-refresh-event.json | |
| aws lambda invoke \ | |
| --function-name "$function_name" \ | |
| --region "$AWS_REGION" \ | |
| --payload file:///tmp/dataops-refresh-event.json \ | |
| /tmp/dataops-refresh-response.json | |
| python - <<'PY' | |
| import json | |
| from pathlib import Path | |
| payload = json.loads(Path("/tmp/dataops-refresh-response.json").read_text()) | |
| assert payload["statusCode"] == 200, payload | |
| body = json.loads(payload["body"]) | |
| assert body.get("ok") is True and body.get("refreshed") is True, body | |
| print(f"Refreshed deployed docs cache on {body.get('branch')}") | |
| PY |