Replace this workaround with actions/download-artifact once a release

Open
#678 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
57/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
github-actions, javascript
Domain
ci-cd, tooling

Research direction

Start by checking the release history for actions/download-artifact and whether a release includes the delayed artifact visibility fix described in issue 505 and pull request 506. Then inspect actions/download-artifact/action.yml and replace the workaround when that release is available; done means the action uses the fixed release and its existing inputs and outputs still work.

Written by the indexing model from the issue text.

Description

help wanted need-fix

includes its fix for delayed artifact visibility:

https://github\.com/actions/download\-artifact/issues/505

https://github\.com/actions/download\-artifact/pull/506

https://github.com/hoverkraft-tech/ci-github-common/blob/6d85d0c1e448999bf4bfdaa0f8bb66a390e3ff2a/actions/download-artifact/action.yml#L51-L54


---
# Download every requested artifact, retrying delayed visibility at consumption time.
#
# ```yaml
# - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@<commit-sha>
#   with:
#     artifact-ids: ${{ steps.upload.outputs.artifact-id }}
#     path: downloaded
# ```
name: Download artifacts
description: |
  Download every requested artifact ID with the official artifact SDK.
  Retry missing metadata and unavailable downloads with bounded backoff, up to
  61 seconds of waiting. Completed downloads are not repeated. Digest mismatches,
  invalid inputs, permission errors and other service failures remain failures.
  No runtime installation is required. Only GitHub.com is supported.
author: hoverkraft
branding:
  icon: download
  color: blue

inputs:
  artifact-ids:
    description: Comma-separated positive artifact IDs. Every ID must download successfully.
    required: true
  path:
    description: Destination directory. Multiple artifacts use named subdirectories unless merge-multiple is true.
    default: ${{ github.workspace }}
  merge-multiple:
    description: Download multiple artifacts into the same destination directory.
    default: "false"
  skip-decompress:
    description: Keep the uploaded file as-is, for example a package tarball uploaded without archiving.
    default: "false"
  github-token:
    description: Optional token with actions:read permission for REST downloads. Empty uses the current run's runtime token.
    default: ""
  repository:
    description: Repository containing the artifacts, used with github-token.
    default: ${{ github.repository }}
  run-id:
    description: Workflow run containing the artifacts, used with github-token.
    default: ${{ github.run_id }}

outputs:
  download-path:
    description: Absolute destination path, set only after every artifact downloads successfully.
    value: ${{ steps.download.outputs.download-path }}

runs:
  # TODO: Replace this workaround with actions/download-artifact once a release
  # includes its fix for delayed artifact visibility:
  # https://github.com/actions/download-artifact/issues/505
  # https://github.com/actions/download-artifact/pull/506
  using: composite
  steps:
    - id: download
      uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
      env:
        ACTION_PATH: ${{ github.action_path }}
        ARTIFACT_IDS: ${{ inputs.artifact-ids }}
        DOWNLOAD_PATH: ${{ inputs.path }}
        MERGE_MULTIPLE: ${{ inputs.merge-multiple }}
        SKIP_DECOMPRESS: ${{ inputs.skip-decompress }}
        ARTIFACT_TOKEN: ${{ inputs.github-token }}
        ARTIFACT_REPOSITORY: ${{ inputs.repository }}
        ARTIFACT_RUN_ID: ${{ inputs.run-id }}
      with:
        script: |
          const path = require('node:path');
          const { pathToFileURL } = require('node:url');
          const { run } = await import(pathToFileURL(path.join(process.env.ACTION_PATH, 'dist/index.js')));
          await run({
            core, artifactIds: process.env.ARTIFACT_IDS, destination: process.env.DOWNLOAD_PATH,
            mergeMultiple: process.env.MERGE_MULTIPLE, skipDecompress: process.env.SKIP_DECOMPRESS,
            githubToken: process.env.ARTIFACT_TOKEN, repository: process.env.ARTIFACT_REPOSITORY,
            runId: process.env.ARTIFACT_RUN_ID
          });

Dominant language
JavaScript
Stars
5
Forks
1
Avg merge
5h 25m
Merged PRs (30d)
60

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hoverkraft-tech/ci-github-common

All issues in hoverkraft-tech/ci-github-common

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.