chore: add warnings to not diretly edit files in /build #42
Workflow file for this run
This file contains hidden or 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: Preview Docs | |
on: pull_request | |
jobs: | |
run: | |
runs-on: ubuntu-22.04 | |
permissions: write-all | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# TODO: Uncomment this once new docs dir in aa-sdk is merged | |
# - name: Download aa-sdk docs | |
# run: | | |
# mkdir -p account-kit | |
# curl -L https://api.github.com/repos/alchemyplatform/aa-sdk/tarball/main -o aa-sdk.tar.gz | |
# tar xzf aa-sdk.tar.gz --strip-components=2 -C account-kit "*/docs" | |
# rm aa-sdk.tar.gz | |
- name: Install Fern | |
run: npm install -g fern-api | |
- name: Generate preview URL | |
id: generate-docs | |
env: | |
FERN_TOKEN: ${{ secrets.FERN_TOKEN }} | |
run: | | |
OUTPUT=$(fern generate --docs --preview 2>&1) || true | |
echo "$OUTPUT" | |
URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?= \()') | |
echo "preview_url=$URL" >> $GITHUB_OUTPUT | |
- name: Comment Preview URL in PR | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '## 🌿 Documentation Preview\n\n| Name | Preview | Updated (UTC) |\n| :--- | :------ | :------ |\n| **Alchemy Docs** | [🔗 Visit Preview](${{ steps.generate-docs.outputs.preview_url }}) | ' + new Date().toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', hour: 'numeric', minute: '2-digit', hour12: true }) + ' |\n\n>' | |
}); |