-
Notifications
You must be signed in to change notification settings - Fork 605
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
Conversation
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.
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 |
…(mainly for windows unit tests)
Here is the original PR where I added support for downloading artifacts by |
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.
This makes sense to me 👍 cc @yacaovsnc @Link-
The change LGTM so I approved. This is a breaking change so we may need to be a bit more careful in releasing this. |
@yacaovsnc v5.0.0🚨 Breaking ChangeThis 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 ChangedPreviously, single artifact downloads behaved differently depending on how you specified the artifact:
Now both methods are consistent:
Migration Guide✅ No Action Needed If:
|
👋 it seems there is another, potentially unintended change: Previously, artifact downloads without using name or id was consistent, e.g.:
Now behavior depends on how many artifacts are there, e.g.:
IMHO, this behavior is not ideal as we can't use generic handling for matrices of size 1 and bigger than 1. |
… 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) [](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)
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:
artifact-ids: my-artifact
→ extracts directly to specified path (e.g.,dist/
)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)