From 9a7c7ac7badfecb970703cd5ec468a9fac5343d8 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Thu, 8 Aug 2024 14:30:34 +0700 Subject: [PATCH] docs: fill readme with usage guide (#12) * docs(readme): add Key Features section * docs(readme): add Getting Inputs section * docs(readme): add Setting Outputs section * docs(readme): add Logging Errors section * chore: bump package version to v0.1.0 --- README.md | 36 ++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d4ed39d..409b746 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,42 @@ A minimalistic utility package for developing [GitHub Actions](https://github.com/features/actions). +## Key Features + +- ES Module support. +- Getting inputs and setting outputs. +- Logging errors. + +## Usage Guide + +### Getting Inputs + +GitHub Actions inputs can be retrieved using the `getInput` function, which will return a trimmed string or an empty string if the input is not specified: + +```ts +const input = getInput("input-name"); +``` + +### Setting Outputs + +GitHub Actions outputs can be set using the `setOutput` function: + +```ts +setOutput("output-name", "some value"); +``` + +### Logging Errors + +Errors can be logged using the `error` function, which can log errors of any type. This is especially useful for logging caught errors: + +```ts +try { + // Do something +} catch (err) { + error(err); +} +``` + ## License This project is licensed under the terms of the [MIT License](./LICENSE). diff --git a/package.json b/package.json index 3634959..25094a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gha-utils", - "version": "0.0.0", + "version": "0.1.0", "description": "A minimalistic utility package for developing GitHub Actions", "keywords": [ "github",