-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (115 loc) · 4.44 KB
/
Copy pathvalidate-dataops-content.yml
File metadata and controls
135 lines (115 loc) · 4.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Validate DataOps Content
on:
push:
branches:
- main
paths:
- "content/**"
- "templates/dataops-knowledge/**"
- "_docs/**"
- "docs/**"
- ".goal-v1.md"
- "PROJECT_PLAN.md"
- "PORTAL_ANALYSIS.md"
- "README.md"
- "backend/scripts/seed-templates.ts"
- "tools/content_tools/**"
- ".github/workflows/validate-dataops-content.yml"
pull_request:
paths:
- "content/**"
- "templates/dataops-knowledge/**"
- "_docs/**"
- "docs/**"
- ".goal-v1.md"
- "PROJECT_PLAN.md"
- "PORTAL_ANALYSIS.md"
- "README.md"
- "backend/scripts/seed-templates.ts"
- "tools/content_tools/**"
- ".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
steps:
- name: Check out repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
- name: Install Python
run: uv python install
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "20"
cache: npm
cache-dependency-path: package-lock.json
- name: Validate docs links and workflow doc IDs
run: uv run --project tools/content_tools python -m content_tools.validate_docs_links --repo-root . --content-root content
- name: Validate dataops-knowledge migration scaffold
run: uv run --project tools/content_tools python -m content_tools.validate_knowledge_repo --repo-root . --scaffold-root templates/dataops-knowledge
- name: Install Node workspace dependencies
run: npm ci
- name: Build search index
run: |
mkdir -p .tmp
npm --prefix backend run build:search-index -- --content-dir ../content --output ../.tmp/dataops-content-search.index
- name: Smoke test built index
working-directory: backend
run: npx tsx scripts/smoke-search-index.ts ../.tmp/dataops-content-search.index
- name: Check whether content changed
if: github.event_name == 'push'
id: content-changes
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 BackendFunction \
--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" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/dataops-refresh-event.json \
/tmp/dataops-refresh-response.json
python3 - <<'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