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

Update automation for new GH project boards #370

Open
j-wags opened this issue Aug 30, 2024 · 3 comments · May be fixed by #377
Open

Update automation for new GH project boards #370

j-wags opened this issue Aug 30, 2024 · 3 comments · May be fixed by #377
Assignees

Comments

@j-wags
Copy link
Member

j-wags commented Aug 30, 2024

Something about lifecycle management actions is currently failing with the following error. I'm able to reproduce locally.

Run python ./management/lifecycle.py --states "Error Cycling" --set-priority --set-computetag
  python ./management/lifecycle.py --states "Error Cycling" --set-priority --set-computetag
  shell: /usr/bin/bash -l {0}
  env:
    MAMBA_ROOT_PREFIX: /home/runner/micromamba
    MAMBA_EXE: /home/runner/micromamba-bin/micromamba
    CONDARC: /home/runner/work/_temp/setup-micromamba/.condarc
    GH_TOKEN: ***
    QCA_USER: ***
    QCA_KEY: ***
Traceback (most recent call last):
Found 11 with the 'tracking' label
  File "/home/runner/work/qca-dataset-submission/qca-dataset-submission/./management/lifecycle.py", line 987, in <module>
    main()
  File "/home/runner/work/qca-dataset-submission/qca-dataset-submission/./management/lifecycle.py", line 931, in main
    board = _get_full_board(repo)
            ^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/qca-dataset-submission/qca-dataset-submission/./management/lifecycle.py", line 813, in _get_full_board
    proj = [proj for proj in repo.get_projects() if proj.name == "Dataset Tracking"][0]
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
Error: Process completed with exit code 1.
@j-wags j-wags self-assigned this Aug 30, 2024
@j-wags
Copy link
Member Author

j-wags commented Aug 30, 2024

It appears to have something to do with how the old project boards are repo-specific (ex https://github.com/openforcefield/qca-dataset-submission/projects/2) and the new ones are accessed on the org level (ex https://github.com/orgs/openforcefield/projects/2).

@j-wags
Copy link
Member Author

j-wags commented Aug 30, 2024

Ah, and pygithub doesn't support the new style of projects yet PyGithub/PyGithub#2140

@j-wags
Copy link
Member Author

j-wags commented Aug 30, 2024

To get REST access to the project board contents using the V2 API, I had to get the project ID. It wasn't at all clear how to do this in the browser, so I made a token at the org level with read access to org:project, then ran

import subprocess

cmd = [
    "curl", "--request", "POST",
    "--url", "https://api.github.com/graphql",
    "--header", f"Authorization: Bearer {token}",
    "--data", '{"query":"query{organization(login: \\"openforcefield\\") {projectV2(number: 2){id}}}"}'
]

subprocess.run(cmd)

and got the node ID of the board (which I don't think is a secret, it's just a pain to get)

{"data":{"organization":{"projectV2":{"id":"PVT_kwDOARrkss4Am84U"}}}}

@lilyminium lilyminium linked a pull request Sep 11, 2024 that will close this issue
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 a pull request may close this issue.

1 participant