diff --git a/DEV_README.md b/DEV_README.md index 5ddd049..8f0e27b 100644 --- a/DEV_README.md +++ b/DEV_README.md @@ -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 }} diff --git a/README.md b/README.md index 2291cb1..1f521c0 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 }} @@ -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 }} diff --git a/dist/python/__pycache__/github_utils.cpython-310.pyc b/dist/python/__pycache__/github_utils.cpython-310.pyc index 6e415ea..1ce281f 100644 Binary files a/dist/python/__pycache__/github_utils.cpython-310.pyc and b/dist/python/__pycache__/github_utils.cpython-310.pyc differ diff --git a/dist/python/__pycache__/test_github_utils.cpython-310-pytest-7.4.3.pyc b/dist/python/__pycache__/test_github_utils.cpython-310-pytest-7.4.3.pyc index e7cbd1d..03d96bd 100644 Binary files a/dist/python/__pycache__/test_github_utils.cpython-310-pytest-7.4.3.pyc and b/dist/python/__pycache__/test_github_utils.cpython-310-pytest-7.4.3.pyc differ diff --git a/dist/python/__pycache__/test_upload_binary.cpython-310-pytest-7.4.3.pyc b/dist/python/__pycache__/test_upload_binary.cpython-310-pytest-7.4.3.pyc index 0d070f4..c212a89 100644 Binary files a/dist/python/__pycache__/test_upload_binary.cpython-310-pytest-7.4.3.pyc and b/dist/python/__pycache__/test_upload_binary.cpython-310-pytest-7.4.3.pyc differ diff --git a/dist/python/__pycache__/test_utils.cpython-310-pytest-7.4.3.pyc b/dist/python/__pycache__/test_utils.cpython-310-pytest-7.4.3.pyc index 36f1499..fb1adf5 100644 Binary files a/dist/python/__pycache__/test_utils.cpython-310-pytest-7.4.3.pyc and b/dist/python/__pycache__/test_utils.cpython-310-pytest-7.4.3.pyc differ diff --git a/dist/python/__pycache__/upload_binary.cpython-310.pyc b/dist/python/__pycache__/upload_binary.cpython-310.pyc index f8a3597..057b7e9 100644 Binary files a/dist/python/__pycache__/upload_binary.cpython-310.pyc and b/dist/python/__pycache__/upload_binary.cpython-310.pyc differ diff --git a/dist/python/__pycache__/utils.cpython-310.pyc b/dist/python/__pycache__/utils.cpython-310.pyc index 8f44b0f..1ce4f40 100644 Binary files a/dist/python/__pycache__/utils.cpython-310.pyc and b/dist/python/__pycache__/utils.cpython-310.pyc differ diff --git a/dist/python/requirements.txt b/dist/python/requirements.txt index 5721ae1..501b935 100644 --- a/dist/python/requirements.txt +++ b/dist/python/requirements.txt @@ -1 +1 @@ -finite-state-sdk==0.1.2 \ No newline at end of file +finite-state-sdk==0.1.9 \ No newline at end of file diff --git a/dist/python/test_utils.py b/dist/python/test_utils.py index 2d062e8..0200fcd 100644 --- a/dist/python/test_utils.py +++ b/dist/python/test_utils.py @@ -3,7 +3,6 @@ from utils import ( extract_asset_version, - generate_comment, set_multiline_output, set_output, ) diff --git a/dist/python/upload_binary.py b/dist/python/upload_binary.py index b61b054..388a10e 100644 --- a/dist/python/upload_binary.py +++ b/dist/python/upload_binary.py @@ -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__) @@ -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 ) @@ -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, @@ -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"] @@ -118,8 +120,8 @@ 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 @@ -127,14 +129,14 @@ def create_and_upload_binary(): 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) diff --git a/dist/python/utils.py b/dist/python/utils.py index 9022c3d..c1def27 100644 --- a/dist/python/utils.py +++ b/dist/python/utils.py @@ -7,7 +7,6 @@ extract_pull_request_number, extract_repository_name, extract_repository_owner, - is_pull_request, ) diff --git a/package.json b/package.json index 9723ca9..7da11ad 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/python/.python-version b/src/python/.python-version new file mode 100644 index 0000000..9ad6380 --- /dev/null +++ b/src/python/.python-version @@ -0,0 +1 @@ +3.8.18 diff --git a/src/python/__pycache__/github_utils.cpython-310.pyc b/src/python/__pycache__/github_utils.cpython-310.pyc index 6e415ea..1ce281f 100644 Binary files a/src/python/__pycache__/github_utils.cpython-310.pyc and b/src/python/__pycache__/github_utils.cpython-310.pyc differ diff --git a/src/python/__pycache__/test_github_utils.cpython-310-pytest-7.4.3.pyc b/src/python/__pycache__/test_github_utils.cpython-310-pytest-7.4.3.pyc index e7cbd1d..03d96bd 100644 Binary files a/src/python/__pycache__/test_github_utils.cpython-310-pytest-7.4.3.pyc and b/src/python/__pycache__/test_github_utils.cpython-310-pytest-7.4.3.pyc differ diff --git a/src/python/__pycache__/test_upload_binary.cpython-310-pytest-7.4.3.pyc b/src/python/__pycache__/test_upload_binary.cpython-310-pytest-7.4.3.pyc index 0d070f4..c212a89 100644 Binary files a/src/python/__pycache__/test_upload_binary.cpython-310-pytest-7.4.3.pyc and b/src/python/__pycache__/test_upload_binary.cpython-310-pytest-7.4.3.pyc differ diff --git a/src/python/__pycache__/test_utils.cpython-310-pytest-7.4.3.pyc b/src/python/__pycache__/test_utils.cpython-310-pytest-7.4.3.pyc index 36f1499..fb1adf5 100644 Binary files a/src/python/__pycache__/test_utils.cpython-310-pytest-7.4.3.pyc and b/src/python/__pycache__/test_utils.cpython-310-pytest-7.4.3.pyc differ diff --git a/src/python/__pycache__/upload_binary.cpython-310.pyc b/src/python/__pycache__/upload_binary.cpython-310.pyc index f8a3597..057b7e9 100644 Binary files a/src/python/__pycache__/upload_binary.cpython-310.pyc and b/src/python/__pycache__/upload_binary.cpython-310.pyc differ diff --git a/src/python/__pycache__/utils.cpython-310.pyc b/src/python/__pycache__/utils.cpython-310.pyc index 8f44b0f..1ce4f40 100644 Binary files a/src/python/__pycache__/utils.cpython-310.pyc and b/src/python/__pycache__/utils.cpython-310.pyc differ diff --git a/src/python/requirements.txt b/src/python/requirements.txt index 5721ae1..501b935 100644 --- a/src/python/requirements.txt +++ b/src/python/requirements.txt @@ -1 +1 @@ -finite-state-sdk==0.1.2 \ No newline at end of file +finite-state-sdk==0.1.9 \ No newline at end of file diff --git a/src/python/test_utils.py b/src/python/test_utils.py index 2d062e8..0200fcd 100644 --- a/src/python/test_utils.py +++ b/src/python/test_utils.py @@ -3,7 +3,6 @@ from utils import ( extract_asset_version, - generate_comment, set_multiline_output, set_output, ) diff --git a/src/python/upload_binary.py b/src/python/upload_binary.py index b61b054..388a10e 100644 --- a/src/python/upload_binary.py +++ b/src/python/upload_binary.py @@ -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__) @@ -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 ) @@ -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, @@ -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"] @@ -118,8 +120,8 @@ 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 @@ -127,14 +129,14 @@ def create_and_upload_binary(): 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) diff --git a/src/python/utils.py b/src/python/utils.py index 9022c3d..c1def27 100644 --- a/src/python/utils.py +++ b/src/python/utils.py @@ -7,7 +7,6 @@ extract_pull_request_number, extract_repository_name, extract_repository_owner, - is_pull_request, )