Skip to content
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

It's trying to download a very old artifact, when much newer ones exist #240

Open
dsnopek opened this issue Apr 28, 2023 · 3 comments
Open

Comments

@dsnopek
Copy link

dsnopek commented Apr 28, 2023

I'm using this YAML:

      - name: Download latest Godot artifacts
        uses: dawidd6/action-download-artifact@v2.27.0
        if: ${{ matrix.run-tests }}
        with:
          github_token: ${{ secrets.GODOT_ACCESS_TOKEN }}
          repo: godotengine/godot
          branch: master
          event: push
          workflow: linux_builds.yml
          workflow_conclusion: success
          name: linux-editor-mono
          search_artifacts: true
          check_artifacts: true
          path: godot-artifacts

And getting this result:

==> Repository: godotengine/godot
==> Artifact name: linux-editor-mono
==> Local path: godot-artifacts
==> Workflow name: linux_builds.yml
==> Workflow conclusion: success
==> Branch: master
==> (found) Run ID: 4612375401
==> (found) Run date: 2023-04-04T21:10:45Z
==> Artifact: 632304094
==> Downloading: linux-editor-mono.zip (159.63 MB)
Error: no downloadable artifacts found (expired)

The thing is, there are many dozens of newer runs! (Maybe even hundreds? Godot is a very active project.)

My first thought was that maybe the API is returning them in chronological order and picking the first (and hence oldest) one. So, I tried recreating the API calls I see in main.js using curl on the command-line, but it appears that the API is correctly returning them in reverse chronologic order (ie. newest first).

When I try to list the runs:

$ curl -L   -H "Accept: application/vnd.github+json"   -H "Authorization: Bearer SECRET"  -H "X-GitHub-Api-Version: 2022-11-28"   https://api.github.com/repos/godotengine/godot/actions/runs?branch=master\&workflow_id=linux_builds.yml\&event=push

Here's just the first one (out of apparently 52,727 of them :-)):

{
  "total_count": 52727,
  "workflow_runs": [
    {
      "id": 4832884014,
      "name": "🔗 GHA",
      "node_id": "WFR_kwLOAO6SJc8AAAABIA_1Lg",
      "head_branch": "master",
      "head_sha": "9f12e7b52d944281a39b7d3a33de6700c76cc23a",
      "path": ".github/workflows/runner.yml",
      "display_title": "Merge pull request #76521 from justinwash/csg-infinite-loop-fix",
      "run_number": 1495,
      "event": "push",
      "status": "completed",
      "conclusion": "success",
      "workflow_id": 33869182,
      "check_suite_id": 12557182992,
      "check_suite_node_id": "CS_kwDOAO6SJc8AAAAC7HdoEA",
      "url": "https://api.github.com/repos/godotengine/godot/actions/runs/4832884014",
      "html_url": "https://github.com/godotengine/godot/actions/runs/4832884014",
      "pull_requests": [
           // ... snip ...
      ],
      "created_at": "2023-04-28T16:47:39Z",
      "updated_at": "2023-04-28T17:27:59Z",
      // ... snip ...

If it would pick that one, that'd be fabulous!

Since I'm using search_artifacts and check_artifacts, I also tried listing the artifacts for this run:

$ curl -L   -H "Accept: application/vnd.github+json"   -H "Authorization: Bearer SECRET"  -H "X-GitHub-Api-Version: 2022-11-28"   https://api.github.com/repos/godotengine/godot/actions/runs/4832884014/artifacts

And I can see an artifact with the correct name in there:

    {
      "id": 671104974,
      "node_id": "MDg6QXJ0aWZhY3Q2NzExMDQ5NzQ=",
      "name": "linux-editor-mono",
      "size_in_bytes": 161234643,
      "url": "https://api.github.com/repos/godotengine/godot/actions/artifacts/671104974",
      "archive_download_url": "https://api.github.com/repos/godotengine/godot/actions/artifacts/671104974/zip",
      "expired": false,
      "created_at": "2023-04-28T17:27:58Z",
      "updated_at": "2023-04-28T17:27:59Z",
      "expires_at": "2023-05-12T16:55:05Z",
      "workflow_run": {
        "id": 4832884014,
        "repository_id": 15634981,
        "head_repository_id": 15634981,
        "head_branch": "master",
        "head_sha": "9f12e7b52d944281a39b7d3a33de6700c76cc23a"
      }
    }

What can I do to induce it to try and download this artifact?

Looking at the code in main.js, I'm not seeing anything obviously wrong, unless the GitHub client is doing something to sort the results in chronological order (such that the oldest is first)?

Thanks!

@dsnopek
Copy link
Author

dsnopek commented Apr 29, 2023

An update: I copied the code for this action into my project, and added some console.log() statements. It is picking the first workflow run in the loop, and it is a very old one. So, it does seem to be an issue with the order.

@AndrewDryga
Copy link

If anyone needs a script to workaround this issue take a look at firezone/firezone#2665

@SoftwarehouseForAutomation

thank's a lot.
I got the very same problem with downloading artifacts, script from this PR helped me to create my own download artifact job
firezone/firezone@040345c

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

No branches or pull requests

3 participants