An open API service indexing awesome lists of open source software.

https://github.com/emilio2hd/pronto-annotate-action

Github action to parse the json generated by the gem https://github.com/emilio2hd/pronto-annotations_formatter and write the annotations
https://github.com/emilio2hd/pronto-annotate-action

github github-actions pronto

Last synced: about 2 months ago
JSON representation

Github action to parse the json generated by the gem https://github.com/emilio2hd/pronto-annotations_formatter and write the annotations

Awesome Lists containing this project

README

          

# pronto-annotate-action

[![GitHub Super-Linter](https://github.com/actions/typescript-action/actions/workflows/linter.yml/badge.svg)](https://github.com/super-linter/super-linter)
![CI](https://github.com/actions/typescript-action/actions/workflows/ci.yml/badge.svg)

This action is meant to work with [pronto-annotations-formatter](https://github.com/emilio2hd/pronto-annotations-formatter).
No need to use GitHub oauth token.

Learn more about pronto at .

## Usage

To include the action in a workflow in another repository, you can use the
`uses` syntax with the `@` symbol to reference a specific branch, tag, or commit
hash.

```yaml
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v3

- name: Test Local Action
id: test-action
uses: emilio2hd/pronto-annotate-action@0.1.0
with:
reportPath: annotations.json
```

Note, you can also point to the `main` branch with `uses: emilio2hd/pronto-annotate-action@main`

Please, check this [annotations.json](__tests__/annotations.json),
to see the expected json content.

Once you run the step, you should see the annotations on the following places:
![Annotation Warning on Console](docs/annotation-warning-console.png)

![Annotation Warning on Summary](docs/annotation-warning-on-summary.png)

![Annotation Warning on Code](docs/annotation-warning-on-code.png)

## Development Setup

After you've cloned the repository to your local machine or codespace, you'll
need to perform some initial setup steps before you can develop your action.

> [!NOTE]
>
> You'll need to have a reasonably modern version of
> [Node.js](https://nodejs.org) handy. If you are using a version manager like
> [`nodenv`](https://github.com/nodenv/nodenv) or
> [`nvm`](https://github.com/nvm-sh/nvm), you can run `nodenv install` in the
> root of your repository to install the version specified in
> [`package.json`](./package.json). Otherwise, 20.x or later should work!

1. :hammer_and_wrench: Install the dependencies

```bash
npm install
```

1. :building_construction: Package the TypeScript for distribution

```bash
npm run bundle
```

1. :white_check_mark: Run the tests

```bash
$ npm test

PASS ./index.test.js
✓ throws invalid number (3ms)
✓ wait 500 ms (504ms)
✓ test runs (95ms)

...
```

## Update the Action Code

There are a few things to keep in mind when writing your action code:

- Most GitHub Actions toolkit and CI/CD operations are processed asynchronously.
In `main.ts`, you will see that the action is run in an `async` function.

```javascript
import * as core from '@actions/core'
//...

async function run() {
try {
//...
} catch (error) {
core.setFailed(error.message)
}
}
```

For more information about the GitHub Actions toolkit, see the
[documentation](https://github.com/actions/toolkit/blob/master/README.md).