Skip to main content

Download Artifact Action

The bffless/download-artifact action downloads previously deployed artifacts from BFFless back into your workflow.

Use Cases

  • Comparing coverage between PRs and production
  • Deploying the same build to multiple environments
  • Running tests against a deployed build
  • Sharing builds across repositories

Quick Start

- uses: bffless/download-artifact@v1
with:
source-path: dist
api-url: ${{ vars.BFFLESS_URL }}
api-key: ${{ secrets.BFFLESS_API_KEY }}
alias: staging

Inputs

InputRequiredDefaultDescription
api-urlYes-BFFless platform URL
api-keyYes-API key for authentication
source-pathYes-Path of files to download (e.g., dist, apps/frontend/dist)
aliasNo-Deployment alias to download from
commit-shaNo-Specific commit SHA to download
branchNo-Branch to download from (gets latest)
output-pathNoSame as source-pathWhere to save downloaded files
repositoryNoCurrent repoRepository in owner/repo format
overwriteNofalseOverwrite existing files at output-path
summaryNotrueWrite GitHub Step Summary
note

You must specify one of alias, commit-sha, or branch to identify which deployment to download.

Outputs

OutputDescription
file-countNumber of files downloaded
total-sizeTotal bytes downloaded
commit-shaCommit SHA of downloaded deployment
filesJSON array of downloaded file paths

Examples

Compare Coverage Between PR and Production

Download the production coverage baseline to compare against PR coverage:

- name: Download production coverage
uses: bffless/download-artifact@v1
continue-on-error: true # Don't fail if no baseline exists yet
with:
alias: coverage-production
source-path: coverage
output-path: ./coverage-production
api-url: ${{ vars.BFFLESS_URL }}
api-key: ${{ secrets.BFFLESS_API_KEY }}

- name: Compare coverage
run: |
PR_COV=$(jq '.total.lines.pct' ./coverage/coverage-summary.json)
PROD_COV=$(jq '.total.lines.pct' ./coverage-production/coverage-summary.json)
echo "PR: $PR_COV% | Production: $PROD_COV%"

For a complete implementation with PR comments, see the Coverage Comparison recipe.

Download Specific Commit

Download a deployment by commit SHA:

- uses: bffless/download-artifact@v1
with:
source-path: dist
api-url: ${{ vars.BFFLESS_URL }}
api-key: ${{ secrets.BFFLESS_API_KEY }}
commit-sha: abc123def456

Download to Different Directory

Download to a different output path:

- uses: bffless/download-artifact@v1
with:
source-path: dist
output-path: ./downloaded-build
api-url: ${{ vars.BFFLESS_URL }}
api-key: ${{ secrets.BFFLESS_API_KEY }}
alias: production

Cross-Repository Download

Download artifacts from a different repository:

- uses: bffless/download-artifact@v1
with:
source-path: dist
api-url: ${{ vars.BFFLESS_URL }}
api-key: ${{ secrets.BFFLESS_API_KEY }}
repository: myorg/shared-components
alias: latest

Run E2E Tests Against Deployed Build

Download a deployment and run tests against it:

name: E2E Tests

on:
deployment_status:

jobs:
test:
if: github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: bffless/download-artifact@v1
id: download
with:
source-path: dist
api-url: ${{ vars.BFFLESS_URL }}
api-key: ${{ secrets.BFFLESS_API_KEY }}
alias: preview

- name: Run E2E tests
run: |
npx serve dist &
npx playwright test

Download Latest from Branch

Download the most recent deployment from a branch:

- uses: bffless/download-artifact@v1
with:
source-path: dist
api-url: ${{ vars.BFFLESS_URL }}
api-key: ${{ secrets.BFFLESS_API_KEY }}
branch: feature/new-ui

Troubleshooting

"No deployment found"

  • Verify the alias, commit-sha, or branch exists
  • Check the repository is correct
  • Ensure the deployment hasn't been deleted

"Output path already exists"

Set overwrite: true to replace existing files:

- uses: bffless/download-artifact@v1
with:
source-path: dist
api-url: ${{ vars.BFFLESS_URL }}
api-key: ${{ secrets.BFFLESS_API_KEY }}
alias: production
overwrite: true

Download Failed - 401 Unauthorized

  • Verify your API key is correct
  • Check the key hasn't been revoked
  • Ensure BFFLESS_API_KEY secret is set

Download Failed - 404 Not Found

  • Verify BFFLESS_URL is correct
  • Check your BFFless instance is running
  • Ensure the URL includes the protocol (https://)