Skip to content

Commit 303308f

Browse files
committed
⚡ API branch names are just repo names
The version number will no longer be used to create branch names for API docs. This prevents a large number of branches being created. Now PRs for the API repo will stack commits for each version created. If a version, like main, is change multiple times, this will look like a commit updating the previous contents of the `main` version files.
1 parent 6f6ab40 commit 303308f

3 files changed

Lines changed: 45 additions & 3 deletions

File tree

.github/scripts/api_deploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def create_pr_or_update_branch_on_api_repo(
192192

193193
# Generate a branch name if not provided
194194
if not branch_name:
195-
branch_name = f"{repo_name}-{version}"
195+
branch_name = f"{repo_name}"
196196

197197
# Create PR using GitHub API (requires GitHub token)
198198
github_token = os.environ.get('GITHUB_TOKEN')

.github/workflows/api_docs_gen.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,28 @@ on:
2020
dir:
2121
type: string
2222
default: .
23+
version:
24+
type: string
25+
default: ${{ github.ref_name }}
26+
repo:
27+
type: string
28+
default: ${{ github.repository }}
29+
repo_name:
30+
type: string
31+
default: ${{ github.event.repository.name }}
32+
dry_run:
33+
type: boolean
34+
default: False
2335

2436
jobs:
2537
generate_api_docs:
2638
runs-on: ubuntu-latest
2739
steps:
2840
- uses: actions/checkout@v3
41+
with:
42+
submodules: true
43+
repository: ${{ inputs.repo }}
44+
ref: ${{ inputs.version }}
2945
- uses: actions/setup-python@v4
3046
with:
3147
python-version: 3.x
@@ -34,8 +50,10 @@ jobs:
3450
- run: pipx install conan>=2.20.0
3551
- run: pip install -r ${{ inputs.dir }}/docs/requirements.txt gitpython requests
3652
- run: conan config install https://github.com/libhal/conan-config2.git
37-
- run: conan hal docs --doc_version ${{ github.ref_name }} ${{ inputs.dir }}/docs
53+
- run: conan hal docs --doc_version ${{ inputs.version }} ${{ inputs.dir }}/docs
3854
- run: wget https://raw.githubusercontent.com/libhal/ci/5.x.y/.github/scripts/api_deploy.py
39-
- run: python api_deploy.py deploy --version ${{ github.ref_name }} --repo-name ${{ github.event.repository.name }} --docs-dir ${{ inputs.dir }}/docs/build/
55+
- name: Deploy to API repo
56+
if: ${{ inputs.dry_run == False }}
57+
run: python api_deploy.py deploy --version ${{ inputs.version }} --repo-name ${{ inputs.repo_name }} --docs-dir ${{ inputs.dir }}/docs/build/
4058
env:
4159
GITHUB_TOKEN: ${{ secrets.API_PUSH_TOKEN }}

.github/workflows/self_check.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343
id: filter
4444
with:
4545
filters: |
46+
api_docs:
47+
- '.github/workflows/api_docs_gen.yml'
4648
library_check:
4749
- '.github/workflows/library_check.yml'
4850
tests:
@@ -57,6 +59,28 @@ jobs:
5759
app_builder2:
5860
- '.github/workflows/app_builder2.yml'
5961
62+
api_strong_ptr:
63+
needs: changes
64+
if: ${{ needs.changes.outputs.api_docs == 'true' }}
65+
uses: ./.github/workflows/api_docs_gen.yml
66+
with:
67+
repo_name: strong_ptr
68+
repo: libhal/strong_ptr
69+
dir: .
70+
dry_run: True
71+
secrets: inherit
72+
73+
api_libhal_v4:
74+
needs: changes
75+
if: ${{ needs.changes.outputs.api_docs == 'true' }}
76+
uses: ./.github/workflows/api_docs_gen.yml
77+
with:
78+
repo_name: libhal
79+
repo: libhal/libhal
80+
dir: v4
81+
dry_run: True
82+
secrets: inherit
83+
6084
library_check_libhal_v4:
6185
needs: changes
6286
if: ${{ needs.changes.outputs.library_check == 'true' }}

0 commit comments

Comments
 (0)