-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Open
Labels
bugSomething isn't workingSomething isn't workinggh-runrelating to the gh run commandrelating to the gh run commandneeds-investigationCLI team needs to investigateCLI team needs to investigateneeds-triageneeds to be reviewedneeds to be reviewed
Description
Describe the bug
When you have a workflow run, that creates an artifact and you rerun this workflow, then you have two artifacts (2 attempts).
Using gh run download <run-id> --name artifact-name, the artifact from the first attempt is downloaded, which is not the latest artifact.
Affected version
2.83.2
Steps to reproduce the behavior
- Type this 'GH_DEBUG=api gh run download 20775770442 --repo pmd/pmd --name pmd-regression-tester'
- View the output, it downloads the artifact https://api.github.com/repos/pmd/pmd/actions/artifacts/5047083281/zip - which is the artifacts from the first attempt of the workflow run
Expected vs actual behavior
Expected: It should download the artifact from the second attempt of the workflow run: https://api.github.com/repos/pmd/pmd/actions/artifacts/5047215209/zip
Actual: It downloaded the artifact from the first attempt of the workflow run: https://api.github.com/repos/pmd/pmd/actions/artifacts/5047083281/zip
Workaround
Instead of the "gh run download" command, you can use this:
download_url=$(gh api \
"/repos/$OWNER/$REPO/actions/runs/$RUN_ID/artifacts?name=$ARTIFACT_NAME" \
--jq '.artifacts|sort_by(.created_at)|.[-1]|.archive_download_url' \
)
curl -L \
-H "Authorization: Bearer $GH_TOKEN" \
--output artifact.zip \
$download_url
unzip artifact.zip
rm artifact.zipThis sorts the artifacts by "created_at" timestamp and chooses the last one.
Logs
Details
GH_DEBUG=api gh run download 20775770442 --repo pmd/pmd --name pmd-regression-tester
* Request at 2026-01-07 13:30:01.253226536 +0100 CET m=+0.169792185
* Request to https://api.github.com/repos/pmd/pmd/actions/runs/20775770442/artifacts?per_page=100
> GET /repos/pmd/pmd/actions/runs/20775770442/artifacts?per_page=100 HTTP/1.1
> Host: api.github.com
> Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
> Authorization: token ...
> Content-Type: application/json; charset=utf-8
> Time-Zone: Europe/Berlin
> User-Agent: GitHub CLI 2.83.2
⣻< HTTP/2.0 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
< Cache-Control: private, max-age=60, s-maxage=60
< Content-Security-Policy: default-src 'none'
< Content-Type: application/json; charset=utf-8
< Date: Wed, 07 Jan 2026 12:30:01 GMT
< Etag: W/"e88a52f7ab5fa4e26bd7b1823d72705aafe994d79ef35945a9996fc28c99226f"
< Github-Authentication-Token-Expiration: 2026-02-09 09:54:11 +0100
< Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
< Server: github.com
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< Vary: Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With
< X-Accepted-Github-Permissions: actions=read
< X-Content-Type-Options: nosniff
< X-Frame-Options: deny
< X-Github-Api-Version-Selected: 2022-11-28
< X-Github-Media-Type: github.v3; param=merge-info-preview.nebula-preview; format=json
< X-Github-Request-Id: EB1F:1776B2:4392FC6:3D33E34:695E51C9
< X-Ratelimit-Limit: 5000
< X-Ratelimit-Remaining: 4999
< X-Ratelimit-Reset: 1767792601
< X-Ratelimit-Resource: core
< X-Ratelimit-Used: 1
< X-Xss-Protection: 0
{
"total_count": 7,
"artifacts": [
{
"id": 5046971645,
"node_id": "MDg6QXJ0aWZhY3Q1MDQ2OTcxNjQ1",
"name": "compile-artifact",
"size_in_bytes": 31712152,
"url": "https://api.github.com/repos/pmd/pmd/actions/artifacts/5046971645",
"archive_download_url": "https://api.github.com/repos/pmd/pmd/actions/artifacts/5046971645/zip",
"expired": false,
"digest": "sha256:7f060bcd4173aee923a2f18cef32575660485b8a1a0df98a0235d7de2f412068",
"created_at": "2026-01-07T08:53:09Z",
"updated_at": "2026-01-07T08:53:09Z",
"expires_at": "2026-04-07T08:49:42Z",
"workflow_run": {
"id": 20775770442,
"repository_id": 4992906,
"head_repository_id": 4992906,
"head_branch": "dependabot/maven/scalameta.version-4.14.4",
"head_sha": "c74a38eec86530a91dae98dc3de5b61ae556aa55"
}
},
{
"id": 5046971843,
"node_id": "MDg6QXJ0aWZhY3Q1MDQ2OTcxODQz",
"name": "staging-repository",
"size_in_bytes": 8364820,
"url": "https://api.github.com/repos/pmd/pmd/actions/artifacts/5046971843",
"archive_download_url": "https://api.github.com/repos/pmd/pmd/actions/artifacts/5046971843/zip",
"expired": false,
"digest": "sha256:c88e407a82262308fd1cb121e4abdf6b181e6d04839e2d90f0ed5fba1dc9fb52",
"created_at": "2026-01-07T08:53:11Z",
"updated_at": "2026-01-07T08:53:11Z",
"expires_at": "2026-04-07T08:49:42Z",
"workflow_run": {
"id": 20775770442,
"repository_id": 4992906,
"head_repository_id": 4992906,
"head_branch": "dependabot/maven/scalameta.version-4.14.4",
"head_sha": "c74a38eec86530a91dae98dc3de5b61ae556aa55"
}
},
{
"id": 5046972269,
"node_id": "MDg6QXJ0aWZhY3Q1MDQ2OTcyMjY5",
"name": "dist-artifact",
"size_in_bytes": 86209640,
"url": "https://api.github.com/repos/pmd/pmd/actions/artifacts/5046972269",
"archive_download_url": "https://api.github.com/repos/pmd/pmd/actions/artifacts/5046972269/zip",
"expired": false,
"digest": "sha256:7f542b5ca1021f0934cea0cdb451bd10a1d48b1ee99f3b90ef83fbcd4bfbbc19",
"created_at": "2026-01-07T08:53:14Z",
"updated_at": "2026-01-07T08:53:14Z",
"expires_at": "2026-04-07T08:49:42Z",
"workflow_run": {
"id": 20775770442,
"repository_id": 4992906,
"head_repository_id": 4992906,
"head_branch": "dependabot/maven/scalameta.version-4.14.4",
"head_sha": "c74a38eec86530a91dae98dc3de5b61ae556aa55"
}
},
{
"id": 5046997887,
"node_id": "MDg6QXJ0aWZhY3Q1MDQ2OTk3ODg3",
"name": "docs-artifact",
"size_in_bytes": 9531535,
"url": "https://api.github.com/repos/pmd/pmd/actions/artifacts/5046997887",
"archive_download_url": "https://api.github.com/repos/pmd/pmd/actions/artifacts/5046997887/zip",
"expired": false,
"digest": "sha256:303f44e45e3bad8245d8a30fa12ac2a71e07ce7e2e23cfa4229cd4bf7e34688d",
"created_at": "2026-01-07T08:56:04Z",
"updated_at": "2026-01-07T08:56:04Z",
"expires_at": "2026-04-07T08:49:42Z",
"workflow_run": {
"id": 20775770442,
"repository_id": 4992906,
"head_repository_id": 4992906,
"head_branch": "dependabot/maven/scalameta.version-4.14.4",
"head_sha": "c74a38eec86530a91dae98dc3de5b61ae556aa55"
}
},
{
"id": 5047033823,
"node_id": "MDg6QXJ0aWZhY3Q1MDQ3MDMzODIz",
"name": "javadocs-artifact",
"size_in_bytes": 19882752,
"url": "https://api.github.com/repos/pmd/pmd/actions/artifacts/5047033823",
"archive_download_url": "https://api.github.com/repos/pmd/pmd/actions/artifacts/5047033823/zip",
"expired": false,
"digest": "sha256:7cf6b24f3e0d3a6bc01736f42949b3c17e766229869f0cffa70a06c4742c5153",
"created_at": "2026-01-07T09:00:09Z",
"updated_at": "2026-01-07T09:00:09Z",
"expires_at": "2026-04-07T08:49:42Z",
"workflow_run": {
"id": 20775770442,
"repository_id": 4992906,
"head_repository_id": 4992906,
"head_branch": "dependabot/maven/scalameta.version-4.14.4",
"head_sha": "c74a38eec86530a91dae98dc3de5b61ae556aa55"
}
},
{
"id": 5047083281,
"node_id": "MDg6QXJ0aWZhY3Q1MDQ3MDgzMjgx",
"name": "pmd-regression-tester",
"size_in_bytes": 348,
"url": "https://api.github.com/repos/pmd/pmd/actions/artifacts/5047083281",
"archive_download_url": "https://api.github.com/repos/pmd/pmd/actions/artifacts/5047083281/zip",
"expired": false,
"digest": "sha256:a88bf576727865790739e17380b7c5447cedb376876f35b8462982be2a5ecca8",
"created_at": "2026-01-07T09:05:47Z",
"updated_at": "2026-01-07T09:05:47Z",
"expires_at": "2026-04-07T08:49:42Z",
"workflow_run": {
"id": 20775770442,
"repository_id": 4992906,
"head_repository_id": 4992906,
"head_branch": "dependabot/maven/scalameta.version-4.14.4",
"head_sha": "c74a38eec86530a91dae98dc3de5b61ae556aa55"
}
},
{
"id": 5047215209,
"node_id": "MDg6QXJ0aWZhY3Q1MDQ3MjE1MjA5",
"name": "pmd-regression-tester",
"size_in_bytes": 312,
"url": "https://api.github.com/repos/pmd/pmd/actions/artifacts/5047215209",
"archive_download_url": "https://api.github.com/repos/pmd/pmd/actions/artifacts/5047215209/zip",
"expired": false,
"digest": "sha256:2a5dc18badea9c17f6d7a33573b56784609b3e357369084aba06f7a105ecbec4",
"created_at": "2026-01-07T09:19:23Z",
"updated_at": "2026-01-07T09:19:23Z",
"expires_at": "2026-04-07T09:18:47Z",
"workflow_run": {
"id": 20775770442,
"repository_id": 4992906,
"head_repository_id": 4992906,
"head_branch": "dependabot/maven/scalameta.version-4.14.4",
"head_sha": "c74a38eec86530a91dae98dc3de5b61ae556aa55"
}
}
]
}
* Request took 315.646026ms
* Request at 2026-01-07 13:30:01.570352359 +0100 CET m=+0.486917998
* Request to https://api.github.com/repos/pmd/pmd/actions/artifacts/5047083281/zip
> GET /repos/pmd/pmd/actions/artifacts/5047083281/zip HTTP/1.1
> Host: api.github.com
> Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
> Authorization: token ...
> Content-Type: application/json; charset=utf-8
> Time-Zone: Europe/Berlin
> User-Agent: GitHub CLI 2.83.2
⣻< HTTP/2.0 302 Found
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
< Content-Length: 0
< Content-Security-Policy: default-src 'none'
< Content-Type: text/html;charset=utf-8
< Date: Wed, 07 Jan 2026 12:30:01 GMT
< Location: https://productionresultssa8.blob.core.windows.net/actions-results/f7e160b1-337d-43e1-9a06-e582cc2049a5/workflow-job-run-85f2ffda-a5d8-59a2-b022-2720c75e89c1/artifacts/320b47470b5efc53d6aabbf132e1c041d7dad8aa50ab2cb6ef7bfe2f874c8b3a.zip?rscd=attachment%3B+filename%3D%22pmd-regression-tester.zip%22&se=2026-01-07T12%3A40%3A01Z&sig=1HHFeiqosmSuXP3o94EESFojnJrnTinXYuQvt9arxGk%3D&ske=2026-01-07T21%3A18%3A57Z&skoid=ca7593d4-ee42-46cd-af88-8b886a2f84eb&sks=b&skt=2026-01-07T09%3A18%3A57Z&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skv=2025-11-05&sp=r&spr=https&sr=b&st=2026-01-07T12%3A29%3A56Z&sv=2025-11-05
< Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
< Server: github.com
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< Vary: Accept-Encoding, Accept, X-Requested-With
< X-Content-Type-Options: nosniff
< X-Frame-Options: deny
< X-Github-Api-Version-Selected: 2022-11-28
< X-Github-Request-Id: EB1F:1776B2:439318C:3D33FF8:695E51C9
< X-Ratelimit-Limit: 5000
< X-Ratelimit-Remaining: 4998
< X-Ratelimit-Reset: 1767792601
< X-Ratelimit-Resource: core
< X-Ratelimit-Used: 2
< X-Xss-Protection: 0
* Request took 299.224323ms
* Request at 2026-01-07 13:30:01.869640176 +0100 CET m=+0.786205809
* Request to https://productionresultssa8.blob.core.windows.net/actions-results/f7e160b1-337d-43e1-9a06-e582cc2049a5/workflow-job-run-85f2ffda-a5d8-59a2-b022-2720c75e89c1/artifacts/320b47470b5efc53d6aabbf132e1c041d7dad8aa50ab2cb6ef7bfe2f874c8b3a.zip?rscd=attachment%3B+filename%3D%22pmd-regression-tester.zip%22&se=2026-01-07T12%3A40%3A01Z&sig=1HHFeiqosmSuXP3o94EESFojnJrnTinXYuQvt9arxGk%3D&ske=2026-01-07T21%3A18%3A57Z&skoid=ca7593d4-ee42-46cd-af88-8b886a2f84eb&sks=b&skt=2026-01-07T09%3A18%3A57Z&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skv=2025-11-05&sp=r&spr=https&sr=b&st=2026-01-07T12%3A29%3A56Z&sv=2025-11-05
> GET /actions-results/f7e160b1-337d-43e1-9a06-e582cc2049a5/workflow-job-run-85f2ffda-a5d8-59a2-b022-2720c75e89c1/artifacts/320b47470b5efc53d6aabbf132e1c041d7dad8aa50ab2cb6ef7bfe2f874c8b3a.zip?rscd=attachment%3B+filename%3D%22pmd-regression-tester.zip%22&se=2026-01-07T12%3A40%3A01Z&sig=1HHFeiqosmSuXP3o94EESFojnJrnTinXYuQvt9arxGk%3D&ske=2026-01-07T21%3A18%3A57Z&skoid=ca7593d4-ee42-46cd-af88-8b886a2f84eb&sks=b&skt=2026-01-07T09%3A18%3A57Z&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skv=2025-11-05&sp=r&spr=https&sr=b&st=2026-01-07T12%3A29%3A56Z&sv=2025-11-05
> Host: productionresultssa8.blob.core.windows.net
> Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
> Content-Type: application/json; charset=utf-8
> Referer: https://api.github.com/repos/pmd/pmd/actions/artifacts/5047083281/zip
> Time-Zone: Europe/Berlin
> User-Agent: GitHub CLI 2.83.2
⣯< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: x-ms-request-id,Server,x-ms-version,Content-Type,ETag,Last-Modified,x-ms-creation-time,x-ms-lease-status,x-ms-lease-state,x-ms-blob-type,Content-Disposition,x-ms-server-encrypted,Accept-Ranges,Content-Length,Date,Transfer-Encoding
< Content-Disposition: attachment; filename="pmd-regression-tester.zip"
< Content-Length: 348
< Content-Type: zip
< Date: Wed, 07 Jan 2026 12:30:02 GMT
< Etag: "0x8DE4DCBF23E85C6"
< Last-Modified: Wed, 07 Jan 2026 09:05:47 GMT
< Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
< X-Ms-Blob-Type: BlockBlob
< X-Ms-Creation-Time: Wed, 07 Jan 2026 09:05:47 GMT
< X-Ms-Lease-State: available
< X-Ms-Lease-Status: unlocked
< X-Ms-Request-Id: 1ce1129d-b01e-00ce-15d1-7f36b3000000
< X-Ms-Server-Encrypted: true
< X-Ms-Version: 2025-11-05
* Request took 455.557872ms
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggh-runrelating to the gh run commandrelating to the gh run commandneeds-investigationCLI team needs to investigateCLI team needs to investigateneeds-triageneeds to be reviewedneeds to be reviewed