scientific-python / circleci-artifacts-redirector-action

GitHub Action to add a GitHub status link to a CircleCI artifact.
MIT License
14 stars 10 forks source link

Action tries to read unknown property 'length' #42

Closed PhiSpel closed 1 year ago

PhiSpel commented 1 year ago

Context

We use this action a lot, and it is very useful to test-build our HTML pages and link them to our pull requests. So first off: Thank you for this contribution!

Expectation

Usually, an action html_demo artifact is run, the details of which in the PR (e.g., here) link to the HTML artifacts on CircleCI.

Bug

Yesterday for the first time, the action threw the error message:

Error: Cannot read properties of undefined (reading 'length')

For the Action log, see here: https://github.com/hbrs-cse/Modellbildung-und-Simulation/actions/runs/4688129308/jobs/8308267867

Our Code

We run

Run larsoner/circleci-artifacts-redirector-action@master
  with:
    repo-token: ***
    artifact-path: 0/html/index.html
    circleci-jobs: html_demo

Debug messages

The full debug message is in the Action log.

The curious part imho is

##[debug]build: 3617
##[debug]Fetching JSON: https://circleci.com/api/v2/project/gh/hbrs-cse/Modellbildung-und-Simulation/3617/artifacts
##[debug]Artifacts JSON (status=404):
##[debug]{"message":"Job not found."}
Error: Cannot read properties of undefined (reading 'length')

Suspicion

length is only used by index.js to create the URL. This seems to be a follow-up error, because:

The URL from which the JSON is fetched, is correct. However, the status is returned as 404 and the JSON {"message":"Job not found."} is only returned for other URLs, such as this one.

larsoner commented 1 year ago

Closing as duplicate of https://github.com/larsoner/circleci-artifacts-redirector-action/issues/40 but let me know if that doesn't solve the problem