-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a workflow to automatically regenerate examples and docs (#8)
Fingers crossed.
- Loading branch information
1 parent
1a5f2d5
commit c9cf805
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Regenerate examples and docs | ||
|
||
on: | ||
cron: "0 */12 * * *" | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- '.github/workflows/regen-examples-and-docs.yml' | ||
- 'src/**' | ||
- 'scripts/**' | ||
workflow_dispatch: | ||
|
||
env: | ||
PIP_DISABLE_PIP_VERSION_CHECK: 1 | ||
|
||
jobs: | ||
regen_examples_and_docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
cache: "pip" | ||
cache-dependency-path: | | ||
requirements-dev.txt | ||
pyproject.toml | ||
python-version: "3.10" | ||
- name: Install wheel | ||
run: pip install "wheel<1" | ||
- name: Install requirements | ||
run: | | ||
pip install -r requirements-dev.txt | ||
pip install -e .[everything] | ||
- name: Regenerate examples and docs | ||
run: | | ||
python scripts/regenerate_examples_and_docs.py | ||
git commit -a -m "Automated regeneration of examples and docs" | ||
- name: Deploy docs | ||
run: mkdocs gh-deploy --force | ||
|
||
create-issue-on-failure: | ||
name: Create an issue if the automated regeneration failed | ||
runs-on: ubuntu-latest | ||
needs: [regen_examples_and_docs] | ||
if: ${{ github.repository == 'AlexWaygood/typeshed-stats' && always() && github.event_name != 'workflow_dispatch' && (needs.regen_examples_and_docs.result == 'failure') }} | ||
permissions: | ||
issues: write | ||
steps: | ||
- uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
await github.rest.issues.create({ | ||
owner: "AlexWaygood", | ||
repo: "typeshed-stats", | ||
title: `Automated regeneration of examples failed on ${new Date().toDateString()}`, | ||
body: "Runs are listed here: https://github.com/AlexWaygood/typeshed-stats/actions/workflows/regen-examples-and-docs.yml", | ||
}) |