Skip to content

code-update

code-update #327

Workflow file for this run

name: Update code docs
on:
repository_dispatch:
types: [code-update]
concurrency:
group: jellyrock-bot-main
cancel-in-progress: false
jobs:
run:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Generate GitHub App Token
id: app-token
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Configure Git as the GitHub App Bot
run: |
APP_USER_ID=$(gh api "/users/jellyrock[bot]" --jq .id)
git config --global user.name "jellyrock[bot]"
git config --global user.email "${APP_USER_ID}+jellyrock[bot]@users.noreply.github.com"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
ref: ${{ github.ref_name }}
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 0
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: "lts/*"
cache: "npm"
- name: Install NPM dependencies
run: npm ci
- name: Checkout jellyrock
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
repository: jellyrock/jellyrock
path: jellyrock
ref: main
- name: Build code docs
# TODO: fix jsdoc build errors then remove '|| true' from run command below
run: npm run build || true
- name: Commit and push any changes
run: |
if git diff --quiet HEAD -- docs/; then
echo "ℹ️ No code docs changes to commit"
exit 0
fi
git pull --rebase --autostash origin ${{ github.ref_name }}
git add docs/
git commit -m "chore(docs): update code docs"
git push origin ${{ github.ref_name }}