3.0.0 • Published 5 months ago

@factorialco/gat v3.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

gat Build npm version

The gat project is a tool to write your GitHub Actions workflows using TypeScript.

Maintaining YAML files is hard and if your project is big enough you will find yourself duplicating a lot of code between your workflows. With gat you can create reusable jobs and steps just using TypeScript objects and importing them in your workflow templates.

Why gat? The name is an acronym of "GitHub Actions Template Generator" without the last part because gat means "cat" in Catalan.

Installation

Install the main package and its dependencies using the following command:

npm i -D @factorialco/gat typescript tsx commander @swc/core

Usage

Writing a template

The gat CLI assumes that you have a index.ts file inside .github/templates. Let's create our first template:

// .github/templates/index.ts
import { Workflow } from "@factorialco/gat";

new Workflow("My first workflow")
  .on("push")
  .addJob("test", {
    steps: [
      {
        uses: "actions/checkout@v3",
      },
      {
        uses: "actions/setup-node@v3",
      },
      {
        run: "npm test",
      },
    ],
  })
  .compile("my-first-workflow.yml");

Notice that you need to call the compile() method at the end, passing the file name of the generated Github Actions workflow.

Compiling your templates

You can build your templates running this command in your root folder:

npx gat build

Following the previous example, you should see now a file .github/workflows/my-first-workflow.yml like this:

# Workflow automatically generated by gat
# DO NOT CHANGE THIS FILE MANUALLY

name: My first workflow
on:
  push: null
jobs:
  test:
    runs-on: ubuntu-22.04
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
      - run: npm test

Notice that the job includes a few assumptions like the runs-on and timeout-minutes fields. You can change those when adding a new job.

Create your own workflow class

TODO

Contributing

TODO

License

MIT

3.0.0

5 months ago

1.5.0

6 months ago

1.4.0

9 months ago

1.3.0

10 months ago

2.3.0

6 months ago

2.2.0

6 months ago

2.5.0

6 months ago

2.4.0

6 months ago

2.6.0

6 months ago

2.1.0

6 months ago

2.0.0

6 months ago

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

2 years ago

1.0.0

2 years ago

0.0.20

2 years ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago