Skip to content

Login to github

Login to github #13

Workflow file for this run

# This workflow will update the docs in the sdk-docs repo
name: Update Docs
on:
push:
branches:
- generate-docs
jobs:
update-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup Yarn
run: |
corepack enable
corepack prepare yarn@4.5.0 --activate
- name: Install dependencies
run: yarn install
- name: Run gen:docs command
run: yarn gen:docs
- name: Check and commit changes
id: commit_check
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
if [[ -n "$(git status --porcelain docs)" ]]; then
git add docs
git commit -m "Update docs"
echo "has_changes=true" >> "$GITHUB_OUTPUT"
else
echo "has_changes=false" >> "$GITHUB_OUTPUT"
fi
- name: Push the changes
if: steps.commit_check.outputs.has_changes == 'true'
run: git push
- name: Install dependencies
if: steps.commit_check.outputs.has_changes == 'true'
run: yarn add simple-git
- name: Setup GitHub CLI
if: steps.commit_check.outputs.has_changes == 'true'
run: |
gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}"
- name: Update docs
if: steps.commit_check.outputs.has_changes == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node ./.github/ci-scripts/update-sdk-docs.cjs