|
| 1 | +name: Push docs to knowledgebase |
1 | 2 | on:
|
2 |
| - workflow_dispatch: |
3 |
| - |
| 3 | + push: |
| 4 | + branches: master |
| 5 | + |
4 | 6 | jobs:
|
5 |
| - copy-docs: |
| 7 | + Copy-docs: |
6 | 8 | runs-on: ubuntu-latest
|
| 9 | + |
7 | 10 | steps:
|
8 |
| - - uses: actions/checkout@v2 |
| 11 | + - name: Checkout source repo |
| 12 | + uses: actions/checkout@v2 |
9 | 13 | with:
|
10 | 14 | fetch-depth: 0
|
11 | 15 |
|
12 |
| - - uses: olivr/copybara-action@v1.2.3 |
| 16 | + - name: Checkout destination repo |
| 17 | + uses: actions/checkout@v2 |
13 | 18 | 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