Skip to content

fix(tipjar): add expiry and duplicate-guard to admin/fee-collector tr… #235

fix(tipjar): add expiry and duplicate-guard to admin/fee-collector tr…

fix(tipjar): add expiry and duplicate-guard to admin/fee-collector tr… #235

Workflow file for this run

name: Generate API Docs
on:
push:
branches: [main]
paths:
- 'contracts/tipjar/src/lib.rs'
- 'tools/doc-generator/**'
pull_request:
branches: [main]
paths:
- 'contracts/tipjar/src/lib.rs'
- 'tools/doc-generator/**'
jobs:
generate-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Generate docs
run: bash scripts/generate-docs.sh
# Fail the PR if the contract changed but docs weren't regenerated
- name: Check docs are up to date
if: github.event_name == 'pull_request'
run: |
if ! git diff --quiet docs/api/; then
echo "::error::docs/api/ is out of date. Run 'bash scripts/generate-docs.sh' and commit."
exit 1
fi
# On main, commit the refreshed docs automatically
- name: Commit updated docs
if: github.event_name == 'push'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/api/
git diff --cached --quiet \
|| git commit -m "docs: regenerate API docs [skip ci]" && git push