Skip to content

GITBOOK-169: Multi-share Backup KB link updated #51

GITBOOK-169: Multi-share Backup KB link updated

GITBOOK-169: Multi-share Backup KB link updated #51

name: "[Bot] Update GitBook revision in Suite"
on:
workflow_dispatch:
push:
branches:
- master
- develop
jobs:
update-revision-in-suite:
if: github.event_name == 'workflow_dispatch' || github.event.head_commit.committer.username == 'gitbook-bot'
env:
SUITE_REPO: "trezor/trezor-suite"
SUITE_BRANCH: "develop"
FILEPATH: "./packages/suite-data/src/guide/constants.ts"
PR_BRANCH: "chore/update-suite-guide"
GITHUB_TOKEN: ${{ secrets.TREZOR_BOT_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Checkout trezor-suite repo
uses: actions/checkout@v3
with:
repository: ${{ env.SUITE_REPO }}
ref: ${{ env.SUITE_BRANCH }}
fetch-depth: 0
token: ${{ secrets.TREZOR_BOT_TOKEN }}
- name: Create a new branch and switch to it
run: git switch -C ${{ env.PR_BRANCH }}
- name: Update GitBook revision
run: sed -i "s/^export const GITBOOK_REVISION = .*/export const GITBOOK_REVISION = '${{ github.sha }}';/" ${{ env.FILEPATH }}
- name: Stage and commit
run: |
git config user.name "trezor-ci"
git config user.email "${{ secrets.TREZOR_BOT_EMAIL }}"
git add ${{ env.FILEPATH }}
git commit -m "chore(suite-data): update guide revision"
- name: Force push
run: git push --force --set-upstream origin ${{ env.PR_BRANCH }}
- name: Create pull request
if: github.ref == 'refs/heads/master'
run: gh pr create --repo ${{ env.SUITE_REPO }} --base ${{ env.SUITE_BRANCH }} --head ${{ env.PR_BRANCH }} --title "GitBook revision update" --label "guide" --body "Automatically generated PR to update GitBook revision, i.e. to sync the latest [trezor-suite-guide](https://github.com/${{ github.repository }}) content to Suite. Before merging, check its [commit history](https://github.com/${{ github.repository }}/commits/master). Once the pipeline finishes, you can check the result [here](https://dev.suite.sldev.cz/suite-web/${{ env.PR_BRANCH }}/web/)."