Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support argus v0.6 #72

Merged
merged 8 commits into from
Sep 25, 2024
Merged
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
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ See [action.yml](action.yml).

```yaml
steps:
- uses: listendev/action@v0.10
- uses: listendev/action@v0.11
```

### Full

```yaml
steps:
- uses: listendev/action@v0.10
- uses: listendev/action@v0.11
with:
# The Github API token.
# Defaults to ${{ github.token }}
Expand Down Expand Up @@ -54,7 +54,7 @@ Just [create a secret](https://docs.github.com/en/actions/security-guides/using-

```yaml
steps:
- uses: listendev/action@v0.10
- uses: listendev/action@v0.11
with:
ci: true
jwt: ${{ secrets.MY_LISTENDEV_JWT }}
Expand All @@ -66,15 +66,18 @@ Because of the `ci` option set to `true`, it will also start the CI eavesdrop to

Notice it only works on linux runners.

Where to get your JWT token?
**Where to get your JWT token?**

[How to get your API key from the project settings](https://docs.listen.dev/workflows/generate-api-token).

It's _recommended_ to regenerate the JWT token for every release, until we will release stable versions.

[Get your API key from the project settings](https://docs.listen.dev/workflows/generate-api-token)
<details>
<summary>Do you also want to also use another reporter together with the pro one?</summary>

```yaml
steps:
- uses: listendev/action@v0.10
- uses: listendev/action@v0.11
with:
jwt: ${{ secrets.MY_JWT }}
lstn_flags: "--reporter gh-pull-comment"
Expand All @@ -90,7 +93,7 @@ So, you only want it to eavesdrop for runtime threats...

```yaml
steps:
- uses: listendev/action@v0.10
- uses: listendev/action@v0.11
with:
ci: only
jwt: ${{ secrets.MY_JWT }}
Expand All @@ -100,7 +103,7 @@ Let's say you want the verdicts in JSON format...

```yaml
steps:
- uses: listendev/action@v0.10
- uses: listendev/action@v0.11
with:
lstn_flags: "--json"
```
Expand All @@ -109,7 +112,7 @@ Let's say you only care for high severity verdicts...

```yaml
steps:
- uses: listendev/action@v0.10
- uses: listendev/action@v0.11
with:
lstn: "v0.13.2"
lstn_flags: "--select '@.severity == \"high\"'"
Expand All @@ -121,7 +124,7 @@ Let's say we only care for dynamic instrumentation verdicts regarding processes.

```yaml
steps:
- uses: listendev/action@v0.10
- uses: listendev/action@v0.11
with:
select: "(@.file =~ \"^dynamic\" && \"process\" in @.categories)"
```
Expand Down
57 changes: 29 additions & 28 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@listendev/action",
"version": "0.10.0",
"version": "0.11.0",
"description": "Get real-time dependency insights in your pull requests",
"main": "dist/index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as core from '@actions/core';
import * as http from '@actions/http-client';
import * as tc from '@actions/tool-cache';
import * as io from '@actions/io';
import {getArgusTag} from './argus';
import {getArgusTagFromListenTag} from './mappings';

export async function lstn(tag: string, directory: string): Promise<string> {
const owner = 'listendev';
Expand Down Expand Up @@ -55,7 +55,7 @@ export async function argusFor(
throw new Error(`unsupported arch: ${arch}`);
}

const argusTag = !explicitTag ? getArgusTag(tag) : explicitTag;
const argusTag = !explicitTag ? getArgusTagFromListenTag(tag) : explicitTag;
const owner = 'listendev';
const repo = 'argus-releases';
const vers = await tagToVersion(argusTag, owner, repo);
Expand Down
5 changes: 3 additions & 2 deletions src/argus.ts → src/mappings.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// argusVersion maps the lstn tags to the argus ones.
const argusTags: Record<string, string> = {
latest: 'v0.4',
latest: 'v0.6',
'v0.15.0': 'v0.6',
'v0.14.0': 'v0.4',
'v0.13.2': 'v0.3',
'v0.13.1': 'v0.1',
'v0.13.0': 'v0.1'
} as const;

export function getArgusTag(lstnTag: string): string {
export function getArgusTagFromListenTag(lstnTag: string): string {
if (!Object.keys(argusTags).includes(lstnTag)) {
throw new Error(`missing argus version for lstn ${lstnTag}`);
}
Expand Down
Loading