Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fossas/fossa-action
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.3.2
Choose a base ref
...
head repository: fossas/fossa-action
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.3.3
Choose a head ref
  • 1 commit
  • 7 files changed
  • 4 contributors

Commits on Feb 15, 2024

  1. Godeepakm/add project flag (#31)

    * add prpject flag
    
    * add prpject flagcd
    
    * Build app
    
    * Add test for scanning with a --project option.
    
    * Run fossa test correctly. Oops.
    
    ---------
    
    Co-authored-by: root <root@ip-172-31-18-17.us-east-2.compute.internal>
    Co-authored-by: Chelsea Boling <chelsea@fossa.com>
    Co-authored-by: Christopher Sasarak <chris@fossa.com>
    4 people authored Feb 15, 2024
    Copy the full SHA
    47ef11b View commit details
Showing with 40 additions and 3 deletions.
  1. +8 −0 .github/workflows/test.yml
  2. +18 −1 README.md
  3. +5 −0 action.yml
  4. +1 −1 dist/index.js
  5. +1 −1 dist/index.js.map
  6. +1 −0 src/config.ts
  7. +6 −0 src/index.ts
8 changes: 8 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -53,6 +53,14 @@ jobs:
with:
api-key: ${{secrets.fossaApiKey}}
branch: develop
project: custom-test-project

- name: Run FOSSA test with a --project and --branch
uses: ./
with:
api-key: ${{secrets.fossaApiKey}}
branch: develop
project: custom-test-project

- name: Run FOSSA test
uses: ./
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -86,6 +86,23 @@ jobs:
branch: some-feature-branch
```

### `project`

**Optional** Project flag passed to FOSSA CLI.

Example
```yml
jobs:
fossa-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: fossas/fossa-action@main # Use a specific version if locking is preferred
with:
api-key: ${{secrets.fossaApiKey}}
project: some-project-name
```

### `endpoint`

**Optional** Endpoint passed to FOSSA CLI. Defaults to `app.fossa.com`. [Read more](https://github.com/fossas/spectrometer/blob/master/docs/userguide.md#common-fossa-project-flags).
@@ -144,7 +161,7 @@ jobs:
```

### Running tests
This run `fossa tests` after doing an initial scan.
This runs `fossa tests` after doing an initial scan.

```yml
jobs:
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -24,6 +24,11 @@ inputs:
Override the detected FOSSA project branch. If running FOSSA analysis on a
Pull Request, as a start you can use the contexts `github.ref` or `github.ref_name`.
required: false
project:
description: >-
Override the detected FOSSA project name. If running FOSSA analysis on a
Pull Request, as a start you can use the contexts `github.ref` or `github.ref_name`.
required: false
debug:
description: >-
Run all FOSSA commands in debug mode. Running `fossa analyze` in debug
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -12,4 +12,5 @@ export const CONTAINER = getInput('container', getInputOptions());
export const RUN_TESTS = getBooleanInput('run-tests', {required: false});
export const ENDPOINT = getInput('endpoint', getInputOptions());
export const BRANCH = getInput('branch', getInputOptions());
export const PROJECT = getInput('project', getInputOptions());
export const DEBUG = getBooleanInput('debug', {required: false});
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ import {
RUN_TESTS,
ENDPOINT,
BRANCH,
PROJECT,
DEBUG,
} from './config';
import { fetchFossaCli } from './download-cli';
@@ -21,12 +22,17 @@ export async function analyze(): Promise<void> {
'--branch',
BRANCH,
];
const getProjectArgs = (): string[] => !PROJECT ? [] : [
'--project',
PROJECT,
];

const getArgs = (cmd: string) => [
CONTAINER ? 'container' : null,
cmd,
...getEndpointArgs(),
...getBranchArgs(),
...getProjectArgs(),
DEBUG ? '--debug' : null,
].filter(arg => arg);