0

I developed a nice workflow a few years ago to keep an inventory of items on our university's github enterprise instance; unfortunately changes to github Projects (Classic being sunset) and APIs have broken my scripts and I can't seem to find a fix. Here's what I was doing, and hope to return to:

  • Enter an item as Issue, including a photo of the item uploaded on github.
  • In Projects, organise them in a kanban layout to keep track of the location of each item, as we move them around different shelves in physical space.
  • A script (using R, curl, gh, but that's largely irrelevant) to grab the content of each issue and produce an Excel spreadsheet for each shelf (kanban column) listing the item titles, location, persons in charge, details (body of the issue), and the photo that had been uploaded. This is the step that's now broken for me.

When I look at the URL for image attachments on the webpage, it looks like this: https://media.<GHE-instance>/user/122/files/xx68ccf3-5035-4d1a-8f57-074d530e492c?token=XXXX6S6KNSZS6T66BUI57DH5HWOE

but the token is added automagically to the URL that is stored in the issue itself, and I cannot figure out how to produce such a token programmatically.

Is it a one-time token created on the fly? Can I create a longer lasting one that will work for all images while I grab them?

1 Answer 1

1

well if anyone's also wondering how to get out of that mess, this trick seems to work for me:

instead of getting the issue body as json or markdown, request it as html, and somehow that weird token will be in there,

gh api \
  -H "Accept: application/vnd.github.html+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  --hostname <HOST> \
  /repos/ORG/REPO/issues/123
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.