# @infracost/compost

> Compost is for tools that run in CI pipelines and want to post results as pull request/commit comments.

Latest version **0.0.9** (published 2022-01-14) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @infracost/compost
pnpm add @infracost/compost
yarn add @infracost/compost
bun add @infracost/compost
```

Provides the command `compost`.

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2022-01-14 |
| First published | 2021-11-17 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 11 |
| Unpacked size | 153.4 KB |
| Known vulnerabilities | 0 (+24 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 29 |
| Maintainers | aliscott |

## Links

- npm: https://www.npmjs.com/package/@infracost/compost
- Repository: https://github.com/infracost/compost
- Homepage: https://github.com/infracost/compost#readme
- Issues: https://github.com/infracost/compost/issues
- npm.io page: https://npm.io/package/@infracost/compost

## Dependencies (11)

- [axios](https://npm.io/package/axios.md) ^0.24.0
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [octokit](https://npm.io/package/octokit.md) ^1.7.0
- [@oclif/config](https://npm.io/package/@oclif/config.md) ^1.17.0
- [@oclif/errors](https://npm.io/package/@oclif/errors.md) ^1.3.5
- [@oclif/parser](https://npm.io/package/@oclif/parser.md) ^3.8.5
- [@oclif/command](https://npm.io/package/@oclif/command.md) ^1.8.0
- [@octokit/types](https://npm.io/package/@octokit/types.md) ^6.34.0
- [@oclif/plugin-help](https://npm.io/package/@oclif/plugin-help.md) ^3.2.4
- [@octokit/plugin-retry](https://npm.io/package/@octokit/plugin-retry.md) ^3.0.9
- [@octokit/graphql-schema](https://npm.io/package/@octokit/graphql-schema.md) ^10.73.0

## Recent versions

- 0.0.9 (latest) — 2022-01-14
- 0.0.8 — 2022-01-13
- 0.0.7 — 2022-01-10
- 0.0.6 — 2021-12-20
- 0.0.5 — 2021-11-25
- 0.0.4 — 2021-11-23
- 0.0.3 — 2021-11-19
- 0.0.2 — 2021-11-17
- 0.0.1 — 2021-11-17

## README

# Compost

Compost is for tools that run in CI pipelines and want to post results as pull request/commit comments.

<img src=".github/assets/screenshot.png" alt="Compost screenshot" width=800 />

It currently detects the following CI environments:
* GitHub Actions
* GitLab CI
* Azure DevOps
* Azure DevOps (GitHub)

Coming soon:
* BitBucket
* Circle CI (GitHub)
* CircleCI (BitBucket)

## Install

```sh
npm install -g @infracost/compost
```

## Examples

Detect the current CI environment and update the previously posted comment. If a previous comment hasn't been posted, then this creates a new comment:

```sh
compost autodetect update --body="my comment"
```

Post a new comment:

```sh
compost autodetect new --body="my new comment"
```

Delete the previous posted comments and post a new comment:

```sh
compost autodetect delete-and-new --body="my new comment"
```

Hide the previous posted comments and post a new comment (**Note:** Currently only supported for GitHub):

```sh
compost autodetect hide-and-new --body="my new comment"
```

Get the latest comment that was posted by compost

```sh
compost autodetect latest
```

Post a comment to a specific GitHub pull request:

```sh
compost github update infracost/compost-example pr 3 --body="my PR comment"
```

Post a comment to a specific GitHub commit SHA:

```sh
compost github update infracost/compost-example commit 2ca7182 --body="my commit comment"
```

## Flags

| Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Description |
|-|-|
| `--body` | Specify the comment body content. |
| `--body-file` | Specify a path to a file containing the comment body. Mutually exclusive with `--body`. |
| `--tag` | Customize the comment tag. This is added to the comment as a markdown comment to detect the previously posted comments. |
| `--platform` | Options: `github`, `gitlab`, `azure-devops`. Only supported by `autodetect` command. Limit the auto-detection to the specified platform. |
| `--target-type` | Options: `pull-request` (`pr`), `merge-request` (`mr`), `commit`. Only supported by `autodetect` command. Limit the auto-detection to add the comment to either pull/merge requests or commits. |
| `--dry-run` | Skips any comment posting, deleting or hiding. |

---
_Source: https://npm.io/package/@infracost/compost · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
