Skip to content

The download-artifact action will preserve file attributes like permissions.

License

Notifications You must be signed in to change notification settings

pyTooling/download-artifact

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Workflow - Build and Test Status Sourcecode License

Artifact Download Action with File Permission Preservation

This composite action, based on actions/download-artifact and extracting the artifact's content from a tarball, will preserve file attributes like file permissions. This essential capability is not implemented by GitHub until now (requested on 05.12.2019) and still delayed and/or refused? to be implemented in the future. According to GitHub, the internal API doesn't allow the implementation of such a feature, but this actions is demonstrating a working solution.

📤 See pyTooling/upload-artifact for the matching upload action.

Usage

jobs:
  MyJob:
    steps:
      - name: 📥 Download artifact
        uses: pyTooling/download-artifact@v4
        with:
          name: binary

      - name: 📥 Download artifact
        uses: pyTooling/download-artifact@dev
        with:
          name: documentation
          path: public

      - name: 📥 Download artifact
        uses: pyTooling/download-artifact@dev
        with:
          pattern: unittest-*
          path: reports

Input Parameters

Parameter Required Default Description
name no '' Name of the artifact to download.
If unspecified, all artifacts for the run are downloaded.
path no $GITHUB_WORKSPACE Destination path. Supports basic tilde expansion.
pattern no A glob pattern to the artifacts that should be downloaded.
Ignored if name is specified.
merge-multiple no false When multiple artifacts are matched, this changes the behavior of the destination directories.
If true, the downloaded artifacts will be in the same directory specified by path.
If false, the downloaded artifacts will be extracted into individual named directories within the specified path.
github-token no The GitHub token used to authenticate with the GitHub API.
This is required when downloading artifacts from a different repository or from a different workflow run.
If unspecified, the action will download artifacts from the current repo and the current workflow run.
repository no ${{ github.repository }} The repository owner and the repository name joined together by "/".
If github-token is specified, this is the repository that artifacts will be downloaded from.
run-id no ${{ github.run_id }} The id of the workflow run where the desired download artifact was uploaded from.
If github-token is specified, this is the run that artifacts will be downloaded from.
tarball-name no 1
investigate no false If enabled, show the downloaded artifact's directory content as a tree.

Output Parameters

Parameter Description
download-path Absolute path where the artifact(s) were downloaded.

Fixed behavior compared to actions/download-artifact

  1. Preserve file permissions
    The artifact's content is collected in a tarball, which allows preserving file attributes like file permissions.
  2. Don't remove common prefix from files
    actions/upload-artifact removes the common prefix from all files before storing in an artifact. This is not a well-defined behavior. Slightly changing the list of collected files might drastically change the directory structure of the artifact.
    This action defines a root directory from where the content of the tarball is constructed. This is independent of the list of provided file patterns.

Further Features

  • Accepts artifacts uploaded from actions/upload-artifact (legacy artifacts) and pyTooling/upload-artifacts.

Dependencies

Competing Actions

Contributors

Credits

This action was inspired by and is based on:

License

This GitHub Composite Action (source code) licensed under The MIT License.


SPDX-License-Identifier: MIT

Footnotes

  1. '__pyTooling_upload_artifact__.tar' ↩