Skip to content
New issue

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

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

Already on GitHub? # to your account

Github may return response codes indicating a redirect #10

Closed
AndEsterson opened this issue Dec 3, 2024 · 1 comment · May be fixed by #11
Closed

Github may return response codes indicating a redirect #10

AndEsterson opened this issue Dec 3, 2024 · 1 comment · May be fixed by #11

Comments

@AndEsterson
Copy link

Github will sometimes give 301,302,307 response codes, which indicate redirects https://docs.github.com/en/rest/using-the-rest-api/best-practices-for-using-the-rest-api?apiVersion=2022-11-28#follow-redirects

gha-update doesn't expect this and so will error with

Traceback (most recent call last):
  File "/Users/andrew.esterson/code/github/PyBaMM/pybamm/bin/gha-update", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/Users/andrew.esterson/code/github/PyBaMM/pybamm/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/andrew.esterson/code/github/PyBaMM/pybamm/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/andrew.esterson/code/github/PyBaMM/pybamm/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/andrew.esterson/code/github/PyBaMM/pybamm/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/andrew.esterson/code/github/gha-update/src/gha_update/_cli.py", line 21, in cli
    asyncio.run(update_workflows(config))
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/andrew.esterson/code/github/gha-update/src/gha_update/_core.py", line 44, in update_workflows
    versions = await get_versions(actions)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/andrew.esterson/code/github/gha-update/src/gha_update/_core.py", line 98, in get_versions
    out[name] = highest_version(task.result().json())
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/andrew.esterson/code/github/gha-update/src/gha_update/_core.py", line 104, in highest_version
    items: dict[str, str] = {t["name"]: t["commit"]["sha"] for t in tags}
                             ~^^^^^^^^
TypeError: string indices must be integers, not 'str'
@davidism
Copy link
Owner

davidism commented Dec 3, 2024

Duplicate of #1

@davidism davidism marked this as a duplicate of #1 Dec 3, 2024
@davidism davidism closed this as completed Dec 3, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 28, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants