Skip to content

Commit 00462a5

Browse files
Add CI workflow to auto-generate api inference documentation (#1480)
* Add ci workflow to auto-generate api inference doc * Update token * add permissions section * change pnpm installation gh action * fix pnpm installation * change working directory * revert * hopefully good * trying with other versions * new tests * pnpm version * do not update .lock file * don't update lock file * fix * explicit package.json * fix lock file * implcit * explicit * update pnpm ? * daily cron job * update huggingface/tasks before generating docs * run workflow on this branch to test * revert to cron job and update PR body --------- Co-authored-by: Wauplin <[email protected]>
1 parent 135c53e commit 00462a5

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Update API Inference Documentation
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 3 * * *" # Every day at 3am
7+
8+
concurrency:
9+
group: api_inference_generate_documentation
10+
cancel-in-progress: true
11+
12+
jobs:
13+
pull_request:
14+
runs-on: ubuntu-latest
15+
steps:
16+
# Setup
17+
- uses: actions/checkout@v3
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: "20"
21+
- name: Install pnpm
22+
uses: pnpm/action-setup@v2
23+
with:
24+
run_install: |
25+
- recursive: true
26+
cwd: ./scripts/api-inference
27+
args: [--frozen-lockfile]
28+
package_json_file: ./scripts/api-inference/package.json
29+
- name: Update huggingface/tasks package
30+
working-directory: ./scripts/api-inference
31+
run: |
32+
pnpm update @huggingface/tasks@latest
33+
# Generate
34+
- name: Generate API inference documentation
35+
run: pnpm run generate
36+
working-directory: ./scripts/api-inference
37+
38+
# Check changes
39+
- name: Check changes
40+
run: git status
41+
42+
# Create or update Pull Request
43+
- name: Create Pull Request
44+
uses: peter-evans/create-pull-request@v7
45+
with:
46+
token: ${{ secrets.TOKEN_INFERENCE_SYNC_BOT }}
47+
commit-message: Update API inference documentation (automated)
48+
branch: update-api-inference-docs-automated-pr
49+
delete-branch: true
50+
title: "[Bot] Update API inference documentation"
51+
body: |
52+
This PR automatically upgrades the `@huggingface/tasks` package and regenerates the API inference documentation by running:
53+
```sh
54+
cd scripts/api-inference
55+
pnpm update @huggingface/tasks@latest
56+
pnpm run generate
57+
```
58+
59+
This PR was automatically created by the [Update API Inference Documentation workflow](https://github.com/huggingface/hub-docs/blob/main/.github/workflows/api_inference_generate_documentation.yml).
60+
61+
Please review the changes before merging.
62+
reviewers: |
63+
Wauplin
64+
hanouticelina

scripts/api-inference/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "api-inference-generator",
3+
"packageManager": "[email protected]",
34
"version": "1.0.0",
45
"description": "",
56
"main": "index.js",

0 commit comments

Comments
 (0)