adaptive-lighting icon indicating copy to clipboard operation
adaptive-lighting copied to clipboard

fix: Detected code that calls async_forward_entry_setup

Open danielbrunt57 opened this issue 1 year ago • 5 comments

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

danielbrunt57 avatar Aug 02 '24 03:08 danielbrunt57

It seems like CI pipelines fail. Any idea?

basnijholt avatar Aug 02 '24 17:08 basnijholt

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]

danielbrunt57 avatar Aug 03 '24 05:08 danielbrunt57

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 avatar Aug 14 '24 20:08 rwjack

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

rwjack avatar Aug 14 '24 20:08 rwjack

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).

danielbrunt57 avatar Aug 14 '24 22:08 danielbrunt57

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

SGXander avatar Dec 03 '24 20:12 SGXander

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 avatar Dec 03 '24 21:12 danielbrunt57

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

image

danielbrunt57 avatar Dec 04 '24 02:12 danielbrunt57

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 avatar Dec 07 '24 08:12 danielbrunt57

@basnijholt and again?

danielbrunt57 avatar Dec 07 '24 16:12 danielbrunt57

@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 avatar Dec 07 '24 17:12 danielbrunt57

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 avatar Dec 07 '24 17:12 danielbrunt57

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

image

danielbrunt57 avatar Dec 07 '24 17:12 danielbrunt57

@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 avatar Dec 08 '24 12:12 danielbrunt57

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 avatar Dec 08 '24 12:12 danielbrunt57

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

danielbrunt57 avatar Dec 18 '24 12:12 danielbrunt57