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

fix: Detected code that calls async_forward_entry_setup #1029

Closed
wants to merge 12 commits into from

Conversation

danielbrunt57
Copy link
Contributor

Fixes #1020
Change async_setup_entry to use await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)

Change `async_setup_entry` to use `await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)`
@basnijholt basnijholt enabled auto-merge (squash) August 2, 2024 06:16
@basnijholt
Copy link
Owner

It seems like CI pipelines fail. Any idea?

@danielbrunt57
Copy link
Contributor Author

danielbrunt57 commented Aug 3, 2024

It seems like CI pipelines fail. Any idea?

All those checks are new to me! I forked the repo like I've done with others in the past, made my change and submitted the PR. I've really no idea at this point what to do. The readme failure seems to be an issue with your repository? Something/something.git returned 403?
As for the yaml test failure, I dunno...

FAILED tests/components/adaptive_lighting/test_config_flow.py::test_changing_options_when_using_yaml[pyloop]

@rwjack
Copy link
Contributor

rwjack commented Aug 14, 2024

Seems like the unit tests need to be modified. If it was up to me, I wouldn't be testing anything older than a year. That means 2023.8 would be the oldest supported version. Maybe even 6 months, since this is a custom integration after all. If people want newer versions they have to keep up with HA as well...

@rwjack
Copy link
Contributor

rwjack commented Aug 14, 2024

And secondly, something is off with this piece of code https://github.com/basnijholt/adaptive-lighting/actions/runs/10209741520/workflow?pr=1029:

     - name: Push changes
        if: env.commit_status == 'committed'
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          branch: ${{ github.head_ref }}

Perhaps your github token expired @basnijholt

@danielbrunt57
Copy link
Contributor Author

FAILED tests/components/adaptive_lighting/test_config_flow.py::test_changing_options_when_using_yaml[pyloop]

It this integration were mine, I'd deprecate using yaml config and adopt config_flow only configuration like the majority of integrations have done (HA included).

@SGXander
Copy link

SGXander commented Dec 3, 2024

Only two more releases before this deprecation becomes live in HA, Can this PR be merged or are changes still required?

@danielbrunt57
Copy link
Contributor Author

Only two more releases before this deprecation becomes live in HA, Can this PR be merged or are changes still required?

I'll try a new fork and merge since I know quite a bit more about this side of things than I did 4 months ago...

@danielbrunt57
Copy link
Contributor Author

@basnijholt
This looks looks different to me from 4 months ago and looks it might succeed now if you approve the workflows?
🤷

image

auto-merge was automatically disabled December 7, 2024 07:47

Head branch was pushed to by a user without write access

pre-commit-ci bot and others added 4 commits December 7, 2024 07:47
"""Initialize the `webapp` package.

Set up the application components and handle configuration.
"""
@danielbrunt57
Copy link
Contributor Author

danielbrunt57 commented Dec 7, 2024

It seems like CI pipelines fail. Any idea?

Hi @basnijholt ,
Could you please approve the pending workflows for this pull request?
The pre-commit.ci checks have passed successfully, and the workflows appear ready to execute.
Thank you!

@danielbrunt57
Copy link
Contributor Author

@basnijholt and again?

@danielbrunt57
Copy link
Contributor Author

@basnijholt
image

says this:

Run ad-m/github-push-action@master
  with:
    github_token: ***
    branch: main
    github_url: https://github.com
    push_to_submodules: on-demand
    directory: .
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.1[2](https://github.com/basnijholt/adaptive-lighting/actions/runs/12214569543/job/34075707225?pr=1029#step:9:2).7/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/[3](https://github.com/basnijholt/adaptive-lighting/actions/runs/12214569543/job/34075707225?pr=1029#step:9:3).12.7/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.7/x6[4](https://github.com/basnijholt/adaptive-lighting/actions/runs/12214569543/job/34075707225?pr=1029#step:9:4)
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.7/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.7/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.7/x64/lib
    commit_status: committed
Push to branch main
remote: Permission to basnijholt/adaptive-lighting.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/basnijholt/adaptive-lighting.git/': The requested URL returned error: 403
Error: Invalid exit code: 128
    at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:30:21)
    at ChildProcess.emit (node:events:[5](https://github.com/basnijholt/adaptive-lighting/actions/runs/12214569543/job/34075707225?pr=1029#step:9:5)19:28)
    at maybeClose (node:internal/child_process:1105:1[6](https://github.com/basnijholt/adaptive-lighting/actions/runs/12214569543/job/34075707225?pr=1029#step:9:6))
    at ChildProcess._handle.onexit (node:internal/child_process:305:5) {
  code: 12[8](https://github.com/basnijholt/adaptive-lighting/actions/runs/12214569543/job/34075707225?pr=1029#step:9:8)
}

@danielbrunt57
Copy link
Contributor Author

FAILED tests/components/adaptive_lighting/test_switch.py::test_light_switch_in_specific_area - TypeError: AreaEntry.__init__() got an unexpected keyword argument 'normalized_name'
FAILED tests/components/adaptive_lighting/test_switch.py::test_proactive_adaptation_with_separate_commands - AssertionError: ['test_context']
assert 1 == 2
 +  where 1 = len(['test_context'])
FAILED tests/components/adaptive_lighting/test_switch.py::test_adapt_until_sleep_and_rgb_colors - AttributeError: module 'homeassistant.config' has no attribute 'async_process_ha_core_config'. Did you mean: 'async_process_component_config'?
ERROR tests/components/adaptive_lighting/test_config_flow.py::test_changing_options_when_using_yaml - Failed: Lingering task after test <Task pending name='Task-268' coro=<test_changing_options_when_using_yaml() running at /home/runner/work/adaptive-lighting/adaptive-lighting/core/tests/components/adaptive_lighting/test_config_flow.py:128> wait_for=<_GatheringFuture pending cb=[Task.task_wakeup()] created at /opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/asyncio/tasks.py:712> created at /opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/asyncio/tasks.py:695>
======== 18 failed, 111 passed, 1 xfailed, 1 error in 134.69s (0:02:14) ========
Error: Process completed with exit code 1.

@danielbrunt57
Copy link
Contributor Author

@basnijholt
Man! It's looking like it might just be easier for you to submit this yourself!

image

@danielbrunt57
Copy link
Contributor Author

danielbrunt57 commented Dec 8, 2024

@basnijholt

Run ad-m/github-push-action@master
  with:
    github_token: ***
    branch: main
    github_url: https://github.com
    push_to_submodules: on-demand
    directory: .
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.1[2](https://github.com/basnijholt/adaptive-lighting/actions/runs/12215549240/job/34077758552?pr=1029#step:9:2).7/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/[3](https://github.com/basnijholt/adaptive-lighting/actions/runs/12215549240/job/34077758552?pr=1029#step:9:3).12.7/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.7/x6[4](https://github.com/basnijholt/adaptive-lighting/actions/runs/12215549240/job/34077758552?pr=1029#step:9:4)
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.7/x[6](https://github.com/basnijholt/adaptive-lighting/actions/runs/12215549240/job/34077758552?pr=1029#step:9:6)4
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.[7](https://github.com/basnijholt/adaptive-lighting/actions/runs/12215549240/job/34077758552?pr=1029#step:9:7)/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.7/x64/lib
    commit_status: committed
Push to branch main
remote: Permission to basnijholt/adaptive-lighting.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/basnijholt/adaptive-lighting.git/': The requested URL returned error: 403

@danielbrunt57
Copy link
Contributor Author

Steps to Resolve the Issue

  1. Check Repository Settings
    Ensure that the repository has enabled write permissions for the GitHub Actions bot. You can check this in the repository settings:
    Navigate to Settings > Actions > General.
    Under Workflow permissions, ensure Read and write permissions is selected.
    If only Read repository contents is selected, update it to allow write access.
  2. Check the GitHub Token
    The GitHub Actions bot uses a token to authenticate. Verify the token being used:
    If you are using the default GITHUB_TOKEN, it is automatically provided by GitHub Actions but needs the correct workflow permissions enabled (as in Step 1).
    If you are using a personal access token (PAT) or another custom token, ensure it has sufficient scopes:
    Required scopes: repo (for private repos) or public_repo (for public repos).
  3. Ensure the Bot Has Write Access
    Confirm the bot has collaborator or write access to the repository or the branch it’s attempting to push to. If branch protection rules are in place, ensure they allow GitHub Actions to bypass restrictions or push changes.
  4. Modify the Action Configuration
    Ensure the action is correctly configured to use the appropriate token. Update the action YAML file:
- name: Push changes to GitHub
  uses: ad-m/github-push-action@master
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }} # Use the correct token
    branch: main # Specify the branch you want to push to
    directory: . # The directory containing changes to push
  1. Address Branch Protection Rules
    If the branch (main in this case) has branch protection rules enabled, ensure:
    The github-actions[bot] is allowed to push.
    Changes from the bot can bypass status checks, approvals, or other restrictions.
    Modify the branch protection rules under Settings > Branches > Branch Protection Rules.

@danielbrunt57
Copy link
Contributor Author

Unable to resolve the 28 failed checks dues to "403" error

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.

Detected code that calls async_forward_entry_setup
4 participants