Skip to content

Library workflow refactor#3928

Merged
andrew-codechimp merged 19 commits into
andrew-codechimp:mainfrom
EVWorth:library-workflow-refactor
Nov 2, 2025
Merged

Library workflow refactor#3928
andrew-codechimp merged 19 commits into
andrew-codechimp:mainfrom
EVWorth:library-workflow-refactor

Conversation

@EVWorth

@EVWorth EVWorth commented Nov 1, 2025

Copy link
Copy Markdown
Contributor

closes #3906

@andrew-codechimp

Ended up reviewing and/or refactoring all workflows.

switched the ones that will need UV to use a uv based container image.

only workflow I didn't refactor for UV was new_device.yaml.. is that one even working? when I tried to drop the python into a .py file it complained that "set_output" wasn't defined.

also, can we delete release.yaml? kinda confused why its uploading a zip to the release when the release autogenerates a zip of the project at that commit already.

@andrew-codechimp

andrew-codechimp commented Nov 1, 2025

Copy link
Copy Markdown
Owner

Hi, I'll have a full read through the changes but to answer your questions

new_device.yaml is working, it throws a deprecation warning at the moment, but it's been doing this for years and following the GitHub discussion they're not ready to remove it yet as it's used in many workflows

The output is used in the Create Pull Request step
${{ steps.update-json.outputs.mode }}

The run-python-script-action provides the utility functions, I do see there is a set env method now which we should maybe move to.
An alternative would be to replace it with a python file and set the environment directly, I'm not that bothered about using the action and a separate python file would make it easier to spot errors. We'd just need to change the Create Pull Request step to use the environment variables instead of the output.
https://github.com/jannekem/run-python-script-action/blob/bbfca66c612a28f3eeca0ae40e1f810265e2ea68/dist/util.py#L13

release.yaml there's an option set within HACS to use the zip file, this gives the advantage of providing download counts for the latest version.
I direct people who want to install manually to download the zip from the latest release, since the zip only has the custom_component folder, not the whole dev environment so easy to work out what to copy into HA.
It's also how the manifest version number is updated which is displayed within HA.

Comment thread .github/workflows/json_librarian.yaml Outdated
Comment thread .github/workflows/json_librarian.yaml
Comment thread .github/workflows/deploy_docs.yaml
@EVWorth

EVWorth commented Nov 1, 2025

Copy link
Copy Markdown
Contributor Author

Hi, I'll have a full read through the changes but to answer your questions

new_device.yaml is working, it throws a deprecation warning at the moment, but it's been doing this for years and following the GitHub discussion they're not ready to remove it yet as it's used in many workflows

The output is used in the Create Pull Request step ${{ steps.update-json.outputs.mode }}

The run-python-script-action provides the utility functions, I do see there is a set env method now which we should maybe move to. An alternative would be to replace it with a python file and set the environment directly, I'm not that bothered about using the action and a separate python file would make it easier to spot errors. We'd just need to change the Create Pull Request step to use the environment variables instead of the output. https://github.com/jannekem/run-python-script-action/blob/bbfca66c612a28f3eeca0ae40e1f810265e2ea68/dist/util.py#L13

release.yaml there's an option set within HACS to use the zip file, this gives the advantage of providing download counts for the latest version. I direct people who want to install manually to download the zip from the latest release, since the zip only has the custom_component folder, not the whole dev environment so easy to work out what to copy into HA. It's also how the manifest version number is updated which is displayed within HA.

all makes sense. I can play with refactoring the run-python-script-action at some point, and good deal on release.yaml.

for now I think** this PR is good to go, but maybe do some additional testing on your end

@andrew-codechimp

Copy link
Copy Markdown
Owner

I had to rename the issue templates to be .yaml, there was a reference elsewhere to it.
Also added back the sorting of the library, this is used for the markdown and I think I may run into issues with discovery in the integration if they don't stay sorted. This would be another candidate for moving out of yaml into a py at some point.
I'll test a bit more but looking good.

@EVWorth

EVWorth commented Nov 2, 2025

Copy link
Copy Markdown
Contributor Author

I had to rename the issue templates to be .yaml, there was a reference elsewhere to it.

Also added back the sorting of the library, this is used for the markdown and I think I may run into issues with discovery in the integration if they don't stay sorted. This would be another candidate for moving out of yaml into a py at some point.

I'll test a bit more but looking good.

Oh sorry I didn't clarify, check the library python file, I moved the sorting into a function of that file to let it handle both actions rather than have the python in the yaml

@andrew-codechimp

Copy link
Copy Markdown
Owner

I'm not seeing that in the library file, did you miss a commit?
Makes sense to put it there though.

@EVWorth

EVWorth commented Nov 2, 2025

Copy link
Copy Markdown
Contributor Author

Ohhh yea I see what happened. I have a commit to reapply still. Good catch!!

@EVWorth

EVWorth commented Nov 2, 2025

Copy link
Copy Markdown
Contributor Author

I'm not seeing that in the library file, did you miss a commit? Makes sense to put it there though.

check now :)

@andrew-codechimp
andrew-codechimp merged commit 95f9122 into andrew-codechimp:main Nov 2, 2025
4 checks passed
@andrew-codechimp

Copy link
Copy Markdown
Owner

All looks good, gave it a quick check on the BN-Test repo for the issue form/action
I don't have a test for doc gen so just tried a quick modification in prod and it built the docs so that looks all good 😄

Thanks for all the work on this, it's got it a lot cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change librarian to use UV/pyproject.toml

2 participants