Append Content To File

Action ID: roadiehq:utils:fs:append
NPM Package:

@roadiehq/scaffolder-backend-module-utils

Description

Append content to the end of the given file, it will create the file if it does not exist.

Input Schema

PropertyTypeDescriptionRequired
pathstring-
contentstring-

Output Schema

PropertyTypeDescriptionRequired
pathstring-

Usage Examples

Append environment variables to a new .env before publishing

Appends environment variables to a .env file at the workspace root. Use this to add runtime configuration during scaffolding before publishing the repository.

Copy
steps:
  - id: fetch-base
    action: fetch:template
    input:
      url: ./skeleton
      targetPath: .
      values:
        name: ${{ parameters.serviceName }}
        owner: ${{ parameters.owner }}

  - id: append-env
    action: roadiehq:utils:fs:append
    input:
      path: .env
      content: |
        APP_NAME=${{ parameters.serviceName }}
        PORT=${{ parameters.port }}
        LOG_LEVEL=info

  - id: publish
    action: publish:github
    input:
      repoUrl: github.com?owner=${{ parameters.owner }}&repo=${{ parameters.serviceName }}

Add a CODEOWNERS entry for the service team

Appends a service specific ownership rule to a CODEOWNERS file at the repository root. Use this to register the owning team during scaffolding while creating the file if it does not exist.

Copy
steps:
  - id: fetch-template
    action: fetch:template
    input:
      url: ./skeleton
      targetPath: .
      values:
        serviceName: ${{ parameters.serviceName }}
        description: ${{ parameters.description }}

  - id: append-codeowners
    action: roadiehq:utils:fs:append
    input:
      path: CODEOWNERS
      content: |
        # Ownership for this service
        /services/${{ parameters.serviceName }} @${{ parameters.githubOrg }}/${{ parameters.ownerTeam }}

  - id: publish
    action: publish:github
    input:
      repoUrl: github.com?owner=${{ parameters.githubOrg }}&repo=${{ parameters.serviceName }}