Skip to content

core functionality for form8ion plugins that manage github workflows

License

Notifications You must be signed in to change notification settings

form8ion/github-workflows-core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

github-workflows-core

core functionality for form8ion plugins that manage github workflows

Node CI Workflow Status Codecov SLSA Level 2

Table of Contents

Usage

MIT license npm Try @form8ion/github-workflows-core on RunKit node

Installation

$ npm install @form8ion/github-workflows-core --save-prod

Example

Import

import {
  scaffoldCheckoutStep,
  scaffoldNodeSetupStep,
  scaffoldDependencyInstallationStep,
  scaffoldVerificationStep,
  loadWorkflowFile,
  writeWorkflowFile,
  workflowFileExists,
  renameWorkflowFile
} from '@form8ion/github-workflows-core';

Execute

const projectRoot = process.cwd();

(async () => {
  scaffoldCheckoutStep();

  scaffoldNodeSetupStep({versionDeterminedBy: 'nvmrc'});

  scaffoldDependencyInstallationStep();

  scaffoldVerificationStep();

  if (await workflowFileExists({projectRoot, name: 'existing-workflow-name'})) {
    await loadWorkflowFile({projectRoot, name: 'existing-workflow-name'});
  }

  await writeWorkflowFile({projectRoot, name: 'workflow-name', config: {}});

  await renameWorkflowFile({projectRoot, oldName: 'existing-workflow-name', newName: 'new-workflow-name'});
})();

API

scaffoldCheckoutStep

Scaffolder to define the details for a step to check out the project in a GitHub workflow

scaffoldNodeSetupStep

Scaffolder to define the details for a step to set up a node.js environment in a GitHub workflow

Takes a single options object as an argument, containing:

versionDeterminedBy string (required)

Source of node version for use in the configured step. Valid options are nvmrc or matrix

scaffoldDependencyInstallationStep

Scaffolder to define the details for a step to install dependencies in a GitHub workflow

scaffoldVerificationStep

Scaffolder to define the details for a step to execute verification

Contributing

PRs Welcome Commitizen friendly Conventional Commits semantic-release: angular Renovate

Dependencies

$ nvm install
$ npm install

Verification

$ npm test