Skip to content
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
2 changes: 1 addition & 1 deletion DEV_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ steps:

- name: Finite State Binary Scan
id: binary_scan
uses: FiniteStateInc/binary-scan@v2.0.0
uses: FiniteStateInc/binary-scan@v2.0.1
with:
finite-state-client-id: ${{ secrets.CLIENT_ID }}
finite-state-secret: ${{ secrets.CLIENT_SECRET }}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ for them.
>
> To avoid issues, consider using a GitHub-hosted runner image like
> 'ubuntu-latest' or 'microsoft-latest' that comes pre-installed with both
> Node.js and Python.
> Node.js and Python required versions.

<!-- action-docs-description -->

Expand Down Expand Up @@ -114,7 +114,7 @@ reference the **Inputs** section.
**Example:**

```yaml
uses: FiniteStateInc/binary-scan@v2.0.0
uses: FiniteStateInc/binary-scan@v2.0.1
with:
finite-state-client-id: ${{ secrets.CLIENT_ID }}
finite-state-secret: ${{ secrets.CLIENT_SECRET }}
Expand Down Expand Up @@ -204,7 +204,7 @@ jobs:
path: # Put the path to your binary file generated in the previous step here

- name: Binary Scan
uses: FiniteStateInc/binary-scan@v2.0.0
uses: FiniteStateInc/binary-scan@v2.0.1
id: binary_scan
with:
finite-state-client-id: ${{ secrets.CLIENT_ID }}
Expand Down
Binary file modified dist/python/__pycache__/github_utils.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified dist/python/__pycache__/test_utils.cpython-310-pytest-7.4.3.pyc
Binary file not shown.
Binary file modified dist/python/__pycache__/upload_binary.cpython-310.pyc
Binary file not shown.
Binary file modified dist/python/__pycache__/utils.cpython-310.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/python/requirements.txt

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

1 change: 0 additions & 1 deletion dist/python/test_utils.py

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

28 changes: 15 additions & 13 deletions dist/python/upload_binary.py

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

1 change: 0 additions & 1 deletion dist/python/utils.py

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "binary-scan-github",
"description": "Binary Scan Github Actino",
"version": "2.0.0",
"description": "Binary Scan Github Action",
"version": "2.0.1",
"author": "christianpfarher@finitestate.io",
"private": false,
"homepage": "https://github.com/FiniteStateInc/binary-scan",
Expand Down
1 change: 1 addition & 0 deletions src/python/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.8.18
Binary file modified src/python/__pycache__/github_utils.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified src/python/__pycache__/test_utils.cpython-310-pytest-7.4.3.pyc
Binary file not shown.
Binary file modified src/python/__pycache__/upload_binary.cpython-310.pyc
Binary file not shown.
Binary file modified src/python/__pycache__/utils.cpython-310.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion src/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
finite-state-sdk==0.1.2
finite-state-sdk==0.1.9
1 change: 0 additions & 1 deletion src/python/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from utils import (
extract_asset_version,
generate_comment,
set_multiline_output,
set_output,
)
Expand Down
28 changes: 15 additions & 13 deletions src/python/upload_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
from utils import (
extract_asset_version,
generate_comment,
is_pull_request,
set_multiline_output,
set_output,
)
from github_utils import (
is_pull_request,
)

# configure a logger
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -54,25 +56,24 @@ def create_and_upload_binary():
INPUT_AUTOMATIC_COMMENT = os.environ.get("INPUT_AUTOMATIC_COMMENT") == "true"
INPUT_GITHUB_TOKEN = os.environ.get("INPUT_GITHUB_TOKEN")
except KeyError:
msg = f"Required inputs not available. Please, check required inputs definition"
msg = "Required inputs not available. Please, check required inputs definition"
error = msg
logger.error(msg)
raise

error = None
asset_version = ""
logger.info(f"Starting - Create new asset version and upload binary")
logger.info("Starting - Create new asset version and upload binary")

if not INPUT_GITHUB_TOKEN and INPUT_AUTOMATIC_COMMENT:
msg = f"Caught an exception. The [Github Token] input is required when [Automatic comment] is enabled."
msg = "Caught an exception. The [Github Token] input is required when [Automatic comment] is enabled."
error = msg
logger.error(msg)
logger.debug(e)

if error == None:
if error is None:
# Authenticate
try:
logger.info(f"Starting - Authentication")
logger.info("Starting - Authentication")
token = finite_state_sdk.get_auth_token(
INPUT_FINITE_STATE_CLIENT_ID, INPUT_FINITE_STATE_SECRET
)
Expand All @@ -85,7 +86,7 @@ def create_and_upload_binary():
logger.debug(e)

# Create new asset version an upload the binary:
if error == None:
if error is None:
try:
response = finite_state_sdk.create_new_asset_version_and_upload_binary(
token,
Expand All @@ -98,6 +99,7 @@ def create_and_upload_binary():
product_id=INPUT_PRODUCT_ID,
artifact_description=INPUT_ARTIFACT_DESCRIPTION,
quick_scan=INPUT_QUICK_SCAN == "true",
upload_method=finite_state_sdk.UploadMethod.GITHUB_INTEGRATION,
)
asset_version = extract_asset_version(
response["launchBinaryUploadProcessing"]["key"]
Expand All @@ -118,23 +120,23 @@ def create_and_upload_binary():
logger.error(msg)
logger.debug(e)

if error == None:
logger.info(f"File uploaded - Extracting asset version")
if error is None:
logger.info("File uploaded - Extracting asset version")
set_multiline_output("response", json.dumps(response, indent=4))
asset_version_url = "https://platform.finitestate.io/artifacts/{asset_id}/versions/{version}".format(
asset_id=INPUT_ASSET_ID, version=asset_version
)
set_output("asset-version-url", asset_version_url)
logger.info(f"Asset version URL: {asset_version_url}")
if not INPUT_AUTOMATIC_COMMENT:
logger.info(f"Automatic comment disabled")
logger.info("Automatic comment disabled")
else:
if is_pull_request():
logger.info(f"Automatic comment enabled. Generating comment...")
logger.info("Automatic comment enabled. Generating comment...")
generate_comment(INPUT_GITHUB_TOKEN, asset_version_url, logger)
else:
logger.info(
f"Automatic comment enabled. But this isn't a pull request. Skip generating comment..."
"Automatic comment enabled. But this isn't a pull request. Skip generating comment..."
)
else:
set_multiline_output("error", error)
Expand Down
1 change: 0 additions & 1 deletion src/python/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
extract_pull_request_number,
extract_repository_name,
extract_repository_owner,
is_pull_request,
)


Expand Down