History

Serve Microsoft Graph selections from precomputed spec slices

Rhys Sullivan committed 2 months ago

Commit aa423aa1 parent 000747410 files · +714 −3Browse files

Showing the changes to .github (1 of 10 files). Show all

Unified · Split

.github/workflows/graph-slices.yml+47−0
@@ -0,0 +1,47 @@
1+# Refresh the Microsoft Graph slice release assets.
2+#
3+# The Graph OpenAPI monolith (~43MB) cannot be processed inside a Workers
4+# isolate, so the runtime reads per-selection slices published on the
5+# `graph-slices` release tag (see packages/plugins/openapi/src/providers/
6+# microsoft/slices.ts). This workflow rebuilds the slices from the current
7+# upstream spec on a schedule and on demand.
8+name: Graph slices
9+
10+on:
11+ schedule:
12+ # Weekly; Microsoft's msgraph-metadata automation lands upstream refreshes
13+ # on a similar cadence. A failed run leaves the previous assets serving.
14+ - cron: "17 6 * * 1"
15+ workflow_dispatch: {}
16+
17+permissions:
18+ contents: write
19+
20+jobs:
21+ slices:
22+ runs-on: ubuntu-latest
23+ timeout-minutes: 20
24+ steps:
25+ - uses: actions/checkout@v4
26+
27+ - uses: oven-sh/setup-bun@v2
28+ with:
29+ bun-version: 1.3.11
30+
31+ - name: Install dependencies
32+ run: bun install --frozen-lockfile
33+
34+ - name: Generate slices
35+ working-directory: packages/plugins/openapi
36+ run: bun scripts/generate-graph-slices.ts --out "$RUNNER_TEMP/graph-slices"
37+
38+ - name: Publish to the graph-slices release
39+ env:
40+ GH_TOKEN: ${{ github.token }}
41+ run: |
42+ gh release view graph-slices --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1 || \
43+ gh release create graph-slices --repo "$GITHUB_REPOSITORY" \
44+ --title "Microsoft Graph slices" --latest=false \
45+ --notes "Generated per-preset Microsoft Graph OpenAPI slices. Data release consumed by the openapi plugin's Microsoft adapter; refreshed by the graph-slices workflow."
46+ gh release upload graph-slices "$RUNNER_TEMP/graph-slices"/* \
47+ --repo "$GITHUB_REPOSITORY" --clobber