Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
DEFAULT: docs
JSONNET_BIN ?= jsonnet

jsonnetfile.json:
jb init
jb init || true

vendor jsonnetfile.lock.json: jsonnetfile.json
jsonnetfile.lock.json: jsonnetfile.json
jb install

vendor: jsonnetfile.lock.json

.PHONY: test
test: vendor jsonnetfile.lock.json
@cd test/ && make test
Expand All @@ -19,14 +22,19 @@ fmt:
-o -name '*.jsonnet' -print \
| xargs -n 1 -- jsonnetfmt --no-use-implicit-plus -i

.PHONY: docs
docs: jsonnetfile.json
docs: vendor raw.libsonnet main.libsonnet
@rm -rf docs/
@$(JSONNET_BIN) \
-J generator/vendor \
-S -c -m docs \
-e '(import "github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet").render(import "main.libsonnet")'

.PHONY: generate
generate: jsonnetfile.json
raw.libsonnet: generator vendor examples
jsonnet -J generator/vendor -S generator/generate.jsonnet | jsonnetfmt - > raw.libsonnet

EXAMPLES_SOURCES := $(wildcard examples/*.jsonnet)
EXAMPLES_FILES := $(EXAMPLES_SOURCES:.jsonnet=.output.yaml)
examples: $(EXAMPLES_FILES)

examples/%.output.yaml: examples/%.jsonnet
jsonnet -S $< > $@
23 changes: 3 additions & 20 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# github-actions-libsonnet

Jsonnet library to create GitHub actions workflows.
Jsonnet library to create workflows and actions for GitHub Actions.
## Install

```
Expand All @@ -10,28 +10,11 @@ jb install github.com/crdsonnet/github-actions-libsonnet@main
## Usage

```jsonnet
local ga = import 'github.com/crdsonnet/github-actions-libsonnet/main.libsonnet';

local exampleWorkflow =
ga.workflow.withName('example workflow')
+ ga.workflow.on.pull_request.withBranches(['main'])
+ ga.workflow.withJobs({
example:
ga.job.withRunsOn('ubuntu-latest')
+ ga.job.withSteps([
ga.job.step.withName('Checkout')
+ ga.job.step.withUses('actions/checkout@v4'),
]),
});

std.manifestYamlDoc(exampleWorkflow, indent_array_in_object=true, quote_keys=false)

local ga = import "github.com/crdsonnet/github-actions-libsonnet/main.libsonnet"
```


## Subpackages

* [action](action/index.md)
* [job](job/index.md)
* [util](util.md)
* [workflow](workflow.md)
* [workflow](workflow/index.md)
231 changes: 231 additions & 0 deletions docs/action/composite/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
# composite

Configures the path to the composite action, and the application used to execute the code.

## Subpackages

* [input](input.md)
* [output](output.md)
* [runs.step](runs/step.md)

## Index

* [`fn new(name, description="defaults to the name")`](#fn-new)
* [`fn withAuthor(value)`](#fn-withauthor)
* [`fn withBranding(value)`](#fn-withbranding)
* [`fn withBrandingMixin(value)`](#fn-withbrandingmixin)
* [`fn withDescription(value)`](#fn-withdescription)
* [`fn withInputs(value)`](#fn-withinputs)
* [`fn withInputsMixin(value)`](#fn-withinputsmixin)
* [`fn withName(value)`](#fn-withname)
* [`fn withOutputs(value)`](#fn-withoutputs)
* [`fn withOutputsMixin(value)`](#fn-withoutputsmixin)
* [`fn withRuns(value)`](#fn-withruns)
* [`fn withRunsMixin(value)`](#fn-withrunsmixin)
* [`obj branding`](#obj-branding)
* [`fn withColor(value)`](#fn-brandingwithcolor)
* [`fn withIcon(value)`](#fn-brandingwithicon)
* [`obj runs`](#obj-runs)
* [`fn withSteps(value)`](#fn-runswithsteps)
* [`fn withStepsMixin(value)`](#fn-runswithstepsmixin)
* [`fn withUsing()`](#fn-runswithusing)

## Fields

### fn new

```jsonnet
new(name, description="defaults to the name")
```

PARAMETERS:

* **name** (`string`)
* **description** (`string`)
- default value: `"defaults to the name"`

`new` initializes a Composite action. Use `withSteps()` to add steps.

### fn withAuthor

```jsonnet
withAuthor(value)
```

PARAMETERS:

* **value** (`string`)

The name of the action's author.
### fn withBranding

```jsonnet
withBranding(value)
```

PARAMETERS:

* **value** (`object`)

You can use a color and Feather icon to create a badge to personalize and distinguish your action. Badges are shown next to your action name in GitHub Marketplace.
### fn withBrandingMixin

```jsonnet
withBrandingMixin(value)
```

PARAMETERS:

* **value** (`object`)

You can use a color and Feather icon to create a badge to personalize and distinguish your action. Badges are shown next to your action name in GitHub Marketplace.
### fn withDescription

```jsonnet
withDescription(value)
```

PARAMETERS:

* **value** (`string`)

A short description of the action.
### fn withInputs

```jsonnet
withInputs(value)
```

PARAMETERS:

* **value** (`object`)

Input parameters allow you to specify data that the action expects to use during runtime. GitHub stores input parameters as environment variables. Input ids with uppercase letters are converted to lowercase during runtime. We recommended using lowercase input ids.
### fn withInputsMixin

```jsonnet
withInputsMixin(value)
```

PARAMETERS:

* **value** (`object`)

Input parameters allow you to specify data that the action expects to use during runtime. GitHub stores input parameters as environment variables. Input ids with uppercase letters are converted to lowercase during runtime. We recommended using lowercase input ids.
### fn withName

```jsonnet
withName(value)
```

PARAMETERS:

* **value** (`string`)

The name of your action. GitHub displays the `name` in the Actions tab to help visually identify actions in each job.
### fn withOutputs

```jsonnet
withOutputs(value)
```

PARAMETERS:

* **value** (`object`)

Output parameters allow you to declare data that an action sets. Actions that run later in a workflow can use the output data set in previously run actions. For example, if you had an action that performed the addition of two inputs (x + y = z), the action could output the sum (z) for other actions to use as an input.
If you don't declare an output in your action metadata file, you can still set outputs and use them in a workflow.
### fn withOutputsMixin

```jsonnet
withOutputsMixin(value)
```

PARAMETERS:

* **value** (`object`)

Output parameters allow you to declare data that an action sets. Actions that run later in a workflow can use the output data set in previously run actions. For example, if you had an action that performed the addition of two inputs (x + y = z), the action could output the sum (z) for other actions to use as an input.
If you don't declare an output in your action metadata file, you can still set outputs and use them in a workflow.
### fn withRuns

```jsonnet
withRuns(value)
```

PARAMETERS:

* **value** (`object`)

Configures the path to the composite action, and the application used to execute the code.
### fn withRunsMixin

```jsonnet
withRunsMixin(value)
```

PARAMETERS:

* **value** (`object`)

Configures the path to the composite action, and the application used to execute the code.
### obj branding


#### fn branding.withColor

```jsonnet
branding.withColor(value)
```

PARAMETERS:

* **value** (`string`)
- valid values: `"white"`, `"black"`, `"yellow"`, `"blue"`, `"green"`, `"orange"`, `"red"`, `"purple"`, `"gray-dark"`

The background color of the badge.
#### fn branding.withIcon

```jsonnet
branding.withIcon(value)
```

PARAMETERS:

* **value** (`string`)
- valid values: `"activity"`, `"airplay"`, `"alert-circle"`, `"alert-octagon"`, `"alert-triangle"`, `"align-center"`, `"align-justify"`, `"align-left"`, `"align-right"`, `"anchor"`, `"aperture"`, `"archive"`, `"arrow-down-circle"`, `"arrow-down-left"`, `"arrow-down-right"`, `"arrow-down"`, `"arrow-left-circle"`, `"arrow-left"`, `"arrow-right-circle"`, `"arrow-right"`, `"arrow-up-circle"`, `"arrow-up-left"`, `"arrow-up-right"`, `"arrow-up"`, `"at-sign"`, `"award"`, `"bar-chart-2"`, `"bar-chart"`, `"battery-charging"`, `"battery"`, `"bell-off"`, `"bell"`, `"bluetooth"`, `"bold"`, `"book-open"`, `"book"`, `"bookmark"`, `"box"`, `"briefcase"`, `"calendar"`, `"camera-off"`, `"camera"`, `"cast"`, `"check-circle"`, `"check-square"`, `"check"`, `"chevron-down"`, `"chevron-left"`, `"chevron-right"`, `"chevron-up"`, `"chevrons-down"`, `"chevrons-left"`, `"chevrons-right"`, `"chevrons-up"`, `"circle"`, `"clipboard"`, `"clock"`, `"cloud-drizzle"`, `"cloud-lightning"`, `"cloud-off"`, `"cloud-rain"`, `"cloud-snow"`, `"cloud"`, `"code"`, `"command"`, `"compass"`, `"copy"`, `"corner-down-left"`, `"corner-down-right"`, `"corner-left-down"`, `"corner-left-up"`, `"corner-right-down"`, `"corner-right-up"`, `"corner-up-left"`, `"corner-up-right"`, `"cpu"`, `"credit-card"`, `"crop"`, `"crosshair"`, `"database"`, `"delete"`, `"disc"`, `"dollar-sign"`, `"download-cloud"`, `"download"`, `"droplet"`, `"edit-2"`, `"edit-3"`, `"edit"`, `"external-link"`, `"eye-off"`, `"eye"`, `"fast-forward"`, `"feather"`, `"file-minus"`, `"file-plus"`, `"file-text"`, `"file"`, `"film"`, `"filter"`, `"flag"`, `"folder-minus"`, `"folder-plus"`, `"folder"`, `"gift"`, `"git-branch"`, `"git-commit"`, `"git-merge"`, `"git-pull-request"`, `"globe"`, `"grid"`, `"hard-drive"`, `"hash"`, `"headphones"`, `"heart"`, `"help-circle"`, `"home"`, `"image"`, `"inbox"`, `"info"`, `"italic"`, `"layers"`, `"layout"`, `"life-buoy"`, `"link-2"`, `"link"`, `"list"`, `"loader"`, `"lock"`, `"log-in"`, `"log-out"`, `"mail"`, `"map-pin"`, `"map"`, `"maximize-2"`, `"maximize"`, `"menu"`, `"message-circle"`, `"message-square"`, `"mic-off"`, `"mic"`, `"minimize-2"`, `"minimize"`, `"minus-circle"`, `"minus-square"`, `"minus"`, `"monitor"`, `"moon"`, `"more-horizontal"`, `"more-vertical"`, `"move"`, `"music"`, `"navigation-2"`, `"navigation"`, `"octagon"`, `"package"`, `"paperclip"`, `"pause-circle"`, `"pause"`, `"percent"`, `"phone-call"`, `"phone-forwarded"`, `"phone-incoming"`, `"phone-missed"`, `"phone-off"`, `"phone-outgoing"`, `"phone"`, `"pie-chart"`, `"play-circle"`, `"play"`, `"plus-circle"`, `"plus-square"`, `"plus"`, `"pocket"`, `"power"`, `"printer"`, `"radio"`, `"refresh-ccw"`, `"refresh-cw"`, `"repeat"`, `"rewind"`, `"rotate-ccw"`, `"rotate-cw"`, `"rss"`, `"save"`, `"scissors"`, `"search"`, `"send"`, `"server"`, `"settings"`, `"share-2"`, `"share"`, `"shield-off"`, `"shield"`, `"shopping-bag"`, `"shopping-cart"`, `"shuffle"`, `"sidebar"`, `"skip-back"`, `"skip-forward"`, `"slash"`, `"sliders"`, `"smartphone"`, `"speaker"`, `"square"`, `"star"`, `"stop-circle"`, `"sun"`, `"sunrise"`, `"sunset"`, `"table"`, `"tablet"`, `"tag"`, `"target"`, `"terminal"`, `"thermometer"`, `"thumbs-down"`, `"thumbs-up"`, `"toggle-left"`, `"toggle-right"`, `"trash-2"`, `"trash"`, `"trending-down"`, `"trending-up"`, `"triangle"`, `"truck"`, `"tv"`, `"type"`, `"umbrella"`, `"underline"`, `"unlock"`, `"upload-cloud"`, `"upload"`, `"user-check"`, `"user-minus"`, `"user-plus"`, `"user-x"`, `"user"`, `"users"`, `"video-off"`, `"video"`, `"voicemail"`, `"volume-1"`, `"volume-2"`, `"volume-x"`, `"volume"`, `"watch"`, `"wifi-off"`, `"wifi"`, `"wind"`, `"x-circle"`, `"x-square"`, `"x"`, `"zap-off"`, `"zap"`, `"zoom-in"`, `"zoom-out"`

The name of the Feather icon to use.
### obj runs


#### fn runs.withSteps

```jsonnet
runs.withSteps(value)
```

PARAMETERS:

* **value** (`array`)

The run steps that you plan to run in this action.
#### fn runs.withStepsMixin

```jsonnet
runs.withStepsMixin(value)
```

PARAMETERS:

* **value** (`array`)

The run steps that you plan to run in this action.
#### fn runs.withUsing

```jsonnet
runs.withUsing()
```


To use a composite run steps action, set this to 'composite'.
2 changes: 1 addition & 1 deletion docs/action/input.md → docs/action/composite/input.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# action
# input



Expand Down
33 changes: 33 additions & 0 deletions docs/action/composite/output.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# output



## Index

* [`fn withDescription(value)`](#fn-withdescription)
* [`fn withValue(value)`](#fn-withvalue)

## Fields

### fn withDescription

```jsonnet
withDescription(value)
```

PARAMETERS:

* **value** (`string`)

A string description of the output parameter.
### fn withValue

```jsonnet
withValue(value)
```

PARAMETERS:

* **value** (`string`)

The value that the output parameter will be mapped to. You can set this to a string or an expression with context. For example, you can use the steps context to set the value of an output to the output value of a step.
File renamed without changes.
Loading