diff --git a/manifest-verifier/action.yml b/manifest-verifier/action.yml index f718a8be..3221b76d 100644 --- a/manifest-verifier/action.yml +++ b/manifest-verifier/action.yml @@ -9,6 +9,10 @@ inputs: description: 'List of comma-separated relative path to submodules that should not be present in manifest.yml. Eg libraries/thirdparty/tinycbor,libraries/thirdparty/mbedtls' required: false default: '' + fail-on-incorrect-version: + description: 'Boolean flag to indicate if verification should fail if any submodule version in manifest.yml file is incorrect or stale.' + required: false + default: 'false' runs: using: "composite" steps: @@ -17,5 +21,10 @@ runs: shell: bash - name: Run verifier script working-directory: ${{ inputs.path }} - run: python3 $GITHUB_ACTION_PATH/verify_manifest.py --ignore-submodule-path=${{ inputs.exclude-submodules }} + run: | + if [[ "${{ inputs.fail-on-incorrect-version }}" == "true" ]] + python3 $GITHUB_ACTION_PATH/verify_manifest.py --ignore-submodule-path=${{ inputs.exclude-submodules }} --fail-on-incorrect-version + else + python3 $GITHUB_ACTION_PATH/verify_manifest.py --ignore-submodule-path=${{ inputs.exclude-submodules }} + fi shell: bash diff --git a/manifest-verifier/verify_manifest.py b/manifest-verifier/verify_manifest.py index 7f1481eb..5ffbd0e0 100644 --- a/manifest-verifier/verify_manifest.py +++ b/manifest-verifier/verify_manifest.py @@ -63,8 +63,10 @@ def get_all_submodules(): parser.add_argument('--ignore-submodule-path', type=str, required=None, - default=os.getcwd(), help='Comma-separated list of submodules path to ignore.') + parser.add_argument('--fail-on-incorrect-versions', + action='store_true', + help='Flag to indicate script to fail for incorrect submodules versions in manifest.yml') args = parser.parse_args() @@ -107,7 +109,7 @@ def get_all_submodules(): print('manifest.yml does not have correct commit ID for', submodule_name,'manifest Commit=(',manifest_commit, submodule.head.commit,') Actual Commit=',submodules_info_from_git[relative_path]) mismatch_flag = True - if mismatch_flag: + if mismatch_flag and args.fail_on_incorrect_versions: sys.exit(1) print('\nmanifest.yml file has been verified!')