Git Product home page Git Product logo

npm-worker's Introduction

Github Action   Sponsor Mudlabs   Support Mudlabs

NPM Worker

Manage node packages on your Github Action repository.

Table of Contents


Requirements

You must include the YAML configuration file in your repository. If you don't specify its path to the config key in your workflow, the action will try to find it in your .github directory and then in root (./) .

Any of the following are accepted config file names.

  • npmworker.config.yaml
  • npmworker.config.yml
  • npm.worker.config.yaml
  • npm.worker.config.yml

Usage

1. Implement a Workflow for your action

  • Here we specify the workflow should only run when a change to our config file is made.
# ./.github/workflows/npmworker.yaml

name: NPM Worker
on:
  push:
    branches:
      - master:
    paths:
      - ./path/to/npmworker.config.yaml
jobs:
  npm:
    runs-on: ubuntu-latest
    name: NPM Worker
    steps:
      - uses: actions/checkout@v2
      - name: Worker
        uses: mudlabs/[email protected]
        with:
          # OPTIONAL: Provide a PAT for the repository, so the
          # action can log activity to an issue.
          # Default: github.token
          token: ${{ secrets.GITHUB_TOKEN }}
          # OPTIONAL: Provide a path within your repository to
          # the YAML configuration file.
          # If not provided the action will attempt to find it
          # before failing.
          config: ./path/to/npmworker.config.yaml

2. Now add the configuration file

  • If you want to remove a package it's not enough to remove it from the install array, you need to add it to the uninstall array.
Prop Description Default
clean Specifies the action should edit the configuration file apon execution. This way every time you update the file it's a clean list of commands. Only the install, update, and uninstall arrays will be emptied, and they will be regardless of the package execution outcome. false
init Specifies the action should create a package.json file at path if one is not there. If the package does need to init, it will do so using npm init -y. true
issue You may provide an issue number to track activity. If set this action will post comments to the issue detailing what has changed, whenever it runs. For an example of what these comments will look like see the Test Logs issue.
path Specifies a path from your repository root, where you would like node_modules located. ./
install An array of npm packages you want installed.
update An array of packages to update, or install if they are not installed.
uninstall An array of packages to uninstall.
# Example Configuration
clean: true
init: true
issue: 1
path: ./dis
install:
  - "@actions/github"
  - unirest
update:
  - cardinal-direction
uninstall:
  - node-fetch

Output

Prop Description
activity A markdown flavourd description of the activity performed by the action. If an issue number is specified within the configuration file, this is the comment sent to that issue.

Notes

  • If you want the node_modules and packages to persist on your repository you will need to commit the changes. I recommend using the Add and Commit action for this.
  • You can not chain executions. Each array item is checked for, and broken at any instance of &&.
  • Each array item is executed as npm x item (i.e. npm install unirest).

npm-worker's People

Contributors

mudlabs avatar

Watchers

 avatar

npm-worker's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.