-
Notifications
You must be signed in to change notification settings - Fork 12
Fix artifacts url parsing #66
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
base: master
Are you sure you want to change the base?
Conversation
Apologies, closing this as I realize my PR is not appropriately formated. I'll open a better one soon. |
Reopening as I could not fix the formatting issue from github. Real diff is around lines 7996 - 8033. |
Ideally you would edit the root |
* upstream/master: Update NCC; pin fetch to v2 (scientific-python#71) ENH: Add automatic rebuild (scientific-python#72) Build(deps): Bump undici from 5.28.5 to 5.29.0 Making config example and narrative consistent (scientific-python#67)
{ headers: { 'Circle-Token': apiToken } } | ||
); | ||
const jobs = await jobsRes.json(); | ||
if (!jobs.items.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matthieutrs you had if (!jobs.items?.length) {
(note the ?
) and eslint
complained, so I removed the ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I pushed this branch to my fork as master
and verified that it still worked okay:
@matthieutrs can you verify that your fix still works? If not, can you push any necessary changes to index.js
and let the autofix.ci
bot update dist/index.js
?
Something I want to mention about this is that it won't work in the case where a workflow contains multiple jobs, and the artifacts are produced by a job which is not first in the workflow. Here is an example value of {
"next_page_token": null,
"items": [
{
"job_number": 29,
"stopped_at": "2025-05-20T02:55:05Z",
"started_at": "2025-05-20T02:31:58Z",
"name": "build_scipy",
"project_slug": "circleci/TZE2qTnF4tD2yK4HmPgb3V/TZakiCrqyJ21zbxV5HZURU",
"type": "build",
"requires": {},
"status": "success",
"id": "24c4aaeb-5226-4b55-a475-ce7b4edddfa3",
"dependencies": []
},
{
"job_number": 31,
"stopped_at": "2025-05-20T02:59:40Z",
"started_at": "2025-05-20T02:55:08Z",
"name": "refguide_check",
"project_slug": "circleci/TZE2qTnF4tD2yK4HmPgb3V/TZakiCrqyJ21zbxV5HZURU",
"type": "build",
"requires": {
"24c4aaeb-5226-4b55-a475-ce7b4edddfa3": [
"success"
]
},
"status": "success",
"id": "0f0cfb08-2cb8-4d4c-a5fd-9f541248bfd7",
"dependencies": [
"24c4aaeb-5226-4b55-a475-ce7b4edddfa3"
]
},
{
"job_number": 30,
"stopped_at": "2025-05-20T03:20:25Z",
"started_at": "2025-05-20T02:55:08Z",
"name": "run_benchmarks",
"project_slug": "circleci/TZE2qTnF4tD2yK4HmPgb3V/TZakiCrqyJ21zbxV5HZURU",
"type": "build",
"requires": {
"24c4aaeb-5226-4b55-a475-ce7b4edddfa3": [
"success"
]
},
"status": "success",
"id": "ad088988-083d-4142-9440-655371fdb48e",
"dependencies": [
"24c4aaeb-5226-4b55-a475-ce7b4edddfa3"
]
},
{
"job_number": 32,
"stopped_at": "2025-05-20T03:12:01Z",
"started_at": "2025-05-20T02:55:08Z",
"name": "build_docs",
"project_slug": "circleci/TZE2qTnF4tD2yK4HmPgb3V/TZakiCrqyJ21zbxV5HZURU",
"type": "build",
"requires": {
"24c4aaeb-5226-4b55-a475-ce7b4edddfa3": [
"success"
]
},
"status": "success",
"id": "241b350e-8cc1-4b48-b8e0-1e889098e35c",
"dependencies": [
"24c4aaeb-5226-4b55-a475-ce7b4edddfa3"
]
}
]
} This code attempts to read the artifacts from |
This PR proposes a fix for #65. I did not check that this fix still works on the legacy urls, although this should!
Details
In my case,
was not working, the proper url being in the format
Proposed solution
Check whether the target url fits in the legacy or in the new format, and apply appropriate parsing depending on the case: