Skip to content

Commit 1e901f1

Browse files
committed
Add analyze-customer-repo workflow for self-serve arch docs
1 parent 7fdb9df commit 1e901f1

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Analyze Customer Repo
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
repo:
7+
description: "Repository to analyze (owner/repo)"
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
analyze:
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 15
18+
steps:
19+
- name: Checkout customer repo
20+
uses: actions/checkout@v4
21+
with:
22+
repository: ${{ inputs.repo }}
23+
24+
- name: Generate arch docs
25+
uses: supermodeltools/arch-docs@main
26+
with:
27+
supermodel-api-key: ${{ secrets.SUPERMODEL_API_KEY }}
28+
base-url: https://repos.supermodeltools.com/${{ inputs.repo }}
29+
output-dir: /tmp/arch-docs-output
30+
env:
31+
GITHUB_REPOSITORY: ${{ inputs.repo }}
32+
33+
- name: Deploy to central site
34+
env:
35+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
REPO: ${{ inputs.repo }}
37+
run: |
38+
git config --global user.name "supermodel-bot"
39+
git config --global user.email "bot@supermodeltools.com"
40+
git clone https://x-access-token:${GH_TOKEN}@github.com/GraphTechnologyDevelopers/graphtechnologydevelopers.github.io.git /tmp/central-site
41+
OWNER=$(echo "$REPO" | cut -d'/' -f1)
42+
REPO_NAME=$(echo "$REPO" | cut -d'/' -f2)
43+
rm -rf /tmp/central-site/site/${OWNER}/${REPO_NAME}
44+
mkdir -p /tmp/central-site/site/${OWNER}/${REPO_NAME}
45+
cp -r /tmp/arch-docs-output/. /tmp/central-site/site/${OWNER}/${REPO_NAME}/
46+
cd /tmp/central-site
47+
git add site/${OWNER}/${REPO_NAME}/
48+
git diff --staged --quiet && echo "No changes to commit" && exit 0
49+
git commit -m "Deploy arch-docs for ${REPO}"
50+
git push

0 commit comments

Comments
 (0)