-
Notifications
You must be signed in to change notification settings - Fork 272
77 lines (69 loc) · 2.67 KB
/
api_inference_generate_documentation.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Update API Inference Documentation
on:
workflow_dispatch:
schedule:
- cron: "0 3 * * *" # Every day at 3am
concurrency:
group: api_inference_generate_documentation
cancel-in-progress: true
jobs:
pull_request:
runs-on: ubuntu-latest
steps:
# Setup
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "20"
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
run_install: |
- recursive: true
cwd: ./scripts/api-inference
args: [--frozen-lockfile]
package_json_file: ./scripts/api-inference/package.json
- name: Update huggingface/tasks package
working-directory: ./scripts/api-inference
run: |
pnpm update @huggingface/tasks@latest
# Generate
- name: Generate API inference documentation
run: pnpm run generate
working-directory: ./scripts/api-inference
# Check changes
- name: Check changes
run: |
git diff --name-only > changed_files.txt
if grep -v -E "^(scripts/api-inference/package.json|scripts/api-inference/pnpm-lock.yaml)$" changed_files.txt | grep -q '.'; then
echo "changes_detected=true" >> $GITHUB_ENV
else
echo "changes_detected=false" >> $GITHUB_ENV
fi
rm changed_files.txt
# Skip PR if only certain files are updated
- name: Skip PR creation if no meaningful changes
if: env.changes_detected == 'false'
run: echo "No meaningful changes. Skipping PR creation."
# Create or update Pull Request
- name: Create Pull Request
if: env.changes_detected == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.TOKEN_INFERENCE_SYNC_BOT }}
commit-message: Update API inference documentation (automated)
branch: update-api-inference-docs-automated-pr
delete-branch: true
title: "[Bot] Update API inference documentation"
body: |
This PR automatically upgrades the `@huggingface/tasks` package and regenerates the API inference documentation by running:
```sh
cd scripts/api-inference
pnpm update @huggingface/tasks@latest
pnpm run generate
```
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).
Please review the changes before merging.
reviewers: |
Wauplin
hanouticelina