Skip to content

Commit 62b252a

Browse files
committed
chore: aggregator workflow example
0 parents  commit 62b252a

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Generate MessageFlow Docs
2+
on:
3+
repository_dispatch:
4+
types: [ source-update ]
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
generate-messageflow-docs:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout aggregator repo
14+
uses: actions/checkout@v4
15+
16+
- name: Checkout source repo
17+
uses: actions/checkout@v4
18+
with:
19+
repository: ${{ github.event.client_payload.source_repo }}
20+
path: temp-source
21+
token: ${{ secrets.INTEGRATION_PAT }}
22+
23+
- name: Configure Git as the bot
24+
run: |
25+
git config user.name "messageflow-ci-bot"
26+
git config user.email "messageflow-ci-bot@example.com"
27+
28+
- name: Copy asyncapi files to appropriate folder
29+
run: |
30+
mkdir -p deps/${{ github.event.client_payload.source_repo }}
31+
find temp-source -type f \( -name "*.yaml" -o -name "*.yml" \) -exec grep -l "asyncapi:" {} \; | while read -r file; do
32+
FILENAME=$(basename "$file")
33+
cp $file "deps/${{ github.event.client_payload.source_repo }}/$FILENAME"
34+
done
35+
rm -rf temp-source
36+
37+
- name: Generate docs
38+
run: |
39+
docker run --rm \
40+
--user $(id -u):$(id -g) \
41+
-v ${{ github.workspace }}:/src \
42+
ghcr.io/holydocs/messageflow:latest \
43+
gen-docs --dir src/deps --output src/docs
44+
45+
- name: Commit & push (if anything changed)
46+
env:
47+
PAT: ${{ secrets.INTEGRATION_PAT }}
48+
run: |
49+
if ! (git diff-index --quiet HEAD -- && [ -z "$(git ls-files --others --exclude-standard)" ]); then
50+
git add -A
51+
git commit -m "Sync: ${{ github.event.client_payload.source_repo }} @ ${{ github.event.client_payload.source_sha }}"
52+
git remote set-url origin "https://x-access-token:${PAT}@github.com/${GITHUB_REPOSITORY}"
53+
git push
54+
fi

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# MessageFlow Aggregator Action Example
2+
3+
See generated docs.

0 commit comments

Comments
 (0)