Skip to content

fix: inconsistent path behavior for single artifact downloads by ID #416

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

Merged
merged 4 commits into from
Aug 5, 2025

Conversation

GrantBirki
Copy link
Member

@GrantBirki GrantBirki commented Aug 5, 2025

Inconsistent path behavior for single artifact downloads by ID

When downloading a single artifact, there is an inconsistency in the path behavior depending on how the artifact was specified:

  • By name: artifact-ids: my-artifact → extracts directly to specified path (e.g., dist/)
  • By ID: artifact-ids: 12345 → creates nested directory (e.g., dist/my-artifact/)

This inconsistency was confusing and may have forced users to work around it by setting merge-multiple: true even for single artifact downloads.

Solution

Modified the path determination logic to treat single artifact downloads consistently, regardless of whether they're specified by name or artifact ID.

Key change: Added artifacts.length === 1 condition to the path logic, so single artifact downloads always extract directly to the specified path.


related: urllib3/urllib3#3650 (another PR I opened as a workaround since this inconsistency still exists)

@Copilot Copilot AI review requested due to automatic review settings August 5, 2025 18:22
@GrantBirki GrantBirki requested a review from a team as a code owner August 5, 2025 18:22
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an inconsistency in path behavior for single artifact downloads, where artifacts downloaded by ID were creating nested directories while artifacts downloaded by name extracted directly to the specified path.

  • Added condition artifacts.length === 1 to the path determination logic for consistent single artifact download behavior
  • Updated test coverage to verify single artifact downloads by ID extract to the same path as downloads by name
  • Enhanced documentation to clarify the consistent behavior for single artifact downloads

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
src/download-artifact.ts Modified path logic to treat single artifact downloads consistently regardless of specification method
tests/download.test.ts Added test case verifying single artifact by ID downloads to same path as by name
README.md Updated documentation to clarify consistent single artifact download behavior and added examples

@GrantBirki
Copy link
Member Author

Here is the original PR where I added support for downloading artifacts by id but missed this behavior leading to an inconsistency -> #401

Copy link
Contributor

@robherley robherley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me 👍 cc @yacaovsnc @Link-

@yacaovsnc
Copy link
Contributor

The change LGTM so I approved. This is a breaking change so we may need to be a bit more careful in releasing this.

@GrantBirki
Copy link
Member Author

@yacaovsnc v5 release notes will look something like this since this will be a breaking change for folks that have already adopted the new_ish_ artifact-ids input option:

v5.0.0

🚨 Breaking Change

This release fixes an inconsistency in path behavior for single artifact downloads by ID. If you're downloading single artifacts by ID, the output path may change.

What Changed

Previously, single artifact downloads behaved differently depending on how you specified the artifact:

  • By name: name: my-artifact → extracted to path/ (direct)
  • By ID: artifact-ids: 12345 → extracted to path/my-artifact/ (nested)

Now both methods are consistent:

  • By name: name: my-artifact → extracted to path/ (unchanged)
  • By ID: artifact-ids: 12345 → extracted to path/ (fixed - now direct)

Migration Guide

✅ No Action Needed If:
  • You download artifacts by name
  • You download multiple artifacts by ID
  • You already use merge-multiple: true as a workaround
⚠️ Action Required If:

You download single artifacts by ID and your workflows expect the nested directory structure.

Before v5 (nested structure):

- uses: actions/download-artifact@v4
  with:
    artifact-ids: 12345
    path: dist
# Files were in: dist/my-artifact/

Where my-artifact is the name of the artifact you previously uploaded

To maintain old behavior (if needed):

- uses: actions/download-artifact@v5
  with:
    artifact-ids: 12345
    path: dist/my-artifact  # Explicitly specify the nested path

@yacaovsnc yacaovsnc merged commit 634f93c into main Aug 5, 2025
11 checks passed
@yacaovsnc yacaovsnc deleted the single-artifact-id-download-path branch August 5, 2025 20:50
@agners
Copy link

agners commented Aug 6, 2025

👋 it seems there is another, potentially unintended change:

Previously, artifact downloads without using name or id was consistent, e.g.:

  • [no name/all artifacts if 1]: → extracted to path/my-artifact/ (nested)
  • [no name/all artifacts if multiple]: → extracted to path/my-artifact/, path/my-artifact2/ (nested)

Now behavior depends on how many artifacts are there, e.g.:

  • [no name/all artifacts if 1]: → extracted to path/ (changed - now direct)
  • [no name/all artifacts if multiple]: → extracted to path/my-artifact/, path/my-artifact2/ (unchanged - nested)

IMHO, this behavior is not ideal as we can't use generic handling for matrices of size 1 and bigger than 1.

mergify bot added a commit to ArcadeData/arcadedb that referenced this pull request Aug 10, 2025
… ci]

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4.3.0 to 5.0.0.
Release notes

*Sourced from [actions/download-artifact's releases](https://github.com/actions/download-artifact/releases).*

> v5.0.0
> ------
>
> What's Changed
> --------------
>
> * Update README.md by [`@​nebuk89`](https://github.com/nebuk89) in [actions/download-artifact#407](https://redirect.github.com/actions/download-artifact/pull/407)
> * BREAKING fix: inconsistent path behavior for single artifact downloads by ID by [`@​GrantBirki`](https://github.com/GrantBirki) in [actions/download-artifact#416](https://redirect.github.com/actions/download-artifact/pull/416)
>
> v5.0.0
> ------
>
> ### 🚨 Breaking Change
>
> This release fixes an inconsistency in path behavior for single artifact downloads by ID. **If you're downloading single artifacts by ID, the output path may change.**
>
> #### What Changed
>
> Previously, **single artifact downloads** behaved differently depending on how you specified the artifact:
>
> * **By name**: `name: my-artifact` → extracted to `path/` (direct)
> * **By ID**: `artifact-ids: 12345` → extracted to `path/my-artifact/` (nested)
>
> Now both methods are consistent:
>
> * **By name**: `name: my-artifact` → extracted to `path/` (unchanged)
> * **By ID**: `artifact-ids: 12345` → extracted to `path/` (fixed - now direct)
>
> #### Migration Guide
>
> ##### ✅ No Action Needed If:
>
> * You download artifacts by **name**
> * You download **multiple** artifacts by ID
> * You already use `merge-multiple: true` as a workaround
>
> ##### ⚠️ Action Required If:
>
> You download **single artifacts by ID** and your workflows expect the nested directory structure.
>
> **Before v5 (nested structure):**
>
> ```
> - uses: actions/download-artifact@v4
>   with:
>     artifact-ids: 12345
>     path: dist
> # Files were in: dist/my-artifact/
>
> ```
>
> > Where `my-artifact` is the name of the artifact you previously uploaded
>
> **To maintain old behavior (if needed):**
>
> ```
> </tr></table> 
>
> ```

... (truncated)


Commits

* [`634f93c`](actions/download-artifact@634f93c) Merge pull request [#416](https://redirect.github.com/actions/download-artifact/issues/416) from actions/single-artifact-id-download-path
* [`b19ff43`](actions/download-artifact@b19ff43) refactor: resolve download path correctly in artifact download tests (mainly ...
* [`e262cbe`](actions/download-artifact@e262cbe) bundle dist
* [`bff23f9`](actions/download-artifact@bff23f9) update docs
* [`fff8c14`](actions/download-artifact@fff8c14) fix download path logic when downloading a single artifact by id
* [`448e3f8`](actions/download-artifact@448e3f8) Merge pull request [#407](https://redirect.github.com/actions/download-artifact/issues/407) from actions/nebuk89-patch-1
* [`47225c4`](actions/download-artifact@47225c4) Update README.md
* See full diff in [compare view](actions/download-artifact@d3f86a1...634f93c)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=actions/download-artifact&package-manager=github\_actions&previous-version=4.3.0&new-version=5.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
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.

4 participants