Download File to Workspace

Action ID: fetch:plain:file
NPM Package:

@backstage/plugin-scaffolder-backend

Description

Downloads single file and places it in the workspace.

Input Schema

PropertyTypeDescriptionRequired
urlstringRelative path or absolute URL pointing to the single file to fetch.
tokenstringAn optional token to use for authentication when reading the resources.
targetPathstringTarget path within the working directory to download the file as.

Output Schema

No output schema defined for this action.

Usage Examples

Add a company-standard LICENSE file from a central repository

Fetches a LICENSE from a central standards repo and places it in the project root. Use after generating the skeleton with fetch:template and before publishing with publish:github.

Copy
steps:
  - id: fetch-license
    action: fetch:plain:file
    input:
      url: https://raw.githubusercontent.com/acme-org/standards/main/licenses/Apache-2.0.txt
      targetPath: LICENSE

Copy a template env file within the workspace to an environment-specific name

Copies a local file from the workspace using a relative path, useful when a template includes a single .env example that should be duplicated for a specific environment.

Copy
steps:
  - id: copy-env-template
    action: fetch:plain:file
    input:
      url: ./templates/env/.env.example
      targetPath: config/.env.${{ parameters.environment }}

Fetch a private Helm values file from GitHub using a token

Downloads an environment-specific Helm values file from a private GitHub repo. Place this after fetch:template so the deploy directory exists.

Copy
steps:
  - id: fetch-helm-values
    action: fetch:plain:file
    input:
      url: https://raw.githubusercontent.com/acme-org/helm-charts/main/services/${{ parameters.serviceId }}/values-${{ parameters.environment }}.yaml
      targetPath: deploy/helm/values.yaml
      token: ${{ secrets.githubToken }}

Download a versioned utility script from an internal artifact host

Retrieves a specific version of a utility script and places it under scripts. Useful for pinning tool versions during scaffolding.

Copy
steps:
  - id: get-kube-lint
    action: fetch:plain:file
    input:
      url: https://downloads.acme.internal/tools/kube-lint/${{ parameters.version }}/kube-lint.sh
      targetPath: scripts/kube-lint.sh

Include a language-specific .gitignore from the GitHub gitignore repository

Adds a .gitignore tailored to the selected language. Run this before committing and publishing with publish:github.

Copy
steps:
  - id: fetch-gitignore
    action: fetch:plain:file
    input:
      url: https://raw.githubusercontent.com/github/gitignore/main/${{ parameters.language }}.gitignore
      targetPath: .gitignore

Other actions in @backstage/plugin-scaffolder-backend