Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@actions/artifact

Package Overview
Dependencies
Maintainers
5
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@actions/artifact

Actions artifact lib

  • 2.1.11
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
98K
increased by4.52%
Maintainers
5
Weekly downloads
 
Created

What is @actions/artifact?

@actions/artifact is an npm package designed for use with GitHub Actions. It allows you to upload and download build artifacts, which can be useful for sharing data between jobs in a workflow or for persisting data after a workflow completes.

What are @actions/artifact's main functionalities?

Upload Artifacts

This feature allows you to upload files as artifacts. The code sample demonstrates how to create an artifact client, specify the files to be uploaded, and then upload them.

const artifact = require('@actions/artifact');
const artifactClient = artifact.create();
const artifactName = 'my-artifact';
const files = ['path/to/file1', 'path/to/file2'];
const rootDirectory = 'path/to';
const options = { continueOnError: false };

artifactClient.uploadArtifact(artifactName, files, rootDirectory, options).then(response => {
  console.log(`Artifact ${response.artifactName} has been successfully uploaded!`);
}).catch(error => {
  console.error(`Failed to upload artifact: ${error}`);
});

Download Artifacts

This feature allows you to download previously uploaded artifacts. The code sample demonstrates how to create an artifact client, specify the artifact to be downloaded, and then download it.

const artifact = require('@actions/artifact');
const artifactClient = artifact.create();
const artifactName = 'my-artifact';
const downloadPath = 'path/to/download';

artifactClient.downloadArtifact(artifactName, downloadPath).then(response => {
  console.log(`Artifact ${response.artifactName} has been successfully downloaded to ${response.downloadPath}`);
}).catch(error => {
  console.error(`Failed to download artifact: ${error}`);
});

List Artifacts

This feature allows you to list all artifacts for a given workflow run. The code sample demonstrates how to create an artifact client and list all artifacts.

const artifact = require('@actions/artifact');
const artifactClient = artifact.create();

artifactClient.listArtifacts().then(response => {
  console.log('Artifacts:', response.artifacts);
}).catch(error => {
  console.error(`Failed to list artifacts: ${error}`);
});

Other packages similar to @actions/artifact

Keywords

FAQs

Package last updated on 08 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc