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

[Feature] Add branch option #19

Merged
merged 17 commits into from
Apr 13, 2022
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
17 changes: 9 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
module.exports = {
'root': true,
'parser': '@typescript-eslint/parser',
'parserOptions': {
'project': './tsconfig.json',
'sourceType': 'module',
},
"ignorePatterns": ["dist/", ".eslintrc.js"],
'settings': {
'import/resolver': {
'node': {
'extensions': ['.ts', '.d.ts', '.js', '.json'],
},
},
},
'extends': [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
Expand All @@ -23,7 +32,6 @@ module.exports = {
'node': true,
'mocha': true,
},
'root': true,
"globals": {
"GLOBAL": true,
},
Expand Down Expand Up @@ -131,11 +139,4 @@ module.exports = {
'@typescript-eslint/no-use-before-define': ["error", {"variables": false, "typedefs": false, "functions": false, "classes": false }],
'no-use-before-define': ["error", {"variables": true, "functions": false, "classes": false }],
},
'settings': {
'import/resolver': {
'node': {
'extensions': ['.ts', '.d.ts', '.js', '.json'],
},
},
},
};
32 changes: 22 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
name: 'FOSSA Action'

# Ensures that this is only run once, either when pushing
# directly to main OR when pushing to a PR against main.
on:
- pull_request
- push
pull_request:
branches:
- main
push:
branches:
- main

jobs:
fossa-scan:
Expand All @@ -11,12 +17,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Use Node.js 12.x
uses: actions/setup-node@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 12.x
node-version: 16.x

- name: Install npm packages
run: yarn --frozen-lockfile
Expand All @@ -29,19 +35,25 @@ jobs:
with:
api-key: ${{secrets.fossaApiKey}}

- name: Run FOSSA test
- name: Run FOSSA container scan and upload build data
uses: ./
with:
api-key: ${{secrets.fossaApiKey}}
run-tests: true
container: alpine:latest

- name: Run FOSSA container scan and upload build data
- name: Run FOSSA scan with branch
uses: ./
with:
api-key: ${{secrets.fossaApiKey}}
container: alpine:latest
branch: develop

- name: Run FOSSA test
uses: ./
with:
api-key: ${{secrets.fossaApiKey}}
run-tests: true

- name: Run FOSSA test with container
uses: ./
with:
api-key: ${{secrets.fossaApiKey}}
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16.14.2
32 changes: 25 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
fossa-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: fossas/fossa-action@main # Use a specific version if locking is preferred
with:
api-key: ${{secrets.fossaApiKey}}
Expand All @@ -45,7 +45,7 @@ jobs:
fossa-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: fossas/fossa-action@main # Use a specific version if locking is preferred
with:
api-key: ${{secrets.fossaApiKey}}
Expand All @@ -62,14 +62,32 @@ jobs:
fossa-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: fossas/fossa-action@main # Use a specific version if locking is preferred
with:
api-key: ${{secrets.fossaApiKey}}
container: ubuntu:20.04
```

### `branch`

**Optional** Branch 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}}
branch: some-feature-branch
```

### `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).

Example
Expand All @@ -78,7 +96,7 @@ jobs:
fossa-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: fossas/fossa-action@main # Use a specific version if locking is preferred
with:
api-key: ${{secrets.fossaApiKey}}
Expand All @@ -96,7 +114,7 @@ jobs:
fossa-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: fossas/fossa-action@main # Use a specific version if locking is preferred
with:
api-key: ${{secrets.fossaApiKey}}
Expand All @@ -111,7 +129,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Checkout Code"
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: "Run FOSSA Scan"
uses: fossas/fossa-action@main # Use a specific version if locking is preferred
Expand All @@ -134,7 +152,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Checkout Code"
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: "Run FOSSA Scan"
uses: fossas/fossa-action@main # Use a specific version if locking is preferred
Expand Down
15 changes: 14 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,29 @@ author: Solomon Rubin

inputs:
api-key:
description: >-
Your FOSSA API key.
required: true
run-tests:
description: >-
If set to `true` FOSSA will run the `fossa test` command.
default: false
container:
description: >-
A container name or OCI image path. Set to use FOSSA's container scanning functionality. This will run `fossa container analyze` (default behavior) and `fossa container test` (if used in combination with `run-tests`).
required: false
endpoint:
description: >-
Endpoint passed to FOSSA CLI. Defaults to `app.fossa.com`.
required: false
branch:
description: >-
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
himynameisdave marked this conversation as resolved.
Show resolved Hide resolved

runs:
using: node12
using: node16
main: dist/index.js

branding:
Expand Down
9 changes: 9 additions & 0 deletions dist/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

@actions/exec
MIT
The MIT License (MIT)

Copyright 2019 GitHub

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@actions/http-client
MIT
Expand Down
8 changes: 0 additions & 8 deletions dist/config.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/config.js.map

This file was deleted.

73 changes: 0 additions & 73 deletions dist/download-cli.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/download-cli.js.map

This file was deleted.

Loading