Skip to content

ci: Automatically push updates to stubs to the current branch #4802

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions .github/workflows/wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

permissions:
contents: read
id-token: write
pull-requests: write

on:
push:
Expand Down Expand Up @@ -143,6 +143,9 @@
steps:
- name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# with:
# ref: ${{ github.event.pull_request.head.ref }}
# repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Install Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
Expand All @@ -167,9 +170,30 @@
./wheelhouse/*.whl
./wheelhouse/OpenImageIO/__init__.pyi
# if stub validation fails we want to upload the stubs for users to review
if: success() || failure()
# if: success() || failure()

- name: Copy stubs to repo
run: |
pwd
if [ -f ./wheelhouse/OpenImageIO/__init__.pyi ]; then
echo "Copying stubs into repo"
cp ./wheelhouse/OpenImageIO/__init__.pyi ./src/python/stubs/OpenImageIO/__init__.pyi
git diff
fi
# if: failure()

# - name: Commit changed stubs back to the repository
# uses: stefanzweifel/git-auto-commit-action@v6
# with:
# commit_message: "Automatic update to python stubs"
# # if: failure()

- uses: parkerbxyz/[email protected]

Check warning

Code scanning / Scorecard

Pinned-Dependencies Medium

score is 7: third-party GitHubAction not pinned by hash
Click Remediation section below to solve this issue
with:
comment: 'Please commit the suggested changes from the python stub generator.'
event: 'REQUEST_CHANGES'

# ---------------------------------------------------------------------------
# Linux ARM Wheels
# ---------------------------------------------------------------------------

Expand Down
6 changes: 3 additions & 3 deletions src/python/stubs/generate_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class OIIOSignatureGenerator(AdvancedSignatureGenerator):
sig_matcher = AdvancedSigMatcher(
signature_overrides={
# signatures for these special methods include many inaccurate overloads
"*.__ne__": "(self, other: object) -> bool",
"*.__eq__": "(self, other: object) -> bool",
# "*.__ne__": "(self, other: object) -> bool",
# "*.__eq__": "(self, other: object) -> bool",
},
arg_type_overrides={
# FIXME: Buffer may in fact be more accurate here
Expand Down Expand Up @@ -209,7 +209,7 @@ def main() -> None:
print(get_colored_diff(old_text, new_text))
print("Run `make pystubs` locally and commit the results for review.")
print("The resulting __init__.pyi file will be uploaded as an artifact on this job.")
sys.exit(2)
# sys.exit(2)


if __name__ == "__main__":
Expand Down
Loading