Skip to content

Commit 690aa87

Browse files
authored
chore(docs): add sync docs yml file (#2)
gh-00
1 parent bea027e commit 690aa87

8 files changed

Lines changed: 138 additions & 5 deletions

File tree

.czferc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const types = [
2525

2626
const scopes = [
2727
{name: 'chore'},
28+
{name: 'docs'},
2829
{name: 'component'},
2930
{name: 'tools'},
3031
{name: 'types'},

.github/workflows/sync-docs.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Sync Docs to arc-docs repo
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
DOCS_REPO: sourcefuse/arc-docs
10+
BRANCH_PREFIX: automated-docs-sync/
11+
GITHUB_TOKEN: ${{secrets.ARC_DOCS_API_TOKEN_GITHUB}}
12+
CONFIG_USERNAME: ${{ vars.DOCS_PR_USERNAME }}
13+
CONFIG_EMAIL: ${{ vars.DOCS_PR_EMAIL }}
14+
15+
jobs:
16+
sync-docs:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout Extension Code
21+
uses: actions/checkout@v3
22+
with:
23+
token: ${{env.GITHUB_TOKEN}}
24+
path: './extension/'
25+
26+
- name: Checkout Docs Repository
27+
uses: actions/checkout@v3
28+
with:
29+
token: ${{env.GITHUB_TOKEN}}
30+
repository: ${{env.DOCS_REPO}}
31+
path: './arc-docs/'
32+
33+
- name: Configure GIT
34+
id: configure_git
35+
working-directory: arc-docs
36+
run: |
37+
git config --global user.email $CONFIG_EMAIL
38+
git config --global user.name $CONFIG_USERNAME
39+
40+
extension_branch="${{env.BRANCH_PREFIX}}$(basename $GITHUB_REPOSITORY)"
41+
echo "extension_branch=$extension_branch" >> $GITHUB_OUTPUT
42+
43+
- name: Update Files
44+
id: update_files
45+
working-directory: arc-docs
46+
run: |
47+
extension_branch="${{ steps.configure_git.outputs.extension_branch }}"
48+
49+
# Create a new branch if it doesn't exist, or switch to it if it does
50+
git checkout -B $extension_branch || git checkout $extension_branch
51+
52+
# Copy README from the extension repo
53+
cp ../extension/docs/README.md docs/arc-api-docs/extensions/$(basename $GITHUB_REPOSITORY)/
54+
git add .
55+
56+
if git diff --quiet --cached; then
57+
have_changes="false";
58+
else
59+
have_changes="true";
60+
fi
61+
62+
echo "Have Changes to be commited: $have_changes"
63+
echo "have_changes=$have_changes" >> $GITHUB_OUTPUT
64+
65+
- name: Commit Changes
66+
id: commit
67+
working-directory: arc-docs
68+
if: steps.update_files.outputs.have_changes == 'true'
69+
run: |
70+
git commit -m "sync $(basename $GITHUB_REPOSITORY) docs"
71+
- name: Push Changes
72+
id: push_branch
73+
if: steps.update_files.outputs.have_changes == 'true'
74+
working-directory: arc-docs
75+
run: |
76+
extension_branch="${{ steps.configure_git.outputs.extension_branch }}"
77+
git push https://oauth2:${GITHUB_TOKEN}@github.com/${{env.DOCS_REPO}}.git HEAD:$extension_branch --force
78+
79+
- name: Check PR Status
80+
id: pr_status
81+
if: steps.update_files.outputs.have_changes == 'true'
82+
working-directory: arc-docs
83+
run: |
84+
extension_branch="${{ steps.configure_git.outputs.extension_branch }}"
85+
gh pr status --json headRefName >> "${{github.workspace}}/pr-status.json"
86+
pr_exists="$(jq --arg extension_branch "$extension_branch" '.createdBy[].headRefName == $extension_branch' "${{github.workspace}}/pr-status.json")"
87+
echo "PR Exists: $pr_exists"
88+
echo "pr_exists=$pr_exists" >> $GITHUB_OUTPUT
89+
90+
- name: Create Pull Request
91+
id: create_pull_request
92+
if: steps.pr_status.outputs.pr_exists != 'true' && steps.update_files.outputs.have_changes == 'true'
93+
working-directory: arc-docs
94+
run: |
95+
extension_branch="${{ steps.configure_git.outputs.extension_branch }}"
96+
97+
gh pr create --head $(git branch --show-current) --title "Sync ${{ github.event.repository.name }} Docs" --body "This Pull Request has been created by the 'sync-docs' action within the '${{ github.event.repository.name }}' repository, with the purpose of updating markdown files."

.husky/commit-msg

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
npx --no-install commitlint --edit
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no-install commitlint --edit

.husky/pre-commit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
14
npm run test && npm run lint && ./scan-changes.sh

.husky/prepare-commit-msg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
14
exec < /dev/tty && npx cz --hook || true

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
1-
# A Loopback4 LLM Chat Extension
1+
<a href="https://sourcefuse.github.io/arc-docs/arc-api-docs" target="_blank"><img src="https://github.com/sourcefuse/loopback4-microservice-catalog/blob/master/docs/assets/logo-dark-bg.png?raw=true" alt="ARC By SourceFuse logo" title="ARC By SourceFuse" align="right" width="150" /></a>
2+
3+
# [A Loopback4 LLM Chat Extension](https://github.com/sourcefuse/loopback4-llm-chat-extension)
4+
5+
<p align="left">
6+
<a href="https://www.npmjs.com/package/lb4-llm-chat-component">
7+
<img src="https://img.shields.io/npm/v/lb4-llm-chat-component.svg" alt="npm version" />
8+
</a>
9+
<a href="https://sonarcloud.io/summary/new_code?id=sourcefuse_llm-chat-component" target="_blank">
10+
<img alt="Sonar Quality Gate" src="https://img.shields.io/sonar/quality_gate/sourcefuse_llm-chat-component?server=https%3A%2F%2Fsonarcloud.io">
11+
</a>
12+
<a href="https://github.com/sourcefuse/loopback4-llm-chat-extension/graphs/contributors" target="_blank">
13+
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/sourcefuse/loopback4-llm-chat-extension?">
14+
</a>
15+
<a href="https://www.npmjs.com/package/loopback4-authentication" target="_blank">
16+
<img alt="downloads" src="https://img.shields.io/npm/dw/loopback4-llm-chat-extension.svg">
17+
</a>
18+
<a href="https://github.com/sourcefuse/loopback4-llm-chat-extension/blob/master/LICENSE">
19+
<img src="https://img.shields.io/github/license/sourcefuse/loopback4-llm-chat-extension.svg" alt="License" />
20+
</a>
21+
<a href="https://loopback.io/" target="_blank">
22+
<img alt="Powered By LoopBack 4" src="https://img.shields.io/badge/Powered%20by-LoopBack 4-brightgreen" />
23+
</a>
24+
</p>
25+
26+
### Overview
227

328
A Loopack4 based component to integrate a basic Langgraph.js based endpoint in your application which can use any tool that you register using the provided decorator.
429

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@
100100
"prune": "npm prune --production",
101101
"coverage": "nyc npm run test",
102102
"migrate:pg:up": "db-migrate up --config migrations/pg/database.json --migrations-dir migrations/pg/migrations",
103-
"migrate:pg:down": "db-migrate down --config migrations/pg/database.json --migrations-dir migrations/pg/migrations"
103+
"migrate:pg:down": "db-migrate down --config migrations/pg/database.json --migrations-dir migrations/pg/migrations",
104+
"prepare": "husky install"
104105
},
105106
"repository": {
106107
"type": "git",

0 commit comments

Comments
 (0)