Skip to content

Commit e6a7fa5

Browse files
Update docs-push.yml (#291)
Push docs/* to the knowledge-base repo
1 parent c9cba00 commit e6a7fa5

File tree

1 file changed

+46
-11
lines changed

1 file changed

+46
-11
lines changed

.github/workflows/docs-push.yml

+46-11
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,54 @@
1+
name: Push docs to knowledgebase
12
on:
2-
workflow_dispatch:
3-
3+
push:
4+
branches: master
5+
46
jobs:
5-
copy-docs:
7+
Copy-docs:
68
runs-on: ubuntu-latest
9+
710
steps:
8-
- uses: actions/checkout@v2
11+
- name: Checkout source repo
12+
uses: actions/checkout@v2
913
with:
1014
fetch-depth: 0
1115

12-
- uses: olivr/copybara-action@v1.2.3
16+
- name: Checkout destination repo
17+
uses: actions/checkout@v2
1318
with:
14-
access_token: ${{ secrets.KNOWLEDGEBASE_PR_TOKEN }}
15-
sot_repo: docknetwork/react-native-sdk
16-
origin_include: docs/*
17-
destination_repo: docknetwork/knowledgebase-docs
18-
move: |
19-
docs/*||developer-documentation/wallet-sdk
19+
repository: docknetwork/knowledgebase-docs
20+
token: ${{ secrets.KNOWLEDGEBASE_PR_TOKEN }}
21+
path: knowledge-base
22+
23+
- name: Copy files
24+
run: |
25+
# Specify the files or directories you want to copy
26+
cp -r docs/* knowledge-base/developer-documentation/wallet-sdk
27+
28+
- name: Get branch name
29+
id: get_branch
30+
run: echo "branch_name=sync/${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
31+
32+
- name: Commit changes
33+
env:
34+
GH_TOKEN: ${{ secrets.KNOWLEDGEBASE_PR_TOKEN }}
35+
run: |
36+
cd knowledge-base
37+
git checkout -b ${{env.branch_name}}
38+
git config user.name "${{ github.triggering_actor }}"
39+
git config user.email "mike@dock.io"
40+
# Get the commit message from the merged PR
41+
commit_message="${{ github.event.pull_request.title }}"
42+
git add -A .
43+
git status
44+
git commit -m "Copy files from ${{ github.event.pull_request.head.repo.full_name }} branch $branch_name: $commit_message"
45+
# Create PR
46+
git ls-remote --get-url origin
47+
git push -u origin ${{ env.branch_name }}
48+
gh pr create \
49+
--body "This PR copies /docs files from ${{ github.event.pull_request.head.repo.full_name }}." \
50+
--title "${{ github.event.pull_request.title }}" \
51+
--head "${{ env.branch_name }}" \
52+
--base "main"
53+
echo "Docs successfully pushed to knowledgebase-docs"
54+

0 commit comments

Comments
 (0)