8000 Fix artifacts url parsing by matthieutrs · Pull Request #66 · scientific-python/circleci-artifacts-redirector-action · GitHub
[go: up one dir, main page]

Skip to content

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

8000
Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

matthieutrs
Copy link

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,

artifacts_url = `https://circleci.com/api/v2/project/gh/${orgId}/${repoId}/${buildId}/artifacts`;

was not working, the proper url being in the format

artifacts_url = `https://circleci.com/api/v2/project/${projectSlug}/${jobNumber}/artifacts`;

Proposed solution
Check whether the target url fits in the legacy or in the new format, and apply appropriate parsing depending on the case:

if (target.includes('/pipelines/circleci/')) {
      // ───── New GitHub‑App URL 
      // .../pipelines/circleci/<org‑id>/<project‑id>/<pipe‑seq>/workflows/<workflow‑id>
      ...
} else {
      // ───── Legacy OAuth URL (…/gh/<org>/<repo>/<build>) ────────────────
      ...
}

@matthieutrs
Copy link
Author

Apologies, closing this as I realize my PR is not appropriately formated. I'll open a better one soon.

@matthieutrs
Copy link
Author

Reopening as I could not fix the formatting issue from github. Real diff is around lines 7996 - 8033.

@matthieutrs matthieutrs reopened this May 5, 2025
@larsoner
Copy link
Collaborator
larsoner commented May 5, 2025

Ideally you would edit the root index.js rather than the dist/*, see https://github.com/scientific-python/circleci-artifacts-redirector-action?tab=readme-ov-file#contributing (though it is a bit sparse). Does that make sense?

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 this pull request may close these issues.

2 participants
0