If you're writing your own Actions using Node.js. Save yourself some time and take a look at Actions Toolkit. Jason is collecting common tasks and extracting them to a single module you can use to build your Actions.
JasonEtco / actions-toolkit
π A toolkit for building GitHub Actions in Node.js
GitHub Actions Toolkit
An opinionated toolkit for building GitHub Actions in Node.js
Usage β’
API β’
How to test your Action β’
FAQ
This toolkit is an opinionated alternative to (and wrapper around) the official toolkit. actions/toolkit
makes many features optional in the interest of performance, so you may prefer to use it instead of this library.
Usage
Installation
$ npm install actions-toolkit
const { Toolkit } = require('actions-toolkit')
const tools = new Toolkit()
Bootstrap a new action
$ npx actions-toolkit my-cool-action
This will create a new folder my-cool-action
with the following files:
βββ Dockerfile
βββ action.yml
βββ index.js
βββ index.test.js
βββ package.json
API
- The Toolkit class
- Authenticated GitHub API client
- Logging
- Getting workflows' inputs
- Output information from your action
- Slash commands
- Reading files
- Run a CLI command
- End the action's process
- Inspect the webhook event payload
Toolkit options
event (optional)
An optional listβ¦
Top comments (2)
I've used this already, definitely recommend!
For those of us who are used to working in JS environments, using actions-toolkit by Jason has made working with actions much easier.