Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📝 Update docstring generator to include target branch for push #477

Merged
merged 9 commits into from
Jul 19, 2024
8 changes: 3 additions & 5 deletions .github/workflows/pyfiction-docstring-generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ on:
paths:
- '**/*.hpp'
- '.github/workflows/pyfiction-docstring-generator.yml'
pull_request:
paths:
- '**/*.hpp'
- '.github/workflows/pyfiction-docstring-generator.yml'
workflow_dispatch:

jobs:
Expand All @@ -20,6 +16,7 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # Fetch all history for all branches and tags
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this important?

Copy link
Collaborator

@simon1hofmann simon1hofmann Jul 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, the docstring generator only worked for branches forked directly from fiction and not, e.g., Drewniok/fiction, which lead to this error message:

Error: Error: fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)
state now, use

  git push origin HEAD:<name-of-remote-branch>

By default, fetch-depth is set to 1, so something similar like this happens:
git fetch --depth 1 origin $GITHUB_REF

I guess this misses the forked branch.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. Many thanks!


- name: Setup Python
uses: actions/setup-python@v5
Expand Down Expand Up @@ -50,7 +47,8 @@ jobs:
path: ${{ github.workspace }}/bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp
overwrite: true

- uses: EndBug/add-and-commit@v9
- name: Commit docstrings
uses: EndBug/add-and-commit@v9
with:
add: 'bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
commit: '--signoff'
Expand Down