openforcefield / qca-dataset-submission

Data generation and submission scripts for the QCArchive ecosystem.
Other
29 stars 6 forks source link

Update automation for new GH project boards #370

Open j-wags opened 2 weeks ago

j-wags commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

Ah, and pygithub doesn't support the new style of projects yet https://github.com/PyGithub/PyGithub/issues/2140

j-wags commented 2 weeks ago

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"}}}}