test #1330
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Docs | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
generate-docs: | |
if: github.event.repository.owner.login == 'react18-tools' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: ${{ github.event.before }} | |
- name: Check if package.json was modified | |
id: pub | |
run: | | |
git fetch && git checkout main | |
diff=$(git diff ${{ github.event.before }}:lib/package.json lib/package.json) | |
if $diff == ''; then | |
echo "diff=''" >> $GITHUB_ENV | |
else | |
echo "diff='not empty'" >> $GITHUB_ENV | |
fi | |
- name: Exit early if lib/package.json was modified | |
if: steps.pub.outputs.diff != '' | |
run: exit 1 | |
- uses: actions/setup-node@v4 | |
with: | |
registry-url: https://registry.npmjs.org | |
node-version: 20 | |
- name: Setup Git | |
run: | | |
git config --global user.name "mayank1513" | |
git config --global user.email "[email protected]" | |
git fetch | |
git checkout main | |
git pull | |
- run: npm i -g pnpm && pnpm i --no-frozen-lockfile | |
name: Install dependencies | |
- run: git stash --include-untracked | |
name: clean up working directory | |
- name: Generate/update docs | |
run: pnpm doc | |
- name: Save docs back to repo | |
run: git add . && git commit -m "upgrade deps && docs [skip ci]" && git push origin main | |
- name: Update website | |
continue-on-error: true | |
run: | | |
gh api \ | |
--method POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/mayank1513/turborepo-template/merge-upstream \ | |
-f "branch=main" | |
env: | |
GH_TOKEN: ${{ secrets.mayank1513PAT }} |