Skip to content

dawidd6/action-download-artifact@v17 - Download older version sometimes, though most recent version exists #428

Open

Description

@ctsmohanreddy072

Some times, the action downloads an older artifact version.

The build.yml always upload the artifact as ExportedARM-{build number}

  • name: Download latest successful
    uses: dawidd6/action-download-artifact@v17
    with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
    workflow: build yml
    branch: Development
    name: ExportedARM
    name_is_regexp: true

Activity

  1. dawidd6 commented on Sep 24, 2026

    @dawidd6
    Owner

    Try v24

  2. ColludingPudding commented on Sep 25, 2026

    @ColludingPudding

    I have been able to replicate this issue on v24. After multiple runs, it eithers

    • pick up latest artifact (intended)
    • pick up a very specific older artifact (in my case 15 push older than latest)
    • fails and says no artifact found

    I'm only specifying workflow, branch and name.

  3. dawidd6 commented on Sep 25, 2026

    @dawidd6
    Owner

    Do you have some repos to show me?

  4. ColludingPudding commented on Sep 25, 2026

    @ColludingPudding

    Unfortunately mine are private firm repo, let me try to reproduce it when I have spare time.

    I noticed this error started earlier this week. I've tried to debug it but it's harder when the results are inconsistent. Any test you want me to run first?

  5. Panzerschrek commented on Sep 25, 2026

    @Panzerschrek

    Same problem for me:

    Run dawidd6/action-download-artifact@v2
      with:
        repo: Panzerschrek/U-00DC-Sprache
        branch: master
        workflow: main.yml
        if_no_artifact_found: fail
        github_token: ***
        workflow_conclusion: success
        name_is_regexp: false
        path: ./
        allow_forks: true
        check_artifacts: false
        search_artifacts: false
        skip_unpack: false
    ==> Repository: Panzerschrek/U-00DC-Sprache
    ==> Artifact name: 
    ==> Local path: ./
    ==> Workflow name: main.yml
    ==> Workflow conclusion: success
    ==> Branch: master
    ==> Allow forks: true
    ==> (found) Run ID: 20638977995
    ==> (found) Run date: 2026-01-01T13:01:41Z
    ==> Artifact: 5003158590
    ==> Downloading: compiler_gnu_linux.zip (148.33 MB)
    Error: no downloadable artifacts found (expired)
    

    A build from 1st January is selected for some reason, but there are a lot of newer builds, the newest one is only a couple of weeks old.

  6. dawidd6 commented on Sep 25, 2026

    @dawidd6
    Owner

    Do you have the public repo where this workflow runs?

  7. dawidd6 commented on Sep 25, 2026

    @dawidd6
    Owner

    I dug into this. Short version: I can't find a code regression that explains it on v2/v17/v24, but I did find places where the action makes itself fragile to a bad API response, and I've changed those.

    This is not the #424 bug. That one was the status= query param added in #417, which makes GitHub return runs in a non-newest-first order; #425 fixed it by filtering the conclusion locally again. Only v23 ever shipped it — v24 is the fix, and v17 and v2 never had it (both already filter workflow_conclusion client-side).

    What @Panzerschrek's log shows. Checking against the public repo:

    • main.yml + branch=master → 123 runs, ordering is exactly created_at descending, stable across repeated calls and on every page. First item is run #5170 (2026-09-13), whose artifact exists and is not expired.
    • The run the action picked, 20638977995, is position 45 in that list: 2026-01-01, run_attempt: 1, master, success, not a fork.

    With check_artifacts: false and search_artifacts: false there is no code path that can skip 44 valid runs — the action takes the first run that matches. So the response at that moment was not newest-first. Same class of problem as #95 back in 2021.

    Changes, in the next release:

    1. Candidate runs are now sorted newest-first by the action instead of trusting the response order, and fetched with per_page=100. In the case above the stale run then lands on page 1, so a shuffled page gets corrected. It does not help if whole pages come back out of order — that would mean draining every page, which I don't want to pay for on repos with thousands of runs.
    2. Expired artifacts no longer satisfy check_artifacts / search_artifacts. At the time of that log the stale run did still list its artifact with expired: true (GitHub has purged the record since), so check_artifacts: true would not have skipped it. Now it will, which also makes it a usable workaround.
    3. Unrelated, spotted while reading: dry_run: false was truthy and silently enabled dry run mode. Fixed.

    @ctsmohanreddy072 yours may be a different thing. name: ExportedARM with name_is_regexp: true matches every ExportedARM-<n> in the selected run, and re-run runs keep the artifacts from all attempts (#384) — so you can end up with ExportedARM-100/ and ExportedARM-101/ both downloaded, and a later step reading the older one. Could you post the full log, including the ==> (found) Run ID and ==> Artifact: lines? Also, workflow: build yml in your snippet has to be the workflow filename (build.yml) or the numeric id, not the display name.

    @ColludingPudding were you on v23 before moving to v24? And do the failing runs line up with anything on githubstatus.com? Both symptoms you describe (an older run, and "no artifact found") fall out of one truncated or misordered response, so I'd expect a single cause rather than two bugs.

  8. ColludingPudding commented on Sep 25, 2026

    @ColludingPudding

    I was on v6. Just ran some test on v25 and looks like its working now. Thanks for the quick response!

  9. ereizas247 commented on Sep 28, 2026

    @ereizas247

    I am still seeing this behavior after upgrading to the release containing PR #429.

    This is a private repository, so I cannot provide a public reproduction or full logs, but the workflow uses the direct action:

    uses: dawidd6/action-download-artifact@v25
    

    The relevant inputs are:

        github_token: ...
        check_artifacts: true
        search_artifacts: true
        workflow: <workflow filename>
        workflow_conclusion: success
        branch: main
        name: <exact artifact name>
        repo: <private repository>

    name_is_regexp is not enabled.

    The action intermittently selected an older successful artifact even though a newer successful run containing the same artifact existed before the consuming workflow started. The selected artifact was still valid and had a future expiration date, so this does not appear to be the expired-artifact case addressed by PR #429.

    Sanitized example:

    ==> (found) Run ID: ######
    ==> (found) Run date: 2026-02-18T13:23:44Z
    ==> Artifact: ######
    

    I also have a diagnostic branch that prints the candidate ordering. I ran it nine times, but it did not reproduce the stale selection. That branch consistently showed the expected ordering during those runs. The failure is intermittent, so I do not know whether the diagnostic workflow changes the timing or whether the bad API response is rare.

    Since PR #429 sorts runs within the returned page but does not drain and globally sort all pages, could this still occur if GitHub returns an incomplete or misordered paginated response? Is there a recommended way to capture the raw workflow-runs API response from the failing invocation, or any other information that would help distinguish an API response issue from an action-selection issue?

  10. dawidd6 commented on Sep 28, 2026

    @dawidd6
    Owner

    Thanks for the detailed report. You're right that #429 only sorts within a page, but with check_artifacts + search_artifacts there are two other ways a newer run can be dropped silently, and your diagnostic branch wouldn't catch either because it only printed the ordering:

    1. The run list lags behind. The newer run can still show up without a success conclusion for a short while after it finishes, so the conclusion filter skips it.
    2. The artifact list lags or comes back empty. For every candidate, search_artifacts calls the list-artifacts endpoint for that run. If that call returns an empty or incomplete list, the run is skipped and the action falls back to an older one.

    The 2026-02-18 date is also telling. If more than ~100 runs of that workflow landed on main since then, the Feb run couldn't have been on page 1, which means every run on page 1 was filtered out. That fits (2) better than a shuffled page.

    The next release logs every page it fetches (raw order) and every skipped run with the reason (status/conclusion, or the artifact names it saw). To capture the failing invocation, set a repository variable ACTIONS_STEP_DEBUG to true and leave it on until it happens again, then post the ==> Fetched page / ==> Skipping run lines.

    Meanwhile, it would help to know:

    • roughly how many main runs of that workflow happened between 2026-02-18 and the bad pick
    • how the consuming workflow is triggered (e.g. workflow_run: completed) and how soon after the producer finished
    • whether it still happens with search_artifacts: false (keep check_artifacts: true; with an exact name a missing artifact still fails the step)
  11. ereizas247 commented on Sep 28, 2026

    @ereizas247

    I think there have been hundreds of runs between that workflow and the bad pick. The consumer is triggered by a push to a branch within it and does not depend on the producer except for requiring a valid artifact (the requirements for validity don't change often but have changed recently with an addition of a required file). I will try setting ACTIONS_STEP_DEBUG to true next.

  12. ctsmohanreddy072 commented on Sep 29, 2026

    @ctsmohanreddy072
    Author

    @dawidd6 - Mine is private repository, so I'have masked the sensitive ones with the full log details. Please find the below which I'm using currently.

    The build.yml will always upload the artifact with format as ExportedARM-
    Let's say if the builld.yml is triggered and build number as 112, then artifact will be ExportedARM-112

    The qa.yml is the workflow that downloads the lastest successful artifact from build.yml
    The qa.yml has below to achieve that

    uses: dawidd6/action-download-artifact@v17
    github_token: ...
    workflow: build.yml
    branch: development
    name: ExportedARM
    name_is_regex: true

    Logs:
    Repository:
    Artifact name: ExportedARM
    Local path ./
    Workflow name: build.yml
    Workflow conclusion: success
    Branch: development
    Allow forks: false
    (Found) Run ID: *******
    (Found) Run date: *******
    Artifact: *****
    Downloading: ExportedARM-92.zip (213.51 kb)
    Extracting: ExportedARM-92.zip

    Issue: Some times it downloads the older artifact like Exported-92.zip, though latest successful artifact is 112 exists. Up on rerun the issue gets fixed. But I did not understand why is it picking the older artifact though the newer one exists

  13. ereizas247 commented on Sep 29, 2026

    @ereizas247

    The next release logs every page it fetches (raw order) and every skipped run with the reason (status/conclusion, or the artifact names it saw). To capture the failing invocation, set a repository variable ACTIONS_STEP_DEBUG to true and leave it on until it happens again, then post the ==> Fetched page / ==> Skipping run lines.

    There were no ==> Skipping run lines, but this is what showed up (with number sanitized):

    ##[debug]==> Fetched page of 1 runs: ########

    And that was the run that was selected.

  14. dawidd6 commented on Sep 29, 2026

    @dawidd6
    Owner

    @ereizas247 thanks, that debug line settled it: Fetched page of 1 runs out of hundreds means GitHub returned a truncated list, not that the action filtered runs out.

    I reproduced it on a public repo (Panzerschrek/U-00DC-Sprache, main.yml, branch=master). When the runs API is queried with branch, event, head_sha or status, it goes through GitHub's search index, and that index intermittently returns a random subset of the matching runs:

    Query Calls Newest run missing
    branch=master 98 6
    status=success 20 3
    no filter 56 0

    A bad response looked like 18 of 114 runs, scattered across the whole history (#5169, 5118, 5108, 5018 … 4950), still sorted newest-first, with total_count: 18 and no next page. Nothing in the response shows anything is missing, so the action picks the newest run it was given, which can be months old. The failures come in bursts, which is why a re-run fixes it and why diagnostic runs rarely catch it. It also explains the reports on v2, v6, v17 and v25 alike.

    #432 works around it: when branch, event or commit/pr is set, the action also fetches the workflow's latest 100 runs without filters, matches them locally and merges in anything the filtered response left out. It won't help if a branch's newest run isn't among the workflow's latest 100 runs. That's rare for main/development, where this was reported.

    It's released in v27. If you still see a stale pick on @v27, please post the ==> Fetched page and ==> Merging runs debug lines.

    @ctsmohanreddy072 yours looks like the same bug. Please upgrade from v17 to @v27, and double-check the input is spelled name_is_regexp (your snippet has name_is_regex).

  15. cahva commented on Oct 5, 2026

    @cahva

    Another data point, on v21: branch=main for one workflow returned 15 runs going back to March and left out every main run from the last month (about 10), so we deployed a month-old build to production :(

    The same query without branch was correct. v27's merge of the latest 100 unfiltered runs would have caught our case, but it won't help once the newest match falls outside those 100, e.g. a workflow that runs on every branch where the target branch builds rarely. We dropped branch and match by artifact name (search_artifacts: true) instead, since our artifact names already include the branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions